2012-08-17 Hareesan Rajendra <rharishan@gmail.com>

* Added missing files and folders.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6874 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
rharishan 2012-08-17 04:33:39 +00:00
parent 9740c8e73d
commit cb962963b4
27 changed files with 5399 additions and 0 deletions

View File

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM "chrome://pandorasidebar/locale/pandorasidebar.dtd">
<overlay id="pandoraSidebarOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://pandorasidebar/content/js/jquery-1.3.2.min.js" />
<script src="chrome://pandorasidebar/content/js/main.js" />
<script src="chrome://pandorasidebar/content/js/sound.js"/>
<menupopup id="viewSidebarMenu">
<menuitem key="key_openPandoraSidebar" observes="viewPandoraSidebar" />
</menupopup>
<menupopup id="menu_ToolsPopup">
<menuseparator />
<menuitem label="Pandora FMS Event Viewer Options..." key="PandoraMenu" oncommand="PandoraChrome.fn.displayDialog();" accesskey="e"/>
</menupopup>
<keyset id="mainKeyset">
<key id="PandoraMenu" modifiers="accel alt shift" key="L" oncommand="PandoraChrome.fn.displayDialog();"/>
<key id="key_openPandoraSidebar" command="viewPandoraSidebar"
key="&openPandoraSidebar.commandkey;"
modifiers="&openPandoraSidebar.modifierskey;" />
</keyset>
<broadcasterset id="mainBroadcasterSet">
<broadcaster id="viewPandoraSidebar"
label="&pandorasidebar.title;"
autoCheck="false"
type="checkbox"
group="sidebar"
sidebarurl="chrome://pandorasidebar/content/pandorasidebar.xul"
sidebartitle="&pandorasidebar.title;"
oncommand="PandoraChrome.fn.displaySideBar();" />
</broadcasterset>
<popupset>
<menupopup id="PandoraContextMenu">
<menuitem label="Pandora FMS Event Viewer Options..." oncommand="PandoraChrome.fn.displayDialog();"/>
</menupopup>
</popupset>
<statusbar id="status-bar" style="cursor:pointer;" hidden="false">
<statusbarpanel id="newEvent"
tooltiptext="New event Occured:"
style="cursor:pointer; display:none;"
onclick="PandoraChrome.fn.displaySideBar();">
</statusbarpanel>
<statusbarpanel id="pandoraStatusBar"
context="PandoraContextMenu"
label="Pandora FMS"
tooltiptext="Pandora FMS"
style="cursor:pointer;"
onclick="PandoraChrome.fn.displaySideBar();">
<image style="width: 16px; height: 16px" src="chrome://pandorasidebar/content/icons/icon16.png" id="ciIcon" />
<label style="cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;" id="updateCount"></label>
</statusbarpanel>
<statusbarpanel id="temp"
tooltiptext="New Events"
style="cursor:pointer; display:none;"
onclick="">
</statusbarpanel>
</statusbar>
</overlay>

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
/*
* jquery.tools 1.1.2 - The missing UI library for the Web
*
* [tools.scrollable-1.1.2, tools.scrollable.navigator-1.0.2]
*
* Copyright (c) 2009 Tero Piirainen
* http://flowplayer.org/tools/
*
* Dual licensed under MIT and GPL 2+ licenses
* http://www.opensource.org/licenses
*
* -----
*
* File generated: Fri Feb 19 02:14:18 GMT 2010
*/
(function(b){b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var c;function a(o,m){var r=this,p=b(this),d=!m.vertical,e=o.children(),k=0,i;if(!c){c=r}b.each(m,function(s,t){if(b.isFunction(t)){p.bind(s,t)}});if(e.length>1){e=b(m.items,o)}function l(t){var s=b(t);return m.globalNav?s:o.parent().find(t)}o.data("finder",l);var f=l(m.prev),h=l(m.next),g=l(m.prevPage),n=l(m.nextPage);b.extend(r,{getIndex:function(){return k},getClickIndex:function(){var s=r.getItems();return s.index(s.filter("."+m.activeClass))},getConf:function(){return m},getSize:function(){return r.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/m.size)},getPageIndex:function(){return Math.ceil(k/m.size)},getNaviButtons:function(){return f.add(h).add(g).add(n)},getRoot:function(){return o},getItemWrap:function(){return e},getItems:function(){return e.children(m.item)},getVisibleItems:function(){return r.getItems().slice(k,k+m.size)},seekTo:function(s,w,t){if(s<0){s=0}if(k===s){return r}if(b.isFunction(w)){t=w}if(s>r.getSize()-m.size){return m.loop?r.begin():this.end()}var u=r.getItems().eq(s);if(!u.length){return r}var v=b.Event("onBeforeSeek");p.trigger(v,[s]);if(v.isDefaultPrevented()){return r}if(w===undefined||b.isFunction(w)){w=m.speed}function x(){if(t){t.call(r,s)}p.trigger("onSeek",[s])}if(d){e.animate({left:-u.position().left},w,m.easing,x)}else{e.animate({top:-u.position().top},w,m.easing,x)}c=r;k=s;v=b.Event("onStart");p.trigger(v,[s]);if(v.isDefaultPrevented()){return r}f.add(g).toggleClass(m.disabledClass,s===0);h.add(n).toggleClass(m.disabledClass,s>=r.getSize()-m.size);return r},move:function(u,t,s){i=u>0;return this.seekTo(k+u,t,s)},next:function(t,s){return this.move(1,t,s)},prev:function(t,s){return this.move(-1,t,s)},movePage:function(w,v,u){i=w>0;var s=m.size*w;var t=k%m.size;if(t>0){s+=(w>0?-t:m.size-t)}return this.move(s,v,u)},prevPage:function(t,s){return this.movePage(-1,t,s)},nextPage:function(t,s){return this.movePage(1,t,s)},setPage:function(t,u,s){return this.seekTo(t*m.size,u,s)},begin:function(t,s){i=false;return this.seekTo(0,t,s)},end:function(t,s){i=true;var u=this.getSize()-m.size;return u>0?this.seekTo(u,t,s):r},reload:function(){p.trigger("onReload");return r},focus:function(){c=r;return r},click:function(u){var v=r.getItems().eq(u),s=m.activeClass,t=m.size;if(u<0||u>=r.getSize()){return r}if(t==1){if(m.loop){return r.next()}if(u===0||u==r.getSize()-1){i=(i===undefined)?true:!i}return i===false?r.prev():r.next()}if(t==2){if(u==k){u--}r.getItems().removeClass(s);v.addClass(s);return r.seekTo(u,time,fn)}if(!v.hasClass(s)){r.getItems().removeClass(s);v.addClass(s);var x=Math.floor(t/2);var w=u-x;if(w>r.getSize()-t){w=r.getSize()-t}if(w!==u){return r.seekTo(w)}}return r},bind:function(s,t){p.bind(s,t);return r},unbind:function(s){p.unbind(s);return r}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),function(s,t){r[t]=function(u){return r.bind(t,u)}});f.addClass(m.disabledClass).click(function(){r.prev()});h.click(function(){r.next()});n.click(function(){r.nextPage()});if(r.getSize()<m.size){h.add(n).addClass(m.disabledClass)}g.addClass(m.disabledClass).click(function(){r.prevPage()});var j=m.hoverClass,q="keydown."+Math.random().toString().substring(10);r.onReload(function(){if(j){r.getItems().hover(function(){b(this).addClass(j)},function(){b(this).removeClass(j)})}if(m.clickable){r.getItems().each(function(s){b(this).unbind("click.scrollable").bind("click.scrollable",function(t){if(b(t.target).is("a")){return}return r.click(s)})})}if(m.keyboard){b(document).unbind(q).bind(q,function(t){if(t.altKey||t.ctrlKey){return}if(m.keyboard!="static"&&c!=r){return}var u=m.keyboardSteps;if(d&&(t.keyCode==37||t.keyCode==39)){r.move(t.keyCode==37?-u:u);return t.preventDefault()}if(!d&&(t.keyCode==38||t.keyCode==40)){r.move(t.keyCode==38?-u:u);return t.preventDefault()}return true})}else{b(document).unbind(q)}});r.reload()}b.fn.scrollable=function(d){var e=this.eq(typeof d=="number"?d:0).data("scrollable");if(e){return e}var f=b.extend({},b.tools.scrollable.conf);d=b.extend(f,d);d.keyboardSteps=d.keyboardSteps||d.size;this.each(function(){e=new a(b(this),d);b(this).data("scrollable",e)});return d.api?e:this}})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.navigator={version:"1.0.2",conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:false,api:false,idPrefix:null}};b.fn.navigator=function(d){var e=b.extend({},a.plugins.navigator.conf),c;if(typeof d=="string"){d={navi:d}}d=b.extend(e,d);this.each(function(){var i=b(this).scrollable(),f=i.getRoot(),l=f.data("finder").call(null,d.navi),g=null,k=i.getNaviButtons();if(i){c=i}i.getNaviButtons=function(){return k.add(l)};function j(){if(!l.children().length||l.data("navi")==i){l.empty();l.data("navi",i);for(var m=0;m<i.getPageAmount();m++){l.append(b("<"+(d.naviItem||"a")+"/>"))}g=l.children().each(function(n){var o=b(this);o.click(function(p){i.setPage(n);return p.preventDefault()});if(d.indexed){o.text(n)}if(d.idPrefix){o.attr("id",d.idPrefix+n)}})}else{g=d.naviItem?l.find(d.naviItem):l.children();g.each(function(n){var o=b(this);o.click(function(p){i.setPage(n);return p.preventDefault()})})}g.eq(0).addClass(d.activeClass)}i.onStart(function(o,n){var m=d.activeClass;g.removeClass(m).eq(i.getPageIndex()).addClass(m)});i.onReload(function(){j()});j();var h=g.filter("[href="+location.hash+"]");if(h.length){i.move(g.index(h))}});return d.api?c:this}})(jQuery);

