Subversion Repositories ALCASAR

Rev

Rev 2976 | Rev 3100 | Go to most recent revision | 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
/**
32
 * Fix PNG loading on IE6 or below
33
 */
34
function PNGload(png) {
35
    if (typeof(png.ifixpng)==='function') { //IE6 PNG fix
36
        png.ifixpng('./gfx/blank.gif');
37
    }
38
}
39
 
40
/**
41
 * generate a cookie, if not exist, and add an entry to it<br><br>
42
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
43
 * @param {String} name name that holds the value
44
 * @param {String} value value that needs to be stored
45
 * @param {Number} days how many days the entry should be valid in the cookie
46
 */
47
function createCookie(name, value, days) {
48
    var date = new Date(), expires = "";
49
    if (days) {
50
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
51
        if (typeof(date.toUTCString)==="function") {
52
            expires = "; expires=" + date.toUTCString();
53
        } else {
54
            //deprecated
55
            expires = "; expires=" + date.toGMTString();
56
        }
57
    } else {
58
        expires = "";
59
    }
2976 rexy 60
    document.cookie = name + "=" + value + expires + "; path=/; samesite=strict";
2788 rexy 61
}
62
 
63
/**
64
 * read a value out of a cookie and return the value<br><br>
65
 * inspired by <a href="http://www.quirksmode.org/js/cookies.html">http://www.quirksmode.org/js/cookies.html</a>
66
 * @param {String} name name of the value that should be retrieved
67
 * @return {String}
68
 */
69
function readCookie(name) {
70
    var nameEQ = "", ca = [], c = '', i = 0;
71
    nameEQ = name + "=";
72
    ca = document.cookie.split(';');
73
    for (i = 0; i < ca.length; i++) {
74
        c = ca[i];
75
        while (c.charAt(0) === ' ') {
76
            c = c.substring(1, c.length);
77
        }
78
        if (!c.indexOf(nameEQ)) {
79
            return c.substring(nameEQ.length, c.length);
80
        }
81
    }
82
    return null;
83
}
84
 
85
/**
86
 * round a given value to the specified precision, difference to Math.round() is that there
87
 * 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)
88
 * @param {Number} x value to round
89
 * @param {Number} n precision
90
 * @return {String}
91
 */
92
function round(x, n) {
93
    var e = 0, k = "";
94
    if (n < 0 || n > 14) {
95
        return 0;
96
    }
97
    if (n === 0) {
98
        return Math.round(x);
99
    } else {
100
        e = Math.pow(10, n);
101
        k = (Math.round(x * e) / e).toString();
102
        if (k.indexOf('.') === -1) {
103
            k += '.';
104
        }
105
        k += e.toString().substring(1);
106
        return k.substring(0, k.indexOf('.') + n + 1);
107
    }
108
}
109
 
110
/**
111
 * activates a given style and disables the old one in the document
112
 * @param {String} template template that should be activated
113
 */
114
function switchStyle(template) {
2976 rexy 115
    if (increaseWidth > 0) {
116
        $('link[rel*=style][title]').each(function getTitle(i) {
117
            if (this.getAttribute('title') === 'PSI_Template') {
118
                this.setAttribute('href', './templates/css.php?name=' + template + '&increase=' + increaseWidth);
119
            }
120
        });
121
    } else {
122
        $('link[rel*=style][title]').each(function getTitle(i) {
123
            if (this.getAttribute('title') === 'PSI_Template') {
124
                this.setAttribute('href', './templates/' + template + ".css");  
125
            }
126
        });
127
    }
2788 rexy 128
}
129
 
130
/**
131
 * load the given translation an translate the entire page<br><br>retrieving the translation is done through a
132
 * ajax call
133
 * @private
134
 * @param {String} plugin if plugin is given, the plugin translation file will be read instead of the main translation file
135
 * @param {String} langarrId internal plugin name
136
 * @return {jQuery} translation jQuery-Object
137
 */
138
function getLanguage(plugin, langarrId) {
139
    var getLangUrl = "";
140
    if (current_language) {
141
        getLangUrl = 'language/language.php?lang=' + current_language;
142
        if (plugin) {
143
            getLangUrl += "&plugin=" + plugin;
144
        }
145
    } else {
146
        getLangUrl = 'language/language.php';
147
        if (plugin) {
148
            getLangUrl += "?plugin=" + plugin;
149
        }
150
    }
151
    $.ajax({
152
        url: getLangUrl,
153
        type: 'GET',
154
        dataType: 'xml',
155
        timeout: 100000,
156
        error: function error() {
157
            $.jGrowl("Error loading language - " + getLangUrl);
158
        },
159
        success: function buildblocks(xml) {
160
            var idexp;
161
            langxml[langarrId] = xml;
162
            if (langarr[langarrId] === undefined) {
163
                langarr.push(langarrId);
164
                langarr[langarrId] = [];
165
            }
166
            $("expression", langxml[langarrId]).each(function langstore(id) {
167
                idexp = $("expression", xml).get(id);
168
                langarr[langarrId][this.getAttribute('id')] = $("exp", idexp).text().toString().replace(/\//g, "/<wbr>");
169
            });
170
            changeSpanLanguage(plugin);
171
        }
172
    });
173
}
174
 
175
/**
176
 * generate a span tag
177
 * @param {Number} id translation id in the xml file
178
 * @param {String} [plugin] name of the plugin for which the tag should be generated
3037 rexy 179
 * @param {String} [defaultvalue] default value
2788 rexy 180
 * @return {String} string which contains generated span tag for translation string
181
 */
3037 rexy 182
function genlang(id, plugin, defaultvalue) {
2788 rexy 183
    var html = "", idString = "", plugname = "",
184
        langarrId = current_language + "_";
185
 
186
    if (plugin === undefined) {
187
        plugname = "";
188
        langarrId += "phpSysInfo";
189
    } else {
190
        plugname = plugin.toLowerCase();
191
        langarrId += plugname;
192
    }
193
    if (id < 100) {
194
        if (id < 10) {
195
            idString = "00" + id.toString();
196
        } else {
197
            idString = "0" + id.toString();
198
        }
199
    } else {
200
        idString = id.toString();
201
    }
202
    if (plugin) {
203
        idString = "plugin_" + plugname + "_" + idString;
204
    }
205
 
206
    html += "<span class=\"lang_" + idString + "\">";
207
 
208
    if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
209
        html += langarr[langarrId][idString];
3037 rexy 210
    } else if (defaultvalue !== undefined) {
211
        html += defaultvalue;
212
    }
2788 rexy 213
 
214
    html += "</span>";
215
 
216
    return html;
217
}
218
 
219
/**
220
 * translates all expressions based on the translation xml file<br>
221
 * translation expressions must be in the format &lt;span class="lang_???"&gt;&lt;/span&gt;, where ??? is
222
 * the number of the translated expression in the xml file<br><br>if a translated expression is not found in the xml
223
 * file nothing would be translated, so the initial value which is inside the span tag is displayed
224
 * @param {String} [plugin] name of the plugin
225
 */
226
function changeLanguage(plugin) {
227
    var langarrId = current_language + "_";
228
 
229
    if (plugin === undefined) {
230
        langarrId += "phpSysInfo";
231
    } else {
232
        langarrId += plugin;
233
    }
234
 
235
    if (langxml[langarrId] !== undefined) {
236
        changeSpanLanguage(plugin);
237
    } else {
238
        langxml.push(langarrId);
239
        getLanguage(plugin, langarrId);
240
    }
241
}
242
 
243
function changeSpanLanguage(plugin) {
244
    var langId = "", langStr = "", langarrId = current_language + "_";
245
 
246
    if (plugin === undefined) {
247
        langarrId += "phpSysInfo";
248
        $('span[class*=lang_]').each(function translate(i) {
249
            langId = this.className.substring(5);
250
            if (langId.indexOf('plugin_') !== 0) { //does not begin with plugin_
251
                langStr = langarr[langarrId][langId];
252
                if (langStr !== undefined) {
253
                    if (langStr.length > 0) {
254
                        this.innerHTML = langStr;
255
                    }
256
                }
257
            }
258
        });
259
        $("#loader").hide();
260
        $("#output").fadeIn("slow"); //show if any language loaded
261
    } else {
262
        langarrId += plugin;
263
        $('span[class*=lang_plugin_'+plugin.toLowerCase()+'_]').each(function translate(i) {
264
            langId = this.className.substring(5);
265
            langStr = langarr[langarrId][langId];
266
            if (langStr !== undefined) {
267
                if (langStr.length > 0) {
268
                    this.innerHTML = langStr;
269
                }
270
            }
271
        });
272
        $('#panel_'+plugin).show(); //show plugin if any language loaded
273
    }
274
}
275
 
276
/**
277
 * generate the filesystemTable and activate the dataTables plugin on it
278
 */
