2788 |
rexy |
1 |
var langxml = [], langarr = [], current_language = "", plugins = [], blocks = [], plugin_liste = [],
|
|
|
2 |
showCPUListExpanded, showCPUInfoExpanded, showNetworkInfosExpanded, showNetworkActiveSpeed, showCPULoadCompact, oldnetwork = [], refrTimer;
|
|
|
3 |
|
|
|
4 |
/**
|
3179 |
rexy |
5 |
* Fix potential XSS vulnerability in jQuery
|
|
|
6 |
*/
|
|
|
7 |
jQuery.htmlPrefilter = function( html ) {
|
|
|
8 |
return html;
|
|
|
9 |
};
|
|
|
10 |
|
|
|
11 |
/**
|
2788 |
rexy |
12 |
* generate a cookie, if not exist, and add an entry to it<br><br>
|
|
|
13 |
* inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
|
|
|
14 |
* @param {String} name name that holds the value
|
|
|
15 |
* @param {String} value value that needs to be stored
|
|
|
16 |
* @param {Number} days how many days the entry should be valid in the cookie
|
|
|
17 |
*/
|
|
|
18 |
function createCookie(name, value, days) {
|
|
|
19 |
var date = new Date(), expires = "";
|
|
|
20 |
if (days) {
|
|
|
21 |
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
|
22 |
if (typeof(date.toUTCString)==="function") {
|
|
|
23 |
expires = "; expires=" + date.toUTCString();
|
|
|
24 |
} else {
|
|
|
25 |
//deprecated
|
|
|
26 |
expires = "; expires=" + date.toGMTString();
|
|
|
27 |
}
|
|
|
28 |
} else {
|
|
|
29 |
expires = "";
|
|
|
30 |
}
|
2976 |
rexy |
31 |
document.cookie = name + "=" + value + expires + "; path=/; samesite=strict";
|
2788 |
rexy |
32 |
}
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* read a value out of a cookie and return the value<br><br>
|
|
|
36 |
* inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
|
|
|
37 |
* @param {String} name name of the value that should be retrieved
|
|
|
38 |
* @return {String}
|
|
|
39 |
*/
|
|
|
40 |
function readCookie(name) {
|
|
|
41 |
var nameEQ = "", ca = [], c = '';
|
|
|
42 |
nameEQ = name + "=";
|
|
|
43 |
ca = document.cookie.split(';');
|
|
|
44 |
for (var i = 0; i < ca.length; i++) {
|
|
|
45 |
c = ca[i];
|
|
|
46 |
while (c.charAt(0) === ' ') {
|
|
|
47 |
c = c.substring(1, c.length);
|
|
|
48 |
}
|
|
|
49 |
if (!c.indexOf(nameEQ)) {
|
|
|
50 |
return c.substring(nameEQ.length, c.length);
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
return null;
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/**
|
|
|
57 |
* activates a given style and disables the old one in the document
|
|
|
58 |
* @param {String} template template that should be activated
|
|
|
59 |
*/
|
|
|
60 |
function switchStyle(template) {
|
|
|
61 |
$("#PSI_Template")[0].setAttribute('href', 'templates/' + template + "_bootstrap.css");
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* load the given translation an translate the entire page<br><br>retrieving the translation is done through a
|
|
|
66 |
* ajax call
|
|
|
67 |
* @private
|
|
|
68 |
* @param {String} plugin if plugin is given, the plugin translation file will be read instead of the main translation file
|
|
|
69 |
* @param {String} langarrId internal plugin name
|
|
|
70 |
* @return {jQuery} translation jQuery-Object
|
|
|
71 |
*/
|
|
|
72 |
function getLanguage(plugin, langarrId) {
|
|
|
73 |
var getLangUrl = "";
|
|
|
74 |
if (current_language) {
|
|
|
75 |
getLangUrl = 'language/language.php?lang=' + current_language;
|
|
|
76 |
if (plugin) {
|
|
|
77 |
getLangUrl += "&plugin=" + plugin;
|
|
|
78 |
}
|
|
|
79 |
} else {
|
|
|
80 |
getLangUrl = 'language/language.php';
|
|
|
81 |
if (plugin) {
|
|
|
82 |
getLangUrl += "?plugin=" + plugin;
|
|
|
83 |
}
|
|
|
84 |
}
|
|
|
85 |
$.ajax({
|
|
|
86 |
url: getLangUrl,
|
|
|
87 |
type: 'GET',
|
|
|
88 |
dataType: 'xml',
|
|
|
89 |
timeout: 100000,
|
|
|
90 |
error: function error() {
|
|
|
91 |
$("#errors").append("<li><b>Error loading language</b> - " + getLangUrl + "</li><br>");
|
|
|
92 |
$("#errorbutton").attr('data-toggle', 'modal');
|
|
|
93 |
$("#errorbutton").css('cursor', 'pointer');
|
|
|
94 |
$("#errorbutton").css("visibility", "visible");
|
|
|
95 |
},
|
|
|
96 |
success: function buildblocks(xml) {
|
|
|
97 |
var idexp;
|
|
|
98 |
langxml[langarrId] = xml;
|
|
|
99 |
if (langarr[langarrId] === undefined) {
|
|
|
100 |
langarr.push(langarrId);
|
|
|
101 |
langarr[langarrId] = [];
|
|
|
102 |
}
|
|
|
103 |
$("expression", langxml[langarrId]).each(function langstore(id) {
|
|
|
104 |
idexp = $("expression", xml).get(id);
|
|
|
105 |
langarr[langarrId][this.getAttribute('id')] = $("exp", idexp).text().toString().replace(/\//g, "/<wbr>");
|
|
|
106 |
});
|
|
|
107 |
changeSpanLanguage(plugin);
|
|
|
108 |
}
|
|
|
109 |
});
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
/**
|
|
|
113 |
* generate a span tag
|
|
|
114 |
* @param {Number} id translation id in the xml file
|
|
|
115 |
* @param {String} [plugin] name of the plugin for which the tag should be generated
|
3037 |
rexy |
116 |
* @param {String} [defaultvalue] default value
|
2788 |
rexy |
117 |
* @return {String} string which contains generated span tag for translation string
|
|
|
118 |
*/
|
3037 |
rexy |
119 |
function genlang(id, plugin, defaultvalue) {
|
2788 |
rexy |
120 |
var html = "", idString = "", plugname = "",
|
|
|
121 |
langarrId = current_language + "_";
|
|
|
122 |
|
|
|
123 |
if (plugin === undefined) {
|
|
|
124 |
plugname = "";
|
|
|
125 |
langarrId += "phpSysInfo";
|
|
|
126 |
} else {
|
|
|
127 |
plugname = plugin.toLowerCase();
|
|
|
128 |
langarrId += plugname;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
if (id < 100) {
|
|
|
132 |
if (id < 10) {
|
|
|
133 |
idString = "00" + id.toString();
|
|
|
134 |
} else {
|
|
|
135 |
idString = "0" + id.toString();
|
|
|
136 |
}
|
|
|
137 |
} else {
|
|
|
138 |
idString = id.toString();
|
|
|
139 |
}
|
|
|
140 |
if (plugin) {
|
|
|
141 |
idString = "plugin_" + plugname + "_" + idString;
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
html += "<span class=\"lang_" + idString + "\">";
|
|
|
145 |
|
|
|
146 |
if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
|
|
|
147 |
html += langarr[langarrId][idString];
|
3037 |
rexy |
148 |
} else if (defaultvalue !== undefined) {
|
|
|
149 |
html += defaultvalue;
|
2788 |
rexy |
150 |
}
|
|
|
151 |
|
|
|
152 |
html += "</span>";
|
|
|
153 |
|
|
|
154 |
return html;
|
|
|
155 |
}
|
|
|
156 |
|
|
|
157 |
/**
|
|
|
158 |
* translates all expressions based on the translation xml file<br>
|
|
|
159 |
* translation expressions must be in the format <span class="lang_???"></span>, where ??? is
|
|
|
160 |
* the number of the translated expression in the xml file<br><br>if a translated expression is not found in the xml
|
|
|
161 |
* file nothing would be translated, so the initial value which is inside the span tag is displayed
|
|
|
162 |
* @param {String} [plugin] name of the plugin
|
|
|
163 |
*/
|
|
|
164 |
function changeLanguage(plugin) {
|
|
|
165 |
var langarrId = current_language + "_";
|
|
|
166 |
|
|
|
167 |
if (plugin === undefined) {
|
|
|
168 |
langarrId += "phpSysInfo";
|
|
|
169 |
} else {
|
|
|
170 |
langarrId += plugin;
|
|
|
171 |
}
|
|
|
172 |
|
|
|
173 |
if (langxml[langarrId] !== undefined) {
|
|
|
174 |
changeSpanLanguage(plugin);
|
|
|
175 |
} else {
|
|
|
176 |
langxml.push(langarrId);
|
|
|
177 |
getLanguage(plugin, langarrId);
|
|
|
178 |
}
|
|
|
179 |
}
|
|
|
180 |
|
|
|
181 |
function changeSpanLanguage(plugin) {
|
|
|
182 |
var langId = "", langStr = "", langarrId = current_language + "_";
|
|
|
183 |
|
|
|
184 |
if (plugin === undefined) {
|
|
|
185 |
langarrId += "phpSysInfo";
|
|
|
186 |
$('span[class*=lang_]').each(function translate(i) {
|
|
|
187 |
langId = this.className.substring(5);
|
|
|
188 |
if (langId.indexOf('plugin_') !== 0) { //does not begin with plugin_
|
|
|
189 |
langStr = langarr[langarrId][langId];
|
|
|
190 |
if (langStr !== undefined) {
|
|
|
191 |
if (langStr.length > 0) {
|
|
|
192 |
this.innerHTML = langStr;
|
|
|
193 |
}
|
|
|
194 |
}
|
|
|
195 |
}
|
|
|
196 |
});
|
|
|
197 |
$("#select").css( "display", "table-cell" ); //show if any language loaded
|
|
|
198 |
$("#output").show();
|
|
|
199 |
} else {
|
|
|
200 |
langarrId += plugin;
|
|
|
201 |
$('span[class*=lang_plugin_'+plugin.toLowerCase()+'_]').each(function translate(i) {
|
|
|
202 |
langId = this.className.substring(5);
|
|
|
203 |
langStr = langarr[langarrId][langId];
|
|
|
204 |
if (langStr !== undefined) {
|
|
|
205 |
if (langStr.length > 0) {
|
|
|
206 |
this.innerHTML = langStr;
|
|
|
207 |
}
|
|
|
208 |
}
|
|
|
209 |
});
|
|
|
210 |
$('#panel_'+plugin.toLowerCase()).show(); //show plugin if any language loaded
|
|
|
211 |
}
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
function reload(initiate) {
|
|
|
215 |
$("#errorbutton").css("visibility", "hidden");
|
|
|
216 |
$("#errorbutton").css('cursor', 'default');
|
|
|
217 |
$("#errorbutton").attr('data-toggle', '');
|
|
|
218 |
$("#errors").empty();
|
|
|
219 |
$.ajax({
|
|
|
220 |
dataType: "json",
|
|
|
221 |
url: "xml.php?json",
|
|
|
222 |
error: function(jqXHR, status, thrownError) {
|
|
|
223 |
if ((status === "parsererror") && (typeof(xmlDoc = $.parseXML(jqXHR.responseText)) === "object")) {
|
|
|
224 |
var errs = 0;
|
|
|
225 |
try {
|
|
|
226 |
$(xmlDoc).find("Error").each(function() {
|
|
|
227 |
$("#errors").append("<li><b>"+$(this)[0].attributes.Function.nodeValue+"</b> - "+$(this)[0].attributes.Message.nodeValue.replace(/\n/g, "<br>")+"</li><br>");
|
|
|
228 |
errs++;
|
|
|
229 |
});
|
|
|
230 |
}
|
|
|
231 |
catch (err) {
|
|
|
232 |
}
|
|
|
233 |
if (errs > 0) {
|
|
|
234 |
$("#errorbutton").attr('data-toggle', 'modal');
|
|
|
235 |
$("#errorbutton").css('cursor', 'pointer');
|
|
|
236 |
$("#errorbutton").css("visibility", "visible");
|
|
|
237 |
}
|
|
|
238 |
}
|
|
|
239 |
},
|
|
|
240 |
success: function (data) {
|
3179 |
rexy |
241 |
var refrtime;
|
2788 |
rexy |
242 |
// console.log(data);
|
|
|
243 |
// data_dbg = data;
|
|
|
244 |
if ((typeof(initiate) === 'boolean') && (data.Options !== undefined) && (data.Options["@attributes"] !== undefined) && ((refrtime = data.Options["@attributes"].refresh) !== undefined) && (refrtime !== "0")) {
|
|
|
245 |
if ((initiate === false) && (typeof(refrTimer) === 'number')) {
|
|
|
246 |
clearInterval(refrTimer);
|
|
|
247 |
}
|
|
|
248 |
refrTimer = setInterval(reload, refrtime);
|
|
|
249 |
}
|
|
|
250 |
renderErrors(data);
|
|
|
251 |
renderVitals(data);
|
|
|
252 |
renderHardware(data);
|
|
|
253 |
renderMemory(data);
|
|
|
254 |
renderFilesystem(data);
|
|
|
255 |
renderNetwork(data);
|
|
|
256 |
renderVoltage(data);
|
|
|
257 |
renderTemperature(data);
|
|
|
258 |
renderFans(data);
|
|
|
259 |
renderPower(data);
|
|
|
260 |
renderCurrent(data);
|
|
|
261 |
renderOther(data);
|
|
|
262 |
renderUPS(data);
|
|
|
263 |
changeLanguage();
|
|
|
264 |
}
|
|
|
265 |
});
|
|
|
266 |
|
|
|
267 |
for (var i = 0; i < plugins.length; i++) {
|
|
|
268 |
plugin_request(plugins[i]);
|
|
|
269 |
if ($("#reload_"+plugins[i]).length > 0) {
|
|
|
270 |
$("#reload_"+plugins[i]).attr("title", "reload");
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
}
|
|
|
274 |
|
|
|
275 |
if ((typeof(initiate) === 'boolean') && (initiate === true)) {
|
|
|
276 |
for (var j = 0; j < plugins.length; j++) {
|
|
|
277 |
if ($("#reload_"+plugins[j]).length > 0) {
|
|
|
278 |
$("#reload_"+plugins[j]).click(clickfunction());
|
|
|
279 |
}
|
|
|
280 |
}
|
|
|
281 |
}
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
function clickfunction(){
|
|
|
285 |
return function(){
|
|
|
286 |
plugin_request(this.id.substring(7)); //cut "reload_" from name
|
|
|
287 |
$(this).attr("title", datetime());
|
|
|
288 |
};
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
/**
|
|
|
292 |
* load the plugin json via ajax
|
|
|
293 |
*/
|
|
|
294 |
function plugin_request(pluginname) {
|
|
|
295 |
|
|
|
296 |
$.ajax({
|
|
|
297 |
dataType: "json",
|
|
|
298 |
url: "xml.php?plugin=" + pluginname + "&json",
|
|
|
299 |
pluginname: pluginname,
|
|
|
300 |
success: function (data) {
|
|
|
301 |
try {
|
2976 |
rexy |
302 |
for (var propertyName in data.Plugins) {
|
3179 |
rexy |
303 |
if ((data.Plugins[propertyName]["@attributes"] !== undefined) &&
|
|
|
304 |
((hostname = data.Plugins[propertyName]["@attributes"].Hostname) !== undefined)) {
|
2976 |
rexy |
305 |
$('span[class=hostname_' + pluginname + ']').html(hostname);
|
|
|
306 |
}
|
|
|
307 |
break;
|
|
|
308 |
}
|
2788 |
rexy |
309 |
// dynamic call
|
|
|
310 |
window['renderPlugin_' + this.pluginname](data);
|
|
|
311 |
changeLanguage(this.pluginname);
|
|
|
312 |
plugin_liste.pushIfNotExist(this.pluginname);
|
|
|
313 |
}
|
|
|
314 |
catch (err) {
|
|
|
315 |
}
|
|
|
316 |
renderErrors(data);
|
|
|
317 |
}
|
|
|
318 |
});
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
$(document).ready(function () {
|
|
|
323 |
var old_template = null, cookie_template = null, cookie_language = null, plugtmp = "", blocktmp = "", ua = null, useragent = navigator.userAgent;
|
|
|
324 |
|
|
|
325 |
if ($("#hideBootstrapLoader").val().toString()!=="true") {
|
|
|
326 |
$(document).ajaxStart(function () {
|
|
|
327 |
$("#loader").css("visibility", "visible");
|
|
|
328 |
});
|
|
|
329 |
$(document).ajaxStop(function () {
|
|
|
330 |
$("#loader").css("visibility", "hidden");
|
|
|
331 |
});
|
|
|
332 |
}
|
|
|
333 |
|
3179 |
rexy |
334 |
if ((ua=useragent.match(/Midori\/(\d+)\.?(\d+)?/)) !== null) {
|
|
|
335 |
if ((ua[1]==0) && (ua.length==3) && (ua[2]<=4)) {
|
|
|
336 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori04.css');
|
|
|
337 |
} else if ((ua[1]==0) && (ua.length==3) && (ua[2]==5)) {
|
|
|
338 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-midori05.css');
|
|
|
339 |
}
|
|
|
340 |
} else if ((ua=useragent.match(/\(KHTML, like Gecko\) Version\/(\d+)\.[\d\.]+ (Mobile\/\S+ )?Safari\//)) !== null) {
|
2976 |
rexy |
341 |
if (ua[1]<=5) {
|
|
|
342 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari5.css');
|
|
|
343 |
} else if (ua[1]<=8) {
|
|
|
344 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-safari8.css');
|
|
|
345 |
}
|
3179 |
rexy |
346 |
} else if ((ua=useragent.match(/Firefox\/(\d+)\.[\d\.]+/)) !== null) {
|
2788 |
rexy |
347 |
if (ua[1]<=15) {
|
|
|
348 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox15.css');
|
|
|
349 |
} else if (ua[1]<=20) {
|
|
|
350 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox20.css');
|
|
|
351 |
} else if (ua[1]<=27) {
|
|
|
352 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox27.css');
|
|
|
353 |
} else if (ua[1]==28) {
|
|
|
354 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-firefox28.css');
|
|
|
355 |
}
|
3179 |
rexy |
356 |
} else if ((ua=useragent.match(/Chrome\/(\d+)\.[\d\.]+/)) !== null) {
|
2976 |
rexy |
357 |
if (ua[1]<=25) {
|
|
|
358 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome25.css');
|
|
|
359 |
} else if (ua[1]<=28) {
|
|
|
360 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-chrome28.css');
|
|
|
361 |
}
|
3179 |
rexy |
362 |
} else if ((ua=useragent.match(/^Opera\/.*Version\/(\d+)\.[\d\.]+$/)) !== null) {
|
|
|
363 |
if (ua[1]<=11) {
|
|
|
364 |
$("#PSI_CSS_Fix")[0].setAttribute('href', 'templates/vendor/bootstrap-opera11.css');
|
|
|
365 |
}
|
2788 |
rexy |
366 |
}
|
|
|
367 |
|
|
|
368 |
$(window).resize();
|
|
|
369 |
|
|
|
370 |
sorttable.init();
|
|
|
371 |
|
|
|
372 |
showCPUListExpanded = $("#showCPUListExpanded").val().toString()==="true";
|
|
|
373 |
showCPUInfoExpanded = $("#showCPUInfoExpanded").val().toString()==="true";
|
|
|
374 |
showNetworkInfosExpanded = $("#showNetworkInfosExpanded").val().toString()==="true";
|
|
|
375 |
showCPULoadCompact = $("#showCPULoadCompact").val().toString()==="true";
|
|
|
376 |
switch ($("#showNetworkActiveSpeed").val().toString()) {
|
|
|
377 |
case "bps": showNetworkActiveSpeed = 2;
|
|
|
378 |
break;
|
|
|
379 |
case "true": showNetworkActiveSpeed = 1;
|
|
|
380 |
break;
|
|
|
381 |
default: showNetworkActiveSpeed = 0;
|
|
|
382 |
}
|
|
|
383 |
|
|
|
384 |
blocktmp = $("#blocks").val().toString();
|
|
|
385 |
if (blocktmp.length >0 ){
|
|
|
386 |
if (blocktmp === "true") {
|
|
|
387 |
blocks[0] = "true";
|
|
|
388 |
} else {
|
|
|
389 |
blocks = blocktmp.split(',');
|
|
|
390 |
var j = 0;
|
|
|
391 |
for (var i = 0; i < blocks.length; i++) {
|
|
|
392 |
if ($("#block_"+blocks[i]).length > 0) {
|
|
|
393 |
$("#output").children().eq(j).before($("#block_"+blocks[i]));
|
|
|
394 |
j++;
|
|
|
395 |
}
|
|
|
396 |
}
|
|
|
397 |
}
|
|
|
398 |
}
|
|
|
399 |
|
|
|
400 |
plugtmp = $("#plugins").val().toString();
|
|
|
401 |
if (plugtmp.length >0 ){
|
|
|
402 |
plugins = plugtmp.split(',');
|
|
|
403 |
}
|
|
|
404 |
|
|
|
405 |
|
|
|
406 |
if ($("#language option").length < 2) {
|
|
|
407 |
current_language = $("#language").val().toString();
|
|
|
408 |
/* not visible any objects
|
|
|
409 |
changeLanguage();
|
|
|
410 |
*/
|
|
|
411 |
/* plugin_liste not initialized yet
|
|
|
412 |
for (var i = 0; i < plugin_liste.length; i++) {
|
|
|
413 |
changeLanguage(plugin_liste[i]);
|
|
|
414 |
}
|
|
|
415 |
*/
|
|
|
416 |
} else {
|
|
|
417 |
cookie_language = readCookie("psi_language");
|
|
|
418 |
if (cookie_language !== null) {
|
|
|
419 |
current_language = cookie_language;
|
|
|
420 |
$("#language").val(current_language);
|
|
|
421 |
} else {
|
|
|
422 |
current_language = $("#language").val().toString();
|
|
|
423 |
}
|
|
|
424 |
/* not visible any objects
|
|
|
425 |
changeLanguage();
|
|
|
426 |
*/
|
|
|
427 |
/* plugin_liste not initialized yet
|
|
|
428 |
for (var i = 0; i < plugin_liste.length; i++) {
|
|
|
429 |
changeLanguage(plugin_liste[i]);
|
|
|
430 |
}
|
|
|
431 |
*/
|
|
|
432 |
$("#langblock").css( "display", "inline-block" );
|
|
|
433 |
|
|
|
434 |
$("#language").change(function changeLang() {
|
|
|
435 |
current_language = $("#language").val().toString();
|
|
|
436 |
createCookie('psi_language', current_language, 365);
|
|
|
437 |
changeLanguage();
|
|
|
438 |
for (var i = 0; i < plugin_liste.length; i++) {
|
|
|
439 |
changeLanguage(plugin_liste[i]);
|
|
|
440 |
}
|
|
|
441 |
return false;
|
|
|
442 |
});
|
|
|
443 |
}
|
|
|
444 |
if ($("#template option").length < 2) {
|
|
|
445 |
switchStyle($("#template").val().toString());
|
|
|
446 |
} else {
|
|
|
447 |
cookie_template = readCookie("psi_bootstrap_template");
|
|
|
448 |
if (cookie_template !== null) {
|
|
|
449 |
old_template = $("#template").val();
|
|
|
450 |
$("#template").val(cookie_template);
|
|
|
451 |
if ($("#template").val() === null) {
|
|
|
452 |
$("#template").val(old_template);
|
|
|
453 |
}
|
|
|
454 |
}
|
|
|
455 |
switchStyle($("#template").val().toString());
|
|
|
456 |
|
|
|
457 |
$("#tempblock").css( "display", "inline-block" );
|
|
|
458 |
|
|
|
459 |
$("#template").change(function changeTemplate() {
|
|
|
460 |
switchStyle($("#template").val().toString());
|
|
|
461 |
createCookie('psi_bootstrap_template', $("#template").val().toString(), 365);
|
|
|
462 |
return false;
|
|
|
463 |
});
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
reload(true);
|
|
|
467 |
|
|
|
468 |
$(".logo").click(function () {
|
|
|
469 |
reload(false);
|
|
|
470 |
});
|
|
|
471 |
});
|
|
|
472 |
|
|
|
473 |
Array.prototype.push_attrs=function(element) {
|
|
|
474 |
for (var i = 0; i < element.length ; i++) {
|
|
|
475 |
this.push(element[i]["@attributes"]);
|
|
|
476 |
}
|
|
|
477 |
return i;
|
|
|
478 |
};
|
|
|
479 |
|
|
|
480 |
function full_addr(ip_string) {
|
|
|
481 |
var wrongvalue = false;
|
|
|
482 |
ip_string = $.trim(ip_string).toLowerCase();
|
|
|
483 |
// ipv4 notation
|
|
|
484 |
if (ip_string.match(/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/)) {
|
|
|
485 |
ip_string ='::ffff:' + ip_string;
|
|
|
486 |
}
|
|
|
487 |
// replace ipv4 address if any
|
|
|
488 |
var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/);
|
|
|
489 |
if (ipv4) {
|
|
|
490 |
ip_string = ipv4[1];
|
|
|
491 |
ipv4 = ipv4[2].match(/[0-9]+/g);
|
|
|
492 |
for (var i = 0;i < 4;i ++) {
|
2976 |
rexy |
493 |
var byte = parseInt(ipv4[i], 10);
|
2788 |
rexy |
494 |
if (byte<256) {
|
|
|
495 |
ipv4[i] = ("0" + byte.toString(16)).substr(-2);
|
|
|
496 |
} else {
|
|
|
497 |
wrongvalue = true;
|
|
|
498 |
break;
|
|
|
499 |
}
|
|
|
500 |
}
|
|
|
501 |
if (wrongvalue) {
|
|
|
502 |
ip_string = '';
|
|
|
503 |
} else {
|
|
|
504 |
ip_string += ipv4[0] + ipv4[1] + ':' + ipv4[2] + ipv4[3];
|
|
|
505 |
}
|
|
|
506 |
}
|
|
|
507 |
|
|
|
508 |
if (ip_string === '') {
|
|
|
509 |
return '';
|
|
|
510 |
}
|
|
|
511 |
// take care of leading and trailing ::
|
|
|
512 |
ip_string = ip_string.replace(/^:|:$/g, '');
|
|
|
513 |
|
|
|
514 |
var ipv6 = ip_string.split(':');
|
|
|
515 |
|
|
|
516 |
for (var li = 0; li < ipv6.length; li ++) {
|
|
|
517 |
var hex = ipv6[li];
|
|
|
518 |
if (hex !== "") {
|
|
|
519 |
if (!hex.match(/^[0-9a-f]{1,4}$/)) {
|
|
|
520 |
wrongvalue = true;
|
|
|
521 |
break;
|
|
|
522 |
}
|
|
|
523 |
// normalize leading zeros
|
|
|
524 |
ipv6[li] = ("0000" + hex).substr(-4);
|
|
|
525 |
}
|
|
|
526 |
else {
|
|
|
527 |
// normalize grouped zeros ::
|
|
|
528 |
hex = [];
|
|
|
529 |
for (var j = ipv6.length; j <= 8; j ++) {
|
|
|
530 |
hex.push('0000');
|
|
|
531 |
}
|
|
|
532 |
ipv6[li] = hex.join(':');
|
|
|
533 |
}
|
|
|
534 |
}
|
|
|
535 |
if (!wrongvalue) {
|
|
|
536 |
var out = ipv6.join(':');
|
|
|
537 |
if (out.length == 39) {
|
|
|
538 |
return out;
|
|
|
539 |
} else {
|
|
|
540 |
return '';
|
|
|
541 |
}
|
|
|
542 |
} else {
|
|
|
543 |
return '';
|
|
|
544 |
}
|
|
|
545 |
}
|
|
|
546 |
|
|
|
547 |
sorttable.sort_ip=function(a,b) {
|
|
|
548 |
var x = full_addr(a[0]);
|
|
|
549 |
var y = full_addr(b[0]);
|
|
|
550 |
if ((x === '') || (y === '')) {
|
|
|
551 |
x = a[0];
|
|
|
552 |
y = b[0];
|
|
|
553 |
}
|
|
|
554 |
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
|
|
555 |
};
|
|
|
556 |
|
|
|
557 |
function items(data) {
|
|
|
558 |
if (data !== undefined) {
|
|
|
559 |
if ((data.length > 0) && (data[0] !== undefined) && (data[0]["@attributes"] !== undefined)) {
|
|
|
560 |
return data;
|
|
|
561 |
} else if (data["@attributes"] !== undefined ) {
|
|
|
562 |
return [data];
|
|
|
563 |
} else {
|
|
|
564 |
return [];
|
|
|
565 |
}
|
|
|
566 |
} else {
|
|
|
567 |
return [];
|
|
|
568 |
}
|
|
|
569 |
}
|
|
|
570 |
|
|
|
571 |
function renderVitals(data) {
|
|
|
572 |
var hostname = "", ip = "";
|
|
|
573 |
|
|
|
574 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
|
|
|
575 |
$("#block_vitals").remove();
|
|
|
576 |
if ((data.Vitals !== undefined) && (data.Vitals["@attributes"] !== undefined) && ((hostname = data.Vitals["@attributes"].Hostname) !== undefined) && ((ip = data.Vitals["@attributes"].IPAddr) !== undefined)) {
|
|
|
577 |
document.title = "System information: " + hostname + " (" + ip + ")";
|
|
|
578 |
}
|
|
|
579 |
return;
|
|
|
580 |
}
|
|
|
581 |
|
|
|
582 |
var directives = {
|
|
|
583 |
Uptime: {
|
|
|
584 |
html: function () {
|
|
|
585 |
return formatUptime(this.Uptime);
|
|
|
586 |
}
|
|
|
587 |
},
|
|
|
588 |
LastBoot: {
|
|
|
589 |
text: function () {
|
|
|
590 |
var lastboot;
|
|
|
591 |
var timestamp = 0;
|
|
|
592 |
var datetimeFormat;
|
|
|
593 |
if ((data.Generation !== undefined) && (data.Generation["@attributes"] !== undefined) && (data.Generation["@attributes"].timestamp !== undefined) ) {
|
2976 |
rexy |
594 |
timestamp = parseInt(data.Generation["@attributes"].timestamp, 10) * 1000; //server time
|
2788 |
rexy |
595 |
if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
|
|
|
596 |
} else {
|
|
|
597 |
timestamp = Number(new Date()); //client time
|
|
|
598 |
}
|
2976 |
rexy |
599 |
lastboot = new Date(timestamp - (parseInt(this.Uptime, 10) * 1000));
|
2788 |
rexy |
600 |
if (((datetimeFormat = data.Options["@attributes"].datetimeFormat) !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
|
|
|
601 |
return lastboot.toLocaleString();
|
|
|
602 |
} else {
|
|
|
603 |
if (typeof(lastboot.toUTCString) === "function") {
|
|
|
604 |
return lastboot.toUTCString();
|
|
|
605 |
} else {
|
|
|
606 |
//deprecated
|
|
|
607 |
return lastboot.toGMTString();
|
|
|
608 |
}
|
|
|
609 |
}
|
|
|
610 |
}
|
|
|
611 |
},
|
|
|
612 |
Distro: {
|
|
|
613 |
html: function () {
|
3179 |
rexy |
614 |
return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:32px;"><img src="gfx/images/' + this.Distroicon + '" alt="" title="' + this.Distroicon + '" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.Distro + '</td></tr></table>';
|
2788 |
rexy |
615 |
}
|
|
|
616 |
},
|
|
|
617 |
OS: {
|
|
|
618 |
html: function () {
|
3179 |
rexy |
619 |
return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:32px;"><img src="gfx/images/' + this.OS + '.png" alt="" title="' + this.OS + '.png" style="width:32px;height:32px;" /></td><td style="vertical-align:middle;">' + this.OS + '</td></tr></table>';
|
2788 |
rexy |
620 |
}
|
|
|
621 |
},
|
|
|
622 |
LoadAvg: {
|
|
|
623 |
html: function () {
|
|
|
624 |
if (this.CPULoad !== undefined) {
|
|
|
625 |
return '<table class="borderless table-hover table-nopadding" style="width:100%;"><tr><td style="padding-right:4px!important;width:50%;">'+this.LoadAvg + '</td><td><div class="progress">' +
|
|
|
626 |
'<div class="progress-bar progress-bar-info" style="width:' + round(this.CPULoad,0) + '%;"></div>' +
|
|
|
627 |
'</div><div class="percent">' + round(this.CPULoad,0) + '%</div></td></tr></table>';
|
|
|
628 |
} else {
|
|
|
629 |
return this.LoadAvg;
|
|
|
630 |
}
|
|
|
631 |
}
|
|
|
632 |
},
|
|
|
633 |
Processes: {
|
|
|
634 |
html: function () {
|
3179 |
rexy |
635 |
var processes = 0, psarray = [0,0,0,0,0,0];
|
2788 |
rexy |
636 |
var not_first = false;
|
2976 |
rexy |
637 |
processes = parseInt(this.Processes, 10);
|
3037 |
rexy |
638 |
if (processes > 0) {
|
|
|
639 |
if (this.ProcessesRunning !== undefined) {
|
3179 |
rexy |
640 |
psarray[0] = parseInt(this.ProcessesRunning, 10);
|
3037 |
rexy |
641 |
}
|
|
|
642 |
if (this.ProcessesSleeping !== undefined) {
|
3179 |
rexy |
643 |
psarray[1] = parseInt(this.ProcessesSleeping, 10);
|
3037 |
rexy |
644 |
}
|
|
|
645 |
if (this.ProcessesStopped !== undefined) {
|
3179 |
rexy |
646 |
psarray[2] = parseInt(this.ProcessesStopped, 10);
|
3037 |
rexy |
647 |
}
|
|
|
648 |
if (this.ProcessesZombie !== undefined) {
|
3179 |
rexy |
649 |
psarray[3] = parseInt(this.ProcessesZombie, 10);
|
3037 |
rexy |
650 |
}
|
|
|
651 |
if (this.ProcessesWaiting !== undefined) {
|
3179 |
rexy |
652 |
psarray[4] = parseInt(this.ProcessesWaiting, 10);
|
3037 |
rexy |
653 |
}
|
|
|
654 |
if (this.ProcessesOther !== undefined) {
|
3179 |
rexy |
655 |
psarray[5] = parseInt(this.ProcessesOther, 10);
|
3037 |
rexy |
656 |
}
|
3179 |
rexy |
657 |
if (psarray[0] || psarray[1] || psarray[2] || psarray[3] || psarray[4] || psarray[5]) {
|
3037 |
rexy |
658 |
processes += " (";
|
3179 |
rexy |
659 |
var idlist = {0:111,1:112,2:113,3:114,4:115,5:116};
|
|
|
660 |
for (var proc_type in idlist) {
|
|
|
661 |
if (psarray[proc_type]) {
|
3037 |
rexy |
662 |
if (not_first) {
|
|
|
663 |
processes += ", ";
|
|
|
664 |
}
|
3179 |
rexy |
665 |
processes += psarray[proc_type] + String.fromCharCode(160) + genlang(idlist[proc_type]);
|
3037 |
rexy |
666 |
not_first = true;
|
2788 |
rexy |
667 |
}
|
|
|
668 |
}
|
3037 |
rexy |
669 |
processes += ")";
|
2788 |
rexy |
670 |
}
|
|
|
671 |
}
|
|
|
672 |
return processes;
|
|
|
673 |
}
|
|
|
674 |
}
|
|
|
675 |
};
|
|
|
676 |
|
3100 |
rexy |
677 |
if ((data.Vitals["@attributes"].LoadAvg === '') && (data.Vitals["@attributes"].CPULoad === undefined)) {
|
|
|
678 |
$("#tr_LoadAvg").hide();
|
|
|
679 |
}
|
2788 |
rexy |
680 |
if (data.Vitals["@attributes"].SysLang === undefined) {
|
|
|
681 |
$("#tr_SysLang").hide();
|
|
|
682 |
}
|
|
|
683 |
if (data.Vitals["@attributes"].CodePage === undefined) {
|
|
|
684 |
$("#tr_CodePage").hide();
|
|
|
685 |
}
|
|
|
686 |
if (data.Vitals["@attributes"].Processes === undefined) {
|
|
|
687 |
$("#tr_Processes").hide();
|
|
|
688 |
}
|
|
|
689 |
$('#vitals').render(data.Vitals["@attributes"], directives);
|
|
|
690 |
|
|
|
691 |
if ((data.Vitals !== undefined) && (data.Vitals["@attributes"] !== undefined) && ((hostname = data.Vitals["@attributes"].Hostname) !== undefined) && ((ip = data.Vitals["@attributes"].IPAddr) !== undefined)) {
|
|
|
692 |
document.title = "System information: " + hostname + " (" + ip + ")";
|
|
|
693 |
}
|
|
|
694 |
|
|
|
695 |
$("#block_vitals").show();
|
|
|
696 |
}
|
|
|
697 |
|
|
|
698 |
function renderHardware(data) {
|
|
|
699 |
var hw_type, datas, proc_param, i;
|
|
|
700 |
|
|
|
701 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('hardware', blocks) < 0))) {
|
|
|
702 |
$("#block_hardware").remove();
|
|
|
703 |
return;
|
|
|
704 |
}
|
|
|
705 |
|
|
|
706 |
var directives = {
|
|
|
707 |
Model: {
|
|
|
708 |
text: function () {
|
|
|
709 |
return this.Model;
|
|
|
710 |
}
|
|
|
711 |
},
|
|
|
712 |
CpuSpeed: {
|
|
|
713 |
html: function () {
|
|
|
714 |
return formatHertz(this.CpuSpeed);
|
|
|
715 |
}
|
|
|
716 |
},
|
|
|
717 |
CpuSpeedMax: {
|
|
|
718 |
html: function () {
|
|
|
719 |
return formatHertz(this.CpuSpeedMax);
|
|
|
720 |
}
|
|
|
721 |
},
|
|
|
722 |
CpuSpeedMin: {
|
|
|
723 |
html: function () {
|
|
|
724 |
return formatHertz(this.CpuSpeedMin);
|
|
|
725 |
}
|
|
|
726 |
},
|
|
|
727 |
Cache: {
|
|
|
728 |
html: function () {
|
|
|
729 |
return formatBytes(this.Cache, data.Options["@attributes"].byteFormat);
|
|
|
730 |
}
|
|
|
731 |
},
|
|
|
732 |
BusSpeed: {
|
|
|
733 |
html: function () {
|
|
|
734 |
return formatHertz(this.BusSpeed);
|
|
|
735 |
}
|
|
|
736 |
},
|
|
|
737 |
Cputemp: {
|
|
|
738 |
html: function () {
|
|
|
739 |
return formatTemp(this.Cputemp, data.Options["@attributes"].tempFormat);
|
|
|
740 |
}
|
|
|
741 |
},
|
3037 |
rexy |
742 |
Voltage: {
|
|
|
743 |
html: function() {
|
3179 |
rexy |
744 |
return round(this.Voltage, 2) + String.fromCharCode(160) + genlang(62); //V
|
3037 |
rexy |
745 |
}
|
|
|
746 |
},
|
2788 |
rexy |
747 |
Bogomips: {
|
|
|
748 |
text: function () {
|
2976 |
rexy |
749 |
return parseInt(this.Bogomips, 10);
|
2788 |
rexy |
750 |
}
|
|
|
751 |
},
|
|
|
752 |
Load: {
|
|
|
753 |
html: function () {
|
|
|
754 |
return '<div class="progress">' +
|
|
|
755 |
'<div class="progress-bar progress-bar-info" style="width:' + round(this.Load,0) + '%;"></div>' +
|
|
|
756 |
'</div><div class="percent">' + round(this.Load,0) + '%</div>';
|
|
|
757 |
}
|
|
|
758 |
}
|
|
|
759 |
};
|
|
|
760 |
|
|
|
761 |
var hw_directives = {
|
|
|
762 |
hwName: {
|
|
|
763 |
html: function() {
|
|
|
764 |
return this.Name;
|
|
|
765 |
}
|
|
|
766 |
},
|
|
|
767 |
hwCount: {
|
|
|
768 |
text: function() {
|
2976 |
rexy |
769 |
if ((this.Count !== undefined) && !isNaN(this.Count) && (parseInt(this.Count, 10)>1)) {
|
|
|
770 |
return parseInt(this.Count, 10);
|
2788 |
rexy |
771 |
} else {
|
|
|
772 |
return "";
|
|
|
773 |
}
|
|
|
774 |
}
|
|
|
775 |
}
|
|
|
776 |
};
|
|
|
777 |
|
2976 |
rexy |
778 |
var mem_directives = {
|
|
|
779 |
Speed: {
|
|
|
780 |
html: function() {
|
|
|
781 |
return formatMTps(this.Speed);
|
|
|
782 |
}
|
|
|
783 |
},
|
|
|
784 |
Voltage: {
|
|
|
785 |
html: function() {
|
3179 |
rexy |
786 |
return round(this.Voltage, 2) + String.fromCharCode(160) + genlang(62); //V
|
2976 |
rexy |
787 |
}
|
|
|
788 |
},
|
|
|
789 |
Capacity: {
|
|
|
790 |
html: function () {
|
|
|
791 |
return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
|
|
|
792 |
}
|
|
|
793 |
}
|
|
|
794 |
};
|
|
|
795 |
|
2788 |
rexy |
796 |
var dev_directives = {
|
2976 |
rexy |
797 |
Speed: {
|
|
|
798 |
html: function() {
|
|
|
799 |
return formatBPS(1000000*this.Speed);
|
|
|
800 |
}
|
|
|
801 |
},
|
2788 |
rexy |
802 |
Capacity: {
|
|
|
803 |
html: function () {
|
|
|
804 |
return formatBytes(this.Capacity, data.Options["@attributes"].byteFormat);
|
|
|
805 |
}
|
|
|
806 |
}
|
|
|
807 |
};
|
|
|
808 |
|
|
|
809 |
var html="";
|
|
|
810 |
|
3179 |
rexy |
811 |
if (data.Hardware["@attributes"] !== undefined) {
|
3037 |
rexy |
812 |
if (data.Hardware["@attributes"].Name !== undefined) {
|
|
|
813 |
html+="<tr id=\"hardware-Machine\">";
|
|
|
814 |
html+="<th style=\"width:8%;\">"+genlang(107)+"</th>"; //Machine
|
|
|
815 |
html+="<td colspan=\"2\"><span data-bind=\"Name\"></span></td>";
|
|
|
816 |
html+="</tr>";
|
|
|
817 |
}
|
|
|
818 |
if (data.Hardware["@attributes"].Virtualizer !== undefined) {
|
|
|
819 |
html+="<tr id=\"hardware-Virtualizer\">";
|
|
|
820 |
html+="<th style=\"width:8%;\">"+genlang(134)+"</th>"; //Virtualizer
|
|
|
821 |
html+="<td colspan=\"2\"><span data-bind=\"Virtualizer\"></span></td>";
|
|
|
822 |
html+="</tr>";
|
|
|
823 |
}
|
2788 |
rexy |
824 |
}
|
|
|
825 |
|
3037 |
rexy |
826 |
var paramlist = {CpuSpeed:13,CpuSpeedMax:100,CpuSpeedMin:101,Cache:15,Virt:94,BusSpeed:14,Voltage:52,Bogomips:16,Cputemp:51,Manufacturer:122,Load:9};
|
2788 |
rexy |
827 |
try {
|
|
|
828 |
datas = items(data.Hardware.CPU.CpuCore);
|
|
|
829 |
for (i = 0; i < datas.length; i++) {
|
|
|
830 |
if (i === 0) {
|
|
|
831 |
html+="<tr id=\"hardware-CPU\" class=\"treegrid-CPU\">";
|
|
|
832 |
html+="<th>CPU</th>";
|
|
|
833 |
html+="<td><span class=\"treegrid-span\">" + genlang(119) + ":</span></td>"; //Number of processors
|
|
|
834 |
html+="<td class=\"rightCell\"><span id=\"CPUCount\"></span></td>";
|
|
|
835 |
html+="</tr>";
|
|
|
836 |
}
|
|
|
837 |
html+="<tr id=\"hardware-CPU-" + i +"\" class=\"treegrid-CPU-" + i +" treegrid-parent-CPU\">";
|
|
|
838 |
html+="<th></th>";
|
|
|
839 |
if (showCPULoadCompact && (datas[i]["@attributes"].Load !== undefined)) {
|
|
|
840 |
html+="<td><span class=\"treegrid-span\" data-bind=\"Model\"></span></td>";
|
|
|
841 |
html+="<td style=\"width:15%;\" class=\"rightCell\"><span data-bind=\"Load\"></span></td>";
|
|
|
842 |
} else {
|
|
|
843 |
html+="<td colspan=\"2\"><span class=\"treegrid-span\" data-bind=\"Model\"></span></td>";
|
|
|
844 |
}
|
|
|
845 |
html+="</tr>";
|
|
|
846 |
for (proc_param in paramlist) {
|
|
|
847 |
if (((proc_param !== 'Load') || !showCPULoadCompact) && (datas[i]["@attributes"][proc_param] !== undefined)) {
|
|
|
848 |
html+="<tr id=\"hardware-CPU-" + i + "-" + proc_param + "\" class=\"treegrid-parent-CPU-" + i +"\">";
|
|
|
849 |
html+="<th></th>";
|
|
|
850 |
html+="<td><span class=\"treegrid-span\">" + genlang(paramlist[proc_param]) + "<span></td>";
|
|
|
851 |
html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
|
|
|
852 |
html+="</tr>";
|
|
|
853 |
}
|
|
|
854 |
}
|
|
|
855 |
|
|
|
856 |
}
|
|
|
857 |
}
|
|
|
858 |
catch (err) {
|
|
|
859 |
$("#hardware-CPU").hide();
|
|
|
860 |
}
|
|
|
861 |
|
2976 |
rexy |
862 |
var devparamlist = {Capacity:43,Manufacturer:122,Product:123,Speed:129,Voltage:52,Serial:124};
|
|
|
863 |
for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
|
2788 |
rexy |
864 |
try {
|
2976 |
rexy |
865 |
if (hw_type == 'MEM') {
|
|
|
866 |
datas = items(data.Hardware[hw_type].Chip);
|
|
|
867 |
} else {
|
|
|
868 |
datas = items(data.Hardware[hw_type].Device);
|
|
|
869 |
}
|
2788 |
rexy |
870 |
for (i = 0; i < datas.length; i++) {
|
|
|
871 |
if (i === 0) {
|
|
|
872 |
html+="<tr id=\"hardware-" + hw_type + "\" class=\"treegrid-" + hw_type + "\">";
|
|
|
873 |
html+="<th>" + hw_type + "</th>";
|
2976 |
rexy |
874 |
if (hw_type == 'MEM') {
|
|
|
875 |
html+="<td><span class=\"treegrid-span\">" + genlang('128') + ":</span></td>"; //Number of memories
|
|
|
876 |
} else {
|
|
|
877 |
html+="<td><span class=\"treegrid-span\">" + genlang('120') + ":</span></td>"; //Number of devices
|
3179 |
rexy |
878 |
}
|
2788 |
rexy |
879 |
html+="<td class=\"rightCell\"><span id=\"" + hw_type + "Count\"></span></td>";
|
|
|
880 |
html+="</tr>";
|
|
|
881 |
}
|
|
|
882 |
html+="<tr id=\"hardware-" + hw_type + "-" + i +"\" class=\"treegrid-" + hw_type + "-" + i +" treegrid-parent-" + hw_type + "\">";
|
|
|
883 |
html+="<th></th>";
|
|
|
884 |
html+="<td><span class=\"treegrid-span\" data-bind=\"hwName\"></span></td>";
|
|
|
885 |
html+="<td class=\"rightCell\"><span data-bind=\"hwCount\"></span></td>";
|
|
|
886 |
html+="</tr>";
|
|
|
887 |
for (proc_param in devparamlist) {
|
|
|
888 |
if (datas[i]["@attributes"][proc_param] !== undefined) {
|
|
|
889 |
html+="<tr id=\"hardware-" + hw_type +"-" + i + "-" + proc_param + "\" class=\"treegrid-parent-" + hw_type +"-" + i +"\">";
|
|
|
890 |
html+="<th></th>";
|
|
|
891 |
html+="<td><span class=\"treegrid-span\">" + genlang(devparamlist[proc_param]) + "<span></td>";
|
|
|
892 |
html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";
|
|
|
893 |
html+="</tr>";
|
|
|
894 |
}
|
|
|
895 |
}
|
|
|
896 |
}
|
|
|
897 |
}
|
|
|
898 |
catch (err) {
|
|
|
899 |
$("#hardware-data"+hw_type).hide();
|
|
|
900 |
}
|
|
|
901 |
}
|
|
|
902 |
$("#hardware-data").empty().append(html);
|
|
|
903 |
|
|
|
904 |
|
3037 |
rexy |
905 |
if (data.Hardware["@attributes"] !== undefined) {
|
|
|
906 |
if (data.Hardware["@attributes"].Name !== undefined) {
|
|
|
907 |
$('#hardware-Machine').render(data.Hardware["@attributes"]);
|
|
|
908 |
}
|
|
|
909 |
if (data.Hardware["@attributes"].Virtualizer !== undefined) {
|
|
|
910 |
$('#hardware-Virtualizer').render(data.Hardware["@attributes"]);
|
|
|
911 |
}
|
2788 |
rexy |
912 |
}
|
|
|
913 |
|
|
|
914 |
try {
|
|
|
915 |
datas = items(data.Hardware.CPU.CpuCore);
|
|
|
916 |
for (i = 0; i < datas.length; i++) {
|
|
|
917 |
$('#hardware-CPU-'+ i).render(datas[i]["@attributes"], directives);
|
|
|
918 |
for (proc_param in paramlist) {
|
|
|
919 |
if (((proc_param !== 'Load') || !showCPULoadCompact) && (datas[i]["@attributes"][proc_param] !== undefined)) {
|
|
|
920 |
$('#hardware-CPU-'+ i +'-'+proc_param).render(datas[i]["@attributes"], directives);
|
|
|
921 |
}
|
|
|
922 |
}
|
|
|
923 |
}
|
|
|
924 |
if (i > 0) {
|
|
|
925 |
$("#CPUCount").html(i);
|
|
|
926 |
}
|
|
|
927 |
}
|
|
|
928 |
catch (err) {
|
|
|
929 |
$("#hardware-CPU").hide();
|
|
|
930 |
}
|
|
|
931 |
|
|
|
932 |
var licz;
|
2976 |
rexy |
933 |
for (hw_type in {MEM:0,PCI:1,IDE:2,SCSI:3,NVMe:4,USB:5,TB:6,I2C:7}) {
|
2788 |
rexy |
934 |
try {
|
|
|
935 |
licz = 0;
|
2976 |
rexy |
936 |
if (hw_type == 'MEM') {
|
|
|
937 |
datas = items(data.Hardware[hw_type].Chip);
|
|
|
938 |
} else {
|
|
|
939 |
datas = items(data.Hardware[hw_type].Device);
|
|
|
940 |
}
|
2788 |
rexy |
941 |
for (i = 0; i < datas.length; i++) {
|
|
|
942 |
$('#hardware-'+hw_type+'-'+ i).render(datas[i]["@attributes"], hw_directives);
|
2976 |
rexy |
943 |
if ((datas[i]["@attributes"].Count !== undefined) && !isNaN(datas[i]["@attributes"].Count) && (parseInt(datas[i]["@attributes"].Count, 10)>1)) {
|
|
|
944 |
licz += parseInt(datas[i]["@attributes"].Count, 10);
|
2788 |
rexy |
945 |
} else {
|
|
|
946 |
licz++;
|
|
|
947 |
}
|
2976 |
rexy |
948 |
if (hw_type == 'MEM') {
|
|
|
949 |
for (proc_param in devparamlist) {
|
|
|
950 |
if ((datas[i]["@attributes"][proc_param] !== undefined)) {
|
|
|
951 |
$('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], mem_directives);
|
|
|
952 |
}
|
2788 |
rexy |
953 |
}
|
2976 |
rexy |
954 |
} else {
|
|
|
955 |
for (proc_param in devparamlist) {
|
|
|
956 |
if ((datas[i]["@attributes"][proc_param] !== undefined)) {
|
|
|
957 |
$('#hardware-'+hw_type+'-'+ i +'-'+proc_param).render(datas[i]["@attributes"], dev_directives);
|
|
|
958 |
}
|
|
|
959 |
}
|
2788 |
rexy |
960 |
}
|
|
|
961 |
}
|
|
|
962 |
if (i > 0) {
|
|
|
963 |
$("#" + hw_type + "Count").html(licz);
|
|
|
964 |
}
|
|
|
965 |
}
|
|
|
966 |
catch (err) {
|
|
|
967 |
$("#hardware-"+hw_type).hide();
|
|
|
968 |
}
|
|
|
969 |
}
|
|
|
970 |
$('#hardware').treegrid({
|
|
|
971 |
initialState: 'collapsed',
|
|
|
972 |
expanderExpandedClass: 'normalicon normalicon-down',
|
|
|
973 |
expanderCollapsedClass: 'normalicon normalicon-right'
|
|
|
974 |
});
|
|
|
975 |
if (showCPUListExpanded) {
|
|
|
976 |
try {
|
|
|
977 |
$('#hardware-CPU').treegrid('expand');
|
|
|
978 |
}
|
|
|
979 |
catch (err) {
|
|
|
980 |
}
|
|
|
981 |
}
|
|
|
982 |
if (showCPUInfoExpanded && showCPUListExpanded) {
|
|
|
983 |
try {
|
|
|
984 |
datas = items(data.Hardware.CPU.CpuCore);
|
|
|
985 |
for (i = 0; i < datas.length; i++) {
|
|
|
986 |
$('#hardware-CPU-'+i).treegrid('expand');
|
|
|
987 |
}
|
|
|
988 |
}
|
|
|
989 |
catch (err) {
|
|
|
990 |
}
|
|
|
991 |
}
|
|
|
992 |
$("#block_hardware").show();
|
|
|
993 |
}
|
|
|
994 |
|
|
|
995 |
function renderMemory(data) {
|
|
|
996 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('memory', blocks) < 0))) {
|
|
|
997 |
$("#block_memory").remove();
|
|
|
998 |
return;
|
|
|
999 |
}
|
|
|
1000 |
|
|
|
1001 |
var directives = {
|
|
|
1002 |
Total: {
|
|
|
1003 |
html: function () {
|
|
|
1004 |
return formatBytes(this["@attributes"].Total, data.Options["@attributes"].byteFormat);
|
|
|
1005 |
}
|
|
|
1006 |
},
|
|
|
1007 |
Free: {
|
|
|
1008 |
html: function () {
|
|
|
1009 |
return formatBytes(this["@attributes"].Free, data.Options["@attributes"].byteFormat);
|
|
|
1010 |
}
|
|
|
1011 |
},
|
|
|
1012 |
Used: {
|
|
|
1013 |
html: function () {
|
|
|
1014 |
return formatBytes(this["@attributes"].Used, data.Options["@attributes"].byteFormat);
|
|
|
1015 |
}
|
|
|
1016 |
},
|
|
|
1017 |
Usage: {
|
|
|
1018 |
html: function () {
|
|
|
1019 |
if ((this.Details === undefined) || (this.Details["@attributes"] === undefined)) {
|
|
|
1020 |
return '<div class="progress">' +
|
|
|
1021 |
'<div class="progress-bar progress-bar-info" style="width:' + this["@attributes"].Percent + '%;"></div>' +
|
|
|
1022 |
'</div><div class="percent">' + this["@attributes"].Percent + '%</div>';
|
|
|
1023 |
} else {
|
2976 |
rexy |
1024 |
var rest = parseInt(this["@attributes"].Percent, 10);
|
2788 |
rexy |
1025 |
var html = '<div class="progress">';
|
|
|
1026 |
if ((this.Details["@attributes"].AppPercent !== undefined) && (this.Details["@attributes"].AppPercent > 0)) {
|
|
|
1027 |
html += '<div class="progress-bar progress-bar-info" style="width:' + this.Details["@attributes"].AppPercent + '%;"></div>';
|
2976 |
rexy |
1028 |
rest -= parseInt(this.Details["@attributes"].AppPercent, 10);
|
2788 |
rexy |
1029 |
}
|
|
|
1030 |
if ((this.Details["@attributes"].CachedPercent !== undefined) && (this.Details["@attributes"].CachedPercent > 0)) {
|
|
|
1031 |
html += '<div class="progress-bar progress-bar-warning" style="width:' + this.Details["@attributes"].CachedPercent + '%;"></div>';
|
2976 |
rexy |
1032 |
rest -= parseInt(this.Details["@attributes"].CachedPercent, 10);
|
2788 |
rexy |
1033 |
}
|
|
|
1034 |
if ((this.Details["@attributes"].BuffersPercent !== undefined) && (this.Details["@attributes"].BuffersPercent > 0)) {
|
|
|
1035 |
html += '<div class="progress-bar progress-bar-danger" style="width:' + this.Details["@attributes"].BuffersPercent + '%;"></div>';
|
2976 |
rexy |
1036 |
rest -= parseInt(this.Details["@attributes"].BuffersPercent, 10);
|
2788 |
rexy |
1037 |
}
|
|
|
1038 |
if (rest > 0) {
|
|
|
1039 |
html += '<div class="progress-bar progress-bar-success" style="width:' + rest + '%;"></div>';
|
|
|
1040 |
}
|
|
|
1041 |
html += '</div>';
|
|
|
1042 |
html += '<div class="percent">' + 'Total: ' + this["@attributes"].Percent + '% ' + '<i>(';
|
|
|
1043 |
var not_first = false;
|
|
|
1044 |
if (this.Details["@attributes"].AppPercent !== undefined) {
|
3100 |
rexy |
1045 |
html += '<span class="progress-bar-info"> </span> ' + genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps
|
2788 |
rexy |
1046 |
not_first = true;
|
|
|
1047 |
}
|
|
|
1048 |
if (this.Details["@attributes"].CachedPercent !== undefined) {
|
|
|
1049 |
if (not_first) html += ' - ';
|
3100 |
rexy |
1050 |
html += '<span class="progress-bar-warning"> </span> ' + genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache
|
2788 |
rexy |
1051 |
not_first = true;
|
|
|
1052 |
}
|
|
|
1053 |
if (this.Details["@attributes"].BuffersPercent !== undefined) {
|
|
|
1054 |
if (not_first) html += ' - ';
|
3100 |
rexy |
1055 |
html += '<span class="progress-bar-danger"> </span> ' + genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers
|
2788 |
rexy |
1056 |
}
|
|
|
1057 |
html += ')</i></div>';
|
|
|
1058 |
return html;
|
|
|
1059 |
}
|
|
|
1060 |
}
|
|
|
1061 |
},
|
|
|
1062 |
Type: {
|
|
|
1063 |
html: function () {
|
|
|
1064 |
return genlang(28); //Physical Memory
|
|
|
1065 |
}
|
|
|
1066 |
}
|
|
|
1067 |
};
|
|
|
1068 |
|
|
|
1069 |
var directive_swap = {
|
|
|
1070 |
Total: {
|
|
|
1071 |
html: function () {
|
|
|
1072 |
return formatBytes(this.Total, data.Options["@attributes"].byteFormat);
|
|
|
1073 |
}
|
|
|
1074 |
},
|
|
|
1075 |
Free: {
|
|
|
1076 |
html: function () {
|
|
|
1077 |
return formatBytes(this.Free, data.Options["@attributes"].byteFormat);
|
|
|
1078 |
}
|
|
|
1079 |
},
|
|
|
1080 |
Used: {
|
|
|
1081 |
html: function () {
|
|
|
1082 |
return formatBytes(this.Used, data.Options["@attributes"].byteFormat);
|
|
|
1083 |
}
|
|
|
1084 |
},
|
|
|
1085 |
Usage: {
|
|
|
1086 |
html: function () {
|
|
|
1087 |
return '<div class="progress">' +
|
|
|
1088 |
'<div class="progress-bar progress-bar-info" style="width:' + this.Percent + '%;"></div>' +
|
|
|
1089 |
'</div><div class="percent">' + this.Percent + '%</div>';
|
|
|
1090 |
}
|
|
|
1091 |
},
|
|
|
1092 |
Name: {
|
|
|
1093 |
html: function () {
|
|
|
1094 |
return this.Name + '<br>' + ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
|
|
|
1095 |
}
|
|
|
1096 |
}
|
|
|
1097 |
};
|
|
|
1098 |
|
|
|
1099 |
var data_memory = [];
|
|
|
1100 |
if (data.Memory.Swap !== undefined) {
|
|
|
1101 |
var datas = items(data.Memory.Swap.Mount);
|
|
|
1102 |
data_memory.push_attrs(datas);
|
|
|
1103 |
$('#swap-data').render(data_memory, directive_swap);
|
|
|
1104 |
$('#swap-data').show();
|
|
|
1105 |
} else {
|
|
|
1106 |
$('#swap-data').hide();
|
|
|
1107 |
}
|
|
|
1108 |
$('#memory-data').render(data.Memory, directives);
|
|
|
1109 |
$("#block_memory").show();
|
|
|
1110 |
}
|
|
|
1111 |
|
|
|
1112 |
function renderFilesystem(data) {
|
|
|
1113 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('filesystem', blocks) < 0))) {
|
|
|
1114 |
$("#block_filesystem").remove();
|
|
|
1115 |
return;
|
|
|
1116 |
}
|
|
|
1117 |
|
|
|
1118 |
var directives = {
|
|
|
1119 |
Total: {
|
|
|
1120 |
html: function () {
|
2976 |
rexy |
1121 |
return formatBytes(this.Total, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
|
2788 |
rexy |
1122 |
}
|
|
|
1123 |
},
|
|
|
1124 |
Free: {
|
|
|
1125 |
html: function () {
|
2976 |
rexy |
1126 |
return formatBytes(this.Free, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore > 0) && showtotals);
|
2788 |
rexy |
1127 |
}
|
|
|
1128 |
},
|
|
|
1129 |
Used: {
|
|
|
1130 |
html: function () {
|
2976 |
rexy |
1131 |
return formatBytes(this.Used, data.Options["@attributes"].byteFormat, (this.Ignore !== undefined) && (this.Ignore >= 3) && showtotals);
|
2788 |
rexy |
1132 |
}
|
|
|
1133 |
},
|
|
|
1134 |
MountPoint: {
|
|
|
1135 |
text: function () {
|
|
|
1136 |
return ((this.MountPoint !== undefined) ? this.MountPoint : this.MountPointID);
|
|
|
1137 |
}
|
|
|
1138 |
},
|
|
|
1139 |
Name: {
|
|
|
1140 |
html: function () {
|
|
|
1141 |
return this.Name.replace(/;/g, ";<wbr>") + ((this.MountOptions !== undefined) ? '<br><i>(' + this.MountOptions + ')</i>' : '');
|
|
|
1142 |
}
|
|
|
1143 |
},
|
|
|
1144 |
Percent: {
|
|
|
1145 |
html: function () {
|
3179 |
rexy |
1146 |
var used1 = Math.max(Math.min((this.Total != 0) ? Math.ceil((this.Used / this.Total) * 100) : 0, 100), 0);
|
|
|
1147 |
var used2 = Math.max(Math.min(Math.ceil(this.Percent), 100), 0);
|
2976 |
rexy |
1148 |
var used21= used2 - used1;
|
|
|
1149 |
if (used21 > 0) {
|
|
|
1150 |
return '
|
|
|
1152 |
= parseInt(data.Options["@attributes"].threshold, 10))) ) ? 'progress-bar progress-bar-danger' : 'progress-bar progress-bar-info' ) +>
|
|
|
1153 |
|
3179 |
rexy |
1154 |
'<div class="progress-bar progress-bar-warning" style="width:' + used21 + '% ;"></div>' +>
|
|
|
1155 |
'div><div class="percent">' + this.Percent + '% ' + ((this.Inodes !== undefined) ? '<i>(' + this.Inodes + '%)</i>' : '') + 'div>';>
|
2976 |
rexy |
1156 |
|
|
|
1157 |
return '<div class="progress">' + '<div class="' +>
|
|
|
1158 |
( ( ((this.Ignore == undefined) || (this.Ignore < 4)) && ((data.Options["@attributes"].threshold !== undefined) &&>
|
|
|
1159 |
(parseInt(this.Percent, 10) >= parseInt(data.Options["@attributes"].threshold, 10))) ) ? 'progress-bar progress-bar-danger' : 'progress-bar progress-bar-info' ) +>
|
|
|
1160 |
'" style="width:' + used2 + '% ;"></div>' +>
|
|
|
1161 |
'div>' + '<div class="percent">' + this.Percent + '% ' + ((this.Inodes !== undefined) ? '<i>(' + this.Inodes + '%)</i>' : '') + 'div>';>
|
|
|
1162 |
|
2788 |
rexy |
1163 |
|
|
|
1164 |
|
|
|
1165 |
|
|
|
1166 |
|
|
|
1167 |
|
|
|
1168 |
|
|
|
1169 |
var datas = items(data.FileSystem.Mount);>
|
|
|
1170 |
var total = {Total:0,Free:0,Used:0};>
|
2976 |
rexy |
1171 |
var showtotals = $("#hideTotals").val().toString()!=="true";>
|
2788 |
rexy |
1172 |
for (var i = 0; i < datas.length; i++) {>
|
|
|
1173 |
fs_data.push(datas[i]["@attributes"]);>
|
2976 |
rexy |
1174 |
|
|
|
1175 |
if ((datas[i]["@attributes"].Ignore !== undefined) && (datas[i]["@attributes"].Ignore > 0)) {>
|
|
|
1176 |
if (datas[i]["@attributes"].Ignore == 2) {>
|
3179 |
rexy |
1177 |
total.Used += parseInt(datas[i]["@attributes"].Used, 10);>
|
2976 |
rexy |
1178 |
} else if (datas[i]["@attributes"].Ignore == 1) {>
|
|
|
1179 |
total.Total += parseInt(datas[i]["@attributes"].Used, 10);>
|
|
|
1180 |
total.Used += parseInt(datas[i]["@attributes"].Used, 10);>
|
|
|
1181 |
|
|
|
1182 |
|
|
|
1183 |
total.Total += parseInt(datas[i]["@attributes"].Total, 10);>
|
|
|
1184 |
total.Free += parseInt(datas[i]["@attributes"].Free, 10);>
|
|
|
1185 |
total.Used += parseInt(datas[i]["@attributes"].Used, 10);>
|
2788 |
rexy |
1186 |
|
2976 |
rexy |
1187 |
total.Percent = (total.Total != 0) ? round(100 - (total.Free / total.Total) * 100, 2) : 0;>
|
2788 |
rexy |
1188 |
|
|
|
1189 |
|
|
|
1190 |
|
|
|
1191 |
$('#filesystem-data').render(fs_data, directives);>
|
2976 |
rexy |
1192 |
|
|
|
1193 |
$('#filesystem-foot').render(total, directives);>
|
|
|
1194 |
$('#filesystem-foot').show();>
|
|
|
1195 |
|
2788 |
rexy |
1196 |
$('#filesystem_MountPoint').removeClass("sorttable_sorted"); //reset sort order>
|
|
|
1197 |
// sorttable.innerSortFunction.apply(document.getElementById('filesystem_MountPoint'), []);>
|
|
|
1198 |
sorttable.innerSortFunction.apply($('#filesystem_MountPoint')[0], []);>
|
|
|
1199 |
$("#block_filesystem").show();>
|
|
|
1200 |
|
|
|
1201 |
$("#block_filesystem").hide();>
|
|
|
1202 |
|
|
|
1203 |
|
|
|
1204 |
|
|
|
1205 |
$("#block_filesystem").hide();>
|
|
|
1206 |
|
|
|
1207 |
|
|
|
1208 |
|
|
|
1209 |
function renderNetwork(data) {>
|
|
|
1210 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {>
|
|
|
1211 |
$("#block_network").remove();>
|
|
|
1212 |
|
|
|
1213 |
|
|
|
1214 |
|
|
|
1215 |
|
3179 |
rexy |
1216 |
|
|
|
1217 |
|
|
|
1218 |
if (this.Bridge !== undefined) {>
|
|
|
1219 |
return this.Name + " (" + this.Bridge + ")";>
|
|
|
1220 |
|
|
|
1221 |
|
|
|
1222 |
|
|
|
1223 |
|
|
|
1224 |
|
2788 |
rexy |
1225 |
|
|
|
1226 |
|
|
|
1227 |
|
3100 |
rexy |
1228 |
if (showNetworkActiveSpeed) {>
|
|
|
1229 |
if ((this.RxBytes == 0) && (this.RxRate !== undefined)) {>
|
2788 |
rexy |
1230 |
if (showNetworkActiveSpeed == 2) {>
|
3100 |
rexy |
1231 |
htmladd ="<br><i>("+formatBPS(round(this.RxRate, 2))+")</i>";>
|
2788 |
rexy |
1232 |
|
3100 |
rexy |
1233 |
htmladd ="<br><i>("+formatBytes(round(this.RxRate, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";>
|
3179 |
rexy |
1234 |
|
3100 |
rexy |
1235 |
} else if ($.inArray(this.Name, oldnetwork) >= 0) {>
|
|
|
1236 |
|
|
|
1237 |
if (((diff = this.RxBytes - oldnetwork[this.Name].RxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) {>
|
|
|
1238 |
if (showNetworkActiveSpeed == 2) {>
|
|
|
1239 |
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";>
|
|
|
1240 |
|
|
|
1241 |
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";>
|
|
|
1242 |
|
2788 |
rexy |
1243 |
|
|
|
1244 |
|
|
|
1245 |
|
|
|
1246 |
return formatBytes(this.RxBytes, data.Options["@attributes"].byteFormat) + htmladd;>
|
|
|
1247 |
|
|
|
1248 |
|
|
|
1249 |
|
|
|
1250 |
|
|
|
1251 |
|
3100 |
rexy |
1252 |
if (showNetworkActiveSpeed) {>
|
|
|
1253 |
if ((this.TxBytes == 0) && (this.TxRate !== undefined)) {>
|
2788 |
rexy |
1254 |
if (showNetworkActiveSpeed == 2) {>
|
3100 |
rexy |
1255 |
htmladd ="<br><i>("+formatBPS(round(this.TxRate, 2))+")</i>";>
|
2788 |
rexy |
1256 |
|
3100 |
rexy |
1257 |
htmladd ="<br><i>("+formatBytes(round(this.TxRate, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";>
|
2788 |
rexy |
1258 |
|
3100 |
rexy |
1259 |
} else if ($.inArray(this.Name, oldnetwork) >= 0) {>
|
|
|
1260 |
|
|
|
1261 |
if (((diff = this.TxBytes - oldnetwork[this.Name].TxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) {>
|
|
|
1262 |
if (showNetworkActiveSpeed == 2) {>
|
|
|
1263 |
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";>
|
|
|
1264 |
|
|
|
1265 |
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";>
|
|
|
1266 |
|
|
|
1267 |
|
2788 |
rexy |
1268 |
|
|
|
1269 |
|
|
|
1270 |
return formatBytes(this.TxBytes, data.Options["@attributes"].byteFormat) + htmladd;>
|
|
|
1271 |
|
|
|
1272 |
|
|
|
1273 |
|
|
|
1274 |
|
|
|
1275 |
return this.Err + "/<wbr>" + this.Drops;>
|
|
|
1276 |
|
|
|
1277 |
|
|
|
1278 |
|
|
|
1279 |
|
|
|
1280 |
|
|
|
1281 |
|
|
|
1282 |
|
|
|
1283 |
|
|
|
1284 |
var datas = items(data.Network.NetDevice);>
|
|
|
1285 |
for (var i = 0; i < datas.length; i++) {>
|
|
|
1286 |
html+="<tr id=\"network-" + i +"\" class=\"treegrid-network-" + i + "\">";>
|
|
|
1287 |
html+="<td><span class=\"treegrid-spanbold\" data-bind=\"Name\"></span></td>";>
|
|
|
1288 |
html+="<td class=\"rightCell\"><span data-bind=\"RxBytes\"></span></td>";>
|
|
|
1289 |
html+="<td class=\"rightCell\"><span data-bind=\"TxBytes\"></span></td>";>
|
|
|
1290 |
html+="<td class=\"rightCell\"><span data-bind=\"Drops\"></span></td>";>
|
|
|
1291 |
|
|
|
1292 |
|
|
|
1293 |
var info = datas[i]["@attributes"].Info;>
|
|
|
1294 |
if ( (info !== undefined) && (info !== "") ) {>
|
|
|
1295 |
var infos = info.replace(/:/g, "<wbr>:").split(";"); /* split long addresses */>
|
|
|
1296 |
for (var j = 0; j < infos.length; j++){>
|
|
|
1297 |
html +="<tr class=\"treegrid-parent-network-" + i + "\"><td colspan=\"4\"><span class=\"treegrid-span\">" + infos[j] + "</span></td></tr>";>
|
|
|
1298 |
|
|
|
1299 |
|
|
|
1300 |
|
|
|
1301 |
$("#network-data").empty().append(html);>
|
|
|
1302 |
|
|
|
1303 |
for (var k = 0; k < datas.length; k++) {>
|
|
|
1304 |
$('#network-' + k).render(datas[k]["@attributes"], directives);>
|
|
|
1305 |
if (showNetworkActiveSpeed) {>
|
|
|
1306 |
preoldnetwork.pushIfNotExist(datas[k]["@attributes"].Name);>
|
|
|
1307 |
preoldnetwork[datas[k]["@attributes"].Name] = {timestamp:data.Generation["@attributes"].timestamp, RxBytes:datas[k]["@attributes"].RxBytes, TxBytes:datas[k]["@attributes"].TxBytes};>
|
|
|
1308 |
|
|
|
1309 |
|
|
|
1310 |
$('#network').treegrid({>
|
|
|
1311 |
initialState: showNetworkInfosExpanded?'expanded':'collapsed',>
|
|
|
1312 |
expanderExpandedClass: 'normalicon normalicon-down',>
|
|
|
1313 |
expanderCollapsedClass: 'normalicon normalicon-right'>
|
|
|
1314 |
|
|
|
1315 |
$("#block_network").show();>
|
|
|
1316 |
|
|
|
1317 |
$("#block_network").hide();>
|
|
|
1318 |
|
|
|
1319 |
|
|
|
1320 |
|
|
|
1321 |
$("#block_network").hide();>
|
|
|
1322 |
|
|
|
1323 |
|
|
|
1324 |
if (showNetworkActiveSpeed) {>
|
|
|
1325 |
while (oldnetwork.length > 0) {>
|
|
|
1326 |
delete oldnetwork[oldnetwork.length-1]; //remove last object>
|
|
|
1327 |
oldnetwork.pop(); //remove last object reference from array>
|
|
|
1328 |
|
|
|
1329 |
oldnetwork = preoldnetwork;>
|
|
|
1330 |
|
|
|
1331 |
|
|
|
1332 |
|
|
|
1333 |
function renderVoltage(data) {>
|
|
|
1334 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('voltage', blocks) < 0))) {>
|
|
|
1335 |
$("#block_voltage").remove();>
|
|
|
1336 |
|
|
|
1337 |
|
|
|
1338 |
|
|
|
1339 |
|
|
|
1340 |
|
|
|
1341 |
|
3179 |
rexy |
1342 |
return (isFinite(this.Value)?round(this.Value,2):"---") + String.fromCharCode(160) + "V";>
|
2788 |
rexy |
1343 |
|
|
|
1344 |
|
|
|
1345 |
|
|
|
1346 |
|
|
|
1347 |
if (this.Min !== undefined)>
|
|
|
1348 |
return round(this.Min,2) + String.fromCharCode(160) + "V";>
|
|
|
1349 |
|
|
|
1350 |
|
|
|
1351 |
|
|
|
1352 |
|
|
|
1353 |
if (this.Max !== undefined)>
|
|
|
1354 |
return round(this.Max,2) + String.fromCharCode(160) + "V";>
|
|
|
1355 |
|
|
|
1356 |
|
|
|
1357 |
|
|
|
1358 |
|
|
|
1359 |
if (this.Event === undefined)>
|
|
|
1360 |
|
|
|
1361 |
|
|
|
1362 |
return this.Label + " <img style=\"vertical-align:middle;width:20px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\"" + this.Event + "\"/>";>
|
|
|
1363 |
|
|
|
1364 |
|
|
|
1365 |
|
|
|
1366 |
|
|
|
1367 |
|
|
|
1368 |
var datas = items(data.MBInfo.Voltage.Item);>
|
|
|
1369 |
if (voltage_data.push_attrs(datas) > 0) {>
|
|
|
1370 |
$('#voltage-data').render(voltage_data, directives);>
|
|
|
1371 |
$("#block_voltage").show();>
|
|
|
1372 |
|
|
|
1373 |
$("#block_voltage").hide();>
|
|
|
1374 |
|
|
|
1375 |
|
|
|
1376 |
|
|
|
1377 |
$("#block_voltage").hide();>
|
|
|
1378 |
|
|
|
1379 |
|
|
|
1380 |
|
|
|
1381 |
function renderTemperature(data) {>
|
|
|
1382 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('temperature', blocks) < 0))) {>
|
|
|
1383 |
$("#block_temperature").remove();>
|
|
|
1384 |
|
|
|
1385 |
|
|
|
1386 |
|
|
|
1387 |
|
|
|
1388 |
|
|
|
1389 |
|
|
|
1390 |
return formatTemp(this.Value, data.Options["@attributes"].tempFormat);>
|
|
|
1391 |
|
|
|
1392 |
|
|
|
1393 |
|
|
|
1394 |
|
|
|
1395 |
if (this.Max !== undefined)>
|
|
|
1396 |
return formatTemp(this.Max, data.Options["@attributes"].tempFormat);>
|
|
|
1397 |
|
|
|
1398 |
|
|
|
1399 |
|
|
|
1400 |
|
|
|
1401 |
if (this.Event === undefined)>
|
|
|
1402 |
|
|
|
1403 |
|
|
|
1404 |
return this.Label + " <img style=\"vertical-align:middle;width:20px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\"" + this.Event + "\"/>";>
|
|
|
1405 |
|
|
|
1406 |
|
|
|
1407 |
|
|
|
1408 |
|
|
|
1409 |
|
|
|
1410 |
var temperature_data = [];>
|
|
|
1411 |
var datas = items(data.MBInfo.Temperature.Item);>
|
|
|
1412 |
if (temperature_data.push_attrs(datas) > 0) {>
|
|
|
1413 |
$('#temperature-data').render(temperature_data, directives);>
|
|
|
1414 |
$("#block_temperature").show();>
|
|
|
1415 |
|
|
|
1416 |
$("#block_temperature").hide();>
|
|
|
1417 |
|
|
|
1418 |
|
|
|
1419 |
|
|
|
1420 |
$("#block_temperature").hide();>
|
|
|
1421 |
|
|
|
1422 |
|
|
|
1423 |
|
|
|
1424 |
function renderFans(data) {>
|
|
|
1425 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('fans', blocks) < 0))) {>
|
|
|
1426 |
$("#block_fans").remove();>
|
|
|
1427 |
|
|
|
1428 |
|
|
|
1429 |
|
|
|
1430 |
|
|
|
1431 |
|
|
|
1432 |
|
2976 |
rexy |
1433 |
if (this.Unit === "%") {>
|
3179 |
rexy |
1434 |
if (isFinite(this.Value))>
|
|
|
1435 |
return '<div class="progress">' +>
|
|
|
1436 |
'<div class="progress-bar progress-bar-info" style="width:' + round(this.Value,0) + '%;"></div>' +>
|
|
|
1437 |
'div><div class="percent">' + round(this.Value,0) + '%</div>';>
|
|
|
1438 |
|
|
|
1439 |
|
2976 |
rexy |
1440 |
|
3179 |
rexy |
1441 |
return (isFinite(this.Value)?round(this.Value,0):"---") + String.fromCharCode(160) + genlang(63); //RPM>
|
2976 |
rexy |
1442 |
|
2788 |
rexy |
1443 |
|
|
|
1444 |
|
|
|
1445 |
|
|
|
1446 |
|
2976 |
rexy |
1447 |
if (this.Min !== undefined) {>
|
|
|
1448 |
if (this.Unit === "%") {>
|
|
|
1449 |
return round(this.Min,0) + "%";>
|
|
|
1450 |
|
|
|
1451 |
return round(this.Min,0) + String.fromCharCode(160) + genlang(63); //RPM>
|
|
|
1452 |
|
|
|
1453 |
|
2788 |
rexy |
1454 |
|
|
|
1455 |
|
|
|
1456 |
|
|
|
1457 |
|
|
|
1458 |
if (this.Event === undefined)>
|
|
|
1459 |
|
|
|
1460 |
|
|
|
1461 |
return this.Label + " gfx/attention.gif\" alt=\"!\" title=\"" + this.Event + "\"/>";>
|
|
|
1462 |
|
|
|
1463 |
|
|
|
1464 |
|
|
|
1465 |
|
|
|
1466 |
|
|
|
1467 |
|
|
|
1468 |
var datas = items(data.MBInfo.Fans.Item);>
|
|
|
1469 |
if (fans_data.push_attrs(datas) > 0) {>
|
|
|
1470 |
$('#fans-data').render(fans_data, directives);>
|
|
|
1471 |
$("#block_fans").show();>
|
|
|
1472 |
|
|
|
1473 |
$("#block_fans").hide();>
|
|
|
1474 |
|
|
|
1475 |
|
|
|
1476 |
|
|
|
1477 |
$("#block_fans").hide();>
|
|
|
1478 |
|
|
|
1479 |
|
|
|
1480 |
|
|
|
1481 |
function renderPower(data) {>
|
|
|
1482 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('power', blocks) < 0))) {>
|
|
|
1483 |
$("#block_power").remove();>
|
|
|
1484 |
|
|
|
1485 |
|
|
|
1486 |
|
|
|
1487 |
|
|
|
1488 |
|
|
|
1489 |
|
3179 |
rexy |
1490 |
return (isFinite(this.Value)?round(this.Value,2):"---") + String.fromCharCode(160) + "W";>
|
2788 |
rexy |
1491 |
|
|
|
1492 |
|
|
|
1493 |
|
|
|
1494 |
|
|
|
1495 |
if (this.Max !== undefined)>
|
|
|
1496 |
return round(this.Max,2) + String.fromCharCode(160) + "W";>
|
|
|
1497 |
|
|
|
1498 |
|
|
|
1499 |
|
|
|
1500 |
|
|
|
1501 |
if (this.Event === undefined)>
|
|
|
1502 |
|
|
|
1503 |
|
|
|
1504 |
return this.Label + " <img style=\"vertical-align:middle;width:20px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\"" + this.Event + "\"/>";>
|
|
|
1505 |
|
|
|
1506 |
|
|
|
1507 |
|
|
|
1508 |
|
|
|
1509 |
|
|
|
1510 |
|
|
|
1511 |
var datas = items(data.MBInfo.Power.Item);>
|
|
|
1512 |
if (power_data.push_attrs(datas) > 0) {>
|
|
|
1513 |
$('#power-data').render(power_data, directives);>
|
|
|
1514 |
$("#block_power").show();>
|
|
|
1515 |
|
|
|
1516 |
$("#block_power").hide();>
|
|
|
1517 |
|
|
|
1518 |
|
|
|
1519 |
|
|
|
1520 |
$("#block_power").hide();>
|
|
|
1521 |
|
|
|
1522 |
|
|
|
1523 |
|
|
|
1524 |
function renderCurrent(data) {>
|
|
|
1525 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('current', blocks) < 0))) {>
|
|
|
1526 |
$("#block_current").remove();>
|
|
|
1527 |
|
|
|
1528 |
|
|
|
1529 |
|
|
|
1530 |
|
|
|
1531 |
|
|
|
1532 |
|
3179 |
rexy |
1533 |
return (isFinite(this.Value)?round(this.Value,2):"---") + String.fromCharCode(160) + "A";>
|
2788 |
rexy |
1534 |
|
|
|
1535 |
|
|
|
1536 |
|
|
|
1537 |
|
|
|
1538 |
if (this.Min !== undefined)>
|
|
|
1539 |
return round(this.Min,2) + String.fromCharCode(160) + "A";>
|
|
|
1540 |
|
|
|
1541 |
|
|
|
1542 |
|
|
|
1543 |
|
|
|
1544 |
if (this.Max !== undefined)>
|
|
|
1545 |
return round(this.Max,2) + String.fromCharCode(160) + "A";>
|
|
|
1546 |
|
|
|
1547 |
|
|
|
1548 |
|
|
|
1549 |
|
|
|
1550 |
if (this.Event === undefined)>
|
|
|
1551 |
|
|
|
1552 |
|
|
|
1553 |
return this.Label + " <img style=\"vertical-align:middle;width:20px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\"" + this.Event + "\"/>";>
|
|
|
1554 |
|
|
|
1555 |
|
|
|
1556 |
|
|
|
1557 |
|
|
|
1558 |
|
|
|
1559 |
|
|
|
1560 |
var datas = items(data.MBInfo.Current.Item);>
|
|
|
1561 |
if (current_data.push_attrs(datas) > 0) {>
|
|
|
1562 |
$('#current-data').render(current_data, directives);>
|
|
|
1563 |
$("#block_current").show();>
|
|
|
1564 |
|
|
|
1565 |
$("#block_current").hide();>
|
|
|
1566 |
|
|
|
1567 |
|
|
|
1568 |
|
|
|
1569 |
$("#block_current").hide();>
|
|
|
1570 |
|
|
|
1571 |
|
|
|
1572 |
|
|
|
1573 |
function renderOther(data) {>
|
|
|
1574 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('other', blocks) < 0))) {>
|
|
|
1575 |
$("#block_other").remove();>
|
|
|
1576 |
|
|
|
1577 |
|
|
|
1578 |
|
|
|
1579 |
|
2976 |
rexy |
1580 |
|
|
|
1581 |
|
|
|
1582 |
if (this.Unit === "%") {>
|
3179 |
rexy |
1583 |
if (isFinite(this.Value))>
|
|
|
1584 |
return '<div class="progress">' +>
|
|
|
1585 |
'<div class="progress-bar progress-bar-info" style="width:' + round(this.Value,0) + '%;"></div>' +>
|
|
|
1586 |
'</div><div class="percent">' + round(this.Value,0) + '%</div>';>
|
|
|
1587 |
|
|
|
1588 |
|
2976 |
rexy |
1589 |
|
|
|
1590 |
|
|
|
1591 |
|
|
|
1592 |
|
|
|
1593 |
|
2788 |
rexy |
1594 |
|
|
|
1595 |
|
|
|
1596 |
if (this.Event === undefined)>
|
|
|
1597 |
|
|
|
1598 |
|
|
|
1599 |
return this.Label + " <img style=\"vertical-align:middle;width:20px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\"" + this.Event + "\"/>";>
|
|
|
1600 |
|
|
|
1601 |
|
|
|
1602 |
|
|
|
1603 |
|
|
|
1604 |
|
|
|
1605 |
|
|
|
1606 |
var datas = items(data.MBInfo.Other.Item);>
|
|
|
1607 |
if (other_data.push_attrs(datas) > 0) {>
|
|
|
1608 |
$('#other-data').render(other_data, directives);>
|
|
|
1609 |
$("#block_other").show();>
|
|
|
1610 |
|
|
|
1611 |
$("#block_other").hide();>
|
|
|
1612 |
|
|
|
1613 |
|
|
|
1614 |
|
|
|
1615 |
$("#block_other").hide();>
|
|
|
1616 |
|
|
|
1617 |
|
|
|
1618 |
|
|
|
1619 |
function renderUPS(data) {>
|
|
|
1620 |
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('ups', blocks) < 0))) {>
|
|
|
1621 |
$("#block_ups").remove();>
|
|
|
1622 |
|
|
|
1623 |
|
|
|
1624 |
|
|
|
1625 |
var i, datas, proc_param;>
|
|
|
1626 |
|
|
|
1627 |
|
|
|
1628 |
|
|
|
1629 |
return this.Name + ((this.Mode !== undefined) ? " (" + this.Mode + ")" : "");>
|
|
|
1630 |
|
|
|
1631 |
|
|
|
1632 |
|
|
|
1633 |
|
|
|
1634 |
return this.LineVoltage + String.fromCharCode(160) + genlang(82); //V>
|
|
|
1635 |
|
|
|
1636 |
|
|
|
1637 |
|
|
|
1638 |
|
|
|
1639 |
return this.LineFrequency + String.fromCharCode(160) + genlang(109); //Hz>
|
|
|
1640 |
|
|
|
1641 |
|
|
|
1642 |
|
|
|
1643 |
|
|
|
1644 |
return this.BatteryVoltage + String.fromCharCode(160) + genlang(82); //V>
|
|
|
1645 |
|
|
|
1646 |
|
|
|
1647 |
|
|
|
1648 |
|
|
|
1649 |
return this.TimeLeftMinutes + String.fromCharCode(160) + genlang(83); //minutes>
|
|
|
1650 |
|
|
|
1651 |
|
|
|
1652 |
|
|
|
1653 |
|
|
|
1654 |
return '<div class="progress">' +>
|
|
|
1655 |
'<div class="progress-bar progress-bar-info" style="width:' + round(this.LoadPercent,0) + '%;"></div>' +>
|
|
|
1656 |
'</div><div class="percent">' + round(this.LoadPercent,0) + '%</div>';>
|
|
|
1657 |
|
|
|
1658 |
|
|
|
1659 |
|
|
|
1660 |
|
|
|
1661 |
return '<div class="progress">' +>
|
|
|
1662 |
'<div class="progress-bar progress-bar-info" style="width:' + round(this.BatteryChargePercent,0) + '%;"></div>' +>
|
|
|
1663 |
'</div><div class="percent">' + round(this.BatteryChargePercent,0) + '%</div>';>
|
|
|
1664 |
|
|
|
1665 |
|
|
|
1666 |
|
|
|
1667 |
|
|
|
1668 |
if ((data.UPSInfo !== undefined) && (items(data.UPSInfo.UPS).length > 0)) {>
|
|
|
1669 |
|
3037 |
rexy |
1670 |
var paramlist = {Model:70,StartTime:72,Status:73,BeeperStatus:133,Temperature:84,OutagesCount:74,LastOutage:75,LastOutageFinish:76,LineVoltage:77,LineFrequency:108,LoadPercent:78,BatteryDate:104,BatteryVoltage:79,BatteryChargePercent:80,TimeLeftMinutes:81};>
|
2788 |
rexy |
1671 |
|
|
|
1672 |
|
|
|
1673 |
datas = items(data.UPSInfo.UPS);>
|
|
|
1674 |
for (i = 0; i < datas.length; i++) {>
|
|
|
1675 |
html+="<tr id=\"ups-" + i +"\" class=\"treegrid-UPS-" + i+ "\">";>
|
|
|
1676 |
html+="<td colspan=\"2\"><span class=\"treegrid-spanbold\" data-bind=\"Name\"></span></td>";>
|
|
|
1677 |
|
|
|
1678 |
for (proc_param in paramlist) {>
|
|
|
1679 |
if (datas[i]["@attributes"][proc_param] !== undefined) {>
|
|
|
1680 |
html+="<tr id=\"ups-" + i + "-" + proc_param + "\" class=\"treegrid-parent-UPS-" + i +"\">";>
|
|
|
1681 |
html+="<td style=\"width:60%;\"><span class=\"treegrid-spanbold\">" + genlang(paramlist[proc_param]) + "</span></td>";>
|
|
|
1682 |
html+="<td class=\"rightCell\"><span data-bind=\"" + proc_param + "\"></span></td>";>
|
|
|
1683 |
|
|
|
1684 |
|
|
|
1685 |
|
|
|
1686 |
|
|
|
1687 |
|
|
|
1688 |
|
|
|
1689 |
|
|
|
1690 |
|
|
|
1691 |
|
|
|
1692 |
if ((data.UPSInfo["@attributes"] !== undefined) && (data.UPSInfo["@attributes"].ApcupsdCgiLinks === "1")) {>
|
|
|
1693 |
|
|
|
1694 |
html+="<td colspan=\"2\">(<a title='details' href='/cgi-bin/apcupsd/multimon.cgi' target='apcupsdcgi'>"+genlang(99)+"</a>)</td>";>
|
|
|
1695 |
|
|
|
1696 |
|
|
|
1697 |
|
|
|
1698 |
$("#ups-data").empty().append(html);>
|
|
|
1699 |
|
|
|
1700 |
|
|
|
1701 |
datas = items(data.UPSInfo.UPS);>
|
|
|
1702 |
for (i = 0; i < datas.length; i++) {>
|
|
|
1703 |
$('#ups-'+ i).render(datas[i]["@attributes"], directives);>
|
|
|
1704 |
for (proc_param in paramlist) {>
|
|
|
1705 |
if (datas[i]["@attributes"][proc_param] !== undefined) {>
|
|
|
1706 |
$('#ups-'+ i +'-'+proc_param).render(datas[i]["@attributes"], directives);>
|
|
|
1707 |
|
|
|
1708 |
|
|
|
1709 |
|
|
|
1710 |
|
|
|
1711 |
|
|
|
1712 |
|
|
|
1713 |
|
|
|
1714 |
|
|
|
1715 |
initialState: 'expanded',>
|
|
|
1716 |
expanderExpandedClass: 'normalicon normalicon-down',>
|
|
|
1717 |
expanderCollapsedClass: 'normalicon normalicon-right'>
|
|
|
1718 |
|
|
|
1719 |
|
|
|
1720 |
|
|
|
1721 |
|
|
|
1722 |
|
|
|
1723 |
|
|
|
1724 |
|
|
|
1725 |
|
|
|
1726 |
function renderErrors(data) {>
|
|
|
1727 |
|
|
|
1728 |
var datas = items(data.Errors.Error);>
|
|
|
1729 |
for (var i = 0; i < datas.length; i++) {>
|
|
|
1730 |
$("#errors").append("<li><b>"+datas[i]["@attributes"].Function+"</b> - "+datas[i]["@attributes"].Message.replace(/\n/g, "<br>")+"</li><br>");>
|
|
|
1731 |
|
|
|
1732 |
|
|
|
1733 |
$("#errorbutton").attr('data-toggle', 'modal');>
|
|
|
1734 |
$("#errorbutton").css('cursor', 'pointer');>
|
|
|
1735 |
$("#errorbutton").css("visibility", "visible");>
|
|
|
1736 |
|
|
|
1737 |
|
|
|
1738 |
|
|
|
1739 |
$("#errorbutton").css("visibility", "hidden");>
|
|
|
1740 |
$("#errorbutton").css('cursor', 'default');>
|
|
|
1741 |
$("#errorbutton").attr('data-toggle', '');>
|
|
|
1742 |
|
|
|
1743 |
|
|
|
1744 |
|
|
|
1745 |
|
|
|
1746 |
* format seconds to a better readable statement with days, hours and minutes>
|
|
|
1747 |
* @param {Number} sec seconds that should be formatted>
|
|
|
1748 |
* @return {String} html string with no breaking spaces and translation statemen>
|
|
|
1749 |
|
|
|
1750 |
function formatUptime(sec) {>
|
|
|
1751 |
var txt = "", intMin = 0, intHours = 0, intDays = 0;>
|
|
|
1752 |
|
|
|
1753 |
|
|
|
1754 |
intDays = Math.floor(intHours / 24);>
|
|
|
1755 |
intHours = Math.floor(intHours - (intDays * 24));>
|
|
|
1756 |
intMin = Math.floor(intMin - (intDays * 60 * 24) - (intHours * 60));>
|
|
|
1757 |
|
|
|
1758 |
txt += intDays.toString() + String.fromCharCode(160) + genlang(48) + String.fromCharCode(160); //days>
|
|
|
1759 |
|
|
|
1760 |
|
|
|
1761 |
txt += intHours.toString() + String.fromCharCode(160) + genlang(49) + String.fromCharCode(160); //hours>
|
|
|
1762 |
|
|
|
1763 |
return txt + intMin.toString() + String.fromCharCode(160) + genlang(50); //Minutes>
|
|
|
1764 |
|
|
|
1765 |
|
|
|
1766 |
|
|
|
1767 |
* format a celcius temperature to fahrenheit and also append the right suffix>
|
|
|
1768 |
* @param {String} degreeC temperature in celvius>
|
3100 |
rexy |
1769 |
* @param {String} temperature format>
|
2788 |
rexy |
1770 |
* @return {String} html string with no breaking spaces and translation statements>
|
|
|
1771 |
|
|
|
1772 |
function formatTemp(degreeC, tempFormat) {>
|
|
|
1773 |
|
|
|
1774 |
if (tempFormat === undefined) {>
|
|
|
1775 |
|
|
|
1776 |
|
|
|
1777 |
degree = parseFloat(degreeC);>
|
|
|
1778 |
|
|
|
1779 |
|
|
|
1780 |
|
|
|
1781 |
switch (tempFormat.toLowerCase()) {>
|
|
|
1782 |
|
|
|
1783 |
return round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61);>
|
|
|
1784 |
|
|
|
1785 |
return round(degree, 1) + String.fromCharCode(160) + genlang(60);>
|
|
|
1786 |
|
|
|
1787 |
return round(degree, 1) + String.fromCharCode(160) + genlang(60) + "<br><i>(" + round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61) + ")i>";>
|
|
|
1788 |
|
|
|
1789 |
return round((((9 * degree) / 5) + 32), 1) + String.fromCharCode(160) + genlang(61) + "<br><i>(" + round(degree, 1) + String.fromCharCode(160) + genlang(60) + ")</i>";>
|
|
|
1790 |
|
|
|
1791 |
|
|
|
1792 |
|
|
|
1793 |
|
|
|
1794 |
|
|
|
1795 |
* format a given MHz value to a better readable statement with the right suffix>
|
|
|
1796 |
* @param {Number} mhertz mhertz value that should be formatted>
|
|
|
1797 |
* @return {String} html string with no breaking spaces and translation statements>
|
|
|
1798 |
|
|
|
1799 |
function formatHertz(mhertz) {>
|
|
|
1800 |
if ((mhertz >= 0) && (mhertz < 1000)) {>>
|
|
|
1801 |
< 1000)) { return mhertz.toString() + String.fromCharCode(160) + genlang(92);>>
|
|
|
1802 |
|
|
|
1803 |
< 1000)) { if (mhertz >= 1000) {>>
|
|
|
1804 |
< 1000)) { return round(mhertz / 1000, 2) + String.fromCharCode(160) + genlang(93);>>
|
|
|
1805 |
|
|
|
1806 |
|
|
|
1807 |
|
|
|
1808 |
|
|
|
1809 |
|
|
|
1810 |
|
|
|
1811 |
|
2976 |
rexy |
1812 |
< 1000)) { * format a given MT/s value to a better readable statement with the right suffix>>
|
|
|
1813 |
< 1000)) { * @param {Number} mtps mtps value that should be formatted>>
|
|
|
1814 |
< 1000)) { * @return {String} html string with no breaking spaces and translation statements>>
|
|
|
1815 |
|
|
|
1816 |
< 1000)) {function formatMTps(mtps) {>>
|
|
|
1817 |
< 1000)) { if ((mtps >= 0) && (mtps < 1000)) {>>
|
|
|
1818 |
< 1000)) { return mtps.toString() + String.fromCharCode(160) + genlang(131);>>
|
|
|
1819 |
|
|
|
1820 |
< 1000)) { if (mtps >= 1000) {>>
|
|
|
1821 |
< 1000)) { return round(mtps / 1000, 2) + String.fromCharCode(160) + genlang(132);>>
|
|
|
1822 |
|
|
|
1823 |
|
|
|
1824 |
|
|
|
1825 |
|
|
|
1826 |
|
|
|
1827 |
|
|
|
1828 |
|
2788 |
rexy |
1829 |
< 1000)) { * format the byte values into a user friendly value with the corespondenting unit expression<br>support is included>>
|
|
|
1830 |
< 1000)) { * for binary and decimal output<br>user can specify a constant format for all byte outputs or the output is formated>>
|
|
|
1831 |
< 1000)) { * automatically so that every value can be read in a user friendly way>>
|
|
|
1832 |
< 1000)) { * @param {Number} bytes value that should be converted in the corespondenting format, which is specified in the phpsysinfo.ini>>
|
3100 |
rexy |
1833 |
< 1000)) { * @param {String} byte format>>
|
2788 |
rexy |
1834 |
< 1000)) { * @param {parenths} if true then add parentheses>>
|
|
|
1835 |
< 1000)) { * @return {String} string of the converted bytes with the translated unit expression>>
|
|
|
1836 |
|
|
|
1837 |
< 1000)) {function formatBytes(bytes, byteFormat, parenths) {>>
|
|
|
1838 |
< 1000)) { var show = "";>>
|
|
|
1839 |
|
|
|
1840 |
< 1000)) { if (byteFormat === undefined) {>>
|
|
|
1841 |
< 1000)) { byteFormat = "auto_binary";>>
|
|
|
1842 |
|
|
|
1843 |
|
|
|
1844 |
< 1000)) { switch (byteFormat.toLowerCase()) {>>
|
|
|
1845 |
|
|
|
1846 |
< 1000)) { show += round(bytes / Math.pow(1024, 5), 2);>>
|
|
|
1847 |
< 1000)) { show += String.fromCharCode(160) + genlang(90);>>
|
|
|
1848 |
|
|
|
1849 |
|
|
|
1850 |
< 1000)) { show += round(bytes / Math.pow(1024, 4), 2);>>
|
|
|
1851 |
< 1000)) { show += String.fromCharCode(160) + genlang(86);>>
|
|
|
1852 |
|
|
|
1853 |
|
|
|
1854 |
< 1000)) { show += round(bytes / Math.pow(1024, 3), 2);>>
|
|
|
1855 |
< 1000)) { show += String.fromCharCode(160) + genlang(87);>>
|
|
|
1856 |
|
|
|
1857 |
|
|
|
1858 |
< 1000)) { show += round(bytes / Math.pow(1024, 2), 2);>>
|
|
|
1859 |
< 1000)) { show += String.fromCharCode(160) + genlang(88);>>
|
|
|
1860 |
|
|
|
1861 |
|
|
|
1862 |
< 1000)) { show += round(bytes / Math.pow(1024, 1), 2);>>
|
|
|
1863 |
< 1000)) { show += String.fromCharCode(160) + genlang(89);>>
|
|
|
1864 |
|
|
|
1865 |
|
|
|
1866 |
< 1000)) { show += round(bytes / Math.pow(1000, 5), 2);>>
|
|
|
1867 |
< 1000)) { show += String.fromCharCode(160) + genlang(91);>>
|
|
|
1868 |
|
|
|
1869 |
|
|
|
1870 |
< 1000)) { show += round(bytes / Math.pow(1000, 4), 2);>>
|
|
|
1871 |
< 1000)) { show += String.fromCharCode(160) + genlang(85);>>
|
|
|
1872 |
|
|
|
1873 |
|
|
|
1874 |
< 1000)) { show += round(bytes / Math.pow(1000, 3), 2);>>
|
|
|
1875 |
< 1000)) { show += String.fromCharCode(160) + genlang(41);>>
|
|
|
1876 |
|
|
|
1877 |
|
|
|
1878 |
< 1000)) { show += round(bytes / Math.pow(1000, 2), 2);>>
|
|
|
1879 |
< 1000)) { show += String.fromCharCode(160) + genlang(40);>>
|
|
|
1880 |
|
|
|
1881 |
|
|
|
1882 |
< 1000)) { show += round(bytes / Math.pow(1000, 1), 2);>>
|
|
|
1883 |
< 1000)) { show += String.fromCharCode(160) + genlang(39);>>
|
|
|
1884 |
|
|
|
1885 |
|
|
|
1886 |
< 1000)) { show += bytes;>>
|
|
|
1887 |
< 1000)) { show += String.fromCharCode(160) + genlang(96);>>
|
|
|
1888 |
|
|
|
1889 |
< 1000)) { case "auto_decimal":>>
|
|
|
1890 |
< 1000)) { if (bytes > Math.pow(1000, 5)) {>>
|
|
|
1891 |
< 1000)) { show += round(bytes / Math.pow(1000, 5), 2);>>
|
|
|
1892 |
< 1000)) { show += String.fromCharCode(160) + genlang(91);>>
|
|
|
1893 |
|
|
|
1894 |
< 1000)) { if (bytes > Math.pow(1000, 4)) {>>
|
|
|
1895 |
< 1000)) { show += round(bytes / Math.pow(1000, 4), 2);>>
|
|
|
1896 |
< 1000)) { show += String.fromCharCode(160) + genlang(85);>>
|
|
|
1897 |
|
|
|
1898 |
< 1000)) { if (bytes > Math.pow(1000, 3)) {>>
|
|
|
1899 |
< 1000)) { show += round(bytes / Math.pow(1000, 3), 2);>>
|
|
|
1900 |
< 1000)) { show += String.fromCharCode(160) + genlang(41);>>
|
|
|
1901 |
|
|
|
1902 |
< 1000)) { if (bytes > Math.pow(1000, 2)) {>>
|
|
|
1903 |
< 1000)) { show += round(bytes / Math.pow(1000, 2), 2);>>
|
|
|
1904 |
< 1000)) { show += String.fromCharCode(160) + genlang(40);>>
|
|
|
1905 |
|
|
|
1906 |
< 1000)) { if (bytes > Math.pow(1000, 1)) {>>
|
|
|
1907 |
< 1000)) { show += round(bytes / Math.pow(1000, 1), 2);>>
|
|
|
1908 |
< 1000)) { show += String.fromCharCode(160) + genlang(39);>>
|
|
|
1909 |
|
|
|
1910 |
< 1000)) { show += bytes;>>
|
|
|
1911 |
< 1000)) { show += String.fromCharCode(160) + genlang(96);>>
|
|
|
1912 |
|
|
|
1913 |
|
|
|
1914 |
|
|
|
1915 |
|
|
|
1916 |
|
|
|
1917 |
|
|
|
1918 |
|
|
|
1919 |
< 1000)) { if (bytes > Math.pow(1024, 5)) {>>
|
|
|
1920 |
< 1000)) { show += round(bytes / Math.pow(1024, 5), 2);>>
|
|
|
1921 |
< 1000)) { show += String.fromCharCode(160) + genlang(90);>>
|
|
|
1922 |
|
|
|
1923 |
< 1000)) { if (bytes > Math.pow(1024, 4)) {>>
|
|
|
1924 |
< 1000)) { show += round(bytes / Math.pow(1024, 4), 2);>>
|
|
|
1925 |
< 1000)) { show += String.fromCharCode(160) + genlang(86);>>
|
|
|
1926 |
|
|
|
1927 |
< 1000)) { if (bytes > Math.pow(1024, 3)) {>>
|
|
|
1928 |
< 1000)) { show += round(bytes / Math.pow(1024, 3), 2);>>
|
|
|
1929 |
< 1000)) { show += String.fromCharCode(160) + genlang(87);>>
|
|
|
1930 |
|
|
|
1931 |
< 1000)) { if (bytes > Math.pow(1024, 2)) {>>
|
|
|
1932 |
< 1000)) { show += round(bytes / Math.pow(1024, 2), 2);>>
|
|
|
1933 |
< 1000)) { show += String.fromCharCode(160) + genlang(88);>>
|
|
|
1934 |
|
|
|
1935 |
< 1000)) { if (bytes > Math.pow(1024, 1)) {>>
|
|
|
1936 |
< 1000)) { show += round(bytes / Math.pow(1024, 1), 2);>>
|
|
|
1937 |
< 1000)) { show += String.fromCharCode(160) + genlang(89);>>
|
|
|
1938 |
|
|
|
1939 |
< 1000)) { show += bytes;>>
|
|
|
1940 |
< 1000)) { show += String.fromCharCode(160) + genlang(96);>>
|
|
|
1941 |
|
|
|
1942 |
|
|
|
1943 |
|
|
|
1944 |
|
|
|
1945 |
|
|
|
1946 |
|
|
|
1947 |
< 1000)) { if (parenths === true) {>>
|
|
|
1948 |
< 1000)) { show = "(" + show + ")i>";>>
|
|
|
1949 |
|
|
|
1950 |
< 1000)) { return "<span style='display:none'>" + round(bytes,0) + ".</span>" + show; //span for sorting>>
|
|
|
1951 |
|
|
|
1952 |
|
|
|
1953 |
< 1000)) {function formatBPS(bps) {>>
|
|
|
1954 |
< 1000)) { var show = "";>>
|
|
|
1955 |
|
|
|
1956 |
< 1000)) { if (bps > Math.pow(1000, 5)) {>>
|
|
|
1957 |
< 1000)) { show += round(bps / Math.pow(1000, 5), 2);>>
|
|
|
1958 |
< 1000)) { show += String.fromCharCode(160) + 'Pb/s';>>
|
|
|
1959 |
|
|
|
1960 |
< 1000)) { if (bps > Math.pow(1000, 4)) {>>
|
|
|
1961 |
< 1000)) { show += round(bps / Math.pow(1000, 4), 2);>>
|
|
|
1962 |
< 1000)) { show += String.fromCharCode(160) + 'Tb/s';>>
|
|
|
1963 |
|
|
|
1964 |
< 1000)) { if (bps > Math.pow(1000, 3)) {>>
|
|
|
1965 |
< 1000)) { show += round(bps / Math.pow(1000, 3), 2);>>
|
|
|
1966 |
< 1000)) { show += String.fromCharCode(160) + 'Gb/s';>>
|
|
|
1967 |
|
|
|
1968 |
< 1000)) { if (bps > Math.pow(1000, 2)) {>>
|
|
|
1969 |
< 1000)) { show += round(bps / Math.pow(1000, 2), 2);>>
|
|
|
1970 |
< 1000)) { show += String.fromCharCode(160) + 'Mb/s';>>
|
|
|
1971 |
|
|
|
1972 |
< 1000)) { if (bps > Math.pow(1000, 1)) {>>
|
|
|
1973 |
< 1000)) { show += round(bps / Math.pow(1000, 1), 2);>>
|
|
|
1974 |
< 1000)) { show += String.fromCharCode(160) + 'Kb/s';>>
|
|
|
1975 |
|
|
|
1976 |
< 1000)) { show += bps;>>
|
|
|
1977 |
< 1000)) { show += String.fromCharCode(160) + 'b/s';>>
|
|
|
1978 |
|
|
|
1979 |
|
|
|
1980 |
|
|
|
1981 |
|
|
|
1982 |
|
|
|
1983 |
< 1000)) { return show;>>
|
|
|
1984 |
|
|
|
1985 |
|
|
|
1986 |
< 1000)) {Array.prototype.pushIfNotExist = function(val) {>>
|
|
|
1987 |
< 1000)) { if (typeof(val) == 'undefined' || val === '') {>>
|
|
|
1988 |
|
|
|
1989 |
|
|
|
1990 |
< 1000)) { val = $.trim(val);>>
|
|
|
1991 |
< 1000)) { if ($.inArray(val, this) == -1) {>>
|
|
|
1992 |
< 1000)) { this.push(val);>>
|
|
|
1993 |
|
|
|
1994 |
|
|
|
1995 |
|
|
|
1996 |
|
|
|
1997 |
< 1000)) { * generate a formatted datetime string of the current datetime>>
|
|
|
1998 |
< 1000)) { * @return {String} formatted datetime string>>
|
|
|
1999 |
|
|
|
2000 |
< 1000)) {function datetime() {>>
|
|
|
2001 |
< 1000)) { var date, day = 0, month = 0, year = 0, hour = 0, minute = 0, days = "", months = "", years = "", hours = "", minutes = "";>>
|
|
|
2002 |
< 1000)) { date = new Date();>>
|
|
|
2003 |
< 1000)) { day = date.getDate();>>
|
|
|
2004 |
< 1000)) { month = date.getMonth() + 1;>>
|
|
|
2005 |
< 1000)) { year = date.getFullYear();>>
|
|
|
2006 |
< 1000)) { hour = date.getHours();>>
|
|
|
2007 |
< 1000)) { minute = date.getMinutes();>>
|
|
|
2008 |
|
|
|
2009 |
< 1000)) { // format values smaller that 10 with a leading 0>>
|
|
|
2010 |
< 1000)) { days = (day < 10) ? "0" + day.toString() : day.toString();>>>
|
|
|
2011 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString(); months = (month < 10) ? "0" + month.toString() : month.toString();>>>>
|
|
|
2012 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString(); years = (year < 1000) ? year.toString() : year.toString();>>>>>
|
|
|
2013 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString(); minutes = (minute < 10) ? "0" + minute.toString() : minute.toString();>>>>>>
|
|
|
2014 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString(); hours = (hour < 10) ? "0" + hour.toString() : hour.toString();>>>>>>>
|
|
|
2015 |
|
|
|
2016 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); return days + "." + months + "." + years + " - " + hours + ":" + minutes;>>>>>>>
|
|
|
2017 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();}>>>>>>>
|
|
|
2018 |
|
|
|
2019 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();/**>>>>>>>
|
|
|
2020 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); * round a given value to the specified precision, difference to Math.round() is that there>>>>>>>
|
|
|
2021 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); * will be appended Zeros to the end if the precision is not reached (0.1 gets rounded to 0.100 when precision is set to 3)>>>>>>>
|
|
|
2022 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); * @param {Number} x value to round>>>>>>>
|
|
|
2023 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); * @param {Number} n precision>>>>>>>
|
|
|
2024 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); * @return {String}>>>>>>>
|
|
|
2025 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); */>>>>>>>
|
|
|
2026 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();function round(x, n) {>>>>>>>
|
|
|
2027 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); var e = 0, k = "";>>>>>>>
|
|
|
2028 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString(); if (n < 0 || n > 14) {>>>>>>>>
|
|
|
2029 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return 0;>>>>>>>>
|
|
|
2030 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }>>>>>>>>
|
|
|
2031 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > if (n === 0) {>>>>>>>>
|
|
|
2032 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return Math.round(x);>>>>>>>>
|
|
|
2033 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > } else {>>>>>>>>
|
|
|
2034 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > e = Math.pow(10, n);>>>>>>>>
|
|
|
2035 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k = (Math.round(x * e) / e).toString();>>>>>>>>
|
|
|
2036 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > if (k.indexOf('.') === -1) {>>>>>>>>
|
|
|
2037 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k += '.';>>>>>>>>
|
|
|
2038 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }>>>>>>>>
|
|
|
2039 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > k += e.toString().substring(1);>>>>>>>>
|
|
|
2040 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > return k.substring(0, k.indexOf('.') + n + 1);>>>>>>>>
|
|
|
2041 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n > }>>>>>>>>
|
|
|
2042 |
< 1000)) {< 10) ? "0" + day.toString() : day.toString();< 10) ? "0" + month.toString() : month.toString();< 1000) ? year.toString() : year.toString();< 10) ? "0" + minute.toString() : minute.toString();< 10) ? "0" + hour.toString() : hour.toString();< 0 || n >}>>>>>>>>
|