2781 |
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: uprecords.js 661 2014-01-08 11:26:39 aolah76 $
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
/*global $, jQuery, buildBlock, datetime, plugin_translate, genlang, createBar */
|
|
|
25 |
|
|
|
26 |
"use strict";
|
|
|
27 |
|
|
|
28 |
var uprecords_show = false;
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* insert content into table
|
|
|
32 |
* @param {jQuery} xml plugin-XML
|
|
|
33 |
*/
|
|
|
34 |
|
|
|
35 |
function uprecords_populate(xml) {
|
|
|
36 |
|
|
|
37 |
var html = "", datetimeFormat = "";
|
|
|
38 |
|
|
|
39 |
$("Options", xml).each(function getByteFormat(id) {
|
|
|
40 |
datetimeFormat = $(this).attr("datetimeFormat");
|
|
|
41 |
});
|
|
|
42 |
|
|
|
43 |
$("Plugins Plugin_uprecords uprecords Item", xml).each(function uprecords_getitem(idp) {
|
|
|
44 |
html += " <tr>\n";
|
|
|
45 |
html += " <td style=\"font-weight:normal\">" + $(this).attr("hash") + "</td>\n";
|
|
|
46 |
html += " <td style=\"font-weight:normal\">" + $(this).attr("Uptime") + "</td>\n";
|
|
|
47 |
html += " <td style=\"font-weight:normal\">" + $(this).attr("System") + "</td>\n";
|
|
|
48 |
/*
|
|
|
49 |
var lastboot = new Date($(this).attr("Bootup"));
|
|
|
50 |
if (typeof(lastboot.toUTCString)==="function") {
|
|
|
51 |
html += " <td style=\"font-weight:normal\">" + lastboot.toUTCString() + "</td>\n";
|
|
|
52 |
} else { //deprecated
|
|
|
53 |
html += " <td style=\"font-weight:normal\">" + lastboot.toGMTString() + "</td>\n";
|
|
|
54 |
}
|
|
|
55 |
*/
|
|
|
56 |
if ((datetimeFormat !== undefined) && (datetimeFormat.toLowerCase() === "locale")) {
|
|
|
57 |
var lastboot = new Date($(this).attr("Bootup"));
|
|
|
58 |
html += " <td style=\"font-weight:normal\">" + lastboot.toLocaleString() + "</td>\n";
|
|
|
59 |
} else {
|
|
|
60 |
html += " <td style=\"font-weight:normal\">" + $(this).attr("Bootup") + "</td>\n";
|
|
|
61 |
}
|
|
|
62 |
html += " </tr>\n";
|
|
|
63 |
uprecords_show = true;
|
|
|
64 |
});
|
|
|
65 |
|
|
|
66 |
$("#Plugin_uprecordsTable-tbody").empty().append(html);
|
|
|
67 |
$('#Plugin_uprecordsTable tr:nth-child(even)').addClass('even');
|
|
|
68 |
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
function uprecords_buildTable() {
|
|
|
72 |
var html = "";
|
|
|
73 |
|
|
|
74 |
html += "<div style=\"overflow-x:auto;\">\n";
|
|
|
75 |
html += " <table id=\"Plugin_uprecordsTable\" class=\"stripeMe\" style=\"border-collapse:collapse;\">\n";
|
|
|
76 |
html += " <thead>\n";
|
|
|
77 |
html += " <tr>\n";
|
|
|
78 |
html += " <th>" + genlang(101, "uprecords") + "</th>\n";
|
|
|
79 |
html += " <th>" + genlang(102, "uprecords") + "</th>\n";
|
|
|
80 |
html += " <th>" + genlang(103, "uprecords") + "</th>\n";
|
|
|
81 |
html += " <th>" + genlang(104, "uprecords") + "</th>\n";
|
|
|
82 |
html += " </tr>\n";
|
|
|
83 |
html += " </thead>\n";
|
|
|
84 |
html += " <tbody id=\"Plugin_uprecordsTable-tbody\">\n";
|
|
|
85 |
html += " </tbody>\n";
|
|
|
86 |
html += " </table>\n";
|
|
|
87 |
html += "</div>\n";
|
|
|
88 |
$("#Plugin_uprecords").append(html);
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
/**
|
|
|
92 |
* load the xml via ajax
|
|
|
93 |
*/
|
|
|
94 |
|
|
|
95 |
function uprecords_request() {
|
|
|
96 |
$("#Reload_uprecordsTable").attr("title", "reload");
|
|
|
97 |
$.ajax({
|
|
|
98 |
url: "xml.php?plugin=uprecords",
|
|
|
99 |
dataType: "xml",
|
|
|
100 |
error: function uprecords_error() {
|
|
|
101 |
$.jGrowl("Error loading XML document for Plugin uprecords!");
|
|
|
102 |
},
|
|
|
103 |
success: function uprecords_buildblock(xml) {
|
|
|
104 |
populateErrors(xml);
|
|
|
105 |
uprecords_populate(xml);
|
|
|
106 |
if (uprecords_show) {
|
|
|
107 |
plugin_translate("uprecords");
|
|
|
108 |
$("#Plugin_uprecords").show();
|
|
|
109 |
}
|
|
|
110 |
}
|
|
|
111 |
});
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
$(document).ready(function uprecords_buildpage() {
|
|
|
115 |
$("#footer").before(buildBlock("uprecords", 1, true));
|
|
|
116 |
$("#Plugin_uprecords").css("width", "915px");
|
|
|
117 |
|
|
|
118 |
uprecords_buildTable();
|
|
|
119 |
|
|
|
120 |
uprecords_request();
|
|
|
121 |
|
|
|
122 |
$("#Reload_uprecordsTable").click(function uprecords_reload(id) {
|
|
|
123 |
uprecords_request();
|
|
|
124 |
$(this).attr("title", datetime());
|
|
|
125 |
});
|
|
|
126 |
});
|