279
function filesystemtable() {
280
    var html = "";
281
    html += "<h2>" + genlang(30) + "</h2>\n";
282
    html += "        <div style=\"overflow-x:auto;\">\n";
283
    html += "          <table id=\"filesystemTable\" style=\"border-collapse:collapse;\">\n";
284
    html += "            <thead>\n";
285
    html += "              <tr>\n";
286
    html += "                <th>" + genlang(31) + "</th>\n";
287
    html += "                <th>" + genlang(34) + "</th>\n";
288
    html += "                <th>" + genlang(32) + "</th>\n";
289
    html += "                <th>" + genlang(33) + "</th>\n";
290
    html += "                <th class=\"right\">" + genlang(35) + "</th>\n";
291
    html += "                <th class=\"right\">" + genlang(36) + "</th>\n";
292
    html += "                <th class=\"right\">" + genlang(37) + "</th>\n";
293
    html += "              </tr>\n";
294
    html += "            </thead>\n";
2976 rexy 295
    if (showTotals) {
296
        html += "            <tfoot>\n";
297
        html += "              <tr style=\"font-weight : bold\">\n";
298
        html += "                <td>&nbsp;</td>\n";
299
        html += "                <td>&nbsp;</td>\n";
300
        html += "                <td>" + genlang(38) + "</td>\n";
301
        html += "                <td id=\"s_fs_total\"></td>\n";
302
        html += "                <td class=\"right\"><span id=\"s_fs_tfree\"></span></td>\n";
303
        html += "                <td class=\"right\"><span id=\"s_fs_tused\"></span></td>\n";
304
        html += "                <td class=\"right\"><span id=\"s_fs_tsize\"></span></td>\n";
305
        html += "              </tr>\n";
306
        html += "            </tfoot>\n";
307
    }
2788 rexy 308
    html += "            <tbody>\n";
309
    html += "            </tbody>\n";
310
    html += "          </table>\n";
311
    html += "        </div>\n";
312
 
313
    $("#filesystem").append(html);
314
 
315
    filesystemTable = $("#filesystemTable").dataTable({
316
        "bPaginate": false,
317
        "bLengthChange": false,
318
        "bFilter": false,
319
        "bSort": true,
320
        "bInfo": false,
321
        "bProcessing": true,
322
        "bAutoWidth": false,
323
        "bStateSave": true,
324
        "aoColumns": [{
325
            "sType": 'span-string',
326
            "sWidth": "100px"
327
        }, {
328
            "sType": 'span-string',
329
            "sWidth": "50px"
330
        }, {
331
            "sType": 'span-string',
332
            "sWidth": "200px"
333
        }, {
334
            "sType": 'span-number'
335
        }, {
336
            "sType": 'span-number',
337
            "sWidth": "80px",
338
            "sClass": "right"
339
        }, {
340
            "sType": 'span-number',
341
            "sWidth": "80px",
342
            "sClass": "right"
343
        }, {
344
            "sType": 'span-number',
345
            "sWidth": "80px",
346
            "sClass": "right"
347
        }]
348
    });
349
}
350
 
351
/**
352
 * fill all errors from the xml in the error div element in the document and show the error icon
353
 * @param {jQuery} xml phpSysInfo-XML
354
 */
355
function populateErrors(xml) {
356
    var values = false;
357
    $("Errors Error", xml).each(function getError(id) {
358
//        $("#errorlist").append("<b>" + $(this).attr("Function") + "</b><br><br><pre>" + $(this).text() + "</pre><hr>");
359
        $("#errorlist").append("<b>" + $(this).attr("Function") + "</b><br><br><pre>" + $(this).attr("Message") + "</pre><hr>");
360
        values = true;
361
    });
362
    if (values) {
363
        $("#warn").css("display", "inline");
364
        $("#loadwarn").css("display", "inline");
365
    }
366
}
367
 
368
/**
369
 * show the page
370
 * @param {jQuery} xml phpSysInfo-XML
371
 */
372
function displayPage(xml) {
373
    var versioni = "";
374
//    $("#loader").hide();
375
//    $("#output").fadeIn("slow");
376
    versioni = $("Generation", xml).attr("version").toString();
377
    $("#version").html(versioni);
378
}
379
 
380
/**
381
 * format seconds to a better readable statement with days, hours and minutes
382
 * @param {Number} sec seconds that should be formatted
383
 * @return {String} html string with no breaking spaces and translation statements
384
 */
385
function formatUptime(sec) {
386
    var txt = "", intMin = 0, intHours = 0, intDays = 0;
387
    intMin = sec / 60;
388
    intHours = intMin / 60;
389
    intDays = Math.floor(intHours / 24);
390
    intHours = Math.floor(intHours - (intDays * 24));
391
    intMin = Math.floor(intMin - (intDays * 60 * 24) - (intHours * 60));
392
    if (intDays) {
393
        txt += intDays.toString() + " " + genlang(48) + " ";
394
    }
395
    if (intHours) {
396
        txt += intHours.toString() + " " + genlang(49) + " ";
397
    }
398
    return txt + intMin.toString() + " " + genlang(50);
399
}
400
 
401
/**
402
 * format a given MHz value to a better readable statement with the right suffix
403
 * @param {Number} mhertz mhertz value that should be formatted
404
 * @return {String} html string with no breaking spaces and translation statements
405
 */
406
function formatHertz(mhertz) {
407
    if ((mhertz >= 0) && (mhertz < 1000)) {
408
< 1000)) {        return mhertz.toString() + " " + genlang(92);
409
< 1000)) {    } else {
410
< 1000)) {        if (mhertz >= 1000) {
411
< 1000)) {            return round(mhertz / 1000, 2) + "&nbsp;" + genlang(93);
412
< 1000)) {        } else {
413
< 1000)) {            return "";
414
< 1000)) {        }
415
< 1000)) {    }
416
< 1000)) {}
417
 
418
< 1000)) {/**
2976 rexy 419
< 1000)) { * format a given MT/s value to a better readable statement with the right suffix
420
< 1000)) { * @param {Number} mtps mtps value that should be formatted
421
< 1000)) { * @return {String} html string with no breaking spaces and translation statements
422
< 1000)) { */
423
< 1000)) {function formatMTps(mtps) {
424
< 1000)) {    if ((mtps >= 0) && (mtps < 1000)) {
425
< 1000)) {        return mtps.toString() + "&nbsp;" + genlang(131);
426
< 1000)) {    } else {
427
< 1000)) {        if (mtps >= 1000) {
428
< 1000)) {            return round(mtps / 1000, 2) + " " + genlang(132);
429
< 1000)) {        } else {
430
< 1000)) {            return "";
431
< 1000)) {        }
432
< 1000)) {    }
433
< 1000)) {}
434
 
435
< 1000)) {/**
2788 rexy 436
< 1000)) { * format the byte values into a user friendly value with the corespondenting unit expression<br>support is included
437
< 1000)) { * for binary and decimal output<br>user can specify a constant format for all byte outputs or the output is formated
438
< 1000)) { * automatically so that every value can be read in a user friendly way
439
< 1000)) { * @param {Number} bytes value that should be converted in the corespondenting format, which is specified in the phpsysinfo.ini
440
< 1000)) { * @param {jQuery} xml phpSysInfo-XML
441
< 1000)) { * @return {String} string of the converted bytes with the translated unit expression
442
< 1000)) { */
443
< 1000)) {function formatBytes(bytes, xml) {
444
< 1000)) {    var byteFormat = "", show = "";
445
 
446
< 1000)) {    $("Options", xml).each(function getByteFormat(id) {
447
< 1000)) {        byteFormat = $(this).attr("byteFormat");
448
< 1000)) {    });
449
 
