forked from Jackysi/advancedtomato-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nas-ups.asp
78 lines (72 loc) · 1.97 KB
/
nas-ups.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!--
Tomato GUI
For use with Tomato Firmware only.
No part of this file may be used without permission.
--><title>UPS Monitor</title>
<content>
<script type="text/javascript">
// <% nvram("at_update,tomatoanon_answer"); %>
function init() {
clientSideInclude('ups-status', '/ext/cgi-bin/tomatoups.cgi');
clientSideInclude('ups-data', '/ext/cgi-bin/tomatodata.cgi');
}
function clientSideInclude(id, url) {
var req = false;
// For Safari, Firefox, and other non-MS browsers
if (window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch (e) {
req = false;
}
} else if (window.ActiveXObject) {
// For Internet Explorer on Windows
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
req = false;
}
}
}
var element = document.getElementById(id);
if (!element) {
alert("Bad id " + id +
"passed to clientSideInclude." +
"You need a div or span element " +
"with this id in your page.");
return;
}
if (req) {
// Synchronous request, wait till we have it all
req.open('GET', url, false);
req.send(null);
element.innerHTML = req.responseText;
$('.tomato-grid').addClass('line-table');
} else {
element.innerHTML =
"Sorry, your browser does not support " +
"XMLHTTPRequest objects. This page requires " +
"Internet Explorer 5 or better for Windows, " +
"or Firefox for any system, or Safari. Other " +
"compatible browsers may also exist.";
}
}
</script>
<input type="hidden" name="_nextpage" value="/#nas-ups.asp">
<div class="box">
<div class="heading">APC UPS Status</div>
<div class="content">
<span id="ups-status"></span>
</div>
</div>
<div class="box">
<div class="heading">UPS Response</div>
<div class="content">
<span id="ups-data"></span>
</div>
</div>
<script type="text/javascript">init();</script>
</content>