Subversion Repositories ALCASAR

Rev

Rev 3100 | Details | Compare with Previous | Last modification | View Log









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Rev Author Line No. Line
2788 rexy 1
/***************************************************************************
2
 *   Copyright (C) 2008 by phpSysInfo - A PHP System Information Script    *
3
 *   http://phpsysinfo.sourceforge.net/                                    *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 ***************************************************************************/
20
//
21
// $Id: phpsysinfo.js 699 2012-09-15 11:57:13Z namiltd $
22
//
23
 
24
/*global $, jQuery */
25
 
26
"use strict";
27
 
28
var langxml = [], filesystemTable, current_language = "", plugin_liste = [], blocks = [], langarr = [],
2976 rexy 29
     showCPUListExpanded, showCPUInfoExpanded, showNetworkInfosExpanded, showMemoryInfosExpanded, showNetworkActiveSpeed, showCPULoadCompact, showTotals, increaseWidth, oldnetwork = [];
2788 rexy 30
 
31
/**
3179 rexy 32
 * Fix potential XSS vulnerability in jQuery
33
 */
34
jQuery.htmlPrefilter = function( html ) {
35
	return html;
36
};
37
 
38
/**
2788 rexy 39
 * Fix PNG loading on IE6 or below
40
 */
41
function PNGload(png) {
42
    if (typeof(png.ifixpng)==='function') { //IE6 PNG fix
43
        png.ifixpng('./gfx/blank.gif');
44
    }
45
}
46
 
47
/**
48
 * generate a cookie, if not exist, and add an entry to it<br><br>
49
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
50
 * @param {String} name name that holds the value
51
 * @param {String} value value that needs to be stored
52
 * @param {Number} days how many days the entry should be valid in the cookie
53
 */
54
function createCookie(name, value, days) {
55
    var date = new Date(), expires = "";
56
    if (days) {
57
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
58
        if (typeof(date.toUTCString)==="function") {
59
            expires = "; expires=" + date.toUTCString();
60
        } else {
61
            //deprecated
62
            expires = "; expires=" + date.toGMTString();
63
        }
64
    } else {
65
        expires = "";
66
    }
2976 rexy 67
    document.cookie = name + "=" + value + expires + "; path=/; samesite=strict";
2788 rexy 68
}
69
 
70
/**
71
 * read a value out of a cookie and return the value<br><br>
72
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
73
 * @param {String} name name of the value that should be retrieved
74
 * @return {String}
75
 */
76
function readCookie(name) {
77
    var nameEQ = "", ca = [], c = '', i = 0;
78
    nameEQ = name + "=";
79
    ca = document.cookie.split(';');
80
    for (i = 0; i < ca.length; i++) {
81
        c = ca[i];
82
        while (c.charAt(0) === ' ') {
83
            c = c.substring(1, c.length);
84
        }
85
        if (!c.indexOf(nameEQ)) {
86
            return c.substring(nameEQ.length, c.length);
87
        }
88
    }
89
    return null;
90
}
91
 
92
/**
93
 * round a given value to the specified precision, difference to Math.round() is that there
94
 * 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)
95
 * @param {Number} x value to round
96
 * @param {Number} n precision
97
 * @return {String}
98
 */
99
function round(x, n) {
100
    var e = 0, k = "";
101
    if (n < 0 || n > 14) {
102
        return 0;
103
    }
104
    if (n === 0) {
105
        return Math.round(x);
106
    } else {
107
        e = Math.pow(10, n);
108
        k = (Math.round(x * e) / e).toString();
109
        if (k.indexOf('.') === -1) {
110
            k += '.';
111
        }
112
        k += e.toString().substring(1);
113
        return k.substring(0, k.indexOf('.') + n + 1);
114
    }
115
}
116
 
117
/**
118
 * activates a given style and disables the old one in the document
119
 * @param {String} template template that should be activated
120
 */
121
function switchStyle(template) {
2976 rexy 122
    if (increaseWidth > 0) {
123
        $('link[rel*=style][title]').each(function getTitle(i) {
124
            if (this.getAttribute('title') === 'PSI_Template') {
125
                this.setAttribute('href', './templates/css.php?name=' + template + '&increase=' + increaseWidth);
126
            }
127
        });
128
    } else {
129
        $('link[rel*=style][title]').each(function getTitle(i) {
130
            if (this.getAttribute('title') === 'PSI_Template') {
3179 rexy 131
                this.setAttribute('href', './templates/' + template + ".css");
2976 rexy 132
            }
133
        });
134
    }
2788 rexy 135
}
136
 
137
/**
138
 * load the given translation an translate the entire page<br><br>retrieving the translation is done through a
139
 * ajax call
140
 * @private
141
 * @param {String} plugin if plugin is given, the plugin translation file will be read instead of the main translation file
142
 * @param {String} langarrId internal plugin name
143
 * @return {jQuery} translation jQuery-Object
144
 */
145
function getLanguage(plugin, langarrId) {
146
    var getLangUrl = "";
147
    if (current_language) {
148
        getLangUrl = 'language/language.php?lang=' + current_language;
149
        if (plugin) {
150
            getLangUrl += "&plugin=" + plugin;
151
        }
152
    } else {
153
        getLangUrl = 'language/language.php';
154
        if (plugin) {
155
            getLangUrl += "?plugin=" + plugin;
156
        }
157
    }
158
    $.ajax({
159
        url: getLangUrl,
160
        type: 'GET',
161
        dataType: 'xml',
162
        timeout: 100000,
163
        error: function error() {
164
            $.jGrowl("Error loading language - " + getLangUrl);
165
        },
166
        success: function buildblocks(xml) {
167
            var idexp;
168
            langxml[langarrId] = xml;
169
            if (langarr[langarrId] === undefined) {
170
                langarr.push(langarrId);
171
                langarr[langarrId] = [];
172
            }
173
            $("expression", langxml[langarrId]).each(function langstore(id) {
174
                idexp = $("expression", xml).get(id);
175
                langarr[langarrId][this.getAttribute('id')] = $("exp", idexp).text().toString().replace(/\//g, "/<wbr>");
176
            });
177
            changeSpanLanguage(plugin);
178
        }
179
    });
180
}
181
 
182
/**
183
 * generate a span tag
184
 * @param {Number} id translation id in the xml file
185
 * @param {String} [plugin] name of the plugin for which the tag should be generated
3037 rexy 186
 * @param {String} [defaultvalue] default value
2788 rexy 187
 * @return {String} string which contains generated span tag for translation string
188
 */
3037 rexy 189
function genlang(id, plugin, defaultvalue) {
2788 rexy 190
    var html = "", idString = "", plugname = "",
191
        langarrId = current_language + "_";
192
 
193
    if (plugin === undefined) {
194
        plugname = "";
195
        langarrId += "phpSysInfo";
196
    } else {
197
        plugname = plugin.toLowerCase();
198
        langarrId += plugname;
199
    }
200
    if (id < 100) {
201
        if (id < 10) {
202
            idString = "00" + id.toString();
203
        } else {
204
            idString = "0" + id.toString();
205
        }
206
    } else {
207
        idString = id.toString();
208
    }
209
    if (plugin) {
210
        idString = "plugin_" + plugname + "_" + idString;
211
    }
212
 
213
    html += "<span class=\"lang_" + idString + "\">";
214
 
215
    if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
216
        html += langarr[langarrId][idString];
3037 rexy 217
    } else if (defaultvalue !== undefined) {
218
        html += defaultvalue;
219
    }
2788 rexy 220
 
221
    html += "</span>";
222
 
223
    return html;
224
}
225
 
226
/**
227
 * translates all expressions based on the translation xml file<br>
228
 * translation expressions must be in the format &lt;span class="lang_???"&gt;&lt;/span&gt;, where ??? is
229
 * the number of the translated expression in the xml file<br><br>if a translated expression is not found in the xml
230
 * file nothing would be translated, so the initial value which is inside the span tag is displayed
231
 * @param {String} [plugin] name of the plugin
232
 */
233
function changeLanguage(plugin) {
234
    var langarrId = current_language + "_";
235
 
236
    if (plugin === undefined) {
237
        langarrId += "phpSysInfo";
238
    } else {
239
        langarrId += plugin;
240
    }
241
 
242
    if (langxml[langarrId] !== undefined) {
243
        changeSpanLanguage(plugin);
244
    } else {
245
        langxml.push(langarrId);
246
        getLanguage(plugin, langarrId);
247
    }
248
}
249
 
250
function changeSpanLanguage(plugin) {
251
    var langId = "", langStr = "", langarrId = current_language + "_";
252
 
253
    if (plugin === undefined) {
254
        langarrId += "phpSysInfo";
255
        $('span[class*=lang_]').each(function translate(i) {
256
            langId = this.className.substring(5);
257
            if (langId.indexOf('plugin_') !== 0) { //does not begin with plugin_
258
                langStr = langarr[langarrId][langId];
259
                if (langStr !== undefined) {
260
                    if (langStr.length > 0) {
261
                        this.innerHTML = langStr;
262
                    }
263
                }
264
            }
265
        });
266
        $("#loader").hide();
267
        $("#output").fadeIn("slow"); //show if any language loaded
268
    } else {
269
        langarrId += plugin;
270
        $('span[class*=lang_plugin_'+plugin.toLowerCase()+'_]').each(function translate(i) {
271
            langId = this.className.substring(5);
272
            langStr = langarr[langarrId][langId];
273
            if (langStr !== undefined) {
274
                if (langStr.length > 0) {
275
                    this.innerHTML = langStr;
276
                }
277
            }
278
        });
279
        $('#panel_'+plugin).show(); //show plugin if any language loaded
280
    }
281
}
282
 
283
/**
284
 * generate the filesystemTable and activate the dataTables plugin on it
285
 */
286
function filesystemtable() {
287
    var html = "";
288
    html += "<h2>" + genlang(30) + "</h2>\n";
289
    html += "        <div style=\"overflow-x:auto;\">\n";
290
    html += "          <table id=\"filesystemTable\" style=\"border-collapse:collapse;\">\n";
291
    html += "            <thead>\n";
292
    html += "              <tr>\n";
293
    html += "                <th>" + genlang(31) + "</th>\n";
294
    html += "                <th>" + genlang(34) + "</th>\n";
295
    html += "                <th>" + genlang(32) + "</th>\n";
296
    html += "                <th>" + genlang(33) + "</th>\n";
297
    html += "                <th class=\"right\">" + genlang(35) + "</th>\n";
298
    html += "                <th class=\"right\">" + genlang(36) + "</th>\n";
299
    html += "                <th class=\"right\">" + genlang(37) + "</th>\n";
300
    html += "              </tr>\n";
301
    html += "            </thead>\n";
2976 rexy 302
    if (showTotals) {
303
        html += "            <tfoot>\n";
304
        html += "              <tr style=\"font-weight : bold\">\n";
305
        html += "                <td>&nbsp;</td>\n";
306
        html += "                <td>&nbsp;</td>\n";
307
        html += "                <td>" + genlang(38) + "</td>\n";
308
        html += "                <td id=\"s_fs_total\"></td>\n";
309
        html += "                <td class=\"right\"><span id=\"s_fs_tfree\"></span></td>\n";
310
        html += "                <td class=\"right\"><span id=\"s_fs_tused\"></span></td>\n";
311
        html += "                <td class=\"right\"><span id=\"s_fs_tsize\"></span></td>\n";
312
        html += "              </tr>\n";
313
        html += "            </tfoot>\n";
314
    }
2788 rexy 315
    html += "            <tbody>\n";
316
    html += "            </tbody>\n";
317
    html += "          </table>\n";
318
    html += "        </div>\n";
319
 
320
    $("#filesystem").append(html);
321
 
322
    filesystemTable = $("#filesystemTable").dataTable({
323
        "bPaginate": false,
324
        "bLengthChange": false,
325
        "bFilter": false,
326
        "bSort": true,
327
        "bInfo": false,
328
        "bProcessing": true,
329
        "bAutoWidth": false,
330
        "bStateSave": true,
331
        "aoColumns": [{
332
            "sType": 'span-string',
333
            "sWidth": "100px"
334
        }, {
335
            "sType": 'span-string',
336
            "sWidth": "50px"
337
        }, {
338
            "sType": 'span-string',
339
            "sWidth": "200px"
340
        }, {
341
            "sType": 'span-number'
342
        }, {
343
            "sType": 'span-number',
344
            "sWidth": "80px",
345
            "sClass": "right"
346
        }, {
347
            "sType": 'span-number',
348
            "sWidth": "80px",
349
            "sClass": "right"
350
        }, {
351
            "sType": 'span-number',
352
            "sWidth": "80px",
353
            "sClass": "right"
354
        }]
355
    });
356
}
357
 
358
/**
359
 * fill all errors from the xml in the error div element in the document and show the error icon
360
 * @param {jQuery} xml phpSysInfo-XML
361
 */
362
function populateErrors(xml) {
363
    var values = false;
364
    $("Errors Error", xml).each(function getError(id) {
365
//        $("#errorlist").append("<b>" + $(this).attr("Function") + "</b><br><br><pre>" + $(this).text() + "</pre><hr>");
366
        $("#errorlist").append("<b>" + $(this).attr("Function") + "</b><br><br><pre>" + $(this).attr("Message") + "</pre><hr>");
367
        values = true;
368
    });
369
    if (values) {
370
        $("#warn").css("display", "inline");
371
        $("#loadwarn").css("display", "inline");
372
    }
373
}
374
 
375
/**
376
 * show the page
377
 * @param {jQuery} xml phpSysInfo-XML
378
 */
379
function displayPage(xml) {
380
    var versioni = "";
381
//    $("#loader").hide();
382
//    $("#output").fadeIn("slow");
383
    versioni = $("Generation", xml).attr("version").toString();
384
    $("#version").html(versioni);
385
}
386
 
387
/**
388
 * format seconds to a better readable statement with days, hours and minutes
389
 * @param {Number} sec seconds that should be formatted
390
 * @return {String} html string with no breaking spaces and translation statements
391
 */
392
function formatUptime(sec) {
393
    var txt = "", intMin = 0, intHours = 0, intDays = 0;
394
    intMin = sec / 60;
395
    intHours = intMin / 60;
396
    intDays = Math.floor(intHours / 24);
397
    intHours = Math.floor(intHours - (intDays * 24));
398
    intMin = Math.floor(intMin - (intDays * 60 * 24) - (intHours * 60));
399
    if (intDays) {
400
        txt += intDays.toString() + " " + genlang(48) + " ";
401
    }
402
    if (intHours) {
403
        txt += intHours.toString() + " " + genlang(49) + " ";
404
    }
405
    return txt + intMin.toString() + " " + genlang(50);
406
}
407
 
408
/**
409
 * format a given MHz value to a better readable statement with the right suffix
410
 * @param {Number} mhertz mhertz value that should be formatted
411
 * @return {String} html string with no breaking spaces and translation statements
412
 */
413
function formatHertz(mhertz) {
414
    if ((mhertz >= 0) && (mhertz < 1000)) {
415
< 1000)) {        return mhertz.toString() + " " + genlang(92);
416
< 1000)) {    } else {
417
< 1000)) {        if (mhertz >= 1000) {
418
< 1000)) {            return round(mhertz / 1000, 2) + "&nbsp;" + genlang(93);
419
< 1000)) {        } else {
420
< 1000)) {            return "";
421
< 1000)) {        }
422
< 1000)) {    }
423
< 1000)) {}
424
 