450
< 1000)) {    switch (byteFormat.toLowerCase()) {
451
< 1000)) {    case "pib":
452
< 1000)) {        show += round(bytes / Math.pow(1024, 5), 2);
453
< 1000)) {        show += "&nbsp;" + genlang(90);
454
< 1000)) {        break;
455
< 1000)) {    case "tib":
456
< 1000)) {        show += round(bytes / Math.pow(1024, 4), 2);
457
< 1000)) {        show += " " + genlang(86);
458
< 1000)) {        break;
459
< 1000)) {    case "gib":
460
< 1000)) {        show += round(bytes / Math.pow(1024, 3), 2);
461
< 1000)) {        show += "&nbsp;" + genlang(87);
462
< 1000)) {        break;
463
< 1000)) {    case "mib":
464
< 1000)) {        show += round(bytes / Math.pow(1024, 2), 2);
465
< 1000)) {        show += " " + genlang(88);
466
< 1000)) {        break;
467
< 1000)) {    case "kib":
468
< 1000)) {        show += round(bytes / Math.pow(1024, 1), 2);
469
< 1000)) {        show += "&nbsp;" + genlang(89);
470
< 1000)) {        break;
471
< 1000)) {    case "pb":
472
< 1000)) {        show += round(bytes / Math.pow(1000, 5), 2);
473
< 1000)) {        show += " " + genlang(91);
474
< 1000)) {        break;
475
< 1000)) {    case "tb":
476
< 1000)) {        show += round(bytes / Math.pow(1000, 4), 2);
477
< 1000)) {        show += "&nbsp;" + genlang(85);
478
< 1000)) {        break;
479
< 1000)) {    case "gb":
480
< 1000)) {        show += round(bytes / Math.pow(1000, 3), 2);
481
< 1000)) {        show += " " + genlang(41);
482
< 1000)) {        break;
483
< 1000)) {    case "mb":
484
< 1000)) {        show += round(bytes / Math.pow(1000, 2), 2);
485
< 1000)) {        show += "&nbsp;" + genlang(40);
486
< 1000)) {        break;
487
< 1000)) {    case "kb":
488
< 1000)) {        show += round(bytes / Math.pow(1000, 1), 2);
489
< 1000)) {        show += " " + genlang(39);
490
< 1000)) {        break;
491
< 1000)) {    case "b":
492
< 1000)) {        show += bytes;
493
< 1000)) {        show += " " + genlang(96);
494
< 1000)) {        break;
495
< 1000)) {    case "auto_decimal":
496
< 1000)) {        if (bytes > Math.pow(1000, 5)) {
497
< 1000)) {            show += round(bytes / Math.pow(1000, 5), 2);
498
< 1000)) {            show += "&nbsp;" + genlang(91);
499
< 1000)) {        } else {
500
< 1000)) {            if (bytes > Math.pow(1000, 4)) {
501
< 1000)) {                show += round(bytes / Math.pow(1000, 4), 2);
502
< 1000)) {                show += " " + genlang(85);
503
< 1000)) {            } else {
504
< 1000)) {                if (bytes > Math.pow(1000, 3)) {
505
< 1000)) {                    show += round(bytes / Math.pow(1000, 3), 2);
506
< 1000)) {                    show += "&nbsp;" + genlang(41);
507
< 1000)) {                } else {
508
< 1000)) {                    if (bytes > Math.pow(1000, 2)) {
509
< 1000)) {                        show += round(bytes / Math.pow(1000, 2), 2);
510
< 1000)) {                        show += " " + genlang(40);
511
< 1000)) {                    } else {
512
< 1000)) {                        if (bytes > Math.pow(1000, 1)) {
513
< 1000)) {                            show += round(bytes / Math.pow(1000, 1), 2);
514
< 1000)) {                            show += "&nbsp;" + genlang(39);
515
< 1000)) {                        } else {
516
< 1000)) {                                show += bytes;
517
< 1000)) {                                show += "&nbsp;" + genlang(96);
518
< 1000)) {                        }
519
< 1000)) {                    }
520
< 1000)) {                }
521
< 1000)) {            }
522
< 1000)) {        }
523
< 1000)) {        break;
524
< 1000)) {    default:
525
< 1000)) {        if (bytes > Math.pow(1024, 5)) {
526
< 1000)) {            show += round(bytes / Math.pow(1024, 5), 2);
527
< 1000)) {            show += " " + genlang(90);
528
< 1000)) {        } else {
529
< 1000)) {            if (bytes > Math.pow(1024, 4)) {
530
< 1000)) {                show += round(bytes / Math.pow(1024, 4), 2);
531
< 1000)) {                show += "&nbsp;" + genlang(86);
532
< 1000)) {            } else {
533
< 1000)) {                if (bytes > Math.pow(1024, 3)) {
534
< 1000)) {                    show += round(bytes / Math.pow(1024, 3), 2);
535
< 1000)) {                    show += " " + genlang(87);
536
< 1000)) {                } else {
537
< 1000)) {                    if (bytes > Math.pow(1024, 2)) {
538
< 1000)) {                        show += round(bytes / Math.pow(1024, 2), 2);
539
< 1000)) {                        show += "&nbsp;" + genlang(88);
540
< 1000)) {                    } else {
541
< 1000)) {                        if (bytes > Math.pow(1024, 1)) {
542
< 1000)) {                            show += round(bytes / Math.pow(1024, 1), 2);
543
< 1000)) {                            show += " " + genlang(89);
544
< 1000)) {                        } else {
545
< 1000)) {                            show += bytes;
546
< 1000)) {                            show += " " + genlang(96);
547
< 1000)) {                        }
548
< 1000)) {                    }
549
< 1000)) {                }
550
< 1000)) {            }
551
< 1000)) {        }
552
< 1000)) {    }
553
< 1000)) {    return show;
554
< 1000)) {}
555
 
556
< 1000)) {function formatBPS(bps) {
557
< 1000)) {    var show = "";
558
 
559
< 1000)) {    if (bps > Math.pow(1000, 5)) {
560
< 1000)) {        show += round(bps / Math.pow(1000, 5), 2);
561
< 1000)) {        show += String.fromCharCode(160) + 'Pb/s';
562
< 1000)) {    } else {
563
< 1000)) {        if (bps > Math.pow(1000, 4)) {
564
< 1000)) {            show += round(bps / Math.pow(1000, 4), 2);
565
< 1000)) {            show += String.fromCharCode(160) + 'Tb/s';
566
< 1000)) {        } else {
567
< 1000)) {            if (bps > Math.pow(1000, 3)) {
568
< 1000)) {                show += round(bps / Math.pow(1000, 3), 2);
569
< 1000)) {                show += String.fromCharCode(160) + 'Gb/s';
570
< 1000)) {            } else {
571
< 1000)) {                if (bps > Math.pow(1000, 2)) {
572
< 1000)) {                    show += round(bps / Math.pow(1000, 2), 2);
573
< 1000)) {                    show += String.fromCharCode(160) + 'Mb/s';
574
< 1000)) {                } else {
575
< 1000)) {                    if (bps > Math.pow(1000, 1)) {
576
< 1000)) {                        show += round(bps / Math.pow(1000, 1), 2);
577
< 1000)) {                        show += String.fromCharCode(160) + 'Kb/s';
578
< 1000)) {                    } else {
579
< 1000)) {                            show += bps;
580
< 1000)) {                            show += String.fromCharCode(160) + 'b/s';
581
< 1000)) {                    }
582
< 1000)) {                }
583
< 1000)) {            }
584
< 1000)) {        }
585
< 1000)) {    }
586
< 1000)) {    return show;
587
< 1000)) {}
588
 
589
< 1000)) {/**
590
< 1000)) { * format a celcius temperature to fahrenheit and also append the right suffix
591
< 1000)) { * @param {String} degreeC temperature in celvius
592
< 1000)) { * @param {jQuery} xml phpSysInfo-XML
593
< 1000)) { * @return {String} html string with no breaking spaces and translation statements
594
< 1000)) { */
595
< 1000)) {function formatTemp(degreeC, xml) {
596
< 1000)) {    var tempFormat = "", degree = 0;
597
 
598
< 1000)) {    $("Options", xml).each(function getOptions(id) {
599
< 1000)) {        tempFormat = $(this).attr("tempFormat").toString().toLowerCase();
600
< 1000)) {    });
601
 
602
< 1000)) {    degree = parseFloat(degreeC);
603
< 1000)) {    if (isNaN(degreeC)) {
604
< 1000)) {        return "---";
605
< 1000)) {    } else {
606
< 1000)) {        switch (tempFormat) {
607
< 1000)) {        case "f":
608
< 1000)) {            return round((((9 * degree) / 5) + 32), 1) + "&nbsp;" + genlang(61);
609
< 1000)) {        case "c":
610
< 1000)) {            return round(degree, 1) + "&nbsp;" + genlang(60);
611
< 1000)) {        case "c-f":
612
< 1000)) {            return round(degree, 1) + "&nbsp;" + genlang(60) + "<br><i>(" + round((((9 * degree) / 5) + 32), 1) + " " + genlang(61) + ")i>";
613
< 1000)) {        case "f-c":
614
< 1000)) {            return round((((9 * degree) / 5) + 32), 1) + "&nbsp;" + genlang(61) + "<br><i>(" + round(degree, 1) + "&nbsp;" + genlang(60) + ")</i>";
615
< 1000)) {        }
616
< 1000)) {    }
617
< 1000)) {}
618
 
619
< 1000)) {/**
620
< 1000)) { * create a visual HTML bar from a given size, the layout of that bar can be costumized through the bar css-class
621
< 1000)) { * @param {Number} size barclass
622
< 1000)) { * @return {String} HTML string which contains the full layout of the bar
623
< 1000)) { */
624
< 1000)) {function createBar(size, barclass) {
625
< 1000)) {    if (barclass === undefined) {
626
< 1000)) {        barclass = "bar";
627
< 1000)) {    }
628
< 1000)) {    return "
 div>&nbsp;" + size + "%";
629
< 1000)) {
}
630
 
631
< 1000)) {
/**
632
< 1000)) {
* (re)fill the vitals block with the values from the given xml
633
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
634
< 1000)) {
*/
635
< 1000)) {
function refreshVitals(xml) {
3037 rexy 636
< 1000)) {
var hostname = "", ip = "", stripid = 0;
637
 
638
< 1000)) {
function setAndStrip(id, value) {
639
< 1000)) {
if (value !== "") {
640
< 1000)) {
$(id).html(value);
641
< 1000)) {
if (stripid%2 === 1) {
642
< 1000)) {
$(id).closest('tr').addClass('even');
643
< 1000)) {
} else {
644
< 1000)) {
$(id).closest('tr').removeClass('even');
645
< 1000)) {
}
646
< 1000)) {
$(id).closest('tr').css("display", "");
647
< 1000)) {
stripid++;
648
< 1000)) {
} else {
649
< 1000)) {
$(id).closest('tr').css("display", "none");
650
< 1000)) {
}
651
< 1000)) {
}
652
 