View File

@ -0,0 +1,245 @@
if ("undefined" == typeof(PandoraChrome)) {
var PandoraChrome = {};
var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("pandora.");
var timer = null;
var allEvents=new Array();
var newEvents=new Array();
var oldEvents=new Array();
var api_div_numbers=21;
};
PandoraChrome.fn = function(){
return {
displaySideBar: function(){
PandoraChrome.fn.hideNotification();
PandoraChrome.fn.hideBadge();
toggleSidebar('viewPandoraSidebar');
},
displayDialog : function(){
window.openDialog("chrome://pandorasidebar/content/options.xul", "","chrome, centerscreen, dialog, modal, resizable=no", null).focus();
},
handleClick: function(e){
if(e.button == 0){
toggleSidebar('viewPandoraSidebar');
PandoraChrome.fn.setIcon('icon16');
}
},
Onloading: function () {
if(prefManager.getBoolPref("firstLoad")){
prefManager.setIntPref("new_events",prefManager.getIntPref("events"));
prefManager.setBoolPref("firstLoad",false);
}
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 100 );
},
main: function() {
// alert('test_main');
var url=prefManager.getCharPref("ip_address")+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+prefManager.getCharPref("api_pass")+'&user='+prefManager.getCharPref("user_name")+'&pass='+prefManager.getCharPref("pass");
var feedUrl = url;
prefManager.setBoolPref("data_check", true);
req = new XMLHttpRequest();
req.onload = PandoraChrome.fn.handleResponse;
req.onerror = PandoraChrome.fn.handleError;
req.open("GET", feedUrl, true);
req.send(null);
},
handleError: function() {
//alert("error");
prefManager.setCharPref("data",null);
prefManager.setBoolPref("data_check", false);
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 1000);
},
handleResponse: function () {
var doc = req.responseText;
if (doc=="auth error") {
prefManager.setCharPref("data",null);
prefManager.setBoolPref("data_check", false);
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 1000);
}
else{
var n=doc.search("404 Not Found");
if(n>0){
prefManager.setCharPref("data",null);
prefManager.setBoolPref("data_check", false);
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , 1000);
}
else{
prefManager.setBoolPref("data_check", true);
prefManager.setCharPref("data",doc);
PandoraChrome.fn.getEvents(doc);
}
}
},
getEvents: function (reply){
if(reply.length>100){
all_event_array=reply.split("\n");
allEvents=PandoraChrome.fn.divideArray(all_event_array);
if(oldEvents.length==0){
oldEvents=allEvents;
}
newEvents=PandoraChrome.fn.fetchNewEvents(allEvents,oldEvents);
if(newEvents.length!=0){
for(var k=0;k<newEvents.length;k++){
var temp=prefManager.getIntPref("new_events")+1;
prefManager.setIntPref("new_events",temp);
PandoraChrome.fn.showNotification(k);
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
}
}
oldEvents=allEvents;
if(prefManager.getIntPref("new_events")>0){
PandoraChrome.fn.showBadge(prefManager.getIntPref("new_events"));
}
else{
PandoraChrome.fn.hideBadge();
}
if(timer) {
clearTimeout(timer);
}
timer =setTimeout(PandoraChrome.fn.main , prefManager.getIntPref("refresh")*1000 );
}
},
showNotification: function(eventId){
//alert("notify"+eventId);
if(prefManager.getBoolPref("sound_alert")){
if(newEvents[eventId][19]=="Critical"){
Sounds.playSound(prefManager.getIntPref("critical"));
}
if(newEvents[eventId][19]=="Informational"){
Sounds.playSound(prefManager.getIntPref("informational"));
}
if(newEvents[eventId][19]=="Maintenance"){
Sounds.playSound(prefManager.getIntPref("maintenance"));
}
if(newEvents[eventId][19]=="Normal"){
Sounds.playSound(prefManager.getIntPref("normal"));
}
if(newEvents[eventId][19]=="Warning"){
Sounds.playSound(prefManager.getIntPref("warning"));
}
}
var newEve = document.getElementById('newEvent');
newEve.label="Last Event : "+newEvents[eventId][6];
var id;
if(newEvents[eventId][9]==0){
id=".";
}
else {
id= " in the module with Id "+ newEvents[eventId][9] + ".";
}
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
newEve.tooltipText=event;
$('#newEvent').show();
return;
},
hideNotification:function(){
//alert("Hide Notif");
$('#newEvent').hide();
},
showBadge: function (txt) {
//alert(txt);
var updateCount = document.getElementById('temp');
updateCount.setAttribute("style","cursor:pointer; font-size:11px; color:#123863; font-weight:bold; display:none;") ;
updateCount.label=txt;
$('#temp').show();
},
hideBadge: function () {
var updateCount = document.getElementById('temp');
//alert("hide B");
$('#temp').hide();
},
divideArray: function (e_array){
var Events=new Array();
for(var i=0;i<e_array.length;i++){
var event=e_array[i].split(";");
Events.push(event);
}
return Events;
},
fetchNewEvents: function (A,B){
var arrDiff = new Array();
// alert(A.length);
//alert(B.length);
for(var i = 0; i < A.length; i++) {
var id = false;
for(var j = 0; j < B.length; j++) {
if(A[i][0] == B[j][0]) {
id = true;
break;
}
}
if(!id) {
arrDiff.push(A[i]);
}
}
return arrDiff;
},
getNotification:function (eventId){
var title=newEvents[eventId][6];
var id;
if(newEvents[eventId][9]==0){
id=".";
}
else {
id= " in the module with Id "+ newEvents[eventId][9] + ".";
}
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
//var event=newEvents[eventId][14]+' '+newEvents[eventId][17]+' Event occured at:'+ newEvents[eventId][5] +'in the module with Id '+ newEvents[eventId][9];
return '<a>' + title + '</a> <br/> <span style="font-size:80%">' + event + '</span>';
}
};
}();
/* Add Event Listener */
window.addEventListener("load", PandoraChrome.fn.Onloading(), false);