425
< 1000)) {/**
2976 rexy 426
< 1000)) { * format a given MT/s value to a better readable statement with the right suffix
427
< 1000)) { * @param {Number} mtps mtps value that should be formatted
428
< 1000)) { * @return {String} html string with no breaking spaces and translation statements
429
< 1000)) { */
430
< 1000)) {function formatMTps(mtps) {
431
< 1000)) {    if ((mtps >= 0) && (mtps < 1000)) {
432
< 1000)) {        return mtps.toString() + "&nbsp;" + genlang(131);
433
< 1000)) {    } else {
434
< 1000)) {        if (mtps >= 1000) {
435
< 1000)) {            return round(mtps / 1000, 2) + " " + genlang(132);
436
< 1000)) {        } else {
437
< 1000)) {            return "";
438
< 1000)) {        }
439
< 1000)) {    }
440
< 1000)) {}
441
 
442
< 1000)) {/**
2788 rexy 443
< 1000)) { * format the byte values into a user friendly value with the corespondenting unit expression<br>support is included
444
< 1000)) { * for binary and decimal output<br>user can specify a constant format for all byte outputs or the output is formated
445
< 1000)) { * automatically so that every value can be read in a user friendly way
446
< 1000)) { * @param {Number} bytes value that should be converted in the corespondenting format, which is specified in the phpsysinfo.ini
447
< 1000)) { * @param {jQuery} xml phpSysInfo-XML
448
< 1000)) { * @return {String} string of the converted bytes with the translated unit expression
449
< 1000)) { */
450
< 1000)) {function formatBytes(bytes, xml) {
451
< 1000)) {    var byteFormat = "", show = "";
452
 
453
< 1000)) {    $("Options", xml).each(function getByteFormat(id) {
454
< 1000)) {        byteFormat = $(this).attr("byteFormat");
455
< 1000)) {    });
456
 
457
< 1000)) {    switch (byteFormat.toLowerCase()) {
458
< 1000)) {    case "pib":
459
< 1000)) {        show += round(bytes / Math.pow(1024, 5), 2);
460
< 1000)) {        show += "&nbsp;" + genlang(90);
461
< 1000)) {        break;
462
< 1000)) {    case "tib":
463
< 1000)) {        show += round(bytes / Math.pow(1024, 4), 2);
464
< 1000)) {        show += " " + genlang(86);
465
< 1000)) {        break;
466
< 1000)) {    case "gib":
467
< 1000)) {        show += round(bytes / Math.pow(1024, 3), 2);
468
< 1000)) {        show += "&nbsp;" + genlang(87);
469
< 1000)) {        break;
470
< 1000)) {    case "mib":
471
< 1000)) {        show += round(bytes / Math.pow(1024, 2), 2);
472
< 1000)) {        show += " " + genlang(88);
473
< 1000)) {        break;
474
< 1000)) {    case "kib":
475
< 1000)) {        show += round(bytes / Math.pow(1024, 1), 2);
476
< 1000)) {        show += "&nbsp;" + genlang(89);
477
< 1000)) {        break;
478
< 1000)) {    case "pb":
479
< 1000)) {        show += round(bytes / Math.pow(1000, 5), 2);
480
< 1000)) {        show += " " + genlang(91);
481
< 1000)) {        break;
482
< 1000)) {    case "tb":
483
< 1000)) {        show += round(bytes / Math.pow(1000, 4), 2);
484
< 1000)) {        show += "&nbsp;" + genlang(85);
485
< 1000)) {        break;
486
< 1000)) {    case "gb":
487
< 1000)) {        show += round(bytes / Math.pow(1000, 3), 2);
488
< 1000)) {        show += " " + genlang(41);
489
< 1000)) {        break;
490
< 1000)) {    case "mb":
491
< 1000)) {        show += round(bytes / Math.pow(1000, 2), 2);
492
< 1000)) {        show += "&nbsp;" + genlang(40);
493
< 1000)) {        break;
494
< 1000)) {    case "kb":
495
< 1000)) {        show += round(bytes / Math.pow(1000, 1), 2);
496
< 1000)) {        show += " " + genlang(39);
497
< 1000)) {        break;
498
< 1000)) {    case "b":
499
< 1000)) {        show += bytes;
500
< 1000)) {        show += " " + genlang(96);
501
< 1000)) {        break;
502
< 1000)) {    case "auto_decimal":
503
< 1000)) {        if (bytes > Math.pow(1000, 5)) {
504
< 1000)) {            show += round(bytes / Math.pow(1000, 5), 2);
505
< 1000)) {            show += "&nbsp;" + genlang(91);
506
< 1000)) {        } else {
507
< 1000)) {            if (bytes > Math.pow(1000, 4)) {
508
< 1000)) {                show += round(bytes / Math.pow(1000, 4), 2);
509
< 1000)) {                show += " " + genlang(85);
510
< 1000)) {            } else {
511
< 1000)) {                if (bytes > Math.pow(1000, 3)) {
512
< 1000)) {                    show += round(bytes / Math.pow(1000, 3), 2);
513
< 1000)) {                    show += "&nbsp;" + genlang(41);
514
< 1000)) {                } else {
515
< 1000)) {                    if (bytes > Math.pow(1000, 2)) {
516
< 1000)) {                        show += round(bytes / Math.pow(1000, 2), 2);
517
< 1000)) {                        show += " " + genlang(40);
518
< 1000)) {                    } else {
519
< 1000)) {                        if (bytes > Math.pow(1000, 1)) {
520
< 1000)) {                            show += round(bytes / Math.pow(1000, 1), 2);
521
< 1000)) {                            show += "&nbsp;" + genlang(39);
522
< 1000)) {                        } else {
523
< 1000)) {                                show += bytes;
524
< 1000)) {                                show += "&nbsp;" + genlang(96);
525
< 1000)) {                        }
526
< 1000)) {                    }
527
< 1000)) {                }
528
< 1000)) {            }
529
< 1000)) {        }
530
< 1000)) {        break;
531
< 1000)) {    default:
532
< 1000)) {        if (bytes > Math.pow(1024, 5)) {
533
< 1000)) {            show += round(bytes / Math.pow(1024, 5), 2);
534
< 1000)) {            show += " " + genlang(90);
535
< 1000)) {        } else {
536
< 1000)) {            if (bytes > Math.pow(1024, 4)) {
537
< 1000)) {                show += round(bytes / Math.pow(1024, 4), 2);
538
< 1000)) {                show += "&nbsp;" + genlang(86);
539
< 1000)) {            } else {
540
< 1000)) {                if (bytes > Math.pow(1024, 3)) {
541
< 1000)) {                    show += round(bytes / Math.pow(1024, 3), 2);
542
< 1000)) {                    show += " " + genlang(87);
543
< 1000)) {                } else {
544
< 1000)) {                    if (bytes > Math.pow(1024, 2)) {
545
< 1000)) {                        show += round(bytes / Math.pow(1024, 2), 2);
546
< 1000)) {                        show += "&nbsp;" + genlang(88);
547
< 1000)) {                    } else {
548
< 1000)) {                        if (bytes > Math.pow(1024, 1)) {
549
< 1000)) {                            show += round(bytes / Math.pow(1024, 1), 2);
550
< 1000)) {                            show += " " + genlang(89);
551
< 1000)) {                        } else {
552
< 1000)) {                            show += bytes;
553
< 1000)) {                            show += " " + genlang(96);
554
< 1000)) {                        }
555
< 1000)) {                    }
556
< 1000)) {                }
557
< 1000)) {            }
558
< 1000)) {        }
559
< 1000)) {    }
560
< 1000)) {    return show;
561
< 1000)) {}
562
 
563
< 1000)) {function formatBPS(bps) {
564
< 1000)) {    var show = "";
565
 
566
< 1000)) {    if (bps > Math.pow(1000, 5)) {
567
< 1000)) {        show += round(bps / Math.pow(1000, 5), 2);
568
< 1000)) {        show += String.fromCharCode(160) + 'Pb/s';
569
< 1000)) {    } else {
570
< 1000)) {        if (bps > Math.pow(1000, 4)) {
571
< 1000)) {            show += round(bps / Math.pow(1000, 4), 2);
572
< 1000)) {            show += String.fromCharCode(160) + 'Tb/s';
573
< 1000)) {        } else {
574
< 1000)) {            if (bps > Math.pow(1000, 3)) {
575
< 1000)) {                show += round(bps / Math.pow(1000, 3), 2);
576
< 1000)) {                show += String.fromCharCode(160) + 'Gb/s';
577
< 1000)) {            } else {
578
< 1000)) {                if (bps > Math.pow(1000, 2)) {
579
< 1000)) {                    show += round(bps / Math.pow(1000, 2), 2);
580
< 1000)) {                    show += String.fromCharCode(160) + 'Mb/s';
581
< 1000)) {                } else {
582
< 1000)) {                    if (bps > Math.pow(1000, 1)) {
583
< 1000)) {                        show += round(bps / Math.pow(1000, 1), 2);
584
< 1000)) {                        show += String.fromCharCode(160) + 'Kb/s';
585
< 1000)) {                    } else {
586
< 1000)) {                            show += bps;
587
< 1000)) {                            show += String.fromCharCode(160) + 'b/s';
588
< 1000)) {                    }
589
< 1000)) {                }
590
< 1000)) {            }
591
< 1000)) {        }
592
< 1000)) {    }
593
< 1000)) {    return show;
594
< 1000)) {}
595
 
596
< 1000)) {/**
597
< 1000)) { * format a celcius temperature to fahrenheit and also append the right suffix
598
< 1000)) { * @param {String} degreeC temperature in celvius
599
< 1000)) { * @param {jQuery} xml phpSysInfo-XML
600
< 1000)) { * @return {String} html string with no breaking spaces and translation statements
601
< 1000)) { */
602
< 1000)) {function formatTemp(degreeC, xml) {
603
< 1000)) {    var tempFormat = "", degree = 0;
604
 
605
< 1000)) {    $("Options", xml).each(function getOptions(id) {
606
< 1000)) {        tempFormat = $(this).attr("tempFormat").toString().toLowerCase();
607
< 1000)) {    });
608
 
609
< 1000)) {    degree = parseFloat(degreeC);
3100 rexy 610
< 1000)) {    if (!isFinite(degreeC)) {
2788 rexy 611
< 1000)) {        return "---";
612
< 1000)) {    } else {
613
< 1000)) {        switch (tempFormat) {
614
< 1000)) {        case "f":
615
< 1000)) {            return round((((9 * degree) / 5) + 32), 1) + "&nbsp;" + genlang(61);
616
< 1000)) {        case "c":
617
< 1000)) {            return round(degree, 1) + "&nbsp;" + genlang(60);
618
< 1000)) {        case "c-f":
619
< 1000)) {            return round(degree, 1) + "&nbsp;" + genlang(60) + "<br><i>(" + round((((9 * degree) / 5) + 32), 1) + " " + genlang(61) + ")i>";
620
< 1000)) {        case "f-c":
621
< 1000)) {            return round((((9 * degree) / 5) + 32), 1) + "&nbsp;" + genlang(61) + "<br><i>(" + round(degree, 1) + "&nbsp;" + genlang(60) + ")</i>";
622
< 1000)) {        }
623
< 1000)) {    }
624
< 1000)) {}
625
 
626
< 1000)) {/**
627
< 1000)) { * create a visual HTML bar from a given size, the layout of that bar can be costumized through the bar css-class
628
< 1000)) { * @param {Number} size barclass
629
< 1000)) { * @return {String} HTML string which contains the full layout of the bar
630
< 1000)) { */
3179 rexy 631
< 1000)) {function createBar(size, barclass, sizeused) {
632
< 1000)) {    var percsize = 0, percsizeused = 0;
2788 rexy 633
< 1000)) {    if (barclass === undefined) {
634
< 1000)) {        barclass = "bar";
635
< 1000)) {    }
3179 rexy 636
< 1000)) {    percsize = Math.max(Math.min(Math.ceil(size), 100), 0);
637
< 1000)) {    if (sizeused === undefined) {
638
< 1000)) {        percsizeused = percsize;
639
< 1000)) {    } else {
640
< 1000)) {        percsizeused = Math.max(Math.min(Math.ceil(sizeused), size), 0);
641
< 1000)) {    }
642
< 1000)) {    if (percsizeused == percsize) {
643
< 1000)) {        return "
 div>&nbsp;" + size + "%";
644
< 1000)) {
} else {
645
< 1000)) {
return "<div class=\"" + barclass + "\" style=\"float:left; width: " + percsizeused + "px;\">&nbsp;</div><div class=\"barrest\" style=\"float:left; width: " + (percsize-percsizeused) + "px;\">&nbsp;</div>&nbsp;" + size + "%";
646
< 1000)) {
}
2788 rexy 647
< 1000)) {
}
648
 
649
< 1000)) {
/**
650
< 1000)) {
* (re)fill the vitals block with the values from the given xml
651
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
652
< 1000)) {
*/
653
< 1000)) {
function refreshVitals(xml) {
3037 rexy 654
< 1000)) {
var hostname = "", ip = "", stripid = 0;
655
 
656
< 1000)) {
function setAndStrip(id, value) {
657
< 1000)) {
if (value !== "") {
658
< 1000)) {
$(id).html(value);
659
< 1000)) {
if (stripid%2 === 1) {
660
< 1000)) {
$(id).closest('tr').addClass('even');
661
< 1000)) {
} else {
662
< 1000)) {
$(id).closest('tr').removeClass('even');
663
< 1000)) {
}
664
< 1000)) {
$(id).closest('tr').css("display", "");
665
< 1000)) {
stripid++;
666
< 1000)) {
} else {
667
< 1000)) {
$(id).closest('tr').css("display", "none");
668
< 1000)) {
}
669
< 1000)) {
}
670
 
2788 rexy 671
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
672
< 1000)) {
$("#vitals").remove();
673
< 1000)) {
$("Vitals", xml).each(function getVitals(id) {
674
< 1000)) {
hostname = $(this).attr("Hostname");
675
< 1000)) {
ip = $(this).attr("IPAddr");
676
< 1000)) {
document.title = "System information: " + hostname + " (" + ip + ")";
677
< 1000)) {
$("#s_hostname_title").html(hostname);
678
< 1000)) {
$("#s_ip_title").html(ip);
679
< 1000)) {
});
680
< 1000)) {
return;
681
< 1000)) {
}
682
 
683
< 1000)) {
var kernel = "", distro = "", icon = "", uptime = "", users = 0, loadavg = "", os = "";
3179 rexy 684
< 1000)) {
var processes = 0, psarray = [0,0,0,0,0,0];
2788 rexy 685
< 1000)) {
var syslang = "", codepage = "";
686
< 1000)) {
var lastboot = 0;
687
< 1000)) {
var timestamp = parseInt($("Generation", xml).attr("timestamp"), 10)*1000; //server time
688
< 1000)) {
var not_first = false;
689
< 1000)) {
var datetimeFormat = "";
690
< 1000)) {
if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
691
 
692
< 1000)) {
$("Options", xml).each(function getDatetimeFormat(id) {
693
< 1000)) {
datetimeFormat = $(this).attr("datetimeFormat");
694
< 1000)) {
});
695
 