2788 rexy 653
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) {
654
< 1000)) {
$("#vitals").remove();
655
< 1000)) {
$("Vitals", xml).each(function getVitals(id) {
656
< 1000)) {
hostname = $(this).attr("Hostname");
657
< 1000)) {
ip = $(this).attr("IPAddr");
658
< 1000)) {
document.title = "System information: " + hostname + " (" + ip + ")";
659
< 1000)) {
$("#s_hostname_title").html(hostname);
660
< 1000)) {
$("#s_ip_title").html(ip);
661
< 1000)) {
});
662
< 1000)) {
return;
663
< 1000)) {
}
664
 
665
< 1000)) {
var kernel = "", distro = "", icon = "", uptime = "", users = 0, loadavg = "", os = "";
666
< 1000)) {
var processes = 0, prunning = 0, psleeping = 0, pstopped = 0, pzombie = 0, pwaiting = 0, pother = 0;
667
< 1000)) {
var syslang = "", codepage = "";
668
< 1000)) {
var lastboot = 0;
669
< 1000)) {
var timestamp = parseInt($("Generation", xml).attr("timestamp"), 10)*1000; //server time
670
< 1000)) {
var not_first = false;
671
< 1000)) {
var datetimeFormat = "";
672
< 1000)) {
if (isNaN(timestamp)) timestamp = Number(new Date()); //client time
673
 
674
< 1000)) {
$("Options", xml).each(function getDatetimeFormat(id) {
675
< 1000)) {
datetimeFormat = $(this).attr("datetimeFormat");
676
< 1000)) {
});
677
 
678
< 1000)) {
$("Vitals", xml).each(function getVitals(id) {
679
< 1000)) {
hostname = $(this).attr("Hostname");
680
< 1000)) {
ip = $(this).attr("IPAddr");
681
< 1000)) {
kernel = $(this).attr("Kernel");
682
< 1000)) {
distro = $(this).attr("Distro");
683
< 1000)) {
icon = $(this).attr("Distroicon");
684
< 1000)) {
os = $(this).attr("OS");
685
< 1000)) {
uptime = formatUptime(parseInt($(this).attr("Uptime"), 10));
686
< 1000)) {
lastboot = new Date(timestamp - (parseInt($(this).attr("Uptime"), 10)*1000));
687
< 1000)) {
users = parseInt($(this).attr("Users"), 10);
688
< 1000)) {
loadavg = $(this).attr("LoadAvg");
689
< 1000)) {
if ($(this).attr("CPULoad") !== undefined) {
690
< 1000)) {
loadavg = loadavg + "<br>" + createBar(parseInt($(this).attr("CPULoad"), 10));
691
< 1000)) {
}
692
< 1000)) {
if ($(this).attr("SysLang") !== undefined) {
693
< 1000)) {
syslang = $(this).attr("SysLang");
694
< 1000)) {
}
695
 
696
< 1000)) {
if ($(this).attr("CodePage") !== undefined) {
697
< 1000)) {
codepage = $(this).attr("CodePage");
698
< 1000)) {
}
699
 
700
< 1000)) {
//processes
701
< 1000)) {
if ($(this).attr("Processes") !== undefined) {
702
< 1000)) {
processes = parseInt($(this).attr("Processes"), 10);
703
< 1000)) {
}
704
< 1000)) {
if ($(this).attr("ProcessesRunning") !== undefined) {
705
< 1000)) {
prunning = parseInt($(this).attr("ProcessesRunning"), 10);
706
< 1000)) {
}
707
< 1000)) {
if ($(this).attr("ProcessesSleeping") !== undefined) {
708
< 1000)) {
psleeping = parseInt($(this).attr("ProcessesSleeping"), 10);
709
< 1000)) {
}
710
< 1000)) {
if ($(this).attr("ProcessesStopped") !== undefined) {
711
< 1000)) {
pstopped = parseInt($(this).attr("ProcessesStopped"), 10);
712
< 1000)) {
}
713
< 1000)) {
if ($(this).attr("ProcessesZombie") !== undefined) {
714
< 1000)) {
pzombie = parseInt($(this).attr("ProcessesZombie"), 10);
715
< 1000)) {
}
716
< 1000)) {
if ($(this).attr("ProcessesWaiting") !== undefined) {
717
< 1000)) {
pwaiting = parseInt($(this).attr("ProcessesWaiting"), 10);
718
< 1000)) {
}
719
< 1000)) {
if ($(this).attr("ProcessesOther") !== undefined) {
720
< 1000)) {
pother = parseInt($(this).attr("ProcessesOther"), 10);
721
< 1000)) {
}
722
 
2976 rexy 723
< 1000)) {
document.title = "System information: " + hostname + " (" + ip + ")";
2788 rexy 724
< 1000)) {
$("#s_hostname_title").html(hostname);
3037 rexy 725
< 1000)) {
$("#s_ip_title").html(ip);
726
< 1000)) {
setAndStrip("#s_hostname", hostname);
727
< 1000)) {
setAndStrip("#s_ip", ip);
728
< 1000)) {
setAndStrip("#s_kernel", kernel);
729
< 1000)) {
setAndStrip("#s_distro", "<img src='./gfx/images/" + icon + "' alt='Icon' title='' style='width:16px;height:16px;vertical-align:middle;' onload='PNGload($(this));' /> " + distro); //onload IE6 PNG fix
730
< 1000)) {
setAndStrip("#s_os", "</FONT></B>OSIcon<B><FONT COLOR="#BC8F8F">
731
< 1000)) {
if ((datetimeFormat !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
3037 rexy 733
< 1000)) {
} else {
735
< 1000)) {
setAndStrip("#s_lastboot", lastboot.toUTCString());
2788 rexy 737
< 1000)) {
//deprecated
3037 rexy 739
< 1000)) {
}
741
< 1000)) {
setAndStrip("#s_users", users);
743
< 1000)) {
setAndStrip("#s_syslang", syslang);
745
< 1000)) {
setAndStrip("#s_processes", processes);
747
< 1000)) {
$("#s_processes").append(" (");
2788 rexy 749
< 1000)) {
for (var proc_type in typelist) {
751
< 1000)) {
if (not_first) {
3037 rexy 753
< 1000)) {
}
3037 rexy 755
< 1000)) {
not_first = true;
757
< 1000)) {
}
3037 rexy 759
< 1000)) {
}
761
< 1000)) {
}
763
 
764
 
765
< 1000)) {
* build the cpu information as table rows
767
< 1000)) {
* @param {Array} tree array that holds the positions for treetable plugin
769
< 1000)) {
* @param {Array} collapsed array that holds all collapsed elements hwne opening page
771
< 1000)) {
function fillCpu(xml, tree, rootposition, collapsed) {
773
< 1000)) {
$("Hardware CPU CpuCore", xml).each(function getCpuCore(cpuCoreId) {
3037 rexy 775
< 1000)) {
cpucount++;
777
< 1000)) {
voltage = $(this).attr("Voltage");
2788 rexy 779
< 1000)) {
speedmax = parseInt($(this).attr("CpuSpeedMax"), 10);
781
< 1000)) {
cache = parseInt($(this).attr("Cache"), 10);
783
< 1000)) {
bus = parseInt($(this).attr("BusSpeed"), 10);
785
< 1000)) {
bogo = parseInt($(this).attr("Bogomips"), 10);
787
< 1000)) {
load = parseInt($(this).attr("Load"), 10);
789
 
790
< 1000)) {
collapsed.push(rootposition);
792
< 1000)) {
if (!isNaN(load) && showCPULoadCompact) {
794
< 1000)) {
} else {
796
< 1000)) {
}
798
< 1000)) {
if (!showCPUInfoExpanded) {
800
< 1000)) {
}
802
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(13) + ":</span></div></td><td>" + formatHertz(speed) + "</td></tr>\n";
804
< 1000)) {
}
806
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(100) + ":</span></div></td><td>" + formatHertz(speedmax) + "</td></tr>\n";
808
< 1000)) {
}
810
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(101) + ":</span></div></td><td>" + formatHertz(speedmin) + "</td></tr>\n";
812
< 1000)) {
}
814
< 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";
816
< 1000)) {
}
818
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(94) + ":</span></div></td><td>" + virt + "</td></tr>\n";
820
< 1000)) {
}
822
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(14) + ":</span></div></td><td>" + formatHertz(bus) + "</td></tr>\n";
824
< 1000)) {
}
3037 rexy 826
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " V</td></tr>\n";
828
< 1000)) {
}
2788 rexy 830
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(16) + ":</span></div></td><td>" + bogo.toString() + "</td></tr>\n";
832
< 1000)) {
}
834
< 1000)) {
if (!isNaN(temp)) {
836
< 1000)) {
tree.push(cpucoreposition);
838
< 1000)) {
*/
840
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(122) + ":</span></div></td><td>" + manufacturer + "</td></tr>\n";
842
< 1000)) {
}
844
< 1000)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(9) + ":</span></div></td><td>" + createBar(load) + "</td></tr>\n";
846
< 1000)) {
}
848
< 1000)) {
if (cpucount === 0) {
850
< 1000)) {
tree.push(rootposition);
852
< 1000)) {
return html;
854
< 1000)) {
function countCpu(xml) {
857
< 1000)) {
$("Hardware CPU CpuCore", xml).each(function getCpuCore(cpuCoreId) {
859
< 1000)) {
});
861
< 1000)) {
}
863
 