View File

@ -0,0 +1,55 @@
var OptionsListener = {
prefs: null,
tickerSymbol: "",
// Initialize the extension
startup: function()
{
// Register to receive notifications of preference changes
this.prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("pandora.");
this.prefs.QueryInterface(Components.interfaces.nsIPrefBranch2);
this.prefs.addObserver("", this, false);
OptionsListener.onChangeSound(this.prefs.getBoolPref("sound_alert"));
},
// Clean up after ourselves and save the prefs
shutdown: function()
{
this.prefs.removeObserver("", this);
},
// Called when events occur on the preferences
// Switches to watch a different stock, by symbol
onChangeSound: function(value){
if(value){
document.getElementById('critical').disabled=false;
document.getElementById('informational').disabled=false;
document.getElementById('maintenance').disabled=false;
document.getElementById('normal').disabled=false;
document.getElementById('warning').disabled=false;
}
else{
document.getElementById('critical').disabled=true;
document.getElementById('informational').disabled=true;
document.getElementById('maintenance').disabled=true;
document.getElementById('normal').disabled=true;
document.getElementById('warning').disabled=true;
}
},
watchStock: function(newSymbol)
{
this.prefs.setCharPref("symbol", newSymbol);
}
}
// Install load and unload handlers
window.addEventListener("load", function(e) { OptionsListener.startup(); }, false);
window.addEventListener("unload", function(e) { OptionsListener.shutdown(); }, false);

