Line 174... |
Line 174... |
174 |
|
174 |
|
175 |
/**
|
175 |
/**
|
176 |
* generate a span tag
|
176 |
* generate a span tag
|
177 |
* @param {Number} id translation id in the xml file
|
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
|
178 |
* @param {String} [plugin] name of the plugin for which the tag should be generated
|
- |
|
179 |
* @param {String} [defaultvalue] default value
|
179 |
* @return {String} string which contains generated span tag for translation string
|
180 |
* @return {String} string which contains generated span tag for translation string
|
180 |
*/
|
181 |
*/
|
181 |
function genlang(id, plugin) {
|
182 |
function genlang(id, plugin, defaultvalue) {
|
182 |
var html = "", idString = "", plugname = "",
|
183 |
var html = "", idString = "", plugname = "",
|
183 |
langarrId = current_language + "_";
|
184 |
langarrId = current_language + "_";
|
184 |
|
185 |
|
185 |
if (plugin === undefined) {
|
186 |
if (plugin === undefined) {
|
186 |
plugname = "";
|
187 |
plugname = "";
|
Line 204... |
Line 205... |
204 |
|
205 |
|
205 |
html += "<span class=\"lang_" + idString + "\">";
|
206 |
html += "<span class=\"lang_" + idString + "\">";
|
206 |
|
207 |
|
207 |
if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
|
208 |
if ((langxml[langarrId] !== undefined) && (langarr[langarrId] !== undefined)) {
|
208 |
html += langarr[langarrId][idString];
|
209 |
html += langarr[langarrId][idString];
|
- |
|
210 |
} else if (defaultvalue !== undefined) {
|
- |
|
211 |
html += defaultvalue;
|
209 |
}
|
212 |
}
|
210 |
|
213 |
|
211 |
html += "</span>";
|
214 |
html += "</span>";
|
212 |
|
215 |
|
213 |
return html;
|
216 |
return html;
|
214 |
}
|
217 |
}
|
Line 628... |
Line 631... |
628 |
< 1000)) {/** >
|
631 |
< 1000)) {/** >
|
629 |
< 1000)) { * (re)fill the vitals block with the values from the given xml >
|
632 |
< 1000)) { * (re)fill the vitals block with the values from the given xml >
|
630 |
< 1000)) { * @param {jQuery} xml phpSysInfo-XML >
|
633 |
< 1000)) { * @param {jQuery} xml phpSysInfo-XML >
|
631 |
< 1000)) { */ >
|
634 |
< 1000)) { */ >
|
632 |
< 1000)) {function refreshVitals(xml) { >
|
635 |
< 1000)) {function refreshVitals(xml) { >
|
633 |
< 1000)) { var hostname = "", ip = ""; >
|
636 |
< 1000)) { var hostname = "", ip = "", stripid = 0; >
|
- |
|
637 |
< 1000)) { >
|
- |
|
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 |
< 1000)) { >
|
634 |
< 1000)) { if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) { >
|
653 |
< 1000)) { if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('vitals', blocks) < 0))) { >
|
635 |
< 1000)) { $("#vitals").remove(); >
|
654 |
< 1000)) { $("#vitals").remove(); >
|
636 |
< 1000)) { $("Vitals", xml).each(function getVitals(id) { >
|
655 |
< 1000)) { $("Vitals", xml).each(function getVitals(id) { >
|
637 |
< 1000)) { hostname = $(this).attr("Hostname"); >
|
656 |
< 1000)) { hostname = $(this).attr("Hostname"); >
|
638 |
< 1000)) { ip = $(this).attr("IPAddr"); >
|
657 |
< 1000)) { ip = $(this).attr("IPAddr"); >
|
Line 670... |
Line 689... |
670 |
< 1000)) { if ($(this).attr("CPULoad") !== undefined) { >
|
689 |
< 1000)) { if ($(this).attr("CPULoad") !== undefined) { >
|
671 |
< 1000)) { loadavg = loadavg + "<br>" + createBar(parseInt($(this).attr("CPULoad"), 10)); >
|
690 |
< 1000)) { loadavg = loadavg + "<br>" + createBar(parseInt($(this).attr("CPULoad"), 10)); >
|
672 |
< 1000)) { } >
|
691 |
< 1000)) { } >
|
673 |
< 1000)) { if ($(this).attr("SysLang") !== undefined) { >
|
692 |
< 1000)) { if ($(this).attr("SysLang") !== undefined) { >
|
674 |
< 1000)) { syslang = $(this).attr("SysLang"); >
|
693 |
< 1000)) { syslang = $(this).attr("SysLang"); >
|
675 |
< 1000)) { document.getElementById("s_syslang_tr").style.display=''; >
|
- |
|
676 |
< 1000)) { } >
|
694 |
< 1000)) { } >
|
677 |
< 1000)) { >
|
695 |
< 1000)) { >
|
678 |
< 1000)) { if ($(this).attr("CodePage") !== undefined) { >
|
696 |
< 1000)) { if ($(this).attr("CodePage") !== undefined) { >
|
679 |
< 1000)) { codepage = $(this).attr("CodePage"); >
|
697 |
< 1000)) { codepage = $(this).attr("CodePage"); >
|
680 |
< 1000)) { if ($(this).attr("SysLang") !== undefined) { >
|
- |
|
681 |
< 1000)) { document.getElementById("s_codepage_tr1").style.display=''; >
|
- |
|
682 |
< 1000)) { } else { >
|
- |
|
683 |
< 1000)) { document.getElementById("s_codepage_tr2").style.display=''; >
|
- |
|
684 |
< 1000)) { } >
|
- |
|
685 |
< 1000)) { } >
|
698 |
< 1000)) { } >
|
686 |
< 1000)) { >
|
699 |
< 1000)) { >
|
687 |
< 1000)) { //processes >
|
700 |
< 1000)) { //processes >
|
688 |
< 1000)) { if ($(this).attr("Processes") !== undefined) { >
|
701 |
< 1000)) { if ($(this).attr("Processes") !== undefined) { >
|
689 |
< 1000)) { processes = parseInt($(this).attr("Processes"), 10); >
|
702 |
< 1000)) { processes = parseInt($(this).attr("Processes"), 10); >
|
690 |
< 1000)) { if ((($(this).attr("CodePage") !== undefined) && ($(this).attr("SysLang") === undefined)) || >
|
- |
|
691 |
< 1000)) { (($(this).attr("CodePage") === undefined) && ($(this).attr("SysLang") !== undefined))) { >
|
- |
|
692 |
< 1000)) { document.getElementById("s_processes_tr1").style.display=''; >
|
- |
|
693 |
< 1000)) { } else { >
|
- |
|
694 |
< 1000)) { document.getElementById("s_processes_tr2").style.display=''; >
|
- |
|
695 |
< 1000)) { } >
|
- |
|
696 |
< 1000)) { } >
|
703 |
< 1000)) { } >
|
697 |
< 1000)) { if ($(this).attr("ProcessesRunning") !== undefined) { >
|
704 |
< 1000)) { if ($(this).attr("ProcessesRunning") !== undefined) { >
|
698 |
< 1000)) { prunning = parseInt($(this).attr("ProcessesRunning"), 10); >
|
705 |
< 1000)) { prunning = parseInt($(this).attr("ProcessesRunning"), 10); >
|
699 |
< 1000)) { } >
|
706 |
< 1000)) { } >
|
700 |
< 1000)) { if ($(this).attr("ProcessesSleeping") !== undefined) { >
|
707 |
< 1000)) { if ($(this).attr("ProcessesSleeping") !== undefined) { >
|
Line 713... |
Line 720... |
713 |
< 1000)) { pother = parseInt($(this).attr("ProcessesOther"), 10); >
|
720 |
< 1000)) { pother = parseInt($(this).attr("ProcessesOther"), 10); >
|
714 |
< 1000)) { } >
|
721 |
< 1000)) { } >
|
715 |
< 1000)) { >
|
722 |
< 1000)) { >
|
716 |
< 1000)) { document.title = "System information: " + hostname + " (" + ip + ")"; >
|
723 |
< 1000)) { document.title = "System information: " + hostname + " (" + ip + ")"; >
|
717 |
< 1000)) { $("#s_hostname_title").html(hostname); >
|
724 |
< 1000)) { $("#s_hostname_title").html(hostname); >
|
718 |
< 1000)) { $("#s_ip_title").html(ip); >
|
725 |
< 1000)) { $("#s_ip_title").html(ip); >
|
719 |
< 1000)) { $("#s_hostname").html(hostname); >
|
726 |
< 1000)) { setAndStrip("#s_hostname", hostname); >
|
720 |
< 1000)) { $("#s_ip").html(ip); >
|
727 |
< 1000)) { setAndStrip("#s_ip", ip); >
|
721 |
< 1000)) { $("#s_kernel").html(kernel); >
|
728 |
< 1000)) { setAndStrip("#s_kernel", kernel); >
|
722 |
< 1000)) { $("#s_distro").html("<img src='./gfx/images/" + icon + "' alt='Icon' title='' style='width:16px;height:16px;vertical-align:middle;' onload='PNGload($(this));' /> " + distro); //onload IE6 PNG fix >
|
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 >
|
723 |
< 1000)) { $("#s_os").html(" >
|
730 |
< 1000)) { setAndStrip("#s_os", " >
|
724 |
< 1000)) { setAndStrip("#s_uptime", uptime); >
|
725 |
< 1000)) { if ((datetimeFormat !== undefined) && (datetimeFormat.toLowerCase() === "locale")) { >
|
726 |
< 1000)) { setAndStrip("#s_lastboot", lastboot.toLocaleString()); >
|
727 |
< 1000)) { } else { >
|
728 |
< 1000)) { if (typeof(lastboot.toUTCString)==="function") { >
|
729 |
< 1000)) { setAndStrip("#s_lastboot", lastboot.toUTCString()); >
|
730 |
< 1000)) { } else { >
|
731 |
< 1000)) { //deprecated >
|
732 |
< 1000)) { setAndStrip("#s_lastboot", lastboot.toGMTString()); >
|
733 |
< 1000)) { } >
|
734 |
< 1000)) { } >
|
735 |
< 1000)) { setAndStrip("#s_users", users); >
|
736 |
< 1000)) { setAndStrip("#s_loadavg", loadavg); >
|
737 |
< 1000)) { setAndStrip("#s_syslang", syslang); >
|
738 |
< 1000)) { $("#s_codepage_2").html(codepage); >
|
745 |
< 1000)) { $("#s_processes_1").html(processes); >
|
- |
|
741 |
< 1000)) { setAndStrip("#s_processes", processes); >
|
742 |
< 1000)) { if ((processes > 0) && (prunning || psleeping || pstopped || pzombie || pwaiting || pother)) { >
|
743 |
< 1000)) { $("#s_processes_2").append(" ("); >
|
748 |
< 1000)) { var typelist = {running:111,sleeping:112,stopped:113,zombie:114,waiting:115,other:116}; >
|
749 |
< 1000)) { for (var proc_type in typelist) { >
|
750 |
< 1000)) { if (eval("p" + proc_type)) { >
|
751 |
< 1000)) { if (not_first) { >
|
752 |
< 1000)) { $("#s_processes_1").append(", "); >
|
- |
|
750 |
< 1000)) { $("#s_processes").append(", "); >
|
751 |
< 1000)) { } >
|
752 |
< 1000)) { $("#s_processes_2").append(eval("p" + proc_type) + " " + genlang(typelist[proc_type])); >
|
755 |
< 1000)) { not_first = true; >
|
756 |
< 1000)) { } >
|
757 |
< 1000)) { } >
|
758 |
< 1000)) { $("#s_processes_1").append(") "); >
|
- |
|
758 |
< 1000)) { $("#s_processes").append(") "); >
|
759 |
< 1000)) { } >
|
760 |
< 1000)) { }); >
|
761 |
< 1000)) {} >
|
762 |
< 1000)) {>
|
763 |
< 1000)) {>
|
Line 769... |
Line 770... |
769 |
< 1000)) { * @param {Array} collapsed array that holds all collapsed elements hwne opening page >
|
770 |
< 1000)) { */ >
|
771 |
< 1000)) {function fillCpu(xml, tree, rootposition, collapsed) { >
|
772 |
< 1000)) { var cpucount = 0, html = ""; >
|
773 |
< 1000)) { $("Hardware CPU CpuCore", xml).each(function getCpuCore(cpuCoreId) { >
|
774 |
< 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 = ""; >
|
775 |
< 1000)) { cpucount++; >
|
776 |
< 1000)) { model = $(this).attr("Model"); >
|
- |
|
778 |
< 1000)) { speed = parseInt($(this).attr("CpuSpeed"), 10); >
|
779 |
< 1000)) { speedmax = parseInt($(this).attr("CpuSpeedMax"), 10); >
|
780 |
< 1000)) { speedmin = parseInt($(this).attr("CpuSpeedMin"), 10); >
|
781 |
< 1000)) { cache = parseInt($(this).attr("Cache"), 10); >
|
782 |
< 1000)) { virt = $(this).attr("Virt"); >
|
783 |
< 1000)) { } >
|
821 |
< 1000)) { if (!isNaN(bus)) { >
|
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"; >
|
823 |
< 1000)) { tree.push(cpucoreposition); >
|
824 |
< 1000)) { } >
|
825 |
< 1000)) { if (!isNaN(voltage)) { >
|
- |
|
827 |
< 1000)) { tree.push(cpucoreposition); >
|
- |
|
829 |
< 1000)) { if (!isNaN(bogo)) { >
|
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"; >
|
831 |
< 1000)) { tree.push(cpucoreposition); >
|
832 |
< 1000)) { } >
|
833 |
< 1000)) {/* >
|
834 |
< 1000)) { if ((blocks.length <= 0) || ((blocks[0] !== "true") && ($.inArray('hardware ', blocks) < 0))) { >
|
935 |
< 1000)) {hardware ', blocks) < 0))) { >
|
930 |
< 1000)) { $("#hardware").remove(); >
|
931 |
< 1000)) { return; >
|
932 |
< 1000)) { } >
|
933 |
< 1000)) {>
|
934 |
< 1000)) { var html = "", tree = [], closed = [], index = 0, machine = "", virtualizer = ""; >
|
935 |
< 1000)) { $("#hardware").empty(); >
|
936 |
< 1000)) { html += "<h2>" + genlang(10) + "</h2>\n"; >
|
937 |
< 1000)) { html += " <div style=\"overflow-x:auto;\">\n"; >
|
938 |
< 1000)) { html += " <table id=\"HardwareTree\" class=\"tablemain\">\n"; >
|
939 |
< 1000)) { html += " <tbody class=\"tree\">\n"; >
|
940 |
< 1000)) {>
|
941 |
< 1000)) { $("Hardware", xml).each(function getMachine(id) { >
|
942 |
< 1000)) { machine = $(this).attr("Name"); >
|
943 |
< 1000)) { }); >
|
- |
|
950 |
< 1000)) { virtualizer = $(this).attr("Virtualizer"); >
|
- |
|
952 |
< 1000)) {>
|
944 |
< 1000)) { if ((machine !== undefined) && (machine !== "")) { >
|
945 |
< 1000)) { html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(107) + "</span></div></td></tr>\n"; >
|
946 |
< 1000)) { html += "<tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespan\">" + machine + "</span></div></td></tr>\n"; >
|
947 |
< 1000)) { tree.push(tree.push(0)); >
|
948 |
< 1000)) { } >
|
949 |
< 1000)) {>
|
- |
|
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)) { >
|
965 |
< 1000)) { html += " <tr><td colspan=\"2\"><div class=\"treediv\"><span class=\"treespanbold\">" + genlang(11) + "</span></div></td></tr>\n"; >
|
966 |
< 1000)) { html += fillCpu(xml, tree, tree.push(0), closed); >
|
967 |
< 1000)) { } >
|
968 |
< 1000)) {>
|
969 |
< 1000)) { options_text = "<br><i>(" + options + ")</i>"; >
|
1273 |
< 1000)) { } >
|
1274 |
< 1000)) { if (!isNaN(inodes)) { >
|
1275 |
< 1000)) { inodes_text = "<span style=\"font-style:italic\"> (" + inodes.toString() + "%)</span>"; >
|
1276 |
< 1000)) { } >
|
1277 |
< 1000)) { if (type === undefined) { >
|
- |
|
1279 |
< 1000)) { } >
|
1263 |
< 1000)) {>
|
1264 |
< 1000)) { if (!isNaN(ignore) && (ignore > 0) && showTotals) { >
|
1265 |
< 1000)) { if (ignore >= 3) { >
|
1266 |
< 1000)) { if ((ignore == 3) && !isNaN(threshold) && (percent >= threshold)) { >
|
1267 |
< 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><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>"]); >
|
Line 1550... |
Line 1568... |
1550 |
< 1000)) { html += " <table class=\"tablemain\" id=\"UPSTree\">\n"; >
|
1551 |
< 1000)) { html += " <tbody class=\"tree\">\n"; >
|
1552 |
< 1000)) {>
|
1553 |
< 1000)) { $("#ups").empty(); >
|
1554 |
< 1000)) { $("UPSInfo UPS", xml).each(function getUps(id) { >
|
1555 |
< 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 = ""; >
|
1556 |
< 1000)) { name = $(this).attr("Name"); >
|
1557 |
< 1000)) { model = $(this).attr("Model"); >
|
1558 |
< 1000)) { mode = $(this).attr("Mode"); >
|
1559 |
< 1000)) { start_time = $(this).attr("StartTime"); >
|
1560 |
< 1000)) { upsstatus = $(this).attr("Status"); >
|
- |
|
1579 |
< 1000)) {>
|
1580 |
< 1000)) { temperature = $(this).attr("Temperature"); >
|
1581 |
< 1000)) { outages_count = $(this).attr("OutagesCount"); >
|
1582 |
< 1000)) { last_outage = $(this).attr("LastOutage"); >
|
1583 |
< 1000)) { last_outage_finish = $(this).attr("LastOutageFinish"); >
|
1584 |
< 1000)) { } >
|
1606 |
< 1000)) { if (upsstatus !== undefined) { >
|
1607 |
< 1000)) { html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(73) + "</span></div></td><td>" + upsstatus + "</td></tr>\n"; >
|
1608 |
< 1000)) { tree.push(index); >
|
1609 |
< 1000)) { } >
|
1610 |
< 1000)) { if (beeperstatus !== undefined) { >
|
- |
|
1612 |
< 1000)) { tree.push(index); >
|
- |
|
1614 |
< 1000)) { if (temperature !== undefined) { >
|
1615 |
< 1000)) { html += "<tr><td style=\"width:36%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(84) + "</span></div></td><td>" + temperature + "</td></tr>\n"; >
|
1616 |
< 1000)) { tree.push(index); >
|
1617 |
< 1000)) { } >
|
1618 |
< 1000)) { if (outages_count !== undefined) { >
|
1619 |
< 1000)) { var ipv4 = ip_string.match(/(.*:)([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$)/); >
|
1922 |
< 1000)) { if (ipv4) { >
|
1923 |
< 1000)) { ip_string = ipv4[1]; >
|
1924 |
< 1000)) { ipv4 = ipv4[2].match(/[0-9]+/g); >
|
1925 |
< 1000)) { for (var i = 0;i < 4;i ++) { >
|
1926 |
< 1000)) { var byte = parseInt(ipv4[i],10); >
|
1927 |
< 1000)) { if (byte<256) { >
|
1928 |
< 1000)) { ipv4[i] = ("0 " + byte.toString(16)).substr(-2); >
|
1929 |
< 1000)) { } else { >
|
1930 |
< 1000)) { wrongvalue = true; >
|
1931 |
< 1000)) { break; >
|
1932 |
< 1000)) {
|