864
< 1000)) {
* build rows for a treetable out of the hardwaredevices
866
< 1000)) {
* @param {String} type type of the hardware device
868
< 1000)) {
* @param {Number} rootposition position of the parent element
870
< 1000)) {
function fillHWDevice(xml, type, tree, rootposition) {
872
< 1000)) {
$("Hardware " + type + ((type=="MEM")?" Chip":" Device"), xml).each(function getHWDevice(deviceId) {
874
< 1000)) {
devicecount++;
877
< 1000)) {
capacity = parseInt($(this).attr("Capacity"), 10);
879
< 1000)) {
product = $(this).attr("Product");
2976 rexy 881
< 1000)) {
voltage = parseFloat($(this).attr("Voltage"));
2788 rexy 883
< 1000)) {
count = parseInt($(this).attr("Count"), 10);
885
< 1000)) {
name = "(" + count + "x) " + name;
887
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + name + "</span></div></td></tr>\n";
889
< 1000)) {
if (!isNaN(capacity)) {
891
< 1000)) {
tree.push(devcoreposition);
893
< 1000)) {
if (manufacturer!== undefined) {
895
< 1000)) {
tree.push(devcoreposition);
897
< 1000)) {
if (product !== undefined) {
899
< 1000)) {
tree.push(devcoreposition);
901
< 1000)) {
if (!isNaN(speed)) {
903
< 1000)) {
tree.push(devcoreposition);
905
< 1000)) {
if (!isNaN(voltage)) {
907
< 1000)) {
tree.push(devcoreposition);
909
< 1000)) {
if (serial !== undefined) {
911
< 1000)) {
tree.push(devcoreposition);
913
< 1000)) {
});
915
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(42) + "</span></div></td></tr>\n";
917
< 1000)) {
}
919
< 1000)) {
}
921
 
922
< 1000)) {
var devicecount = 0;
2976 rexy 924
< 1000)) {
devicecount++;
926
< 1000)) {
return devicecount;
928
< 1000)) {
/**
931
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
933
< 1000)) {
function refreshHardware(xml) {
935
< 1000)) {
hardware', blocks) < 0))) {
936
< 1000)) {
return;
938
< 1000)) {
var html = "", tree = [], closed = [], index = 0, machine = "", virtualizer = "";
2788 rexy 941
< 1000)) {
html += "<h2>" + genlang(10) + "</h2>\n";
943
< 1000)) {
html += " <table id=\"HardwareTree\" class=\"tablemain\">\n";
945
< 1000)) {
$("Hardware", xml).each(function getMachine(id) {
948
< 1000)) {
});
3037 rexy 950
< 1000)) {
virtualizer = $(this).attr("Virtualizer");
952
< 1000)) {
if ((machine !== undefined) && (machine !== "")) {
955
< 1000)) {
html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + machine + "</span></div></td></tr>\n";
957
< 1000)) {
}
959
 
3037 rexy 960
< 1000)) {
html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(134) + "</span></div></td></tr>\n";
962
< 1000)) {
tree.push(tree.push(0));
964
< 1000)) {
if (countCpu(xml)) {
966
< 1000)) {
html += fillCpu(xml, tree, tree.push(0), closed);
968
< 1000)) {
var typelist = {MEM:130,PCI:17,IDE:18,SCSI:19,NVMe:126,USB:20,TB:117,I2C:118};
2788 rexy 971
< 1000)) {
if (countHWDevice(xml, dev_type)) {
973
< 1000)) {
index = tree.push(0);
975
< 1000)) {
html += fillHWDevice(xml, dev_type, tree, index);
977
< 1000)) {
}
979
 
980
< 1000)) {
html += " </table>\n";
982
< 1000)) {
$("#hardware").append(html);
984
 
985
< 1000)) {
openImg: "./gfx/treeTable/tv-collapsable.gif",
987
< 1000)) {
leafImg: "./gfx/treeTable/tv-item.gif",
989
< 1000)) {
lastShutImg: "./gfx/treeTable/tv-expandable-last.gif",
991
< 1000)) {
vertLineImg: "./gfx/treeTable/vertline.gif",
993
< 1000)) {
collapse: closed,
995
< 1000)) {
striped: true,
997
< 1000)) {
state: false
999
< 1000)) {
}
1001
 
1002
< 1000)) {
*(re)fill the network block with the values from the given xml
1004
< 1000)) {
*/
1006
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('network', blocks) < 0))) {
1008
< 1000)) {
return;
1010
< 1000)) {
var tree = [], closed = [], html0= "", html1= "" ,html = "", isinfo = false, preoldnetwork = [], timestamp;
1013
 
1014
< 1000)) {
html0 += "<h2>" + genlang(21) + "</h2>\n";
1017
 
1018
< 1000)) {
html1 += " <tr>\n";
1020
< 1000)) {
html1 += " <th class=\"right\" style=\"width:17.7%;\">" + genlang(23) + "</th>\n";
1022
< 1000)) {
html1 += " <th class=\"right\" style=\"width:17.7%;\">" + genlang(25) + "</th>\n";
2788 rexy 1024
< 1000)) {
html1 += " </thead>\n";
1026
 
1027
< 1000)) {
$("Generation", xml).each(function getTimestamp(id) {
1029
< 1000)) {
});
1031
< 1000)) {
$("Network NetDevice", xml).each(function getDevice(id) {
1034
< 1000)) {
', htmltx = '';
1035
< 1000)) {
rx = parseInt($(this).attr("RxBytes"), 10);
1037
< 1000)) {
er = parseInt($(this).attr("Err"), 10);
1039
< 1000)) {
if (showNetworkActiveSpeed && ($.inArray(name, oldnetwork) >= 0)) {
1042
< 1000)) {
if (((diff = rx - oldnetwork[name].rx) > 0) && ((difftime = timestamp - oldnetwork[name].timestamp) > 0)) {
1044
< 1000)) {
htmlrx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
1046
< 1000)) {
htmlrx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>";
1048
< 1000)) {
}
1050
< 1000)) {
if (showNetworkActiveSpeed == 2) {
1052
< 1000)) {
} else {
1054
< 1000)) {
}
1056
< 1000)) {
}
1058
 
1059
< 1000)) {
networkindex = tree.push(0);
1062
 
1063
< 1000)) {
preoldnetwork.pushIfNotExist(name);
1065
< 1000)) {
}
1067
 
1068
< 1000)) {
if ( (info !== undefined) && (info !== "") ) {
1070
< 1000)) {
isinfo = true;
1072
< 1000)) {
html +="<tr><td colspan=\"4\"><div class=\"treediv\"><span class=\"treespan\">" + infos[i] + "</span></div></td></tr>";
1074
< 1000)) {
}
1076
< 1000)) {
closed.push(networkindex);
1078
< 1000)) {
}
1080
< 1000)) {
html += " </tbody>\n";
1082
< 1000)) {
html += "</div>\n";
1084
< 1000)) {
if (isinfo) {
1086
< 1000)) {
html1 += " <tbody class=\"tree\">\n";
1088
< 1000)) {
html0 += " <table id=\"NetworkTree\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
1090
< 1000)) {
}
1092
< 1000)) {
if (isinfo) $("#NetworkTree").jqTreeTable(tree, {
1095
< 1000)) {
shutImg: "./gfx/treeTable/tv-expandable.gif",
1097
< 1000)) {
lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1099
< 1000)) {
lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1101
< 1000)) {
blankImg: "./gfx/treeTable/blank.gif",
1103
< 1000)) {
column: 0,
1105
< 1000)) {
highlight: false,
1107
< 1000)) {
});
1109
 
1110
< 1000)) {
while (oldnetwork.length > 0) {
1112
< 1000)) {
oldnetwork.pop(); //remove last object reference from array
1114
< 1000)) {
oldnetwork = preoldnetwork;
1116
< 1000)) {
}
1118
 