View File

@ -0,0 +1,241 @@
if ("undefined" == typeof(PandoraPoPUp)) {
var PandoraPoPUp = {};
var timer = null;
var event_array;
var max_events;
var htmlns = "http://www.w3.org/1999/xhtml";
var allEvents = new Array();
var newEvents = new Array();
var oldEvents = new Array();
var api_div_numbers = 21;
var prefmanager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("pandora.");
}
;
PandoraPoPUp = function () {
return{
displayDialog:function () {
window.openDialog("chrome://pandorasidebar/content/options.xul", "", "chrome, centerscreen, dialog, modal, resizable=no", null).focus();
},
onLoadPopUp:function () {
max_events = prefmanager.getIntPref("events");
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraPoPUp.mainPoP, 2000);
},
mainPoP:function () {
if (prefmanager.getBoolPref("data_check")) {
if (prefmanager.getCharPref("data").length > 1000) {
PandoraPoPUp.showEvents();
}
else {
PandoraPoPUp.showUrlError();
}
}
else {
PandoraPoPUp.showDataError();
}
},
showUrlError:function () {
var res = document.createDocumentFragment();
var r = document.getElementById('e');
var eve = document.createElement('label');
eve.setAttribute("value", "Configure ip address,API password, user name and password with correct values");
eve.setAttribute("class", "b");
res.appendChild(eve);
r.parentNode.insertBefore(res, r);
$('.loader').hide();
$('vbox.b').show();
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraPoPUp.refresh, 1000);
},
showDataError:function () {
var res = document.createDocumentFragment();
var r = document.getElementById('e');
var eve = document.createElement('label');
eve.setAttribute("value", "Error in fetching data!! Check your internet connection");
eve.setAttribute("class", "b");
res.appendChild(eve);
r.parentNode.insertBefore(res, r);
$('.loader').hide();
$('vbox.b').show();
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraPoPUp.refresh, 1000);
},
showEvents:function () {
var data = prefmanager.getCharPref("data");
PandoraPoPUp.getEvents(data);
var allEventsPoP = allEvents;
//alert(allEventsPoP[0]);
var r = document.getElementById('e');
var res = document.createDocumentFragment();
var eve = document.createElement('vbox');
eve.setAttribute("id", "event_temp");
eve.setAttribute("class", "b");
eve.setAttribute("style", "display:none;");
var i = 0;
if (allEventsPoP.length > 0) {
while (i < max_events) {
var eve_title = document.createElement('hbox');
var img = document.createElement('image');
img.setAttribute("src", 'images/plus.gif');
img.setAttribute("width", '9');
img.setAttribute("height", '9');
img.setAttribute("id", 'i_' + i);
img.setAttribute("class", "pm");
eve_title.appendChild(img);
var a = document.createElement("label");
var temp_style;
a.setAttribute("value", allEventsPoP[i][6]);
//var temp_style="font-weight:bold;"; new_events
if (i < prefmanager.getIntPref("new_events")) {
var temp_style = "font-weight:bold;";
}
else {
var temp_style = "font-weight:normal;";
}
if (allEventsPoP[i][19] == "Warning") {
eve_title.setAttribute("style", "background:#FDE84F; margin-bottom:1px;" + temp_style);
}
if (allEventsPoP[i][19] == "Critical") {
eve_title.setAttribute("style", "background:#C60700; margin-bottom:1px;" + temp_style);
}
if (allEventsPoP[i][19] == "Informational") {
eve_title.setAttribute("style", "background:#739FD0; margin-bottom:1px;" + temp_style);
}
if (allEventsPoP[i][19] == "Normal") {
eve_title.setAttribute("style", "background:#8AE234; margin-bottom:1px;" + temp_style);
}
if (allEventsPoP[i][19] == "Maintenance") {
eve_title.setAttribute("style", "background:#BABDB6; margin-bottom:1px;" + temp_style);
}
eve_title.appendChild(a);
eve.appendChild(eve_title);
var b = document.createElement('br');
eve.appendChild(b);
var time = allEventsPoP[i][5].split(" ");
var time_text = time[0] + " " + time[1];
var p = document.createElement('description');
var p1 = document.createElement('description');
var p2= document.createElement('description');
var id;
if (allEventsPoP[i][9] == 0) {
id = ".";
}
else {
id = " in the module with Id " + allEventsPoP[i][9] + ".";
}
p1.setAttribute("value", allEventsPoP[i][14] + " : " + allEventsPoP[i][17] + ".");
p2.setAttribute("value", "Event occured at " + time_text + id);
p.appendChild(p1);
p.appendChild(b);
p.appendChild(p2);
p.setAttribute("id", 'p_' + i);
p.setAttribute("style", "display:none;");
eve.appendChild(p);
i++;
}
prefmanager.setIntPref("new_events", 0);
res.appendChild(eve);
r.parentNode.insertBefore(res, r);
$('image.pm').click(PandoraPoPUp.showHide);
$('.loader').hide();
$('.b').show();
}
else {
PandoraPoPUp.showDataError();
}
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(PandoraPoPUp.refresh, 30 * 1000);
},
showHide:function () {
var id = $(this).attr('id');
var num = id.split("_")[1];
var pid = "p_" + num;
if ($('#' + pid).css('display') == 'none') {
$('#' + pid).show();
$(this).attr({
src:'images/minus.gif'
});
}
else {
$('#' + pid).slideUp("fast");
$(this).attr({
src:'images/plus.gif'
});
}
},
refresh:function () {
prefmanager.setIntPref("new_events", 0);
hideBadge();
var e = document.getElementById('event_temp');
if (e) {
e.parentNode.removeChild(e);
}
PandoraPoPUp.mainPoP();
},
mrefresh:function () {
prefmanager.setIntPref("new_events", 0);
document.getElementById("m_refresh").disabled = true;
setTimeout(function () {
document.getElementById("m_refresh").disabled = false;
}, 5000);
var e = document.getElementById('event_temp');
if (e) {
e.parentNode.removeChild(e);
}
PandoraPoPUp.mainPoP();
},
getEvents:function (data) {
all_event_array = data.split("\n");
allEvents = PandoraPoPUp.divideArray(all_event_array);
},
divideArray:function (e_array) {
var Events = new Array();
for (var i = 0; i < e_array.length; i++) {
var event = e_array[i].split(";");
Events.push(event);
}
return Events;
}
};
}();
window.addEventListener("load", PandoraPoPUp.onLoadPopUp(), false);