696
< 1000)) {
$("Vitals", xml).each(function getVitals(id) {
697
< 1000)) {
hostname = $(this).attr("Hostname");
698
< 1000)) {
ip = $(this).attr("IPAddr");
699
< 1000)) {
kernel = $(this).attr("Kernel");
700
< 1000)) {
distro = $(this).attr("Distro");
701
< 1000)) {
icon = $(this).attr("Distroicon");
702
< 1000)) {
os = $(this).attr("OS");
703
< 1000)) {
uptime = formatUptime(parseInt($(this).attr("Uptime"), 10));
704
< 1000)) {
lastboot = new Date(timestamp - (parseInt($(this).attr("Uptime"), 10)*1000));
705
< 1000)) {
users = parseInt($(this).attr("Users"), 10);
706
< 1000)) {
loadavg = $(this).attr("LoadAvg");
707
< 1000)) {
if ($(this).attr("CPULoad") !== undefined) {
708
< 1000)) {
loadavg = loadavg + "<br>" + createBar(parseInt($(this).attr("CPULoad"), 10));
709
< 1000)) {
}
710
< 1000)) {
if ($(this).attr("SysLang") !== undefined) {
711
< 1000)) {
syslang = $(this).attr("SysLang");
712
< 1000)) {
}
713
 
714
< 1000)) {
if ($(this).attr("CodePage") !== undefined) {
715
< 1000)) {
codepage = $(this).attr("CodePage");
716
< 1000)) {
}
717
 
718
< 1000)) {
//processes
719
< 1000)) {
if ($(this).attr("Processes") !== undefined) {
720
< 1000)) {
processes = parseInt($(this).attr("Processes"), 10);
721
< 1000)) {
}
722
< 1000)) {
if ($(this).attr("ProcessesRunning") !== undefined) {
3179 rexy 723
< 1000)) {
psarray[0] = parseInt($(this).attr("ProcessesRunning"), 10);
2788 rexy 724
< 1000)) {
}
725
< 1000)) {
if ($(this).attr("ProcessesSleeping") !== undefined) {
3179 rexy 726
< 1000)) {
psarray[1] = parseInt($(this).attr("ProcessesSleeping"), 10);
2788 rexy 727
< 1000)) {
}
728
< 1000)) {
if ($(this).attr("ProcessesStopped") !== undefined) {
3179 rexy 729
< 1000)) {
psarray[2] = parseInt($(this).attr("ProcessesStopped"), 10);
2788 rexy 730
< 1000)) {
}
731
< 1000)) {
if ($(this).attr("ProcessesZombie") !== undefined) {
3179 rexy 732
< 1000)) {
psarray[3] = parseInt($(this).attr("ProcessesZombie"), 10);
2788 rexy 733
< 1000)) {
}
734
< 1000)) {
if ($(this).attr("ProcessesWaiting") !== undefined) {
3179 rexy 735
< 1000)) {
psarray[4] = parseInt($(this).attr("ProcessesWaiting"), 10);
2788 rexy 736
< 1000)) {
}
737
< 1000)) {
if ($(this).attr("ProcessesOther") !== undefined) {
3179 rexy 738
< 1000)) {
psarray[5] = parseInt($(this).attr("ProcessesOther"), 10);
2788 rexy 739
< 1000)) {
}
740
 
2976 rexy 741
< 1000)) {
document.title = "System information: " + hostname + " (" + ip + ")";
2788 rexy 742
< 1000)) {
$("#s_hostname_title").html(hostname);
3179 rexy 743
< 1000)) {
$("#s_ip_title").html(ip);
3037 rexy 744
< 1000)) {
setAndStrip("#s_hostname", hostname);
745
< 1000)) {
setAndStrip("#s_ip", ip);
746
< 1000)) {
setAndStrip("#s_kernel", kernel);
3179 rexy 747
< 1000)) {
setAndStrip("#s_distro", "<img src='./gfx/images/" + icon + "' alt='Icon' title='" + icon + "' style='width:16px;height:16px;vertical-align:middle;' onload='PNGload($(this));' />&nbsp;" + distro); //onload IE6 PNG fix
748
< 1000)) {
setAndStrip("#s_os", "<img src='./gfx/images/" + os + ".png' alt='OSIcon' title='" + os + ".png' style='width:16px;height:16px;vertical-align:middle;' onload='PNGload($(this));' />&nbsp;" + os); //onload IE6 PNG fix
3037 rexy 749
< 1000)) {
setAndStrip("#s_uptime", uptime);
2788 rexy 750
< 1000)) {
if ((datetimeFormat !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
3037 rexy 751
< 1000)) {
setAndStrip("#s_lastboot", lastboot.toLocaleString());
2788 rexy 752
< 1000)) {
} else {
753
< 1000)) {
if (typeof(lastboot.toUTCString)==="function") {
3037 rexy 754
< 1000)) {
setAndStrip("#s_lastboot", lastboot.toUTCString());
2788 rexy 755
< 1000)) {
} else {
756
< 1000)) {
//deprecated
3037 rexy 757
< 1000)) {
setAndStrip("#s_lastboot", lastboot.toGMTString());
2788 rexy 758
< 1000)) {
}
759
< 1000)) {
}
3037 rexy 760
< 1000)) {
setAndStrip("#s_users", users);
761
< 1000)) {
setAndStrip("#s_loadavg", loadavg);
762
< 1000)) {
setAndStrip("#s_syslang", syslang);
763
< 1000)) {
setAndStrip("#s_codepage", codepage);
764
< 1000)) {
setAndStrip("#s_processes", processes);
3179 rexy 765
< 1000)) {
if ((processes > 0) && (psarray[0] || psarray[1] || psarray[2] || psarray[3] || psarray[4] || psarray[5])) {
3037 rexy 766
< 1000)) {
$("#s_processes").append(" (");
3179 rexy 767
< 1000)) {
var idlist = {0:111,1:112,2:113,3:114,4:115,5:116};
768
< 1000)) {
for (var proc_type in idlist) {
769
< 1000)) {
if (psarray[proc_type]) {
2788 rexy 770
< 1000)) {
if (not_first) {
3037 rexy 771
< 1000)) {
$("#s_processes").append(", ");
2788 rexy 772
< 1000)) {
}
3179 rexy 773
< 1000)) {
$("#s_processes").append(psarray[proc_type] + "&nbsp;" + genlang(idlist[proc_type]));
2788 rexy 774
< 1000)) {
not_first = true;
775
< 1000)) {
}
776
< 1000)) {
}
3037 rexy 777
< 1000)) {
$("#s_processes").append(") ");
2788 rexy 778
< 1000)) {
}
779
< 1000)) {
});
780
< 1000)) {
}
781
 
782
 
783
< 1000)) {
/**
784
< 1000)) {
* build the cpu information as table rows
785
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
786
< 1000)) {
* @param {Array} tree array that holds the positions for treetable plugin
787
< 1000)) {
* @param {Number} rootposition position of the parent element
788
< 1000)) {
* @param {Array} collapsed array that holds all collapsed elements hwne opening page
789
< 1000)) {
*/
790
< 1000)) {
function fillCpu(xml, tree, rootposition, collapsed) {
791
< 1000)) {
var cpucount = 0, html = "";
792
< 1000)) {
$("Hardware CPU CpuCore", xml).each(function getCpuCore(cpuCoreId) {
3037 rexy 793
< 1000)) {
var model = "", speed = 0, voltage = 0, bus = 0, cache = 0, bogo = 0, temp = 0, load = 0, speedmax = 0, speedmin = 0, cpucoreposition = 0, virt = "", manufacturer = "";
2788 rexy 794
< 1000)) {
cpucount++;
795
< 1000)) {
model = $(this).attr("Model");
3100 rexy 796
< 1000)) {
voltage = parseFloat($(this).attr("Voltage"));
2788 rexy 797
< 1000)) {
speed = parseInt($(this).attr("CpuSpeed"), 10);
798
< 1000)) {
speedmax = parseInt($(this).attr("CpuSpeedMax"), 10);
799
< 1000)) {
speedmin = parseInt($(this).attr("CpuSpeedMin"), 10);
800
< 1000)) {
cache = parseInt($(this).attr("Cache"), 10);
801
< 1000)) {
virt = $(this).attr("Virt");
802
< 1000)) {
bus = parseInt($(this).attr("BusSpeed"), 10);
803
< 1000)) {
temp = parseInt($(this).attr("Cputemp"), 10);
804
< 1000)) {
bogo = parseInt($(this).attr("Bogomips"), 10);
805
< 1000)) {
manufacturer = $(this).attr("Manufacturer");
806
< 1000)) {
load = parseInt($(this).attr("Load"), 10);
807
 
808
< 1000)) {
if (!showCPUListExpanded) {
809
< 1000)) {
collapsed.push(rootposition);
810
< 1000)) {
}
811
< 1000)) {
if (!isNaN(load) && showCPULoadCompact) {
812
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + model + "</span></div></td><td>" + createBar(load) + "</td></tr>\n";
813
< 1000)) {
} else {
814
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + model + "</span></div></td></tr>\n";
815
< 1000)) {
}
816
< 1000)) {
cpucoreposition = tree.push(rootposition);
817
< 1000)) {
if (!showCPUInfoExpanded) {
818
< 1000)) {
collapsed.push(cpucoreposition);
819
< 1000)) {
}
820
< 1000)) {
if (!isNaN(speed)) {
821
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(13) + ":</span></div></td><td>" + formatHertz(speed) + "</td></tr>\n";
822
< 1000)) {
tree.push(cpucoreposition);
823
< 1000)) {
}
824
< 1000)) {
if (!isNaN(speedmax)) {
825
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(100) + ":</span></div></td><td>" + formatHertz(speedmax) + "</td></tr>\n";
826
< 1000)) {
tree.push(cpucoreposition);
827
< 1000)) {
}
828
< 1000)) {
if (!isNaN(speedmin)) {
829
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(101) + ":</span></div></td><td>" + formatHertz(speedmin) + "</td></tr>\n";
830
< 1000)) {
tree.push(cpucoreposition);
831
< 1000)) {
}
832
< 1000)) {
if (!isNaN(cache)) {
833
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(15) + ":</span></div></td><td>" + formatBytes(cache, xml) + "</td></tr>\n";
834
< 1000)) {
tree.push(cpucoreposition);
835
< 1000)) {
}
836
< 1000)) {
if (virt !== undefined) {
837
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(94) + ":</span></div></td><td>" + virt + "</td></tr>\n";
838
< 1000)) {
tree.push(cpucoreposition);
839
< 1000)) {
}
840
< 1000)) {
if (!isNaN(bus)) {
841
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(14) + ":</span></div></td><td>" + formatHertz(bus) + "</td></tr>\n";
842
< 1000)) {
tree.push(cpucoreposition);
843
< 1000)) {
}
3100 rexy 844
< 1000)) {
if (isFinite(voltage)) {
3179 rexy 845
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + String.fromCharCode(160) + genlang(62) + "</td></tr>\n";
3037 rexy 846
< 1000)) {
tree.push(cpucoreposition);
847
< 1000)) {
}
2788 rexy 848
< 1000)) {
if (!isNaN(bogo)) {
849
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(16) + ":</span></div></td><td>" + bogo.toString() + "</td></tr>\n";
850
< 1000)) {
tree.push(cpucoreposition);
851
< 1000)) {
}
852
< 1000)) {
/*
853
< 1000)) {
if (!isNaN(temp)) {
854
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(51) + ":</span></div></td><td>" + formatTemp(temp, xml) + "</td></tr>\n";
855
< 1000)) {
tree.push(cpucoreposition);
856
< 1000)) {
}
857
< 1000)) {
*/
858
< 1000)) {
if (manufacturer !== undefined) {
859
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(122) + ":</span></div></td><td>" + manufacturer + "</td></tr>\n";
860
< 1000)) {
tree.push(cpucoreposition);
861
< 1000)) {
}
862
< 1000)) {
if (!isNaN(load) && !showCPULoadCompact) {
863
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(9) + ":</span></div></td><td>" + createBar(load) + "</td></tr>\n";
864
< 1000)) {
tree.push(cpucoreposition);
865
< 1000)) {
}
866
< 1000)) {
});
867
< 1000)) {
if (cpucount === 0) {
868
< 1000)) {
html += "<tr><td colspan=\"2\">" + genlang(42) + "</td></tr>\n";
869
< 1000)) {
tree.push(rootposition);
870
< 1000)) {
}
871
< 1000)) {
return html;
872
< 1000)) {
}
873
 
874
< 1000)) {
function countCpu(xml) {
875
< 1000)) {
var cpucount = 0;
876
< 1000)) {
$("Hardware CPU CpuCore", xml).each(function getCpuCore(cpuCoreId) {
877
< 1000)) {
cpucount++;
878
< 1000)) {
});
879
< 1000)) {
return cpucount;
880
< 1000)) {
}
881
 
882
< 1000)) {
/**
883
< 1000)) {
* build rows for a treetable out of the hardwaredevices
884
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
885
< 1000)) {
* @param {String} type type of the hardware device
886
< 1000)) {
* @param {Array} tree array that holds the positions for treetable plugin
887
< 1000)) {
* @param {Number} rootposition position of the parent element
888
< 1000)) {
*/
889
< 1000)) {
function fillHWDevice(xml, type, tree, rootposition) {
890
< 1000)) {
var devicecount = 0, html = "";
2976 rexy 891
< 1000)) {
$("Hardware " + type + ((type=="MEM")?" Chip":" Device"), xml).each(function getHWDevice(deviceId) {
892
< 1000)) {
var name = "", count = 0, capacity = 0, manufacturer = "", product = "", serial = "", speed = 0, voltage = 0, devcoreposition = 0;
2788 rexy 893
 
894
< 1000)) {
devicecount++;
895
< 1000)) {
name = $(this).attr("Name");
896
< 1000)) {
capacity = parseInt($(this).attr("Capacity"), 10);
897
< 1000)) {
manufacturer = $(this).attr("Manufacturer");
898
< 1000)) {
product = $(this).attr("Product");
2976 rexy 899
< 1000)) {
speed = parseInt($(this).attr("Speed"), 10);
900
< 1000)) {
voltage = parseFloat($(this).attr("Voltage"));
2788 rexy 901
< 1000)) {
serial = $(this).attr("Serial");
902
< 1000)) {
count = parseInt($(this).attr("Count"), 10);
903
< 1000)) {
if (!isNaN(count) && count > 1) {
904
< 1000)) {
name = "(" + count + "x) " + name;
905
< 1000)) {
}
906
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + name + "</span></div></td></tr>\n";
907
< 1000)) {
devcoreposition = tree.push(rootposition);
908
< 1000)) {
if (!isNaN(capacity)) {
909
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(43) + ":</span></div></td><td>" + formatBytes(capacity, xml) + "</td></tr>\n";
910
< 1000)) {
tree.push(devcoreposition);
911
< 1000)) {
}
912
< 1000)) {
if (manufacturer!== undefined) {
913
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(122) + ":</span></div></td><td>" + manufacturer + "</td></tr>\n";
914
< 1000)) {
tree.push(devcoreposition);
915
< 1000)) {
}
916
< 1000)) {
if (product !== undefined) {
917
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(123) + ":</span></div></td><td>" + product + "</td></tr>\n";
918
< 1000)) {
tree.push(devcoreposition);
919
< 1000)) {
}
2976 rexy 920
< 1000)) {
if (!isNaN(speed)) {
921
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(129) + ":</span></div></td><td>" + ((type=="MEM")?formatMTps(speed):formatBPS(1000000*speed)) + "</td></tr>\n";
922
< 1000)) {
tree.push(devcoreposition);
923
< 1000)) {
}
3100 rexy 924
< 1000)) {
if (isFinite(voltage)) {
3179 rexy 925
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + String.fromCharCode(160) + genlang(62) + "</td></tr>\n";
2976 rexy 926
< 1000)) {
tree.push(devcoreposition);
927
< 1000)) {
}
2788 rexy 928
< 1000)) {
if (serial !== undefined) {
929
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(124) + ":</span></div></td><td>" + serial + "</td></tr>\n";
930
< 1000)) {
tree.push(devcoreposition);
931
< 1000)) {
}
932
< 1000)) {
});
933
< 1000)) {
if (devicecount === 0) {
934
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(42) + "</span></div></td></tr>\n";
935
< 1000)) {
tree.push(rootposition);
936
< 1000)) {
}
937
< 1000)) {
return html;
938
< 1000)) {
}
939
 