1119
< 1000)) {
* (re)fill the memory block with the values from the given xml
1121
< 1000)) {
*/
1123
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('memory', blocks) < 0))) {
1125
< 1000)) {
return;
1127
< 1000)) {
var html = "", tree = [], closed = [];
1130
 
1131
< 1000)) {
html += "<h2>" + genlang(27) + "</h2>\n";
1133
< 1000)) {
html += " <table id=\"MemoryTree\" class=\"tablemain\">\n";
1135
< 1000)) {
html += " <tr>\n";
2976 rexy 1137
< 1000)) {
html += " <th style=\"width:33.3%;\">" + genlang(33) + "</th>\n";
1139
< 1000)) {
html += " <th class=\"right\" style=\"width:14.2%;\">" + genlang(36) + "</th>\n";
1141
< 1000)) {
html += " </tr>\n";
1143
< 1000)) {
html += " <tbody class=\"tree\">\n";
1145
 
1146
< 1000)) {
var free = 0, total = 0, used = 0, percent = 0, memoryindex = 0;
1148
< 1000)) {
used = parseInt($(this).attr("Used"), 10);
1150
< 1000)) {
percent = parseInt($(this).attr("Percent"), 10);
2976 rexy 1152
< 1000)) {
memoryindex = tree.push(0);
1154
 
1155
< 1000)) {
var app = 0, appp = 0, buff = 0, buffp = 0, cached = 0, cachedp = 0;
1157
< 1000)) {
appp = parseInt($(this).attr("AppPercent"), 10);
1159
< 1000)) {
buffp = parseInt($(this).attr("BuffersPercent"), 10);
1161
< 1000)) {
cachedp = parseInt($(this).attr("CachedPercent"), 10);
1163
< 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 1165
< 1000)) {
}
1167
< 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 1169
< 1000)) {
}
1171
< 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 1173
< 1000)) {
}
1175
< 1000)) {
if (!showMemoryInfosExpanded) {
1177
< 1000)) {
}
1179
< 1000)) {
});
1181
< 1000)) {
$("Memory Swap", xml).each(function getSwap(id) {
1183
< 1000)) {
free = parseInt($(this).attr("Free"), 10);
1185
< 1000)) {
total = parseInt($(this).attr("Total"), 10);
1187
< 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 1189
< 1000)) {
$("Memory Swap Mount", xml).each(function getDevices(id) {
1192
< 1000)) {
if (!showMemoryInfosExpanded) {
1194
< 1000)) {
}
1196
< 1000)) {
used = parseInt($(this).attr("Used"), 10);
1198
< 1000)) {
percent = parseInt($(this).attr("Percent"), 10);
1200
< 1000)) {
mpoint = $(this).attr("MountPoint");
1202
 
1203
< 1000)) {
mpoint = mpid;
1205
< 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 1208
< 1000)) {
});
1210
< 1000)) {
html += " </tbody>\n";
1213
< 1000)) {
html += "</div>\n";
1215
< 1000)) {
$("#MemoryTree").jqTreeTable(tree, {
1218
< 1000)) {
shutImg: "./gfx/treeTable/tv-expandable.gif",
1220
< 1000)) {
lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1222
< 1000)) {
lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1224
< 1000)) {
blankImg: "./gfx/treeTable/blank.gif",
1226
< 1000)) {
column: 0,
1228
< 1000)) {
highlight: false,
1230
< 1000)) {
});
1232
 
1233
< 1000)) {
/**
1236
< 1000)) {
* appends the filesystems (each in a row) to the filesystem table in the tbody<br>before the rows are inserted the entire
1238
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
1240
< 1000)) {
function refreshFilesystems(xml) {
1242
< 1000)) {
filesystem', blocks) < 0))) {
1243
< 1000)) {
return;
1245
< 1000)) {
var total_usage = 0, total_used = 0, total_free = 0, total_size = 0, threshold = 0;
1248
 
1249
< 1000)) {
$("Options", xml).each(function getThreshold(id) {
1252
< 1000)) {
});
1254
 
1255
< 1000)) {
var mpoint = "", mpid = 0, type = "", name = "", free = 0, used = 0, size = 0, percent = 0, options = "", inodes = 0, inodes_text = "", options_text = "", ignore = 0;
1257
< 1000)) {
type = $(this).attr("FSType");
1259
< 1000)) {
free = parseInt($(this).attr("Free"), 10);
1261
< 1000)) {
size = parseInt($(this).attr("Total"), 10);
1263
< 1000)) {
options = $(this).attr("MountOptions");
1265
< 1000)) {
mpoint = $(this).attr("MountPoint");
1267
< 1000)) {
if (mpoint === undefined) {
1270
< 1000)) {
}
1272
< 1000)) {
options_text = "<br><i>(" + options + ")</i>";
1274
< 1000)) {
if (!isNaN(inodes)) {
1276
< 1000)) {
}
3037 rexy 1278
< 1000)) {
type = "";
1280
< 1000)) {
if (!isNaN(ignore) && (ignore > 0) && showTotals) {
1283
< 1000)) {
if ((ignore == 3) && !isNaN(threshold) && (percent >= threshold)) {
2788 rexy 1285
< 1000)) {
} else {
1287
< 1000)) {
}
1289
< 1000)) {
if (!isNaN(threshold) && (percent >= threshold)) {
1291
< 1000)) {
} else {
1293
< 1000)) {
}
1295
< 1000)) {
} else {
2976 rexy 1297
< 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") + 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)]);
1299
< 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) + 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)]);
1301
< 1000)) {
}
2976 rexy 1303
< 1000)) {
if (!isNaN(ignore) && (ignore > 0)) {
1305
< 1000)) {
total_used += used;
1307
< 1000)) {
total_used += used;
1309
< 1000)) {
}
1311
< 1000)) {
total_used += used;
2976 rexy 1313
< 1000)) {
total_size += size;
2788 rexy 1315
< 1000)) {
total_usage = (total_size != 0) ? round(100 - (total_free / total_size) * 100, 2) : 0;
1317
< 1000)) {
});
1319
 
1320
< 1000)) {
if (!isNaN(threshold) && (total_usage >= threshold)) {
1322
< 1000)) {
} else {
2976 rexy 1324
< 1000)) {
}
2976 rexy 1326
< 1000)) {
$("#s_fs_tused").html(formatBytes(total_used, xml));
1328
< 1000)) {
}
1330
< 1000)) {
/**
1333
< 1000)) {
* build the block content for the temperature block, this includes normal temperature information in the XML
1335
< 1000)) {
* to avoid HTML warnings
1337
< 1000)) {
*/
1339
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('temperature', blocks) < 0))) {
1341
< 1000)) {
return;
1343
< 1000)) {
var values = false;
1346
< 1000)) {
$("MBInfo Temperature Item", xml).each(function getTemperatures(id) {
2976 rexy 1348
< 1000)) {
label = $(this).attr("Label");
1350
< 1000)) {
event = $(this).attr("Event");
1352
< 1000)) {
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1354
< 1000)) {
if (isFinite(limit))
1356
< 1000)) {
$("#temperatureTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + formatTemp(value, xml) + "</td><td class=\"right\">" + _limit + "</td></tr>");
1358
< 1000)) {
});
1360
< 1000)) {
$("#temperature").show();
1362
< 1000)) {
$("#temperature").hide();
1364
< 1000)) {
}
1366
 