View File

@ -0,0 +1,42 @@
var Sounds = {
playSound: function (value){
var sound;
if(value==1){
sound = new Audio("chrome://pandorasidebar/content/sounds/aircraftalarm.wav");
}
if(value==2){
sound = new Audio("chrome://pandorasidebar/content/sounds/air_shock_alarm.wav");
}
if(value==3){
sound = new Audio("chrome://pandorasidebar/content/sounds/alien_alarm.wav");
}
if(value==4){
sound = new Audio("chrome://pandorasidebar/content/sounds/alien_beacon.wav");
}
if(value==5){
sound = new Audio("chrome://pandorasidebar/content/sounds/bell_school_ringing.wav");
}
if(value==6){
sound = new Audio("chrome://pandorasidebar/content/sounds/Door_Alarm.wav");
}
if(value==7){
sound = new Audio("chrome://pandorasidebar/content/sounds/EAS_beep.wav");
}
if(value==8){
sound = new Audio("chrome://pandorasidebar/content/sounds/Firewarner.wav");
}
if(value==9){
sound = new Audio("chrome://pandorasidebar/content/sounds/HardPCMAlarm.wav");
}
if(value==10){
sound = new Audio("chrome://pandorasidebar/content/sounds/negativebeep.wav");
}
if(value==11){
sound = new Audio("chrome://pandorasidebar/content/sounds/Star_Trek_emergency_simulation.wav");
}
if(value==0){
sound = new Audio("chrome://pandorasidebar/content/sounds/aircraftalarm.wav");
}
sound.play();
}
}