940
< 1000)) {
function countHWDevice(xml, type) {
941
< 1000)) {
var devicecount = 0;
2976 rexy 942
< 1000)) {
$("Hardware " + type + ((type=="MEM")?" Chip":" Device"), xml).each(function getHWDevice(deviceId) {
2788 rexy 943
< 1000)) {
devicecount++;
944
< 1000)) {
});
945
< 1000)) {
return devicecount;
946
< 1000)) {
}
947
 
948
< 1000)) {
/**
949
< 1000)) {
* (re)fill the hardware block with the values from the given xml
950
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
951
< 1000)) {
*/
952
< 1000)) {
function refreshHardware(xml) {
953
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('hardware', blocks) < 0))) {
954
< 1000)) {
$("#hardware").remove();
955
< 1000)) {
return;
956
< 1000)) {
}
957
 
3037 rexy 958
< 1000)) {
var html = "", tree = [], closed = [], index = 0, machine = "", virtualizer = "";
2788 rexy 959
< 1000)) {
$("#hardware").empty();
960
< 1000)) {
html += "<h2>" + genlang(10) + "</h2>\n";
961
< 1000)) {
html += " <div style=\"overflow-x:auto;\">\n";
962
< 1000)) {
html += " <table id=\"HardwareTree\" class=\"tablemain\">\n";
963
< 1000)) {
html += " <tbody class=\"tree\">\n";
964
 
965
< 1000)) {
$("Hardware", xml).each(function getMachine(id) {
966
< 1000)) {
machine = $(this).attr("Name");
967
< 1000)) {
});
3037 rexy 968
< 1000)) {
$("Hardware", xml).each(function getVirtualizer(id) {
969
< 1000)) {
virtualizer = $(this).attr("Virtualizer");
970
< 1000)) {
});
971
 
2788 rexy 972
< 1000)) {
if ((machine !== undefined) && (machine !== "")) {
973
< 1000)) {
html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(107) + "</span></div></td></tr>\n";
974
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + machine + "</span></div></td></tr>\n";
975
< 1000)) {
tree.push(tree.push(0));
976
< 1000)) {
}
977
 
3037 rexy 978
< 1000)) {
if ((virtualizer !== undefined) && (virtualizer !== "")) {
979
< 1000)) {
html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(134) + "</span></div></td></tr>\n";
980
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + virtualizer + "</span></div></td></tr>\n";
981
< 1000)) {
tree.push(tree.push(0));
982
< 1000)) {
}
2788 rexy 983
< 1000)) {
if (countCpu(xml)) {
984
< 1000)) {
html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(11) + "</span></div></td></tr>\n";
985
< 1000)) {
html += fillCpu(xml, tree, tree.push(0), closed);
986
< 1000)) {
}
987
 
2976 rexy 988
< 1000)) {
var typelist = {MEM:130,PCI:17,IDE:18,SCSI:19,NVMe:126,USB:20,TB:117,I2C:118};
2788 rexy 989
< 1000)) {
for (var dev_type in typelist) {
990
< 1000)) {
if (countHWDevice(xml, dev_type)) {
991
< 1000)) {
html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(typelist[dev_type]) + "</span></div></td></tr>\n";
992
< 1000)) {
index = tree.push(0);
993
< 1000)) {
closed.push(index);
994
< 1000)) {
html += fillHWDevice(xml, dev_type, tree, index);
995
< 1000)) {
}
996
< 1000)) {
}
997
 
998
< 1000)) {
html += " </tbody>\n";
999
< 1000)) {
html += " </table>\n";
1000
< 1000)) {
html += " </div>\n";
1001
< 1000)) {
$("#hardware").append(html);
1002
 
1003
< 1000)) {
$("#HardwareTree").jqTreeTable(tree, {
1004
< 1000)) {
openImg: "./gfx/treeTable/tv-collapsable.gif",
1005
< 1000)) {
shutImg: "./gfx/treeTable/tv-expandable.gif",
1006
< 1000)) {
leafImg: "./gfx/treeTable/tv-item.gif",
1007
< 1000)) {
lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1008
< 1000)) {
lastShutImg: "./gfx/treeTable/tv-expandable-last.gif",
1009
< 1000)) {
lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1010
< 1000)) {
vertLineImg: "./gfx/treeTable/vertline.gif",
1011
< 1000)) {
blankImg: "./gfx/treeTable/blank.gif",
1012
< 1000)) {
collapse: closed,
1013
< 1000)) {
column: 0,
1014
< 1000)) {
striped: true,
1015
< 1000)) {
highlight: false,
1016
< 1000)) {
state: false
1017
< 1000)) {
});
1018
< 1000)) {
}
1019
 
1020
< 1000)) {
/**
1021
< 1000)) {
*(re)fill the network block with the values from the given xml
1022
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
1023
< 1000)) {
*/
1024
< 1000)) {
function refreshNetwork(xml) {
1025
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {
1026
< 1000)) {
$("#network").remove();
1027
< 1000)) {
return;
1028
< 1000)) {
}
1029
 
1030
< 1000)) {
var tree = [], closed = [], html0= "", html1= "" ,html = "", isinfo = false, preoldnetwork = [], timestamp;
1031
 
1032
< 1000)) {
$("#network").empty();
1033
 
1034
< 1000)) {
html0 += "<h2>" + genlang(21) + "</h2>\n";
1035
 
1036
< 1000)) {
html1 += " <thead>\n";
1037
< 1000)) {
html1 += " <tr>\n";
1038
< 1000)) {
html1 += " <th>" + genlang(22) + "</th>\n";
2976 rexy 1039
< 1000)) {
html1 += " <th class=\"right\" style=\"width:17.7%;\">" + genlang(23) + "</th>\n";
1040
< 1000)) {
html1 += " <th class=\"right\" style=\"width:17.7%;\">" + genlang(24) + "</th>\n";
1041
< 1000)) {
html1 += " <th class=\"right\" style=\"width:17.7%;\">" + genlang(25) + "</th>\n";
2788 rexy 1042
< 1000)) {
html1 += " </tr>\n";
1043
< 1000)) {
html1 += " </thead>\n";
1044
 
1045
< 1000)) {
if (showNetworkActiveSpeed) {
1046
< 1000)) {
$("Generation", xml).each(function getTimestamp(id) {
1047
< 1000)) {
timestamp = $(this).attr("timestamp");
1048
< 1000)) {
});
1049
< 1000)) {
}
1050
 
1051
< 1000)) {
$("Network NetDevice", xml).each(function getDevice(id) {
3179 rexy 1052
< 1000)) {
var name = "", rx = 0, tx = 0, er = 0, dr = 0, info = "", bridge = "", networkindex = 0, htmlrx = '', htmltx = '', rxr = 0, txr = 0;
2788 rexy 1053
< 1000)) {
name = $(this).attr("Name");
3179 rexy 1054
< 1000)) {
bridge = $(this).attr("Bridge");
2788 rexy 1055
< 1000)) {
rx = parseInt($(this).attr("RxBytes"), 10);
1056
< 1000)) {
tx = parseInt($(this).attr("TxBytes"), 10);
1057
< 1000)) {
er = parseInt($(this).attr("Err"), 10);
1058
< 1000)) {
dr = parseInt($(this).attr("Drops"), 10);
3100 rexy 1059
< 1000)) {
rxr = parseInt($(this).attr("RxRate"), 10);
1060
< 1000)) {
txr = parseInt($(this).attr("TxRate"), 10);
2788 rexy 1061
 
3100 rexy 1062
< 1000)) {
if (showNetworkActiveSpeed) {
1063
< 1000)) {
if ((rx == 0) && !isNaN(rxr)) {
2788 rexy 1064
< 1000)) {
if (showNetworkActiveSpeed == 2) {
3100 rexy 1065
< 1000)) {
htmlrx ="<br><i>("+formatBPS(round(rxr, 2))+")</i>";
2788 rexy 1066
< 1000)) {
} else {
3100 rexy 1067
< 1000)) {
htmlrx ="<br><i>("+formatBytes(round(rxr, 2), xml)+"/s)</i>";
2788 rexy 1068
< 1000)) {
}
3100 rexy 1069
< 1000)) {
} else if ($.inArray(name, oldnetwork) >= 0) {
1070
< 1000)) {
var diff, difftime;
1071
< 1000)) {
if (((diff = rx - oldnetwork[name].rx) > 0) && ((difftime = timestamp - oldnetwork[name].timestamp) > 0)) {
1072
< 1000)) {
if (showNetworkActiveSpeed == 2) {
1073
< 1000)) {
htmlrx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")i>";
1074
< 1000)) {
} else {
1075
< 1000)) {
htmlrx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)i>";
1076
< 1000)) {
}
1077
< 1000)) {
}
2788 rexy 1078
< 1000)) {
}
3100 rexy 1079
< 1000)) {
if ((tx == 0) && !isNaN(txr)) {
2788 rexy 1080
< 1000)) {
if (showNetworkActiveSpeed == 2) {
3100 rexy 1081
< 1000)) {
htmltx ="<br><i>("+formatBPS(round(txr, 2))+")</i>";
2788 rexy 1082
< 1000)) {
} else {
3100 rexy 1083
< 1000)) {
htmltx ="
("+formatBytes(round(txr, 2), xml)+"/
s)</i>";
2788 rexy 1084
< 1000)) {

}
3100 rexy 1085
< 1000)) {

} else if ($.inArray(name, oldnetwork) >= 0) {
1086
< 1000)) {

if (((diff = tx - oldnetwork[name].tx) > 0) && (difftime > 0)) {
1087
< 1000)) {

if (showNetworkActiveSpeed == 2) {
1088
< 1000)) {

htmltx ="
("+formatBPS(round(8*diff/
difftime, 2))+")</i>";

1089
< 1000)) {


} else {

1090
< 1000)) {


htmltx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>";

1091
< 1000)) {


}

1092
< 1000)) {


}

2788 rexy 1093
< 1000)) {


}

1094
< 1000)) {


}

1095
 
3179 rexy 1096
< 1000)) {


if ( (bridge !== undefined) && (bridge !== "") ) {

1097
< 1000)) {


html +="
" + name + " (" + bridge +")span></div>td><td class=\"right\">" + formatBytes(rx, xml) + htmlrx + "</td><td class=\"right\">" + formatBytes(tx, xml) + htmltx +"</td><td class=\"right\">" + er.toString() + "/<wbr>" + dr.toString() + "</td></tr>";
1098
< 1000)) {


} else {
1099
< 1000)) {


html +="<tr><td><div class=\"treediv\"><span class=\"treespan\">" + name + "</span></div></td><td class=\"right\">" + formatBytes(rx, xml) + htmlrx + "</td><td class=\"right\">" + formatBytes(tx, xml) + htmltx +"</td><td class=\"right\">" + er.toString() + "/<wbr>" + dr.toString() + "</td></tr>";
1100
< 1000)) {


}
2788 rexy 1101
< 1000)) {


networkindex = tree.push(0);
1102
 
1103
< 1000)) {


if (showNetworkActiveSpeed) {
1104
< 1000)) {


preoldnetwork.pushIfNotExist(name);
1105
< 1000)) {


preoldnetwork[name] = {timestamp:timestamp, rx:rx, tx:tx};
1106
< 1000)) {


}
1107
 
1108
< 1000)) {


info = $(this).attr("Info");
1109
< 1000)) {


if ( (info !== undefined) && (info !== "") ) {
1110
< 1000)) {


var i = 0, infos = info.replace(/:/g, "<wbr>:").split(";"); /* split long addresses */
1111
< 1000)) {


isinfo = true;
1112
< 1000)) {


for(i = 0; i < infos.length; i++){
1113
< 1000)) {


html +="<tr><td colspan=\"4\"><div class=\"treediv\"><span class=\"treespan\">" + infos[i] + "</span></div></td></tr>";
1114
< 1000)) {


tree.push(networkindex);
1115
< 1000)) {


}
1116
< 1000)) {


if (!showNetworkInfosExpanded) {
1117
< 1000)) {


closed.push(networkindex);
1118
< 1000)) {


}
1119
< 1000)) {


}
1120
< 1000)) {


});
1121
< 1000)) {


html += " </tbody>\n";
1122
< 1000)) {


html += " </table>\n";
1123
< 1000)) {


html += "</div>\n";
1124
< 1000)) {


html0 += "<div style=\"overflow-x:auto;\">\n";
1125
< 1000)) {


if (isinfo) {
1126
< 1000)) {


html0 += " <table id=\"NetworkTree\" class=\"tablemain\">\n";
1127
< 1000)) {


html1 += " <tbody class=\"tree\">\n";
1128
< 1000)) {


} else {
1129
< 1000)) {


html0 += " <table id=\"NetworkTree\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
1130
< 1000)) {


html1 += " <tbody class=\"tbody_network\">\n";
1131
< 1000)) {


}
1132
< 1000)) {


$("#network").append(html0+html1+html);
1133
 
1134
< 1000)) {


if (isinfo) $("#NetworkTree").jqTreeTable(tree, {
1135
< 1000)) {


openImg: "./gfx/treeTable/tv-collapsable.gif",
1136
< 1000)) {


shutImg: "./gfx/treeTable/tv-expandable.gif",
1137
< 1000)) {


leafImg: "./gfx/treeTable/tv-item.gif",
1138
< 1000)) {


lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1139
< 1000)) {


lastShutImg: "./gfx/treeTable/tv-expandable-last.gif",
1140
< 1000)) {


lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1141
< 1000)) {


vertLineImg: "./gfx/treeTable/vertline.gif",
1142
< 1000)) {


blankImg: "./gfx/treeTable/blank.gif",
1143
< 1000)) {


collapse: closed,
1144
< 1000)) {


column: 0,
1145
< 1000)) {


striped: true,
1146
< 1000)) {


highlight: false,
1147
< 1000)) {


state: false
1148
< 1000)) {


});
1149
 
1150
< 1000)) {


if (showNetworkActiveSpeed) {
1151
< 1000)) {


while (oldnetwork.length > 0) {
1152
< 1000)) {


delete oldnetwork[oldnetwork.length-1]; //remove last object
1153
< 1000)) {


oldnetwork.pop(); //remove last object reference from array
1154
< 1000)) {


}
1155
< 1000)) {


oldnetwork = preoldnetwork;
1156
< 1000)) {


}
1157
< 1000)) {


}
1158
 
1159
< 1000)) {


/**
1160
< 1000)) {


* (re)fill the memory block with the values from the given xml
1161
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1162
< 1000)) {


*/
1163
< 1000)) {


function refreshMemory(xml) {
1164
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('memory', blocks) < 0))) {
1165
< 1000)) {


$("#memory").remove();
1166
< 1000)) {


return;
1167
< 1000)) {


}
1168
 