1367
< 1000)) {
* (re)fill the voltage block with the values from the given xml<br><br>
1369
< 1000)) {
* entire table will be removed to avoid HTML warnings
1371
< 1000)) {
*/
1373
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('voltage', blocks) < 0))) {
1375
< 1000)) {
return;
1377
< 1000)) {
var values = false;
1380
< 1000)) {
$("MBInfo Voltage Item", xml).each(function getVoltages(id) {
2976 rexy 1382
< 1000)) {
label = $(this).attr("Label");
1384
< 1000)) {
event = $(this).attr("Event");
1386
< 1000)) {
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1388
< 1000)) {
if (isFinite(max))
1390
< 1000)) {
min = parseFloat($(this).attr("Min"));
1392
< 1000)) {
_min = round(min, 2) + "&nbsp;" + genlang(62);
1394
< 1000)) {
values = true;
1396
< 1000)) {
if (values) {
1398
< 1000)) {
} else {
1400
< 1000)) {
}
1402
< 1000)) {
/**
1405
< 1000)) {
* build the fan information into a separate block, if there is no fan information available the
1407
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
1409
< 1000)) {
function refreshFans(xml) {
1411
< 1000)) {
fans', blocks) < 0))) {
1412
< 1000)) {
return;
1414
< 1000)) {
var values = false;
1417
< 1000)) {
$("MBInfo Fans Item", xml).each(function getFans(id) {
2976 rexy 1419
< 1000)) {
label = $(this).attr("Label");
1421
< 1000)) {
event = $(this).attr("Event");
1423
< 1000)) {
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2976 rexy 1425
< 1000)) {
unit = $(this).attr("Unit");
1427
< 1000)) {
if (isFinite(min))
1429
< 1000)) {
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td><td class=\"right\">" + _min + "</td></tr>");
1431
< 1000)) {
if (isFinite(min))
1433
< 1000)) {
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value,0) + "&nbsp;" + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>");
1435
< 1000)) {
values = true;
1437
< 1000)) {
if (values) {
1439
< 1000)) {
} else {
1441
< 1000)) {
}
1443
< 1000)) {
/**
1446
< 1000)) {
* build the power information into a separate block, if there is no power information available the
1448
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
1450
< 1000)) {
function refreshPower(xml) {
1452
< 1000)) {
power', blocks) < 0))) {
1453
< 1000)) {
return;
1455
< 1000)) {
var values = false;
1458
< 1000)) {
$("MBInfo Power Item", xml).each(function getPowers(id) {
2976 rexy 1460
< 1000)) {
label = $(this).attr("Label");
1462
< 1000)) {
event = $(this).attr("Event");
1464
< 1000)) {
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1466
< 1000)) {
if (isFinite(limit))
1468
< 1000)) {
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + "&nbsp;" + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>");
1470
< 1000)) {
});
1472
< 1000)) {
$("#power").show();
1474
< 1000)) {
$("#power").hide();
1476
< 1000)) {
}
1478
 
1479
< 1000)) {
* (re)fill the current block with the values from the given xml<br><br>
1481
< 1000)) {
* entire table will be removed to avoid HTML warnings
1483
< 1000)) {
*/
1485
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('current', blocks) < 0))) {
1487
< 1000)) {
return;
1489
< 1000)) {
var values = false;
1492
< 1000)) {
$("MBInfo Current Item", xml).each(function getCurrents(id) {
2976 rexy 1494
< 1000)) {
label = $(this).attr("Label");
1496
< 1000)) {
event = $(this).attr("Event");
1498
< 1000)) {
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2788 rexy 1500
< 1000)) {
if (isFinite(max))
1502
< 1000)) {
min = parseFloat($(this).attr("Min"));
1504
< 1000)) {
_min = round(min, 2) + "&nbsp;" + genlang(106);
1506
< 1000)) {
values = true;
1508
< 1000)) {
if (values) {
1510
< 1000)) {
} else {
1512
< 1000)) {
}
1514
< 1000)) {
/**
1517
< 1000)) {
* build the other information into a separate block, if there is no other information available the
1519
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
1521
< 1000)) {
function refreshOther(xml) {
1523
< 1000)) {
other', blocks) < 0))) {
1524
< 1000)) {
return;
1526
< 1000)) {
var values = false;
1529
< 1000)) {
$("MBInfo Other Item", xml).each(function getOthers(id) {
2976 rexy 1531
< 1000)) {
label = $(this).attr("Label");
1533
< 1000)) {
event = $(this).attr("Event");
1535
< 1000)) {
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
2976 rexy 1537
< 1000)) {
if (unit === "%") {
1539
< 1000)) {
} else {
1541
< 1000)) {
}
2788 rexy 1543
< 1000)) {
});
1545
< 1000)) {
$("#other").show();
1547
< 1000)) {
$("#other").hide();
1549
< 1000)) {
}
1551
 
1552
< 1000)) {
* (re)fill the ups block with the values from the given xml<br><br>
1554
< 1000)) {
* entire table will be removed to avoid HTML warnings
1556
< 1000)) {
*/
1558
< 1000)) {
if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('ups', blocks) < 0))) {
1560
< 1000)) {
return;
1562
< 1000)) {
var add_apcupsd_cgi_links = ($("[ApcupsdCgiLinks='1']", xml).length > 0);
1565
< 1000)) {
html += "<h2>" + genlang(68) + "</h2>\n";
1567
< 1000)) {
html += " <table class=\"tablemain\" id=\"UPSTree\">\n";
1569
< 1000)) {
$("#ups").empty();
1572
< 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 1574
< 1000)) {
model = $(this).attr("Model");
1576
< 1000)) {
start_time = $(this).attr("StartTime");
1578
< 1000)) {
beeperstatus = $(this).attr("BeeperStatus");
2788 rexy 1580
 
1581
< 1000)) {
outages_count = $(this).attr("OutagesCount");
1583
< 1000)) {
last_outage_finish = $(this).attr("LastOutageFinish");
1585
< 1000)) {
line_frequency = $(this).attr("LineFrequency");
1587
< 1000)) {
battery_date = $(this).attr("BatteryDate");
1589
< 1000)) {
battery_charge_percent = parseInt($(this).attr("BatteryChargePercent"), 10);
1591
< 1000)) {
if (mode !== undefined) {
1594
< 1000)) {
} else {
1596
< 1000)) {
}
1598
< 1000)) {
if (model !== undefined) {
2976 rexy 1600
< 1000)) {
tree.push(index);
1602
< 1000)) {
if (start_time !== undefined) {
2976 rexy 1604
< 1000)) {
tree.push(index);
1606
< 1000)) {
if (upsstatus !== undefined) {
2976 rexy 1608
< 1000)) {
tree.push(index);
1610
< 1000)) {
if (beeperstatus !== undefined) {
1612
< 1000)) {
tree.push(index);
1614
< 1000)) {
if (temperature !== undefined) {
2976 rexy 1616
< 1000)) {
tree.push(index);
1618
< 1000)) {
if (outages_count !== undefined) {
2976 rexy 1620
< 1000)) {
tree.push(index);
1622
< 1000)) {
if (last_outage !== undefined) {
2976 rexy 1624
< 1000)) {
tree.push(index);
1626
< 1000)) {
if (last_outage_finish !== undefined) {
2976 rexy 1628
< 1000)) {
tree.push(index);
1630
< 1000)) {
if (line_voltage !== undefined) {
2976 rexy 1632
< 1000)) {
tree.push(index);
1634
< 1000)) {
if (line_frequency !== undefined) {
2976 rexy 1636
< 1000)) {
tree.push(index);
1638
< 1000)) {
if (!isNaN(load_percent)) {
2976 rexy 1640
< 1000)) {
tree.push(index);
1642
< 1000)) {
if (battery_date !== undefined) {
2976 rexy 1644
< 1000)) {
tree.push(index);
1646
< 1000)) {
if (battery_voltage !== undefined) {
2976 rexy 1648
< 1000)) {
tree.push(index);
1650
< 1000)) {
if (!isNaN(battery_charge_percent)) {
2976 rexy 1652
< 1000)) {
tree.push(index);
1654
< 1000)) {
if (time_left_minutes !== undefined) {
2976 rexy 1656
< 1000)) {
tree.push(index);
1658
< 1000)) {
values=true;
1660
< 1000)) {
html += " </tbody>\n";
1662
< 1000)) {
html += " </div>\n";
1664
< 1000)) {
html += " (<a title='details' href='/cgi-bin/apcupsd/multimon.cgi' target='apcupsdcgi'>" + genlang(99) + "a>)\n";
1666
< 1000)) {
$("#ups").append(html);
1669
 
1670
< 1000)) {
$("#UPSTree").jqTreeTable(tree, {
1672
< 1000)) {
shutImg: "./gfx/treeTable/tv-expandable.gif",
1674
< 1000)) {
lastOpenImg: "./gfx/treeTable/tv-collapsable-last.gif",
1676
< 1000)) {
lastLeafImg: "./gfx/treeTable/tv-item-last.gif",
1678
< 1000)) {
blankImg: "./gfx/treeTable/blank.gif",
1680
< 1000)) {
column: 0,
1682
< 1000)) {
highlight: false,
1684
< 1000)) {
});
1686
< 1000)) {
} else {
1688
< 1000)) {
}
1690
< 1000)) {
/**
1693
< 1000)) {
*/
1695
< 1000)) {
$.ajax({
1697
< 1000)) {
1698
< 1000)) {
1699
< 1000)) {
if ((typeof(initiate) === 'boolean') && (initiate === true)) {
1701
< 1000)) {
sticky: true
1703
< 1000)) {
} else {
1705
< 1000)) {
}
1707
< 1000)) {
success: function buildblocks(xml) {
1709
< 1000)) {
1710
< 1000)) {
}
1712
 