View File

@ -0,0 +1,239 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<prefwindow id="pandorafms-prefs"
title="Pandora FMS EventViewer Options Page"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://pandorasidebar/content/js/options.js"/>
<script src="chrome://pandorasidebar/content/js/sound.js"/>
<prefpane id="pandorafms-pane" label="Event Viewer Settings">
<preferences>
<preference id="ipaddress" name="pandora.ip_address" type="string"/>
<preference id="apipass" name="pandora.api_pass" type="string"/>
<preference id="username" name="pandora.user_name" type="string"/>
<preference id="passw" name="pandora.pass" type="string"/>
<preference id="critical" name="pandora.critical" type="int"/>
<preference id="informational" name="pandora.informational" type="int"/>
<preference id="maintenance" name="pandora.maintenance" type="int"/>
<preference id="normal" name="pandora.normal" type="int"/>
<preference id="warning" name="pandora.warning" type="int"/>
<preference id="events_disp" name="pandora.events" type="int"/>
<preference id="refresh_time" name="pandora.refresh" type="int"/>
<preference id="sound_alerts" name="pandora.sound_alert" type="bool"/>
</preferences>
<tabbox id="myTabList" selectedIndex="0">
<tabs>
<tab label="General Parameters"/>
<tab label="Sound Settings"/>
<tab label="Other Settings"/>
</tabs>
<tabpanels>
<tabpanel>
<groupbox>
<grid>
<columns>
<column flex="1"/>
<column flex="2" style="width:400px;"/>
</columns>
<rows>
<caption label="General Parameters" />
<row>
<label control="ipaddress" value="Enter IP Address:"/>
<textbox id="ip_address" preference="ipaddress"/>
</row>
<row>
<label control="apipass" value="Enter API Password:"/>
<textbox id="api_pass" type="password" preference="apipass"/>
</row>
<row>
<label control="username" value="Enter User Name:"/>
<textbox id="user_name" preference="username"/>
</row>
<row>
<label control="passw" value="Enter Password:"/>
<textbox id="pass" type="password" preference="passw"/>
</row>
</rows>
</grid>
</groupbox>
</tabpanel>
<tabpanel>
<groupbox>
<grid>
<columns>
<column flex="1"/>
<column flex="2" style="width:100px;"/>
</columns>
<rows>
<caption label="Sound Alert Settings" />
<row>
<label value="Sound Alerts:"/>
<radiogroup preference="sound_alerts">
<radio id="sound_alert_o" label="On" accesskey="R" selected="true" value="true" oncommand="OptionsListener.onChangeSound(true)"/>
<radio id="sound_alert_f" label="Off" accesskey="G" value="false" oncommand="OptionsListener.onChangeSound(false)"/>
</radiogroup>
</row>
</rows>
</grid>
<grid>
<columns>
<column flex="1"/>
<column flex="2" style="width:400px;"/>
</columns>
<rows>
<row>
<caption label="Severity" />
<caption label="Sound Type" />
</row>
<row>
<label value="Critical" />
<menulist id="critical" preference="critical" >
<menupopup>
<menuitem label="Air Craft Alarm" value="1" oncommand="Sounds.playSound(1)"/>
<menuitem label="Air Shock Alarm" value="2" oncommand="Sounds.playSound(2)"/>
<menuitem label="Alien Alarm" value="3" oncommand="Sounds.playSound(3)"/>
<menuitem label="Alien Beacon" value="4" oncommand="Sounds.playSound(4)"/>
<menuitem label="Bell Ringing" value="5" oncommand="Sounds.playSound(5)"/>
<menuitem label="Door Alarm" value="6" oncommand="Sounds.playSound(6)"/>
<menuitem label="EAS Beep" value="7" oncommand="Sounds.playSound(7)"/>
<menuitem label="Fire Warner" value="8" oncommand="Sounds.playSound(8)"/>
<menuitem label="Hard PCM Alarm" value="9" oncommand="Sounds.playSound(9)"/>
<menuitem label="Negative Beep" value="10" oncommand="Sounds.playSound(10)"/>
<menuitem label="Star Trek Emergency Alarm" value="11" oncommand="Sounds.playSound(11)"/>
</menupopup>
</menulist>
</row>
<row>
<label value="Informational" />
<menulist id="informational" preference="informational">
<menupopup>
<menuitem label="Air Craft Alarm" value="1" oncommand="Sounds.playSound(1)"/>
<menuitem label="Air Shock Alarm" value="2" oncommand="Sounds.playSound(2)"/>
<menuitem label="Alien Alarm" value="3" oncommand="Sounds.playSound(3)"/>
<menuitem label="Alien Beacon" value="4" oncommand="Sounds.playSound(4)"/>
<menuitem label="Bell Ringing" value="5" oncommand="Sounds.playSound(5)"/>
<menuitem label="Door Alarm" value="6" oncommand="Sounds.playSound(6)"/>
<menuitem label="EAS Beep" value="7" oncommand="Sounds.playSound(7)"/>
<menuitem label="Fire Warner" value="8" oncommand="Sounds.playSound(8)"/>
<menuitem label="Hard PCM Alarm" value="9" oncommand="Sounds.playSound(9)"/>
<menuitem label="Negative Beep" value="10" oncommand="Sounds.playSound(10)"/>
<menuitem label="Star Trek Emergency Alarm" value="11" oncommand="Sounds.playSound(11)"/>
</menupopup>
</menulist>
</row>
<row>
<label value="Maintenance" />
<menulist id="maintenance" preference="maintenance">
<menupopup>
<menuitem label="Air Craft Alarm" value="1" oncommand="Sounds.playSound(1)"/>
<menuitem label="Air Shock Alarm" value="2" oncommand="Sounds.playSound(2)"/>
<menuitem label="Alien Alarm" value="3" oncommand="Sounds.playSound(3)"/>
<menuitem label="Alien Beacon" value="4" oncommand="Sounds.playSound(4)"/>
<menuitem label="Bell Ringing" value="5" oncommand="Sounds.playSound(5)"/>
<menuitem label="Door Alarm" value="6" oncommand="Sounds.playSound(6)"/>
<menuitem label="EAS Beep" value="7" oncommand="Sounds.playSound(7)"/>
<menuitem label="Fire Warner" value="8" oncommand="Sounds.playSound(8)"/>
<menuitem label="Hard PCM Alarm" value="9" oncommand="Sounds.playSound(9)"/>
<menuitem label="Negative Beep" value="10" oncommand="Sounds.playSound(10)"/>
<menuitem label="Star Trek Emergency Alarm" value="11" oncommand="Sounds.playSound(11)"/>
</menupopup>
</menulist>
</row>
<row>
<label value="Normal" />
<menulist id="normal" preference="normal">
<menupopup>
<menuitem label="Air Craft Alarm" value="1" oncommand="Sounds.playSound(1)"/>
<menuitem label="Air Shock Alarm" value="2" oncommand="Sounds.playSound(2)"/>
<menuitem label="Alien Alarm" value="3" oncommand="Sounds.playSound(3)"/>
<menuitem label="Alien Beacon" value="4" oncommand="Sounds.playSound(4)"/>
<menuitem label="Bell Ringing" value="5" oncommand="Sounds.playSound(5)"/>
<menuitem label="Door Alarm" value="6" oncommand="Sounds.playSound(6)"/>
<menuitem label="EAS Beep" value="7" oncommand="Sounds.playSound(7)"/>
<menuitem label="Fire Warner" value="8" oncommand="Sounds.playSound(8)"/>
<menuitem label="Hard PCM Alarm" value="9" oncommand="Sounds.playSound(9)"/>
<menuitem label="Negative Beep" value="10" oncommand="Sounds.playSound(10)"/>
<menuitem label="Star Trek Emergency Alarm" value="11" oncommand="Sounds.playSound(11)"/>
</menupopup>
</menulist>
</row>
<row>
<label value="Warning" />
<menulist id="warning" preference="warning">
<menupopup>
<menuitem label="Air Craft Alarm" value="1" oncommand="Sounds.playSound(1)"/>
<menuitem label="Air Shock Alarm" value="2" oncommand="Sounds.playSound(2)"/>
<menuitem label="Alien Alarm" value="3" oncommand="Sounds.playSound(3)"/>
<menuitem label="Alien Beacon" value="4" oncommand="Sounds.playSound(4)"/>
<menuitem label="Bell Ringing" value="5" oncommand="Sounds.playSound(5)"/>
<menuitem label="Door Alarm" value="6" oncommand="Sounds.playSound(6)"/>
<menuitem label="EAS Beep" value="7" oncommand="Sounds.playSound(7)"/>
<menuitem label="Fire Warner" value="8" oncommand="Sounds.playSound(8)"/>
<menuitem label="Hard PCM Alarm" value="9" oncommand="Sounds.playSound(9)"/>
<menuitem label="Negative Beep" value="10" oncommand="Sounds.playSound(10)"/>
<menuitem label="Star Trek Emergency Alarm" value="11" oncommand="Sounds.playSound(11)"/>
</menupopup>
</menulist>
</row>
</rows>
</grid>
</groupbox>
</tabpanel>
<tabpanel>
<groupbox>
<grid>
<columns>
<column flex="1"/>
<column flex="2" style="width:200px;"/>
</columns>
<rows>
<caption label="Other Settings" />
<row>
<label value="Auto Refresh Time:" />
<menulist id="refresh" preference="refresh_time">
<menupopup>
<menuitem label="5 Seconds" value="5"/>
<menuitem label="10 Seconds" value="10"/>
<menuitem label="15 Seconds" value="15"/>
<menuitem label="30 Seconds" value="30"/>
<menuitem label="1 minute" value="60"/>
<menuitem label="2 minutes" value="120"/>
<menuitem label="5 minutes" value="300"/>
<menuitem label="15 minutes" value="900"/>
<menuitem label="30 minutes" value="1800"/>
<menuitem label="1 hour" value="3600"/>
</menupopup>
</menulist>
</row>
<row>
<label value="Number of events to be displayed in pop up window" />
<menulist id="events" preference="events_disp">
<menupopup>
<menuitem label="5" value="5"/>
<menuitem label="10" value="10"/>
<menuitem label="12" value="12"/>
<menuitem label="14" value="14"/>
<menuitem label="16" value="16"/>
<menuitem label="18" value="18"/>
<menuitem label="20" value="20"/>
</menupopup>
</menulist>
</row>
</rows>
</grid>
</groupbox>
</tabpanel>
</tabpanels>
</tabbox>
</prefpane>
</prefwindow>