1169
< 1000)) {


var html = "", tree = [], closed = [];
1170
 
1171
< 1000)) {


$("#memory").empty();
1172
< 1000)) {


html += "<h2>" + genlang(27) + "</h2>\n";
1173
< 1000)) {


html += "<div style=\"overflow-x:auto;\">\n";
1174
< 1000)) {


html += " <table id=\"MemoryTree\" class=\"tablemain\">\n";
1175
< 1000)) {


html += " <thead>\n";
1176
< 1000)) {


html += " <tr>\n";
2976 rexy 1177
< 1000)) {


html += " <th>" + genlang(34) + "</th>\n";
1178
< 1000)) {


html += " <th style=\"width:33.3%;\">" + genlang(33) + "</th>\n";
1179
< 1000)) {


html += " <th class=\"right\" style=\"width:14.2%;\">" + genlang(125) + "</th>\n";
1180
< 1000)) {


html += " <th class=\"right\" style=\"width:14.2%;\">" + genlang(36) + "</th>\n";
1181
< 1000)) {


html += " <th class=\"right\" style=\"width:14.2%;\">" + genlang(37) + "</th>\n";
2788 rexy 1182
< 1000)) {


html += " </tr>\n";
1183
< 1000)) {


html += " </thead>\n";
1184
< 1000)) {


html += " <tbody class=\"tree\">\n";
1185
 
1186
< 1000)) {


$("Memory", xml).each(function getMemory(id) {
1187
< 1000)) {


var free = 0, total = 0, used = 0, percent = 0, memoryindex = 0;
1188
< 1000)) {


free = parseInt($(this).attr("Free"), 10);
1189
< 1000)) {


used = parseInt($(this).attr("Used"), 10);
1190
< 1000)) {


total = parseInt($(this).attr("Total"), 10);
1191
< 1000)) {


percent = parseInt($(this).attr("Percent"), 10);
2976 rexy 1192
< 1000)) {


html += "<tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(28) + "</span></div></td><td>" + createBar(percent) + "</td><td class=\"right\">" + formatBytes(free, xml) + "</td><td class=\"right\">" + formatBytes(used, xml) + "</td><td class=\"right\">" + formatBytes(total, xml) + "</td></tr>";
2788 rexy 1193
< 1000)) {


memoryindex = tree.push(0);
1194
 
1195
< 1000)) {


$("Memory Details", xml).each(function getMemorydetails(id) {
1196
< 1000)) {


var app = 0, appp = 0, buff = 0, buffp = 0, cached = 0, cachedp = 0;
1197
< 1000)) {


app = parseInt($(this).attr("App"), 10);
1198
< 1000)) {


appp = parseInt($(this).attr("AppPercent"), 10);
1199
< 1000)) {


buff = parseInt($(this).attr("Buffers"), 10);
1200
< 1000)) {


buffp = parseInt($(this).attr("BuffersPercent"), 10);
1201
< 1000)) {


cached = parseInt($(this).attr("Cached"), 10);
1202
< 1000)) {


cachedp = parseInt($(this).attr("CachedPercent"), 10);
1203
< 1000)) {


if (!isNaN(app)) {
2976 rexy 1204
< 1000)) {


html += "<tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(64) + "</span></div></td><td>" + createBar(appp) + "</td><td class=\"right\">&nbsp;</td><td class=\"right\">" + formatBytes(app, xml) + "</td><td class=\"right\">&nbsp;</td></tr>";
2788 rexy 1205
< 1000)) {


tree.push(memoryindex);
1206
< 1000)) {


}
1207
< 1000)) {


if (!isNaN(cached)) {
2976 rexy 1208
< 1000)) {


html += "<tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(66) + "</span></div></td><td>" + createBar(cachedp) + "</td><td class=\"right\">&nbsp;</td><td class=\"right\">" + formatBytes(cached, xml) + "</td><td class=\"right\">&nbsp;</td></tr>";
2788 rexy 1209
< 1000)) {


tree.push(memoryindex);
1210
< 1000)) {


}
1211
< 1000)) {


if (!isNaN(buff)) {
2976 rexy 1212
< 1000)) {


html += "<tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(65) + "</span></div></td><td>" + createBar(buffp) + "</td><td class=\"rigth\">&nbsp;</td><td class=\"right\">" + formatBytes(buff, xml) + "</td><td class=\"right\">&nbsp;</td></tr>";
2788 rexy 1213
< 1000)) {


tree.push(memoryindex);
1214
< 1000)) {


}
1215
< 1000)) {


if (!isNaN(app) || !isNaN(buff) || !isNaN(cached)) {
1216
< 1000)) {


if (!showMemoryInfosExpanded) {
1217
< 1000)) {


closed.push(memoryindex);
1218
< 1000)) {


}
1219
< 1000)) {


}
1220
< 1000)) {


});
1221
< 1000)) {


});
1222
< 1000)) {


$("Memory Swap", xml).each(function getSwap(id) {
1223
< 1000)) {


var free = 0, total = 0, used = 0, percent = 0, swapindex = 0;
1224
< 1000)) {


free = parseInt($(this).attr("Free"), 10);
1225
< 1000)) {


used = parseInt($(this).attr("Used"), 10);
1226
< 1000)) {


total = parseInt($(this).attr("Total"), 10);
1227
< 1000)) {


percent = parseInt($(this).attr("Percent"), 10);
2976 rexy 1228
< 1000)) {


html += "<tr><td><div class=\"treediv\"><span class=\"treespan\">" + genlang(29) + "</span></div></td><td>" + createBar(percent) + "</td><td class=\"right\">" + formatBytes(free, xml) + "</td><td class=\"right\">" + formatBytes(used, xml) + "</td><td class=\"right\">" + formatBytes(total, xml) + "</td></tr>";
2788 rexy 1229
< 1000)) {


swapindex = tree.push(0);
1230
 
1231
< 1000)) {


$("Memory Swap Mount", xml).each(function getDevices(id) {
1232
< 1000)) {


var free = 0, total = 0, used = 0, percent = 0, mpoint = "", mpid = 0;
1233
< 1000)) {


if (!showMemoryInfosExpanded) {
1234
< 1000)) {


closed.push(swapindex);
1235
< 1000)) {


}
1236
< 1000)) {


free = parseInt($(this).attr("Free"), 10);
1237
< 1000)) {


used = parseInt($(this).attr("Used"), 10);
1238
< 1000)) {


total = parseInt($(this).attr("Total"), 10);
1239
< 1000)) {


percent = parseInt($(this).attr("Percent"), 10);
1240
< 1000)) {


mpid = parseInt($(this).attr("MountPointID"), 10);
1241
< 1000)) {


mpoint = $(this).attr("MountPoint");
1242
 
1243
< 1000)) {


if (mpoint === undefined) {
1244
< 1000)) {


mpoint = mpid;
1245
< 1000)) {


}
1246
 
2976 rexy 1247
< 1000)) {


html += "<tr><td><div class=\"treediv\"><span class=\"treespan\">" + mpoint + "</span></div></td><td>" + createBar(percent) + "</td><td class=\"right\">" + formatBytes(free, xml) + "</td><td class=\"right\">" + formatBytes(used, xml) + "</td><td class=\"right\">" + formatBytes(total, xml) + "</td></tr>";
2788 rexy 1248
< 1000)) {


tree.push(swapindex);
1249
< 1000)) {


});
1250
< 1000)) {


});
1251
 
1252
< 1000)) {


html += " </tbody>\n";
1253
< 1000)) {


html += " </table>\n";
1254
< 1000)) {


html += "</div>\n";
1255
< 1000)) {


$("#memory").append(html);
1256
 
1257
< 1000)) {


$("#MemoryTree").jqTreeTable(tree, {
1258
< 1000)) {


openImg: "./gfx/treeTable/tv-collapsable.gif",
1259
< 1000)) {


shutImg: "./gfx/treeTable/tv-expandable.gif",
1260
< 1000)) {


leafImg: "./gfx/treeTable/tv-item.gif",
1261
< 1000)) {


lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1262
< 1000)) {


lastShutImg: "./gfx/treeTable/tv-expandable-last.gif",
1263
< 1000)) {


lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1264
< 1000)) {


vertLineImg: "./gfx/treeTable/vertline.gif",
1265
< 1000)) {


blankImg: "./gfx/treeTable/blank.gif",
1266
< 1000)) {


collapse: closed,
1267
< 1000)) {


column: 0,
1268
< 1000)) {


striped: true,
1269
< 1000)) {


highlight: false,
1270
< 1000)) {


state: false
1271
< 1000)) {


});
1272
 
1273
< 1000)) {


}
1274
 
1275
< 1000)) {


/**
1276
< 1000)) {


* (re)fill the filesystems block with the values from the given xml<br><br>
1277
< 1000)) {


* appends the filesystems (each in a row) to the filesystem table in the tbody<br>before the rows are inserted the entire
1278
< 1000)) {


* tbody is cleared
1279
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1280
< 1000)) {


*/
1281
< 1000)) {


function refreshFilesystems(xml) {
1282
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('filesystem', blocks) < 0))) {
1283
< 1000)) {


$("#filesystem").remove();
1284
< 1000)) {


return;
1285
< 1000)) {


}
1286
 
3179 rexy 1287
< 1000)) {


var total_usage = 0, total_used = 0, total_free = 0, total_size = 0, threshold = 0, usage = 0;
2788 rexy 1288
 
1289
< 1000)) {


filesystemTable.fnClearTable();
1290
 
1291
< 1000)) {


$("Options", xml).each(function getThreshold(id) {
1292
< 1000)) {


threshold = parseInt($(this).attr("threshold"), 10);
1293
< 1000)) {


});
1294
 
1295
< 1000)) {


$("FileSystem Mount", xml).each(function getMount(mid) {
1296
< 1000)) {


var mpoint = "", mpid = 0, type = "", name = "", free = 0, used = 0, size = 0, percent = 0, options = "", inodes = 0, inodes_text = "", options_text = "", ignore = 0;
1297
< 1000)) {


mpid = parseInt($(this).attr("MountPointID"), 10);
1298
< 1000)) {


type = $(this).attr("FSType");
1299
< 1000)) {


name = $(this).attr("Name").replace(/;/g, ";<wbr>"); /* split long name */
1300
< 1000)) {


free = parseInt($(this).attr("Free"), 10);
1301
< 1000)) {


used = parseInt($(this).attr("Used"), 10);
1302
< 1000)) {


size = parseInt($(this).attr("Total"), 10);
1303
< 1000)) {


percent = parseInt($(this).attr("Percent"), 10);
1304
< 1000)) {


options = $(this).attr("MountOptions");
1305
< 1000)) {


inodes = parseInt($(this).attr("Inodes"), 10);
1306
< 1000)) {


mpoint = $(this).attr("MountPoint");
1307
< 1000)) {


ignore = parseInt($(this).attr("Ignore"), 10);
1308
 
1309
< 1000)) {


if (mpoint === undefined) {
1310
< 1000)) {


mpoint = mpid;
1311
< 1000)) {


}
1312
< 1000)) {


if (options !== undefined) {
1313
< 1000)) {


options_text = "<br><i>(" + options + ")</i>";
1314
< 1000)) {


}
1315
< 1000)) {


if (!isNaN(inodes)) {
1316
< 1000)) {


inodes_text = "<span style=\"font-style:italic\">&nbsp;(" + inodes.toString() + "%)</span>";
1317
< 1000)) {


}
3037 rexy 1318
< 1000)) {


if (type === undefined) {
1319
< 1000)) {


type = "";
1320
< 1000)) {


}
2788 rexy 1321
 
3179 rexy 1322
< 1000)) {


usage = (size != 0) ? Math.ceil((used / size) * 100) : 0;
2976 rexy 1323
< 1000)) {


if (!isNaN(ignore) && (ignore > 0) && showTotals) {
1324
< 1000)) {


if (ignore >= 3) {
1325
< 1000)) {


if ((ignore == 3) && !isNaN(threshold) && (percent >= threshold)) {
3179 rexy 1326
< 1000)) {


filesystemTable.fnAddData(["" + mpoint + "span>" + mpoint, "<span style=\"display:none;\">" + type + "</span>" + type, "<span style=\"display:none;\">" + name + "</span>" + name + options_text, "<span style=\"display:none;\">" + percent.toString() + "</span>" + createBar(percent, "barwarn", usage) + inodes_text, "<span style=\"display:none;\">" + free.toString() + "</span><i>(" + formatBytes(free, xml) + ")</i>", "<span style=\"display:none;\">" + used.toString() + "</span><i>(" + formatBytes(used, xml) + ")</i>", "<span style=\"display:none;\">" + size.toString() + "</span><i>(" + formatBytes(size, xml) + ")</i>"]);
2788 rexy 1327
< 1000)) {


} else {
3179 rexy 1328
< 1000)) {


filesystemTable.fnAddData(["<span style=\"display:none;\">" + mpoint + "</span>" + mpoint, "<span style=\"display:none;\">" + type + "</span>" + type, "<span style=\"display:none;\">" + name + "</span>" + name + options_text, "<span style=\"display:none;\">" + percent.toString() + "</span>" + createBar(percent, "bar", usage) + inodes_text, "<span style=\"display:none;\">" + free.toString() + "</span><i>(" + formatBytes(free, xml) + ")</i>", "<span style=\"display:none;\">" + used.toString() + "</span><i>(" + formatBytes(used, xml) + ")</i>", "<span style=\"display:none;\">" + size.toString() + "</span><i>(" + formatBytes(size, xml) + ")</i>"]);
2788 rexy 1329
< 1000)) {


}
1330
< 1000)) {


} else {
1331
< 1000)) {


if (!isNaN(threshold) && (percent >= threshold)) {
3179 rexy 1332
< 1000)) {


filesystemTable.fnAddData(["<span style=\"display:none;\">" + mpoint + "</span>" + mpoint, "<span style=\"display:none;\">" + type + "</span>" + type, "<span style=\"display:none;\">" + name + "</span>" + name + options_text, "<span style=\"display:none;\">" + percent.toString() + "</span>" + createBar(percent, "barwarn", usage) + inodes_text, "<span style=\"display:none;\">" + free.toString() + "</span><i>(" + formatBytes(free, xml) + ")</i>", "<span style=\"display:none;\">" + used.toString() + "</span>" + formatBytes(used, xml), "<span style=\"display:none;\">" + size.toString() + "</span><i>(" + formatBytes(size, xml) + ")</i>"]);
2788 rexy 1333
< 1000)) {


} else {
3179 rexy 1334
< 1000)) {


filesystemTable.fnAddData(["<span style=\"display:none;\">" + mpoint + "</span>" + mpoint, "<span style=\"display:none;\">" + type + "</span>" + type, "<span style=\"display:none;\">" + name + "</span>" + name + options_text, "<span style=\"display:none;\">" + percent.toString() + "</span>" + createBar(percent, "bar", usage) + inodes_text, "<span style=\"display:none;\">" + free.toString() + "</span><i>(" + formatBytes(free, xml) + ")</i>", "<span style=\"display:none;\">" + used.toString() + "</span>" + formatBytes(used, xml), "<span style=\"display:none;\">" + size.toString() + "</span><i>(" + formatBytes(size, xml) + ")</i>"]);
2788 rexy 1335
< 1000)) {


}
1336
< 1000)) {


}
1337
< 1000)) {


} else {
2976 rexy 1338
< 1000)) {


if (!isNaN(threshold) && (percent >= threshold) && (showTotals || isNaN(ignore) || (ignore < 4))) {
3179 rexy 1339
< 1000)) {


filesystemTable.fnAddData(["<span style=\"display:none;\">" + mpoint + "</span>" + mpoint, "<span style=\"display:none;\">" + type + "</span>" + type, "<span style=\"display:none;\">" + name + "</span>" + name + options_text, "<span style=\"display:none;\">" + percent.toString() + "</span>" + createBar(percent, "barwarn", usage) + inodes_text, "<span style=\"display:none;\">" + free.toString() + "</span>" + formatBytes(free, xml), "<span style=\"display:none;\">" + used.toString() + "</span>" + formatBytes(used, xml), "<span style=\"display:none;\">" + size.toString() + "</span>" + formatBytes(size, xml)]);
2788 rexy 1340
< 1000)) {


} else {
3179 rexy 1341
< 1000)) {


filesystemTable.fnAddData(["<span style=\"display:none;\">" + mpoint + "</span>" + mpoint, "<span style=\"display:none;\">" + type + "</span>" + type, "<span style=\"display:none;\">" + name + "</span>" + name + options_text, "<span style=\"display:none;\">" + percent.toString() + "</span>" + createBar(percent, "bar", usage) + inodes_text, "<span style=\"display:none;\">" + free.toString() + "</span>" + formatBytes(free, xml), "<span style=\"display:none;\">" + used.toString() + "</span>" + formatBytes(used, xml), "<span style=\"display:none;\">" + size.toString() + "</span>" + formatBytes(size, xml)]);
2788 rexy 1342
< 1000)) {


}
1343
< 1000)) {


}
2976 rexy 1344
< 1000)) {


if (showTotals) {
1345
< 1000)) {


if (!isNaN(ignore) && (ignore > 0)) {
1346
< 1000)) {


if (ignore == 2) {
1347
< 1000)) {


total_used += used;
1348
< 1000)) {


} else if (ignore == 1) {
1349
< 1000)) {


total_used += used;
1350
< 1000)) {


total_size += used;
1351
< 1000)) {


}
1352
< 1000)) {


} else {
2788 rexy 1353
< 1000)) {


total_used += used;
2976 rexy 1354
< 1000)) {


total_free += free;
1355
< 1000)) {


total_size += size;
2788 rexy 1356
< 1000)) {


}
2976 rexy 1357
< 1000)) {


}
1358
< 1000)) {


});
3179 rexy 1359
 