1713
< 1000)) {
refreshHardware(xml);
1715
< 1000)) {
refreshFilesystems(xml);
1717
< 1000)) {
refreshVoltage(xml);
1719
< 1000)) {
refreshTemp(xml);
1721
< 1000)) {
refreshPower(xml);
1723
< 1000)) {
refreshUps(xml);
1725
< 1000)) {
if ((typeof(initiate) === 'boolean') && (initiate === true)) {
1728
< 1000)) {
settimer(xml);
1730
< 1000)) {
for (var i = 0; i < plugin_liste.length; i++) {
1732
< 1000)) {
//dynamic call
1734
< 1000)) {
1735
< 1000)) {
catch (err) {
1737
< 1000)) {
}
1739
< 1000)) {
$('.stripeMe tr:nth-child(even)').addClass('even');
1742
< 1000)) {
});
1744
< 1000)) {
/**
1747
< 1000)) {
* @param {jQuery} xml phpSysInfo-XML
1749
< 1000)) {
function settimer(xml) {
1751
< 1000)) {
var options, refresh = "";
1753
< 1000)) {
refresh = $(this).attr("refresh");
1755
< 1000)) {
1756
< 1000)) {
}
1758
< 1000)) {
}
1760
 
1761
< 1000)) {
var i = 0, old_template = null, cookie_template = null, cookie_language = null, blocktmp = "";
1763
 
1764
< 1000)) {
showCPUInfoExpanded = $("#showCPUInfoExpanded").val().toString()==="true";
1766
< 1000)) {
showMemoryInfosExpanded = $("#showMemoryInfosExpanded").val().toString()==="true";
1768
< 1000)) {
showTotals = $("#hideTotals").val().toString()!=="true";
1770
< 1000)) {
if (isNaN(increaseWidth) || (increaseWidth<=0)) increaseWidth = 0;
2788 rexy 1772
< 1000)) {
case "bps": showNetworkActiveSpeed = 2;
1774
< 1000)) {
case "true": showNetworkActiveSpeed = 1;
1776
< 1000)) {
default: showNetworkActiveSpeed = 0;
1778
< 1000)) {
blocktmp = $("#blocks").val().toString();
1781
< 1000)) {
if (blocktmp === "true") {
1783
< 1000)) {
} else {
1785
< 1000)) {
1786
< 1000)) {
for (i = 0; i < blocks.length; i++) {
1788
< 1000)) {
$("#output").children().eq(j).before($("#"+blocks[i]));
1790
< 1000)) {
}
1792
< 1000)) {
}
1795
< 1000)) {
if ($("#language option").length < 2) {
1798
< 1000)) {
/*
1800
< 1000)) {
for (i = 0; i < plugin_liste.length; i++) {
1802
< 1000)) {
}
1804
< 1000)) {
} else {
1806
< 1000)) {
if (cookie_language !== null) {
1808
< 1000)) {
$("#language").val(current_language);
1810
< 1000)) {
current_language = $("#language").val().toString();
1812
< 1000)) {
/*
1814
< 1000)) {
for (i = 0; i < plugin_liste.length; i++) {
1816
< 1000)) {
}
1818
< 1000)) {
$('#language').show();
1820
< 1000)) {
1821
< 1000)) {
var i = 0;
1823
< 1000)) {
createCookie('psi_language', current_language, 365);
1825
< 1000)) {
for (i = 0; i < plugin_liste.length; i++) {
1827
< 1000)) {
}
1829
< 1000)) {
});
1831
< 1000)) {
if ($("#template option").length < 2) {
1833
< 1000)) {
} else {
1835
< 1000)) {
if (cookie_template !== null) {
1837
< 1000)) {
$("#template").val(cookie_template);
1839
< 1000)) {
$("#template").val(old_template);
1841
< 1000)) {
}
1843
< 1000)) {
$('#template').show();
1845
< 1000)) {
1846
< 1000)) {
switchStyle($("#template").val().toString());
1848
< 1000)) {
#template").val().toString(), 365);
1849
< 1000)) {
});
1851
< 1000)) {
filesystemtable();
1854
 
1855
< 1000)) {
$("#errors").nyroModal();
1858
< 1000)) {
jQuery.fn.dataTableExt.oSort['span-string-asc'] = function sortStringAsc(a, b) {
1861
< 1000)) {
x = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1863
< 1000)) {
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1865
< 1000)) {
jQuery.fn.dataTableExt.oSort['span-string-desc'] = function sortStringDesc(a, b) {
1868
< 1000)) {
x = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1870
< 1000)) {
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
1872
< 1000)) {
jQuery.fn.dataTableExt.oSort['span-number-asc'] = function sortNumberAsc(a, b) {
1875
< 1000)) {
x = parseInt(a.substring(a.indexOf(">") + 1, a.indexOf("</")), 10);
1877
< 1000)) {
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1879
< 1000)) {
jQuery.fn.dataTableExt.oSort['span-number-desc'] = function sortNumberDesc(a, b) {
1882
< 1000)) {
x = parseInt(a.substring(a.indexOf(">") + 1, a.indexOf("</")), 10);
1884
< 1000)) {
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
1886
< 1000)) {
jQuery.fn.dataTableExt.oSort['span-ip-asc'] = function sortIpAsc(a, b) {
1889
< 1000)) {
aa = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1891
< 1000)) {
x = full_addr(aa);
1893
< 1000)) {
if ((x === '') || (y === '')) {
1895
< 1000)) {
y = bb;
1897
< 1000)) {
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
1899
< 1000)) {
jQuery.fn.dataTableExt.oSort['span-ip-desc'] = function sortIpDesc(a, b) {
1902
< 1000)) {
aa = a.substring(a.indexOf(">") + 1, a.indexOf("</"));
1904
< 1000)) {
x = full_addr(aa);
1906
< 1000)) {
if ((x === '') || (y === '')) {
1908
< 1000)) {
y = bb;
1910
< 1000)) {
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
1912
< 1000)) {
function full_addr(ip_string) {
1915
< 1000)) {
ip_string = $.trim(ip_string).toLowerCase();
1917
< 1000)) {
if (ip_string.match(/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/)) {
1919
< 1000)) {
1920
< 1000)) {
// replace ipv4 address if any
1922
< 1000)) {
if (ipv4) {
1924
< 1000)) {
ipv4 = ipv4[2].match(/[0-9]+/g);
1926
< 1000)) {
var byte = parseInt(ipv4[i], 10);
2788 rexy 1928
< 1000)) {
ipv4[i] = ("0" + byte.toString(16)).substr(-2);
1930
< 1000)) {
wrongvalue = true;
1932
< 1000)) {
}
1934
< 1000)) {
if (wrongvalue) {
1936
< 1000)) {
1937
< 1000)) {
ip_string += ipv4[0] + ipv4[1] + ':' + ipv4[2] + ipv4[3];
1939
< 1000)) {
}
1941
 
1942
< 1000)) {
1943
< 1000)) {
1944
< 1000)) {
// take care of leading and trailing ::
1946
< 1000)) {
1947
 
1948
< 1000)) {
1949
 
1950
< 1000)) {
var hex = ipv6[li];
1952
< 1000)) {
if (!hex.match(/^[0-9a-f]{1,4}$/)) {
1954
< 1000)) {
break;
1956
< 1000)) {
// normalize leading zeros
1958
< 1000)) {
}
1960
< 1000)) {
// normalize grouped zeros ::
1962
< 1000)) {
for (var j = ipv6.length; j <= 8; j ++) {
1964
< 1000)) {
1965
< 1000)) {
ipv6[li] = hex.join(':');
1967
< 1000)) {
}
1969
< 1000)) {
var out = ipv6.join(':');
1971
< 1000)) {
return out;
1973
< 1000)) {
return '';
1975
< 1000)) {
} else {
1977
< 1000)) {
1978
< 1000)) {
}
1980
 
1981
< 1000)) {
* generate the block element for a specific plugin that is available
1983
< 1000)) {
* @param {Number} translationid id of the translated headline in the plugin translation file
1985
< 1000)) {
* @return {String} HTML string which contains the full layout of the block
1987
< 1000)) {
function buildBlock(plugin, translationid, reload) {
1989
< 1000)) {
if (reload) {
1991
< 1000)) {
}
1993
< 1000)) {
block += "<div id=\"Plugin_" + plugin + "\" class=\"plugin\" style=\"display:none;\">\n";
2976 rexy 1995
< 1000)) {
block += "<span class=\"Hostname_" + plugin + "\"></span></h2>\n";
2788 rexy 1997
< 1000)) {
block += "</div>\n";
1999
< 1000)) {
}
2001
 
2002
< 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
2004
< 1000)) {
*/
2006
< 1000)) {
plugin_liste.pushIfNotExist(plugin);
2008
< 1000)) {
}
2010
 
2011
< 1000)) {
* generate a formatted datetime string of the current datetime
2013
< 1000)) {
*/
2015
< 1000)) {
var date, day = 0, month = 0, year = 0, hour = 0, minute = 0, days = "", months = "", years = "", hours = "", minutes = "";
2017
< 1000)) {
day = date.getDate();
2019
< 1000)) {
year = date.getFullYear();
2021
< 1000)) {
minute = date.getMinutes();
2023
 
2024
< 1000)) {
days = (day < 10) ? "0" + day.toString() : day.toString();
2026
< 1000)) {
years = (year < 1000) ? year.toString() : year.toString();
2028
< 1000)) {
hours = (hour < 10) ? "0" + hour.toString() : hour.toString();
2030
 
2031
< 1000)) {
}
2033
 
2034
< 1000)) {
if (typeof(val) == 'undefined' || val === '') {
2036
< 1000)) {
}
2038
< 1000)) {
if ($.inArray(val, this) == -1) {
2040
< 1000)) {
}
2042
< 1000)) {
/**
2045
< 1000)) {
* @param {String} name name of the script that should be included
2047
< 1000)) {
/*
2049
< 1000)) {
var scrptE, hdEl;
2051
< 1000)) {
hdEl = document.getElementsByTagName("head")[0];
2053
< 1000)) {
scrptE.setAttribute("type", "text/javascript");
2055
< 1000)) {
}
2057
< 1000)) {
/**
2059
< 1000)) {
* @param {String} name name of the css file that should be included
2061
< 1000)) {
/*
2063
< 1000)) {
var scrptE, hdEl;
2065
< 1000)) {
hdEl = document.getElementsByTagName("head")[0];
2067
< 1000)) {
scrptE.setAttribute("rel", "stylesheet");
2069
< 1000)) {
hdEl.appendChild(scrptE);
2071
< 1000)) {
*/