View File

@ -0,0 +1,52 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type"text/css" ?>
<?xml-stylesheet href="chrome://pandorasidebar/skin/popup.css" type"text/css" ?>
<?xml-stylesheet
href="data:text/css,
#browser {
-moz-box-direction: reverse;
}
#side-bar{
cursor:pointer;
}
"?>
<!DOCTYPE page SYSTEM "chrome://pandorasidebar/locale/pandorasidebar.dtd">
<page id="sbPandoraSidebar" title="&pandorasidebar.title;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml" width="10" minwidth="10">
<script src="chrome://pandorasidebar/content/js/jquery-1.3.2.min.js"/>
<script src="chrome://pandorasidebar/content/js/jquery.tools.min.js"/>
<script src="chrome://pandorasidebar/content/js/popup.js"/>
<vbox flex="1">
<vbox>
<hbox>
<image src="images/logo.png"></image>
<toolbox>
<toolbar id="nav-toolbar">
<toolbarbutton image="images/refresh.png" id="m_refresh" oncommand="PandoraPoPUp.mrefresh();"/>
<toolbarbutton image="images/gear.png" id="options" oncommand="PandoraPoPUp.displayDialog();"/>
</toolbar>
</toolbox>
</hbox>
<hbox class="loader">
<image src='images/spinny.gif'/>
<description value="Loading..."/>
</hbox>
<vbox class="result" id="result">
<vbox class="b" id="event" style="display:none;">
<description value="Events"
style="font-weight: bold; font-size:16px; margin:2px 0px 2px 0px; color:#0068C4; font-family:arial"/>
<vbox class="e" id="e">
</vbox>
</vbox>
</vbox>
</vbox>
</vbox>
</page>