2976 rexy 1360
< 1000)) {


if (showTotals) {
3179 rexy 1361
< 1000)) {


usage = (total_size != 0) ? Math.ceil((total_used / total_size) * 100) : 0;
1362
< 1000)) {


total_usage = (total_size != 0) ? round(100 - (total_free / total_size) * 100, 2) : 0;
2976 rexy 1363
< 1000)) {


if (!isNaN(threshold) && (total_usage >= threshold)) {
3179 rexy 1364
< 1000)) {


$("#s_fs_total").html(createBar(total_usage, "barwarn" , usage));
2788 rexy 1365
< 1000)) {


} else {
3179 rexy 1366
< 1000)) {


$("#s_fs_total").html(createBar(total_usage, "bar", usage));
2788 rexy 1367
< 1000)) {


}
2976 rexy 1368
< 1000)) {


$("#s_fs_tfree").html(formatBytes(total_free, xml));
1369
< 1000)) {


$("#s_fs_tused").html(formatBytes(total_used, xml));
1370
< 1000)) {


$("#s_fs_tsize").html(formatBytes(total_size, xml));
2788 rexy 1371
< 1000)) {


}
1372
< 1000)) {


}
1373
 
1374
< 1000)) {


/**
1375
< 1000)) {


* (re)fill the temperature block with the values from the given xml<br><br>
1376
< 1000)) {


* build the block content for the temperature block, this includes normal temperature information in the XML
1377
< 1000)) {


* and also the HDDTemp information, if there are no information the entire table will be removed
1378
< 1000)) {


* to avoid HTML warnings
1379
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1380
< 1000)) {


*/
1381
< 1000)) {


function refreshTemp(xml) {
1382
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('temperature', blocks) < 0))) {
1383
< 1000)) {


$("#temperature").remove();
1384
< 1000)) {


return;
1385
< 1000)) {


}
1386
 
1387
< 1000)) {


var values = false;
1388
< 1000)) {


$("#temperatureTable tbody").empty();
1389
< 1000)) {


$("MBInfo Temperature Item", xml).each(function getTemperatures(id) {
2976 rexy 1390
< 1000)) {


var label = "", value = "", event = "", limit = 0, _limit = "";
2788 rexy 1391
< 1000)) {


label = $(this).attr("Label");
1392
< 1000)) {


value = $(this).attr("Value");
2976 rexy 1393
< 1000)) {


event = $(this).attr("Event");
1394
< 1000)) {


if (event !== undefined)
1395
< 1000)) {


label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1396
< 1000)) {


limit = parseFloat($(this).attr("Max"));
1397
< 1000)) {


if (isFinite(limit))
1398
< 1000)) {


_limit = formatTemp(limit, xml);
1399
< 1000)) {


$("#temperatureTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + formatTemp(value, xml) + "</td><td class=\"right\">" + _limit + "</td></tr>");
1400
< 1000)) {


values = true;
1401
< 1000)) {


});
1402
< 1000)) {


if (values) {
1403
< 1000)) {


$("#temperature").show();
1404
< 1000)) {


} else {
1405
< 1000)) {


$("#temperature").hide();
1406
< 1000)) {


}
1407
< 1000)) {


}
1408
 
1409
< 1000)) {


/**
1410
< 1000)) {


* (re)fill the voltage block with the values from the given xml<br><br>
1411
< 1000)) {


* build the voltage information into a separate block, if there is no voltage information available the
1412
< 1000)) {


* entire table will be removed to avoid HTML warnings
1413
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1414
< 1000)) {


*/
1415
< 1000)) {


function refreshVoltage(xml) {
1416
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('voltage', blocks) < 0))) {
1417
< 1000)) {


$("#voltage").remove();
1418
< 1000)) {


return;
1419
< 1000)) {


}
1420
 
1421
< 1000)) {


var values = false;
1422
< 1000)) {


$("#voltageTable tbody").empty();
1423
< 1000)) {


$("MBInfo Voltage Item", xml).each(function getVoltages(id) {
2976 rexy 1424
< 1000)) {


var label = "", value = 0, event = "", max = 0, min = 0, _min = "", _max = "";
2788 rexy 1425
< 1000)) {


label = $(this).attr("Label");
1426
< 1000)) {


value = parseFloat($(this).attr("Value"));
2976 rexy 1427
< 1000)) {


event = $(this).attr("Event");
1428
< 1000)) {


if (event !== undefined)
1429
< 1000)) {


label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1430
< 1000)) {


max = parseFloat($(this).attr("Max"));
1431
< 1000)) {


if (isFinite(max))
1432
< 1000)) {


_max = round(max, 2) + "&nbsp;" + genlang(62);
1433
< 1000)) {


min = parseFloat($(this).attr("Min"));
1434
< 1000)) {


if (isFinite(min))
1435
< 1000)) {


_min = round(min, 2) + "&nbsp;" + genlang(62);
3100 rexy 1436
< 1000)) {


if (isFinite(value))
1437
< 1000)) {


$("#voltageTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + "&nbsp;" + genlang(62) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>");
1438
< 1000)) {


else
1439
< 1000)) {


$("#voltageTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">---&nbsp;" + genlang(62) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>");
2788 rexy 1440
< 1000)) {


values = true;
1441
< 1000)) {


});
1442
< 1000)) {


if (values) {
1443
< 1000)) {


$("#voltage").show();
1444
< 1000)) {


} else {
1445
< 1000)) {


$("#voltage").hide();
1446
< 1000)) {


}
1447
< 1000)) {


}
1448
 
1449
< 1000)) {


/**
1450
< 1000)) {


* (re)fill the fan block with the values from the given xml<br><br>
1451
< 1000)) {


* build the fan information into a separate block, if there is no fan information available the
1452
< 1000)) {


* entire table will be removed to avoid HTML warnings
1453
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1454
< 1000)) {


*/
1455
< 1000)) {


function refreshFans(xml) {
1456
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('fans', blocks) < 0))) {
1457
< 1000)) {


$("#fans").remove();
1458
< 1000)) {


return;
1459
< 1000)) {


}
1460
 
1461
< 1000)) {


var values = false;
1462
< 1000)) {


$("#fansTable tbody").empty();
1463
< 1000)) {


$("MBInfo Fans Item", xml).each(function getFans(id) {
2976 rexy 1464
< 1000)) {


var label = "", value = 0, event = "", min = 0, _min = "", unit = "";
2788 rexy 1465
< 1000)) {


label = $(this).attr("Label");
1466
< 1000)) {


value = parseFloat($(this).attr("Value"));
1467
< 1000)) {


event = $(this).attr("Event");
1468
< 1000)) {


if (event !== undefined)
1469
< 1000)) {


label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2976 rexy 1470
< 1000)) {


min = parseFloat($(this).attr("Min"));
1471
< 1000)) {


unit = $(this).attr("Unit");
1472
< 1000)) {


if (unit === "%") {
1473
< 1000)) {


if (isFinite(min))
1474
< 1000)) {


_min = round(min,0) + "%";
3100 rexy 1475
< 1000)) {


if (isFinite(value))
1476
< 1000)) {


$("#fansTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td><td class=\"right\">" + _min + "</td></tr>");
1477
< 1000)) {


else
3179 rexy 1478
< 1000)) {


$("#fansTable tbody").append("<tr><td>" + label + "</td><td>---%</td><td class=\"right\">" + _min + "</td></tr>");
2976 rexy 1479
< 1000)) {


} else {
1480
< 1000)) {


if (isFinite(min))
1481
< 1000)) {


_min = round(min,0) + "&nbsp;" + genlang(63);
3100 rexy 1482
< 1000)) {


if (isFinite(value))
1483
< 1000)) {


$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value,0) + "&nbsp;" + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>");
1484
< 1000)) {


else
1485
< 1000)) {


$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">---&nbsp;" + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>");
2976 rexy 1486
< 1000)) {


}
2788 rexy 1487
< 1000)) {


values = true;
1488
< 1000)) {


});
1489
< 1000)) {


if (values) {
1490
< 1000)) {


$("#fans").show();
1491
< 1000)) {


} else {
1492
< 1000)) {


$("#fans").hide();
1493
< 1000)) {


}
1494
< 1000)) {


}
1495
 
1496
< 1000)) {


/**
1497
< 1000)) {


* (re)fill the power block with the values from the given xml<br><br>
1498
< 1000)) {


* build the power information into a separate block, if there is no power information available the
1499
< 1000)) {


* entire table will be removed to avoid HTML warnings
1500
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1501
< 1000)) {


*/
1502
< 1000)) {


function refreshPower(xml) {
1503
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('power', blocks) < 0))) {
1504
< 1000)) {


$("#power").remove();
1505
< 1000)) {


return;
1506
< 1000)) {


}
1507
 
1508
< 1000)) {


var values = false;
1509
< 1000)) {


$("#powerTable tbody").empty();
1510
< 1000)) {


$("MBInfo Power Item", xml).each(function getPowers(id) {
2976 rexy 1511
< 1000)) {


var label = "", value = "", event = "", limit = 0, _limit = "";
2788 rexy 1512
< 1000)) {


label = $(this).attr("Label");
3100 rexy 1513
< 1000)) {


value = parseFloat($(this).attr("Value"));
2976 rexy 1514
< 1000)) {


event = $(this).attr("Event");
1515
< 1000)) {


if (event !== undefined)
1516
< 1000)) {


label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1517
< 1000)) {


limit = parseFloat($(this).attr("Max"));
1518
< 1000)) {


if (isFinite(limit))
1519
< 1000)) {


_limit = round(limit, 2) + "&nbsp;" + genlang(103);
3100 rexy 1520
< 1000)) {


if (isFinite(value))
1521
< 1000)) {


$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + "&nbsp;" + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>");
1522
< 1000)) {


else
1523
< 1000)) {


$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">---&nbsp;" + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>");
2788 rexy 1524
< 1000)) {


values = true;
1525
< 1000)) {


});
1526
< 1000)) {


if (values) {
1527
< 1000)) {


$("#power").show();
1528
< 1000)) {


} else {
1529
< 1000)) {


$("#power").hide();
1530
< 1000)) {


}
1531
< 1000)) {


}
1532
 
1533
< 1000)) {


/**
1534
< 1000)) {


* (re)fill the current block with the values from the given xml<br><br>
1535
< 1000)) {


* build the current information into a separate block, if there is no current information available the
1536
< 1000)) {


* entire table will be removed to avoid HTML warnings
1537
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1538
< 1000)) {


*/
1539
< 1000)) {


function refreshCurrent(xml) {
1540
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('current', blocks) < 0))) {
1541
< 1000)) {


$("#current").remove();
1542
< 1000)) {


return;
1543
< 1000)) {


}
1544
 
1545
< 1000)) {


var values = false;
1546
< 1000)) {


$("#currentTable tbody").empty();
1547
< 1000)) {


$("MBInfo Current Item", xml).each(function getCurrents(id) {
2976 rexy 1548
< 1000)) {


var label = "", value = "", event = "", min = 0, max = 0, _min = "", _max = "";
2788 rexy 1549
< 1000)) {


label = $(this).attr("Label");
3100 rexy 1550
< 1000)) {


value = parseFloat($(this).attr("Value"));
2976 rexy 1551
< 1000)) {


event = $(this).attr("Event");
1552
< 1000)) {


if (event !== undefined)
1553
< 1000)) {


label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1554
< 1000)) {


max = parseFloat($(this).attr("Max"));
1555
< 1000)) {


if (isFinite(max))
1556
< 1000)) {


_max = round(max, 2) + "&nbsp;" + genlang(106);
1557
< 1000)) {


min = parseFloat($(this).attr("Min"));
1558
< 1000)) {


if (isFinite(min))
1559
< 1000)) {


_min = round(min, 2) + "&nbsp;" + genlang(106);
3100 rexy 1560
< 1000)) {


if (isFinite(value))
1561
< 1000)) {


$("#currentTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + "&nbsp;" + genlang(106) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>");
1562
< 1000)) {


else
1563
< 1000)) {


$("#currentTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">---&nbsp;" + genlang(106) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>");
2788 rexy 1564
< 1000)) {


values = true;
1565
< 1000)) {


});
1566
< 1000)) {


if (values) {
1567
< 1000)) {


$("#current").show();
1568
< 1000)) {


} else {
1569
< 1000)) {


$("#current").hide();
1570
< 1000)) {


}
1571
< 1000)) {


}
1572
 
1573
< 1000)) {


/**
1574
< 1000)) {


* (re)fill the other block with the values from the given xml<br><br>
1575
< 1000)) {


* build the other information into a separate block, if there is no other information available the
1576
< 1000)) {


* entire table will be removed to avoid HTML warnings
1577
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1578
< 1000)) {


*/
1579
< 1000)) {


function refreshOther(xml) {
1580
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('other', blocks) < 0))) {
1581
< 1000)) {


$("#other").remove();
1582
< 1000)) {


return;
1583
< 1000)) {


}
1584
 
1585
< 1000)) {


var values = false;
1586
< 1000)) {


$("#otherTable tbody").empty();
1587
< 1000)) {


$("MBInfo Other Item", xml).each(function getOthers(id) {
2976 rexy 1588
< 1000)) {


var label = "", value = "", event = "", unit = "";
2788 rexy 1589
< 1000)) {


label = $(this).attr("Label");
1590
< 1000)) {


value = $(this).attr("Value");
1591
< 1000)) {


event = $(this).attr("Event");
1592
< 1000)) {


if (event !== undefined)
1593
< 1000)) {


label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2976 rexy 1594
< 1000)) {


unit = $(this).attr("Unit");
1595
< 1000)) {


if (unit === "%") {
3179 rexy 1596
< 1000)) {


if (isFinite(value))
1597
< 1000)) {


$("#otherTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td></tr>");
1598
< 1000)) {


else
1599
< 1000)) {


$("#otherTable tbody").append("<tr><td>" + label + "</td><td>---%</td></tr>");
2976 rexy 1600
< 1000)) {


} else {
1601
< 1000)) {


$("#otherTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + value + "</td></tr>");
1602
< 1000)) {


}
2788 rexy 1603
< 1000)) {


values = true;
1604
< 1000)) {


});
1605
< 1000)) {


if (values) {
1606
< 1000)) {


$("#other").show();
1607
< 1000)) {


} else {
1608
< 1000)) {


$("#other").hide();
1609
< 1000)) {


}
1610
< 1000)) {


}
1611
 
