1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
12 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
13 <meta name='robots' content='noindex,nofollow'
>
14 <title>[<%
ident(); %>] Status: Device List
</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'
>
16 <link rel='stylesheet' type='text/css' href='color.css'
>
17 <script type='text/javascript' src='tomato.js'
></script>
21 <style type='text/css'
>
51 <script type='text/javascript' src='debug.js'
></script>
53 <script type='text/javascript'
>
55 ipp
= '<% lipp(); %>.';
56 //<% nvram('lan_ifname,wl_ifname,wl_mode,wl_radio'); %>
61 function find(mac
, ip
)
65 mac
= mac
.toUpperCase();
66 for (i
= list
.length
- 1; i
>= 0; --i
) {
68 if (((e
.mac
== mac
) && ((e
.ip
== ip
) || (e
.ip
== '') || (ip
== null))) ||
69 ((e
.mac
== '00:00:00:00:00:00') && (e
.ip
== ip
))) {
80 mac
= mac
.toUpperCase();
81 if ((e
= find(mac
, ip
)) != null) {
102 function _deleteLease(ip
)
104 form
.submitHidden('dhcpd.cgi', { remove
: ip
});
107 function deleteLease(a
, ip
)
110 if ((xob
= new XmlHttp()) == null) {
116 a
.innerHTML
= 'deleting...';
118 xob
.onCompleted = function(text
, xml
) {
122 xob
.onError = function() {
126 xob
.post('dhcpd.cgi', 'remove=' + ip
);
129 function addStatic(n
)
132 cookie
.set('addstatic', [e
.mac
, e
.ip
, e
.name
.split(',')[0]].join(','), 1);
133 location
.href
= 'basic-static.asp';
139 cookie
.set('addmac', [e
.mac
, e
.name
.split(',')[0]].join(','), 1);
140 location
.href
= 'basic-wfilter.asp';
144 var ref
= new TomatoRefresh('update.cgi', 'exec=devlist', 0, 'status_devices_refresh');
146 ref
.refresh = function(text
)
152 E("noise").innerHTML
= wlnoise
;
156 var dg
= new TomatoGrid();
158 dg
.sortCompare = function(a
, b
) {
159 var col
= this.sortColumn
;
160 var ra
= a
.getRowData();
161 var rb
= b
.getRowData();
166 r
= cmpIP(ra
.ip
, rb
.ip
);
169 r
= cmpInt(ra
.rssi
, rb
.rssi
);
172 r
= cmpInt(ra
.qual
, rb
.qual
);
175 r
= cmpText(a
.cells
[col
].innerHTML
, b
.cells
[col
].innerHTML
);
178 r
= cmpIP(ra
.ip
, rb
.ip
);
179 if (r
== 0) r
= cmpText(ra
.ifname
, rb
.ifname
);
181 return this.sortAscending
? r
: -r
;
184 dg
.populate = function()
191 for (i
= 0; i
< list
.length
; ++i
) {
199 for (i
= dhcpd_lease
.length
- 1; i
>= 0; --i
) {
202 e
.lease
= '<small><a href="javascript:deleteLease(\'L' + i
+ '\',\'' + a
[1] + '\')" title="Delete Lease" id="L' + i
+ '">' + a
[3] + '</a></small>';
204 e
.ifname
= nvram
.lan_ifname
;
207 for (i
= wldev
.length
- 1; i
>= 0; --i
) {
209 if (a
[0].indexOf('wds') == 0) {
215 e
.ifname
= nvram
.wl_ifname
;
220 for (i
= arplist
.length
- 1; i
>= 0; --i
) {
223 if ((e
= get(a
[1], a
[0])) != null) {
224 if (e
.ifname
== '') e
.ifname
= a
[2];
228 for (i
= dhcpd_static
.length
- 1; i
>= 0; --i
) {
229 a
= dhcpd_static
[i
].split('<');
230 if (a
.length
< 3) continue;
232 if (a
[1].indexOf('.') == -1) a
[1] = (ipp
+ a
[1]);
235 for (j
= c
.length
- 1; j
>= 0; --j
) {
236 if ((e
= find(c
[j
], a
[1])) != null) break;
244 b
= e
.name
.toLowerCase();
245 c
= a
[2].toLowerCase();
246 if ((b
.indexOf(c
) == -1) && (c
.indexOf(b
) == -1)) {
247 if (e
.name
!= '') e
.name
+= ', ';
253 for (i
= list
.length
- 1; i
>= 0; --i
) {
257 if (e
.mac
.match(/^(..):(..):(..)/)) {
259 '<a href="http://standards.ieee.org/cgi-bin/ouisearch?' + RegExp
.$1 + '-' + RegExp
.$2 + '-' + RegExp
.$3 + '" target="_new" title="OUI Search">[oui]</a> ' +
260 '<a href="javascript:addStatic(' + i
+ ')" title="Static Lease...">[static]</a>';
263 b
+= ' <a href="javascript:addWF(' + i
+ ')" title="Wireless Filter...">[wfilter]</a>';
271 if ((e
.rssi
!== '') && (wlnoise
< 0)) {
272 e
.qual
= MAX(e
.rssi
- wlnoise
, 0);
279 e
.ifname
, b
, (e
.ip
== '-') ? '' : e
.ip
, e
.name
,
280 (e
.rssi
!= 0) ? e
.rssi
+ ' <small>dBm</small>' : '',
281 (e
.qual
< 0) ? '' : '<small>' + e
.qual
+ '</small> <img src="bar' + MIN(MAX(Math
.floor(e
.qual
/ 10), 1), 6) + '.gif">',
286 dg
.setup = function()
288 this.init('dev-grid', 'sort');
289 this.headerSet(['Interface', 'MAC Address', 'IP Address', 'Name', 'RSSI ', 'Quality', 'Lease ']);
302 ref
.initPage(3000, 3);
306 <body onload='init()'
>
307 <table id='container' cellspacing=
0>
308 <tr><td colspan=
2 id='header'
>
309 <div class='title'
>Tomato
</div>
310 <div class='version'
>Version <%
version(); %></div>
312 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
314 <div id='ident'
><%
ident(); %></div>
318 <div class='section-title'
>Device List
</div>
319 <div class='section'
>
320 <table id='dev-grid' class='tomato-grid' cellspacing=
0></table>
321 <script type='text/javascript'
>
322 if (nvram
.wl_radio
== '1') {
323 W('<div style="float:left"><b>Noise Floor:</b> <span id="noise">' + wlnoise
+ '</span> <small>dBm</small>');
324 if ((nvram
.wl_mode
== 'ap') || (nvram
.wl_mode
== 'wds')) {
325 W(' <input type="button" value="Measure" onclick="javascript:window.location=\'wlmnoise.cgi?_http_id=' + nvram
.http_id
+ '\'">');
336 <tr><td id='footer' colspan=
2><script type='text/javascript'
>genStdRefresh(1,0,'ref.toggle()');</script></td></tr>
338 <script type='text/javascript'
>earlyInit();</script>