Subversion Repositories ALCASAR

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
2781 rexy 1
function renderPlugin_snmppinfo(data) {
2
 
3
    var directives = {
4
        Device: {
5
            text: function () {
6
                var Name = (this.Name !== undefined) ? (' (' + this.Name + ')'): '';
7
                return this.Device + Name;
8
            }
9
        },
10
        Percent: {
11
            html: function () {
12
                var max = parseInt(this.MaxCapacity);
13
                var level = parseInt(this.Level);
14
                var percent = 0;
15
 
16
                if (max>0 && (level>=0) && (level<=max) ) {
17
                    percent = Math.round(100*level/max);
18
                } else if (max==-2 && (level>=0) && (level<=100) ) {
19
<=100) ) {                    percent = level;
20
<=100) ) {                } else if (level==-3) {
21
<=100) ) {                    percent = 100;
22
<=100) ) {                }
23
<=100) ) {                return '
div>' +
24
<=100) ) {
'</div>
' + percent + '%div>';
25
<=100) ) {
}
26
<=100) ) {
},
27
<=100) ) {
Units: {
28
<=100) ) {
html: function () {
29
<=100) ) {
var max = parseInt(this.MaxCapacity);
30
<=100) ) {
var level = parseInt(this.Level);
31
 
32
<=100) ) {
if (max>0 && (level>=0) && (level<=max) ) {
33
<=100) ) {
return level+" / "+max;
34
<=100) ) {
} else if (max==-2 && (level>=0) && (level<=100) ) {
35
<=100) ) {
return level+" / 100";
36
<=100) ) {
} else if (level==-3) {
37
<=100) ) {
return genlang(5, 'snmppinfo'); // enough
38
<=100) ) {
} else {
39
<=100) ) {
return genlang(6, 'snmppinfo'); // unknown
40
<=100) ) {
}
41
<=100) ) {
}
42
<=100) ) {
},
43
<=100) ) {
SUnits: {
44
<=100) ) {
html: function () {
45
<=100) ) {
var supply = parseInt(this.SupplyUnit);
46
<=100) ) {
if (isNaN(supply)) {
47
<=100) ) {
return "";
48
<=100) ) {
} else {
49
<=100) ) {
switch (supply) {
50
<=100) ) {
case 7:
51
<=100) ) {
return "<br>" + genlang(9, "snmppinfo");
52
<=100) ) {
case 13:
53
<=100) ) {
return "<br>" + genlang(8, "snmppinfo");
54
<=100) ) {
case 15:
55
<=100) ) {
return "<br>" + genlang(7, "snmppinfo");
56
<=100) ) {
case 19:
57
<=100) ) {
return "<br>" + genlang(3, "snmppinfo");
58
<=100) ) {
}
59
<=100) ) {
}
60
<=100) ) {
}
61
<=100) ) {
}
62
<=100) ) {
};
63
 
64
<=100) ) {
if (data.Plugins.Plugin_SNMPPInfo !== undefined) {
65
<=100) ) {
var printers = items(data.Plugins.Plugin_SNMPPInfo.Printer);
66
<=100) ) {
if (printers.length > 0) {
67
<=100) ) {
var i, j, datas;
68
<=100) ) {
var html = "";
69
<=100) ) {
for (i = 0; i < printers.length; i++) {
70
<=100) ) {
html+="<tr id=\"snmppinfo-" + i + "\" class=\"treegrid-snmppinfo-" + i + "\" style=\"display:none;\" >";
71
<=100) ) {
html+="<td colspan=\"3\"><span class=\"treegrid-spanbold\" data-bind=\"Device\"></span></td>";
72
<=100) ) {
html+="</tr>";
73
 
74
<=100) ) {
try {
75
<=100) ) {
datas = items(printers[i].MarkerSupplies);
76
<=100) ) {
for (j = 0; j < datas.length; j++) {
77
<=100) ) {
html+="<tr id=\"snmppinfo-" + i + "-" + j +"\" class=\"treegrid-parent-snmppinfo-" + i + "\">";
78
<=100) ) {
html+="<td><span class=\"treegrid-spanbold\" data-bind=\"Description\"></span></td>";
79
<=100) ) {
html+="<td><span data-bind=\"Percent\"></span></td>";
80
<=100) ) {
html+="<td class=\"rightCell\"><span data-bind=\"Units\"></span><span data-bind=\"SUnits\"></span></td>";
81
<=100) ) {
html+="</tr>";
82
<=100) ) {
}
83
<=100) ) {
}
84
<=100) ) {
catch (err) {
85
<=100) ) {
$("#snmppinfo-" + i).hide();
86
<=100) ) {
}
87
<=100) ) {
}
88
 
89
<=100) ) {
$("#snmppinfo-data").empty().append(html);
90
 
91
<=100) ) {
for (i = 0; i < printers.length; i++) {
92
<=100) ) {
$('#snmppinfo-'+ i).render(printers[i]["@attributes"], directives);
93
<=100) ) {
try {
94
<=100) ) {
datas = items(printers[i].MarkerSupplies);
95
<=100) ) {
for (j = 0; j < datas.length; j++) {
96
<=100) ) {
$('#snmppinfo-'+ i+ "-" + j).render(datas[j]["@attributes"], directives);
97
<=100) ) {
}
98
<=100) ) {
}
99
<=100) ) {
catch (err) {
100
<=100) ) {
$("#snmppinfo-" + i).hide();
101
<=100) ) {
}
102
<=100) ) {
}
103
 
104
<=100) ) {
$('#snmppinfo').treegrid({
105
<=100) ) {
initialState: 'expanded',
106
<=100) ) {
expanderExpandedClass: 'normalicon normalicon-down',
107
<=100) ) {
expanderCollapsedClass: 'normalicon normalicon-right'
108
<=100) ) {
});
109
 
110
<=100) ) {
$('#block_snmppinfo').show();
111
<=100) ) {
} else {
112
<=100) ) {
$('#block_snmppinfo').hide();
113
<=100) ) {
}
114
<=100) ) {
} else {
115
<=100) ) {
$('#block_snmppinfo').hide();
116
<=100) ) {
}
117
<=100) ) {
}