1612
< 1000)) {


/**
1613
< 1000)) {


* (re)fill the ups block with the values from the given xml<br><br>
1614
< 1000)) {


* build the ups information into a separate block, if there is no ups information available the
1615
< 1000)) {


* entire table will be removed to avoid HTML warnings
1616
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1617
< 1000)) {


*/
1618
< 1000)) {


function refreshUps(xml) {
1619
< 1000)) {


if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('ups', blocks) < 0))) {
1620
< 1000)) {


$("#ups").remove();
1621
< 1000)) {


return;
1622
< 1000)) {


}
1623
 
1624
< 1000)) {


var add_apcupsd_cgi_links = ($("[ApcupsdCgiLinks='1']", xml).length > 0);
1625
< 1000)) {


var html = "", tree = [], closed = [], index = 0, values = false;
1626
< 1000)) {


html += "<h2>" + genlang(68) + "</h2>\n";
1627
< 1000)) {


html += " <div style=\"overflow-x:auto;\">\n";
1628
< 1000)) {


html += " <table class=\"tablemain\" id=\"UPSTree\">\n";
1629
< 1000)) {


html += " <tbody class=\"tree\">\n";
1630
 
1631
< 1000)) {


$("#ups").empty();
1632
< 1000)) {


$("UPSInfo UPS", xml).each(function getUps(id) {
3037 rexy 1633
< 1000)) {


var name = "", model = "", mode = "", start_time = "", upsstatus = "", beeperstatus = "", temperature = "", outages_count = "", last_outage = "", last_outage_finish = "", line_voltage = "", line_frequency = "", load_percent = "", battery_date = "", battery_voltage = "", battery_charge_percent = "", time_left_minutes = "";
2788 rexy 1634
< 1000)) {


name = $(this).attr("Name");
1635
< 1000)) {


model = $(this).attr("Model");
1636
< 1000)) {


mode = $(this).attr("Mode");
1637
< 1000)) {


start_time = $(this).attr("StartTime");
1638
< 1000)) {


upsstatus = $(this).attr("Status");
3037 rexy 1639
< 1000)) {


beeperstatus = $(this).attr("BeeperStatus");
2788 rexy 1640
 
1641
< 1000)) {


temperature = $(this).attr("Temperature");
1642
< 1000)) {


outages_count = $(this).attr("OutagesCount");
1643
< 1000)) {


last_outage = $(this).attr("LastOutage");
1644
< 1000)) {


last_outage_finish = $(this).attr("LastOutageFinish");
1645
< 1000)) {


line_voltage = $(this).attr("LineVoltage");
1646
< 1000)) {


line_frequency = $(this).attr("LineFrequency");
1647
< 1000)) {


load_percent = parseInt($(this).attr("LoadPercent"), 10);
1648
< 1000)) {


battery_date = $(this).attr("BatteryDate");
1649
< 1000)) {


battery_voltage = $(this).attr("BatteryVoltage");
1650
< 1000)) {


battery_charge_percent = parseInt($(this).attr("BatteryChargePercent"), 10);
1651
< 1000)) {


time_left_minutes = $(this).attr("TimeLeftMinutes");
1652
 
1653
< 1000)) {


if (mode !== undefined) {
1654
< 1000)) {


html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + name + " (" + mode + ")</span></div></td></tr>\n";
1655
< 1000)) {


} else {
1656
< 1000)) {


html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + name + "</span></div></td></tr>\n";
1657
< 1000)) {


}
1658
< 1000)) {


index = tree.push(0);
1659
< 1000)) {


if (model !== undefined) {
2976 rexy 1660
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(70) + "</span></div></td><td>" + model + "</td></tr>\n";
2788 rexy 1661
< 1000)) {


tree.push(index);
1662
< 1000)) {


}
1663
< 1000)) {


if (start_time !== undefined) {
2976 rexy 1664
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(72) + "</span></div></td><td>" + start_time + "</td></tr>\n";
2788 rexy 1665
< 1000)) {


tree.push(index);
1666
< 1000)) {


}
1667
< 1000)) {


if (upsstatus !== undefined) {
2976 rexy 1668
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(73) + "</span></div></td><td>" + upsstatus + "</td></tr>\n";
2788 rexy 1669
< 1000)) {


tree.push(index);
1670
< 1000)) {


}
3037 rexy 1671
< 1000)) {


if (beeperstatus !== undefined) {
1672
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(133) + "</span></div></td><td>" + beeperstatus + "</td></tr>\n";
1673
< 1000)) {


tree.push(index);
1674
< 1000)) {


}
2788 rexy 1675
< 1000)) {


if (temperature !== undefined) {
2976 rexy 1676
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(84) + "</span></div></td><td>" + temperature + "</td></tr>\n";
2788 rexy 1677
< 1000)) {


tree.push(index);
1678
< 1000)) {


}
1679
< 1000)) {


if (outages_count !== undefined) {
2976 rexy 1680
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(74) + "</span></div></td><td>" + outages_count + "</td></tr>\n";
2788 rexy 1681
< 1000)) {


tree.push(index);
1682
< 1000)) {


}
1683
< 1000)) {


if (last_outage !== undefined) {
2976 rexy 1684
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(75) + "</span></div></td><td>" + last_outage + "</td></tr>\n";
2788 rexy 1685
< 1000)) {


tree.push(index);
1686
< 1000)) {


}
1687
< 1000)) {


if (last_outage_finish !== undefined) {
2976 rexy 1688
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(76) + "</span></div></td><td>" + last_outage_finish + "</td></tr>\n";
2788 rexy 1689
< 1000)) {


tree.push(index);
1690
< 1000)) {


}
1691
< 1000)) {


if (line_voltage !== undefined) {
2976 rexy 1692
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(77) + "</span></div></td><td>" + line_voltage + "&nbsp;" + genlang(82) + "</td></tr>\n";
2788 rexy 1693
< 1000)) {


tree.push(index);
1694
< 1000)) {


}
1695
< 1000)) {


if (line_frequency !== undefined) {
2976 rexy 1696
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(108) + "</span></div></td><td>" + line_frequency + "&nbsp;" + genlang(109) + "</td></tr>\n";
2788 rexy 1697
< 1000)) {


tree.push(index);
1698
< 1000)) {


}
1699
< 1000)) {


if (!isNaN(load_percent)) {
2976 rexy 1700
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(78) + "</span></div></td><td>" + createBar(load_percent) + "</td></tr>\n";
2788 rexy 1701
< 1000)) {


tree.push(index);
1702
< 1000)) {


}
1703
< 1000)) {


if (battery_date !== undefined) {
2976 rexy 1704
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(104) + "</span></div></td><td>" + battery_date + "</td></tr>\n";
2788 rexy 1705
< 1000)) {


tree.push(index);
1706
< 1000)) {


}
1707
< 1000)) {


if (battery_voltage !== undefined) {
2976 rexy 1708
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(79) + "</span></div></td><td>" + battery_voltage + "&nbsp;" + genlang(82) + "</td></tr>\n";
2788 rexy 1709
< 1000)) {


tree.push(index);
1710
< 1000)) {


}
1711
< 1000)) {


if (!isNaN(battery_charge_percent)) {
2976 rexy 1712
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(80) + "</span></div></td><td>" + createBar(battery_charge_percent) + "</td></tr>\n";
2788 rexy 1713
< 1000)) {


tree.push(index);
1714
< 1000)) {


}
1715
< 1000)) {


if (time_left_minutes !== undefined) {
2976 rexy 1716
< 1000)) {


html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(81) + "</span></div></td><td>" + time_left_minutes + "&nbsp;" + genlang(83) + "</td></tr>\n";
2788 rexy 1717
< 1000)) {


tree.push(index);
1718
< 1000)) {


}
1719
< 1000)) {


values=true;
1720
< 1000)) {


});
1721
< 1000)) {


html += " </tbody>\n";
1722
< 1000)) {


html += " </table>\n";
1723
< 1000)) {


html += " </div>\n";
1724
< 1000)) {


if (add_apcupsd_cgi_links){
1725
< 1000)) {


html += " (<a title='details' href='/cgi-bin/apcupsd/multimon.cgi' target='apcupsdcgi'>" + genlang(99) + "</a>)\n";
1726
< 1000)) {


}
1727
 
1728
< 1000)) {


$("#ups").append(html);
1729
 
1730
< 1000)) {


if (values) {
1731
< 1000)) {


$("#UPSTree").jqTreeTable(tree, {
1732
< 1000)) {


openImg: "./gfx/treeTable/tv-collapsable.gif",
1733
< 1000)) {


shutImg: "./gfx/treeTable/tv-expandable.gif",
1734
< 1000)) {


leafImg: "./gfx/treeTable/tv-item.gif",
1735
< 1000)) {


lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1736
< 1000)) {


lastShutImg: "./gfx/treeTable/tv-expandable-last.gif",
1737
< 1000)) {


lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1738
< 1000)) {


vertLineImg: "./gfx/treeTable/vertline.gif",
1739
< 1000)) {


blankImg: "./gfx/treeTable/blank.gif",
1740
< 1000)) {


collapse: closed,
1741
< 1000)) {


column: 0,
1742
< 1000)) {


striped: true,
1743
< 1000)) {


highlight: false,
1744
< 1000)) {


state: false
1745
< 1000)) {


});
1746
< 1000)) {


$("#ups").show();
1747
< 1000)) {


} else {
1748
< 1000)) {


$("#ups").hide();
1749
< 1000)) {


}
1750
< 1000)) {


}
1751
 
1752
< 1000)) {


/**
1753
< 1000)) {


* reload the page, this means all values are refreshed
1754
< 1000)) {


*/
1755
< 1000)) {


function reload(initiate) {
1756
< 1000)) {


$.ajax({
1757
< 1000)) {


url: 'xml.php',
1758
< 1000)) {


dataType: 'xml',
1759
< 1000)) {


error: function error() {
1760
< 1000)) {


if ((typeof(initiate) === 'boolean') && (initiate === true)) {
1761
< 1000)) {


$.jGrowl("Error loading XML document!", {
1762
< 1000)) {


sticky: true
1763
< 1000)) {


});
1764
< 1000)) {


} else {
1765
< 1000)) {


$.jGrowl("Error loading XML document!");
1766
< 1000)) {


}
1767
< 1000)) {


},
1768
< 1000)) {


success: function buildblocks(xml) {
1769
< 1000)) {


if ((typeof(initiate) === 'boolean') && (initiate === true)) {
1770
< 1000)) {


populateErrors(xml);
1771
< 1000)) {


}
1772
 
1773
< 1000)) {


refreshVitals(xml);
1774
< 1000)) {


refreshHardware(xml);
1775
< 1000)) {


refreshMemory(xml);
1776
< 1000)) {


refreshFilesystems(xml);
1777
< 1000)) {


refreshNetwork(xml);
1778
< 1000)) {


refreshVoltage(xml);
1779
< 1000)) {


refreshCurrent(xml);
1780
< 1000)) {


refreshTemp(xml);
1781
< 1000)) {


refreshFans(xml);
1782
< 1000)) {


refreshPower(xml);
1783
< 1000)) {


refreshOther(xml);
1784
< 1000)) {


refreshUps(xml);
1785
< 1000)) {


changeLanguage();
1786
 
1787
< 1000)) {


if ((typeof(initiate) === 'boolean') && (initiate === true)) {
1788
< 1000)) {


displayPage(xml);
1789
< 1000)) {


settimer(xml);
1790
< 1000)) {


} else {
1791
< 1000)) {


for (var i = 0; i < plugin_liste.length; i++) {
1792
< 1000)) {


try {
1793
< 1000)) {


//dynamic call
1794
< 1000)) {


window[plugin_liste[i].toLowerCase() + '_request']();
1795
< 1000)) {


}
1796
< 1000)) {


catch (err) {
1797
< 1000)) {


}
1798
< 1000)) {


}
1799
< 1000)) {


}
1800
 
1801
< 1000)) {


$('.stripeMe tr:nth-child(even)').addClass('even');
1802
< 1000)) {


}
1803
< 1000)) {


});
1804
< 1000)) {


}
1805
 
1806
< 1000)) {


/**
1807
< 1000)) {


* set a reload timer for the page
1808
< 1000)) {


* @param {jQuery} xml phpSysInfo-XML
1809
< 1000)) {


*/
1810
< 1000)) {


function settimer(xml) {
1811
< 1000)) {


$("Options", xml).each(function getRefreshTime(id) {
1812
< 1000)) {


var options, refresh = "";
1813
< 1000)) {


options = $("Options", xml).get(id);
1814
< 1000)) {


refresh = $(this).attr("refresh");
1815
< 1000)) {


if (refresh !== '0') {
1816
< 1000)) {


$.timer(refresh, reload);
1817
< 1000)) {


}
1818
< 1000)) {


});
1819
< 1000)) {


}
1820
 
1821
< 1000)) {


$(document).ready(function buildpage() {
1822
< 1000)) {


var i = 0, old_template = null, cookie_template = null, cookie_language = null, blocktmp = "";
1823
 
1824
< 1000)) {


showCPUListExpanded = $("#showCPUListExpanded").val().toString()==="true";
1825
< 1000)) {


showCPUInfoExpanded = $("#showCPUInfoExpanded").val().toString()==="true";
1826
< 1000)) {


showNetworkInfosExpanded = $("#showNetworkInfosExpanded").val().toString()==="true";
1827
< 1000)) {


showMemoryInfosExpanded = $("#showMemoryInfosExpanded").val().toString()==="true";
1828
< 1000)) {


showCPULoadCompact = $("#showCPULoadCompact").val().toString()==="true";
2976 rexy 1829
< 1000)) {


showTotals = $("#hideTotals").val().toString()!=="true";
1830
< 1000)) {


increaseWidth = $("#increaseWidth").val().toString();
1831
< 1000)) {


if (isNaN(increaseWidth) || (increaseWidth<=0)) increaseWidth = 0;
2788 rexy 1832
< 1000)) {


switch ($("#showNetworkActiveSpeed").val().toString()) {
1833
< 1000)) {


case "bps": showNetworkActiveSpeed = 2;
1834
< 1000)) {


break;
1835
< 1000)) {


case "true": showNetworkActiveSpeed = 1;
1836
< 1000)) {


break;
1837
< 1000)) {


default: showNetworkActiveSpeed = 0;
1838
< 1000)) {


}
1839
 
1840
< 1000)) {


blocktmp = $("#blocks").val().toString();
1841
< 1000)) {


if (blocktmp.length >0 ){
1842
< 1000)) {


if (blocktmp === "true") {
1843
< 1000)) {


blocks[0] = "true";
1844
< 1000)) {


} else {
1845
< 1000)) {


blocks = blocktmp.split(',');
1846
< 1000)) {


var j = 2;
1847
< 1000)) {


for (i = 0; i < blocks.length; i++) {
1848
< 1000)) {


if ($("#"+blocks[i]).length > 0) {
1849
< 1000)) {


$("#output").children().eq(j).before($("#"+blocks[i]));
1850
< 1000)) {


j++;
1851
< 1000)) {


}
1852
< 1000)) {


}
1853
 
1854
< 1000)) {


}
1855
< 1000)) {


}
1856
 