View File

@ -0,0 +1,3 @@
<!ENTITY pandorasidebar.title "Pandora FMS">
<!ENTITY openPandoraSidebar.commandkey "L">
<!ENTITY openPandoraSidebar.modifierskey "shift accel">

View File

@ -0,0 +1,65 @@
body {
min-width:425px;
min-height:540px;
margin:5px;
font-family:Tahoma, Geneva, Arial;
font-size:10pt;
}
h1 { font-weight: bold; font-size:16px; margin:2px 0px 2px 0px; color:#0068C4; font-family:arial }
h2{
color : blue;
}
label { color: #035BAC; text-decoration:none; }
label:hover { text-decoration:underline; }
label:visited { color: #035BAC; text-decoration:none; }
label:visited:hover { text-decoration:underline; }
span.res { font-size:80%; color:#555; }
image.pm { margin-right:3px;cursor:pointer; margin-top:0px; }
.main{
background-color : white;
height: 500px;
width: 400px;
}
.textarea{
background-color : #D5DED5;
width :100%
}
vbox.e{ text-align:right; font-size:8pt; }
vbox.b { background-color:white; border:1px solid #BABABA; margin:5px; padding:4px; }
vbox.b description label { font-size: 10pt; }
vbox.b description { margin:2px 0px 4px 0px; color:#333; font-size:9pt; }
vbox.b vbox.items description {
margin:2px 0px 8px 0px; color:#333; width:355px;float:left; display:block;
}
vbox.b vbox.items description image {
float:left;margin:0px 3px 0px 0px;
}
.tooltip {
display:none;
font-size:12px;
height:70px;
width:160px;
padding:25px;
color:#eee;
}
.spinner {
position: fixed;
top: 50%;
left: 50%;
margin-left: -50px; /* half width of the spinner gif */
margin-top: -50px; /* half height of the spinner gif */
text-align:center;
z-index:1234;
overflow: auto;
width: 100px; /* width of the spinner gif */
height: 102px; /*hight of the spinner gif +2px to fix IE8 issue */
}