Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3037 → Rev 3100

/web/acc/phpsysinfo/js/phpSysInfo/phpsysinfo.js
600,7 → 600,7
});
 
degree = parseFloat(degreeC);
if (isNaN(degreeC)) {
if (!isFinite(degreeC)) {
return "---";
} else {
switch (tempFormat) {
775,7 → 775,7
var model = "", speed = 0, voltage = 0, bus = 0, cache = 0, bogo = 0, temp = 0, load = 0, speedmax = 0, speedmin = 0, cpucoreposition = 0, virt = "", manufacturer = "";
cpucount++;
model = $(this).attr("Model");
voltage = $(this).attr("Voltage");
voltage = parseFloat($(this).attr("Voltage"));
speed = parseInt($(this).attr("CpuSpeed"), 10);
speedmax = parseInt($(this).attr("CpuSpeedMax"), 10);
speedmin = parseInt($(this).attr("CpuSpeedMin"), 10);
823,8 → 823,8
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(14) + ":</span></div></td><td>" + formatHertz(bus) + "</td></tr>\n";
tree.push(cpucoreposition);
}
if (!isNaN(voltage)) {
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";
if (isFinite(voltage)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " " + genlang(82) + "</td></tr>\n";
tree.push(cpucoreposition);
}
if (!isNaN(bogo)) {
903,8 → 903,8
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";
tree.push(devcoreposition);
}
if (!isNaN(voltage)) {
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";
if (isFinite(voltage)) {
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " " + genlang(82) + "</td></tr>\n";
tree.push(devcoreposition);
}
if (serial !== undefined) {
1031,28 → 1031,46
}
 
$("Network NetDevice", xml).each(function getDevice(id) {
var name = "", rx = 0, tx = 0, er = 0, dr = 0, info = "", networkindex = 0, htmlrx = '', htmltx = '';
var name = "", rx = 0, tx = 0, er = 0, dr = 0, info = "", networkindex = 0, htmlrx = '', htmltx = '', rxr = 0, txr = 0;
name = $(this).attr("Name");
rx = parseInt($(this).attr("RxBytes"), 10);
tx = parseInt($(this).attr("TxBytes"), 10);
er = parseInt($(this).attr("Err"), 10);
dr = parseInt($(this).attr("Drops"), 10);
rxr = parseInt($(this).attr("RxRate"), 10);
txr = parseInt($(this).attr("TxRate"), 10);
 
if (showNetworkActiveSpeed && ($.inArray(name, oldnetwork) >= 0)) {
var diff, difftime;
if (((diff = rx - oldnetwork[name].rx) > 0) && ((difftime = timestamp - oldnetwork[name].timestamp) > 0)) {
if (showNetworkActiveSpeed) {
if ((rx == 0) && !isNaN(rxr)) {
if (showNetworkActiveSpeed == 2) {
htmlrx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
htmlrx ="<br><i>("+formatBPS(round(rxr, 2))+")</i>";
} else {
htmlrx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>";
htmlrx ="<br><i>("+formatBytes(round(rxr, 2), xml)+"/s)</i>";
}
} else if ($.inArray(name, oldnetwork) >= 0) {
var diff, difftime;
if (((diff = rx - oldnetwork[name].rx) > 0) && ((difftime = timestamp - oldnetwork[name].timestamp) > 0)) {
if (showNetworkActiveSpeed == 2) {
htmlrx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
} else {
htmlrx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>";
}
}
}
if (((diff = tx - oldnetwork[name].tx) > 0) && (difftime > 0)) {
if ((tx == 0) && !isNaN(txr)) {
if (showNetworkActiveSpeed == 2) {
htmltx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
htmltx ="<br><i>("+formatBPS(round(txr, 2))+")</i>";
} else {
htmltx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>";
htmltx ="<br><i>("+formatBytes(round(txr, 2), xml)+"/s)</i>";
}
} else if ($.inArray(name, oldnetwork) >= 0) {
if (((diff = tx - oldnetwork[name].tx) > 0) && (difftime > 0)) {
if (showNetworkActiveSpeed == 2) {
htmltx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
} else {
htmltx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>";
}
}
}
}
 
1391,7 → 1409,10
min = parseFloat($(this).attr("Min"));
if (isFinite(min))
_min = round(min, 2) + "&nbsp;" + genlang(62);
$("#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>");
if (isFinite(value))
$("#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>");
else
$("#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>");
values = true;
});
if (values) {
1427,11 → 1448,17
if (unit === "%") {
if (isFinite(min))
_min = round(min,0) + "%";
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td><td class=\"right\">" + _min + "</td></tr>");
if (isFinite(value))
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td><td class=\"right\">" + _min + "</td></tr>");
else
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>---%</td><td class=\"right\">" + _min + "</td></tr>");
} else {
if (isFinite(min))
_min = round(min,0) + "&nbsp;" + genlang(63);
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value,0) + "&nbsp;" + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>");
if (isFinite(value))
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value,0) + "&nbsp;" + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>");
else
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">---&nbsp;" + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>");
}
values = true;
});
1459,7 → 1486,7
$("MBInfo Power Item", xml).each(function getPowers(id) {
var label = "", value = "", event = "", limit = 0, _limit = "";
label = $(this).attr("Label");
value = $(this).attr("Value");
value = parseFloat($(this).attr("Value"));
event = $(this).attr("Event");
if (event !== undefined)
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
1466,7 → 1493,10
limit = parseFloat($(this).attr("Max"));
if (isFinite(limit))
_limit = round(limit, 2) + "&nbsp;" + genlang(103);
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + "&nbsp;" + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>");
if (isFinite(value))
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + "&nbsp;" + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>");
else
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">---&nbsp;" + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>");
values = true;
});
if (values) {
1493,7 → 1523,7
$("MBInfo Current Item", xml).each(function getCurrents(id) {
var label = "", value = "", event = "", min = 0, max = 0, _min = "", _max = "";
label = $(this).attr("Label");
value = $(this).attr("Value");
value = parseFloat($(this).attr("Value"));
event = $(this).attr("Event");
if (event !== undefined)
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>";
1503,7 → 1533,10
min = parseFloat($(this).attr("Min"));
if (isFinite(min))
_min = round(min, 2) + "&nbsp;" + genlang(106);
$("#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>");
if (isFinite(value))
$("#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>");
else
$("#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>");
values = true;
});
if (values) {
/web/acc/phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js
661,6 → 661,9
}
};
 
if ((data.Vitals["@attributes"].LoadAvg === '') && (data.Vitals["@attributes"].CPULoad === undefined)) {
$("#tr_LoadAvg").hide();
}
if (data.Vitals["@attributes"].SysLang === undefined) {
$("#tr_SysLang").hide();
}
725,7 → 728,7
},
Voltage: {
html: function() {
return round(this.Voltage, 2) + ' V';
return round(this.Voltage, 2) + genlang(82); //V
}
},
Bogomips: {
767,7 → 770,7
},
Voltage: {
html: function() {
return round(this.Voltage, 2) + ' V';
return round(this.Voltage, 2) + genlang(82); //V
}
},
Capacity: {
1026,17 → 1029,17
html += '<div class="percent">' + 'Total: ' + this["@attributes"].Percent + '% ' + '<i>(';
var not_first = false;
if (this.Details["@attributes"].AppPercent !== undefined) {
html += genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps
html += '<span class="progress-bar-info">&emsp;</span>&nbsp;' + genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps
not_first = true;
}
if (this.Details["@attributes"].CachedPercent !== undefined) {
if (not_first) html += ' - ';
html += genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache
html += '<span class="progress-bar-warning">&emsp;</span>&nbsp;' + genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache
not_first = true;
}
if (this.Details["@attributes"].BuffersPercent !== undefined) {
if (not_first) html += ' - ';
html += genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers
html += '<span class="progress-bar-danger">&emsp;</span>&nbsp;' + genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers
}
html += ')</i></div>';
return html;
1200,13 → 1203,21
RxBytes: {
html: function () {
var htmladd = '';
if (showNetworkActiveSpeed && ($.inArray(this.Name, oldnetwork) >= 0)) {
var diff, difftime;
if (((diff = this.RxBytes - oldnetwork[this.Name].RxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) {
if (showNetworkActiveSpeed) {
if ((this.RxBytes == 0) && (this.RxRate !== undefined)) {
if (showNetworkActiveSpeed == 2) {
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
htmladd ="<br><i>("+formatBPS(round(this.RxRate, 2))+")</i>";
} else {
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";
htmladd ="<br><i>("+formatBytes(round(this.RxRate, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";
}
} else if ($.inArray(this.Name, oldnetwork) >= 0) {
var diff, difftime;
if (((diff = this.RxBytes - oldnetwork[this.Name].RxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) {
if (showNetworkActiveSpeed == 2) {
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
} else {
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";
}
}
}
}
1216,14 → 1227,22
TxBytes: {
html: function () {
var htmladd = '';
if (showNetworkActiveSpeed && ($.inArray(this.Name, oldnetwork) >= 0)) {
var diff, difftime;
if (((diff = this.TxBytes - oldnetwork[this.Name].TxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) {
if (showNetworkActiveSpeed) {
if ((this.TxBytes == 0) && (this.TxRate !== undefined)) {
if (showNetworkActiveSpeed == 2) {
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
htmladd ="<br><i>("+formatBPS(round(this.TxRate, 2))+")</i>";
} else {
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";
htmladd ="<br><i>("+formatBytes(round(this.TxRate, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";
}
} else if ($.inArray(this.Name, oldnetwork) >= 0) {
var diff, difftime;
if (((diff = this.TxBytes - oldnetwork[this.Name].TxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) {
if (showNetworkActiveSpeed == 2) {
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>";
} else {
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>";
}
}
}
}
return formatBytes(this.TxBytes, data.Options["@attributes"].byteFormat) + htmladd;
1720,7 → 1739,7
/**
* format a celcius temperature to fahrenheit and also append the right suffix
* @param {String} degreeC temperature in celvius
* @param {jQuery} xml phpSysInfo-XML
* @param {String} temperature format
* @return {String} html string with no breaking spaces and translation statements
*/
function formatTemp(degreeC, tempFormat) {
1784,7 → 1803,7
* for binary and decimal output<br>user can specify a constant format for all byte outputs or the output is formated
* automatically so that every value can be read in a user friendly way
* @param {Number} bytes value that should be converted in the corespondenting format, which is specified in the phpsysinfo.ini
* @param {jQuery} xml phpSysInfo-XML
* @param {String} byte format
* @param {parenths} if true then add parentheses
* @return {String} string of the converted bytes with the translated unit expression
*/