1857
< 1000)) {


if ($("#language option").length < 2) {
1858
< 1000)) {


current_language = $("#language").val().toString();
1859
< 1000)) {


/*
1860
< 1000)) {


changeLanguage();
1861
< 1000)) {


for (i = 0; i < plugin_liste.length; i++) {
1862
< 1000)) {


changeLanguage(plugin_liste[i]);
1863
< 1000)) {


}
1864
< 1000)) {


*/
1865
< 1000)) {


} else {
1866
< 1000)) {


cookie_language = readCookie("psi_language");
1867
< 1000)) {


if (cookie_language !== null) {
1868
< 1000)) {


current_language = cookie_language;
1869
< 1000)) {


$("#language").val(current_language);
1870
< 1000)) {


} else {
1871
< 1000)) {


current_language = $("#language").val().toString();
1872
< 1000)) {


}
1873
< 1000)) {


/*
1874
< 1000)) {


changeLanguage();
1875
< 1000)) {


for (i = 0; i < plugin_liste.length; i++) {
1876
< 1000)) {


changeLanguage(plugin_liste[i]);
1877
< 1000)) {


}
1878
< 1000)) {


*/
1879
< 1000)) {


$('#language').show();
1880
< 1000)) {


$('span[class=lang_045]').show();
1881
< 1000)) {


$("#language").change(function changeLang() {
1882
< 1000)) {


var i = 0;
1883
< 1000)) {


current_language = $("#language").val().toString();
1884
< 1000)) {


createCookie('psi_language', current_language, 365);
1885
< 1000)) {


changeLanguage();
1886
< 1000)) {


for (i = 0; i < plugin_liste.length; i++) {
1887
< 1000)) {


changeLanguage(plugin_liste[i]);
1888
< 1000)) {


}
1889
< 1000)) {


return false;
1890
< 1000)) {


});
1891
< 1000)) {


}
1892
< 1000)) {


if ($("#template option").length < 2) {
1893
< 1000)) {


switchStyle($("#template").val().toString());
1894
< 1000)) {


} else {
1895
< 1000)) {


cookie_template = readCookie("psi_template");
1896
< 1000)) {


if (cookie_template !== null) {
1897
< 1000)) {


old_template = $("#template").val();
1898
< 1000)) {


$("#template").val(cookie_template);
1899
< 1000)) {


if ($("#template").val() === null) {
1900
< 1000)) {


$("#template").val(old_template);
3179 rexy 1901
< 1000)) {


}
2788 rexy 1902
< 1000)) {


}
1903
< 1000)) {


switchStyle($("#template").val().toString());
1904
< 1000)) {


$('#template').show();
1905
< 1000)) {


$('span[class=lang_044]').show();
1906
< 1000)) {


$("#template").change(function changeTemplate() {
1907
< 1000)) {


switchStyle($("#template").val().toString());
1908
< 1000)) {


createCookie('psi_template', $("#template").val().toString(), 365);
1909
< 1000)) {


return false;
1910
< 1000)) {


});
1911
< 1000)) {


}
1912
 
1913
< 1000)) {


filesystemtable();
1914
 
1915
< 1000)) {


reload(true);
1916
 
1917
< 1000)) {


$("#errors").nyroModal();
1918
< 1000)) {


});
1919
 
1920
< 1000)) {


jQuery.fn.dataTableExt.oSort['span-string-asc'] = function sortStringAsc(a, b) {
1921
< 1000)) {


var x = "", y = "";
1922
< 1000)) {


x = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1923
< 1000)) {


y = b.substring(b.indexOf(">") + 1, b.indexOf("</"));
1924
< 1000)) {


return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1925
< 1000)) {


};
1926
 
1927
< 1000)) {


jQuery.fn.dataTableExt.oSort['span-string-desc'] = function sortStringDesc(a, b) {
1928
< 1000)) {


var x = "", y = "";
1929
< 1000)) {


x = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1930
< 1000)) {


y = b.substring(b.indexOf(">") + 1, b.indexOf("</"));
1931
< 1000)) {


return ((x < y) ? 1 : ((x > y) ? -1 : 0));
1932
< 1000)) {


};
1933
 
1934
< 1000)) {


jQuery.fn.dataTableExt.oSort['span-number-asc'] = function sortNumberAsc(a, b) {
1935
< 1000)) {


var x = 0, y = 0;
1936
< 1000)) {


x = parseInt(a.substring(a.indexOf(">") + 1, a.indexOf("</")), 10);
1937
< 1000)) {


y = parseInt(b.substring(b.indexOf(">") + 1, b.indexOf("</")), 10);
1938
< 1000)) {


return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1939
< 1000)) {


};
1940
 
1941
< 1000)) {


jQuery.fn.dataTableExt.oSort['span-number-desc'] = function sortNumberDesc(a, b) {
1942
< 1000)) {


var x = 0, y = 0;
1943
< 1000)) {


x = parseInt(a.substring(a.indexOf(">") + 1, a.indexOf("</")), 10);
1944
< 1000)) {


y = parseInt(b.substring(b.indexOf(">") + 1, b.indexOf("</")), 10);
1945
< 1000)) {


return ((x < y) ? 1 : ((x > y) ? -1 : 0));
1946
< 1000)) {


};
1947
 
1948
< 1000)) {


jQuery.fn.dataTableExt.oSort['span-ip-asc'] = function sortIpAsc(a, b) {
1949
< 1000)) {


var x = 0, y = 0, aa = "", bb = "";
1950
< 1000)) {


aa = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1951
< 1000)) {


bb = b.substring(b.indexOf(">") + 1, b.indexOf("</"));
1952
< 1000)) {


x = full_addr(aa);
1953
< 1000)) {


y = full_addr(bb);
1954
< 1000)) {


if ((x === '') || (y === '')) {
1955
< 1000)) {


x = aa;
1956
< 1000)) {


y = bb;
1957
< 1000)) {


}
1958
< 1000)) {


return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1959
< 1000)) {


};
1960
 
1961
< 1000)) {


jQuery.fn.dataTableExt.oSort['span-ip-desc'] = function sortIpDesc(a, b) {
1962
< 1000)) {


var x = 0, y = 0, aa = "", bb = "";
1963
< 1000)) {


aa = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1964
< 1000)) {


bb = b.substring(b.indexOf(">") + 1, b.indexOf("</"));
1965
< 1000)) {


x = full_addr(aa);
1966
< 1000)) {


y = full_addr(bb);
1967
< 1000)) {


if ((x === '') || (y === '')) {
1968
< 1000)) {


x = aa;
1969
< 1000)) {


y = bb;
1970
< 1000)) {


}
1971
< 1000)) {


return ((x < y) ? 1 : ((x > y) ? -1 : 0));
1972
< 1000)) {


};
1973
 
1974
< 1000)) {


function full_addr(ip_string) {
1975
< 1000)) {


var wrongvalue = false;
1976
< 1000)) {


ip_string = $.trim(ip_string).toLowerCase();
1977
< 1000)) {


// ipv4 notation
1978
< 1000)) {


if (ip_string.match(/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/)) {
1979
< 1000)) {


ip_string ='::ffff:' + ip_string;
1980
< 1000)) {


}
1981
< 1000)) {


// replace ipv4 address if any
1982
< 1000)) {


var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/);
1983
< 1000)) {


if (ipv4) {
1984
< 1000)) {


ip_string = ipv4[1];
1985
< 1000)) {


ipv4 = ipv4[2].match(/[0-9]+/g);
1986
< 1000)) {


for (var i = 0;i < 4;i ++) {
3037 rexy 1987
< 1000)) {


var byte = parseInt(ipv4[i], 10);
2788 rexy 1988
< 1000)) {


if (byte<256) {
1989
< 1000)) {


ipv4[i] = ("0" + byte.toString(16)).substr(-2);
1990
< 1000)) {


} else {
1991
< 1000)) {


wrongvalue = true;
1992
< 1000)) {


break;
1993
< 1000)) {


}
1994
< 1000)) {


}
1995
< 1000)) {


if (wrongvalue) {
1996
< 1000)) {


ip_string = '';
1997
< 1000)) {


} else {
1998
< 1000)) {


ip_string += ipv4[0] + ipv4[1] + ':' + ipv4[2] + ipv4[3];
1999
< 1000)) {


}
2000
< 1000)) {


}
2001
 
2002
< 1000)) {


if (ip_string === '') {
2003
< 1000)) {


return '';
2004
< 1000)) {


}
2005
< 1000)) {


// take care of leading and trailing ::
2006
< 1000)) {


ip_string = ip_string.replace(/^:|:$/g, '');
2007
 
2008
< 1000)) {


var ipv6 = ip_string.split(':');
2009
 
2010
< 1000)) {


for (var li = 0; li < ipv6.length; li ++) {
2011
< 1000)) {


var hex = ipv6[li];
2012
< 1000)) {


if (hex !== "") {
2013
< 1000)) {


if (!hex.match(/^[0-9a-f]{1,4}$/)) {
2014
< 1000)) {


wrongvalue = true;
2015
< 1000)) {


break;
2016
< 1000)) {


}
2017
< 1000)) {


// normalize leading zeros
2018
< 1000)) {


ipv6[li] = ("0000" + hex).substr(-4);
2019
< 1000)) {


}
2020
< 1000)) {


else {
2021
< 1000)) {


// normalize grouped zeros ::
2022
< 1000)) {


hex = [];
2023
< 1000)) {


for (var j = ipv6.length; j <= 8; j ++) {
2024
< 1000)) {


hex.push('0000');
2025
< 1000)) {


}
2026
< 1000)) {


ipv6[li] = hex.join(':');
2027
< 1000)) {


}
2028
< 1000)) {


}
2029
< 1000)) {


if (!wrongvalue) {
2030
< 1000)) {


var out = ipv6.join(':');
2031
< 1000)) {


if (out.length == 39) {
2032
< 1000)) {


return out;
2033
< 1000)) {


} else {
2034
< 1000)) {


return '';
2035
< 1000)) {


}
2036
< 1000)) {


} else {
2037
< 1000)) {


return '';
2038
< 1000)) {


}
2039
< 1000)) {


}
2040
 
2041
< 1000)) {


/**
2042
< 1000)) {


* generate the block element for a specific plugin that is available
2043
< 1000)) {


* @param {String} plugin name of the plugin
2044
< 1000)) {


* @param {Number} translationid id of the translated headline in the plugin translation file
2045
< 1000)) {


* @param {Boolean} reload controls if a reload button should be appended to the headline
2046
< 1000)) {


* @return {String} HTML string which contains the full layout of the block
2047
< 1000)) {


*/
2048
< 1000)) {


function buildBlock(plugin, translationid, reload) {
2049
< 1000)) {


var block = "", reloadpic = "";
2050
< 1000)) {


if (reload) {
2051
< 1000)) {


reloadpic = "<img id=\"Reload_" + plugin + "Table\" src=\"./gfx/reload.gif\" alt=\"reload\" title=\"reload\" style=\"vertical-align:middle;float:right;cursor:pointer;border:0px;width:16px\" />&nbsp;";
2052
< 1000)) {


}
2053
< 1000)) {


block += "<div id=\"panel_" + plugin + "\" style=\"display:none;\">\n";
2054
< 1000)) {


block += "<div id=\"Plugin_" + plugin + "\" class=\"plugin\" style=\"display:none;\">\n";
2976 rexy 2055
< 1000)) {


block += "<h2>" + reloadpic + genlang(translationid, plugin) + "\n";
2056
< 1000)) {


block += "<span class=\"Hostname_" + plugin + "\"></span></h2>\n";
2788 rexy 2057
< 1000)) {


block += "</div>\n";
2058
< 1000)) {


block += "</div>\n";
2059
< 1000)) {


return block;
2060
< 1000)) {


}
2061
 
2062
< 1000)) {


/**
2063
< 1000)) {


* translate a plugin and add this plugin to the internal plugin-list, this is only needed once and shouldn't be called more than once
2064
< 1000)) {


* @param {String} plugin name of the plugin that should be translated
2065
< 1000)) {


*/
2066
< 1000)) {


function plugin_translate(plugin) {
2067
< 1000)) {


plugin_liste.pushIfNotExist(plugin);
2068
< 1000)) {


changeLanguage(plugin);
2069
< 1000)) {


}
2070
 
2071
< 1000)) {


/**
2072
< 1000)) {


* generate a formatted datetime string of the current datetime
2073
< 1000)) {


* @return {String} formatted datetime string
2074
< 1000)) {


*/
2075
< 1000)) {


function datetime() {
2076
< 1000)) {


var date, day = 0, month = 0, year = 0, hour = 0, minute = 0, days = "", months = "", years = "", hours = "", minutes = "";
2077
< 1000)) {


date = new Date();
2078
< 1000)) {


day = date.getDate();
2079
< 1000)) {


month = date.getMonth() + 1;
2080
< 1000)) {


year = date.getFullYear();
2081
< 1000)) {


hour = date.getHours();
2082
< 1000)) {


minute = date.getMinutes();
2083
 
2084
< 1000)) {


// format values smaller that 10 with a leading 0
2085
< 1000)) {


days = (day < 10) ? "0" + day.toString() : day.toString();
2086
< 1000)) {


months = (month < 10) ? "0" + month.toString() : month.toString();
2087
< 1000)) {


years = (year < 1000) ? year.toString() : year.toString();
2088
< 1000)) {


minutes = (minute < 10) ? "0" + minute.toString() : minute.toString();
2089
< 1000)) {


hours = (hour < 10) ? "0" + hour.toString() : hour.toString();
2090
 
2091
< 1000)) {


return days + "." + months + "." + years + " - " + hours + ":" + minutes;
2092
< 1000)) {


}
2093
 
2094
< 1000)) {


Array.prototype.pushIfNotExist = function(val) {
2095
< 1000)) {


if (typeof(val) == 'undefined' || val === '') {
2096
< 1000)) {


return;
2097
< 1000)) {


}
2098
< 1000)) {


val = $.trim(val);
2099
< 1000)) {


if ($.inArray(val, this) == -1) {
2100
< 1000)) {


this.push(val);
2101
< 1000)) {


}
2102
< 1000)) {


};
2103
 
2104
< 1000)) {


/**
2105
< 1000)) {


* insert dynamically a js script file into the website
2106
< 1000)) {


* @param {String} name name of the script that should be included
2107
< 1000)) {


*/
2108
< 1000)) {


/*
2109
< 1000)) {


function appendjs(name) {
2110
< 1000)) {


var scrptE, hdEl;
2111
< 1000)) {


scrptE = document.createElement("script");
2112
< 1000)) {


hdEl = document.getElementsByTagName("head")[0];
2113
< 1000)) {


scrptE.setAttribute("src", name);
2114
< 1000)) {


scrptE.setAttribute("type", "text/javascript");
2115
< 1000)) {


hdEl.appendChild(scrptE);
2116
< 1000)) {


}
2117
< 1000)) {


*/
2118
< 1000)) {


/**
2119
< 1000)) {


* insert dynamically a css file into the website
2120
< 1000)) {


* @param {String} name name of the css file that should be included
2121
< 1000)) {


*/
2122
< 1000)) {


/*
2123
< 1000)) {


function appendcss(name) {
2124
< 1000)) {


var scrptE, hdEl;
2125
< 1000)) {


scrptE = document.createElement("link");
2126
< 1000)) {


hdEl = document.getElementsByTagName("head")[0];
2127
< 1000)) {


scrptE.setAttribute("type", "text/css");
2128
< 1000)) {


scrptE.setAttribute("rel", "stylesheet");
2129
< 1000)) {


scrptE.setAttribute("href", name);
2130
< 1000)) {


hdEl.appendChild(scrptE);
2131
< 1000)) {


}
2132
< 1000)) {


*/