1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML
4.0//EN'
>
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
8 Copyright (C) 2011 Augusto Bott
9 http://code.google.com/p/tomato-sdhc-vlan/
11 For use with Tomato Firmware only.
12 No part of this file may be used without permission.
16 <meta http-equiv='content-type' content='text/html;charset=utf-
8'
>
17 <meta name='robots' content='noindex,nofollow'
>
18 <title>[<%
ident(); %>] Status: Device List
</title>
19 <link rel='stylesheet' type='text/css' href='tomato.css'
>
21 <script type='text/javascript' src='tomato.js'
></script>
25 <style type='text/css'
>
59 <script type='text/javascript' src='debug.js'
></script>
61 <script type='text/javascript' src='wireless.jsx?_http_id=<%
nv(http_id
); %>'
></script>
62 <script type='text/javascript'
>
64 ipp
= '<% lipp(); %>.';
65 //<% nvram('lan_ifname,wl_ifname,wl_mode,wl_radio'); %>
70 function find(mac
, ip
)
74 mac
= mac
.toUpperCase();
75 for (i
= list
.length
- 1; i
>= 0; --i
) {
77 if (((e
.mac
== mac
) && ((e
.ip
== ip
) || (e
.ip
== '') || (ip
== null))) ||
78 ((e
.mac
== '00:00:00:00:00:00') && (e
.ip
== ip
))) {
89 mac
= mac
.toUpperCase();
90 if ((e
= find(mac
, ip
)) != null) {
113 function _deleteLease(ip
)
115 form
.submitHidden('dhcpd.cgi', { remove
: ip
});
118 function deleteLease(a
, ip
)
121 if ((xob
= new XmlHttp()) == null) {
127 a
.innerHTML
= 'deleting...';
129 xob
.onCompleted = function(text
, xml
) {
133 xob
.onError = function() {
137 xob
.post('dhcpd.cgi', 'remove=' + ip
);
140 function addStatic(n
)
143 cookie
.set('addstatic', [e
.mac
, e
.ip
, e
.name
.split(',')[0]].join(','), 1);
144 location
.href
= 'basic-static.asp';
150 cookie
.set('addmac', [e
.mac
, e
.name
.split(',')[0]].join(','), 1);
151 location
.href
= 'basic-wfilter.asp';
154 function addbwlimit(n
)
157 cookie
.set('addbwlimit', [e
.ip
, e
.name
.split(',')[0]].join(','), 1);
158 location
.href
= 'bwlimit.asp';
161 var ref
= new TomatoRefresh('update.cgi', 'exec=devlist', 0, 'status_devices_refresh');
163 ref
.refresh = function(text
)
169 for (var uidx
= 0; uidx
< wl_ifaces
.length
; ++uidx
) {
170 if (wl_sunit(uidx
)<0)
171 E("noise"+uidx
).innerHTML
= wlnoise
[uidx
];
176 var dg
= new TomatoGrid();
178 dg
.sortCompare = function(a
, b
) {
179 var col
= this.sortColumn
;
180 var ra
= a
.getRowData();
181 var rb
= b
.getRowData();
186 r
= cmpIP(ra
.ip
, rb
.ip
);
189 r
= cmpInt(ra
.rssi
, rb
.rssi
);
192 r
= cmpInt(ra
.qual
, rb
.qual
);
195 r
= cmpText(a
.cells
[col
].innerHTML
, b
.cells
[col
].innerHTML
);
198 r
= cmpIP(ra
.ip
, rb
.ip
);
199 if (r
== 0) r
= cmpText(ra
.ifname
, rb
.ifname
);
201 return this.sortAscending
? r
: -r
;
204 dg
.populate = function()
211 for (i
= 0; i
< list
.length
; ++i
) {
221 for (i
= dhcpd_lease
.length
- 1; i
>= 0; --i
) {
224 e
.lease
= '<small><a href="javascript:deleteLease(\'L' + i
+ '\',\'' + a
[1] + '\')" title="Delete Lease" id="L' + i
+ '">' + a
[3] + '</a></small>';
229 for (i
= wldev
.length
- 1; i
>= 0; --i
) {
231 if (a
[0].indexOf('wds') == 0) {
241 if ((a
[3] > 1000) || (a
[4] > 1000))
242 e
.txrx
= ((a
[3] > 1000) ? Math
.round(a
[3] / 1000) : '-') + ' / ' + ((a
[4] > 1000) ? Math
.round(a
[4] / 1000) : '-'); //+ '<br><small>Mbps</small>';
245 for (i
= arplist
.length
- 1; i
>= 0; --i
) {
248 if ((e
= get(a
[1], a
[0])) != null) {
249 if (e
.ifname
== '') e
.ifname
= a
[2];
253 for (i
= dhcpd_static
.length
- 1; i
>= 0; --i
) {
254 a
= dhcpd_static
[i
].split('<');
255 if (a
.length
< 3) continue;
257 if (a
[1].indexOf('.') == -1) a
[1] = (ipp
+ a
[1]);
260 for (j
= c
.length
- 1; j
>= 0; --j
) {
261 if ((e
= find(c
[j
], a
[1])) != null) break;
273 b
= e
.name
.toLowerCase();
274 c
= a
[2].toLowerCase();
275 if ((b
.indexOf(c
) == -1) && (c
.indexOf(b
) == -1)) {
276 if (e
.name
!= '') e
.name
+= ', ';
282 for (i
= list
.length
- 1; i
>= 0; --i
) {
286 if (e
.mac
.match(/^(..):(..):(..)/)) {
288 '<a href="http://standards.ieee.org/cgi-bin/ouisearch?' + RegExp
.$1 + '-' + RegExp
.$2 + '-' + RegExp
.$3 + '" target="_new" title="OUI Search">[oui]</a> ' +
289 '<a href="javascript:addStatic(' + i
+ ')" title="Static Lease...">[static]</a> ' +
290 '<a href="javascript:addbwlimit(' + i
+ ')" title="BW Limiter">[bwlimit]</a>';
293 b
+= ' <a href="javascript:addWF(' + i
+ ')" title="Wireless Filter...">[wfilter]</a>';
301 var ifidx
= wl_uidx(e
.unit
);
302 if ((e
.rssi
!== '') && (ifidx
>= 0) && (wlnoise
[ifidx
] < 0)) {
303 e
.qual
= MAX(e
.rssi
- wlnoise
[ifidx
], 0);
310 e
.ifname
, b
, (e
.ip
== '-') ? '' : e
.ip
, e
.name
,
311 (e
.rssi
!= 0) ? e
.rssi
+ ' <small>dBm</small>' : '',
312 (e
.qual
< 0) ? '' : '<small>' + e
.qual
+ '</small> <img src="bar' + MIN(MAX(Math
.floor(e
.qual
/ 10), 1), 6) + '.gif">',
313 e
.txrx
, e
.lease
], false);
317 dg
.setup = function()
319 this.init('dev-grid', 'sort');
320 this.headerSet(['Interface', 'MAC Address', 'IP Address', 'Name', 'RSSI ', 'Quality', 'TX/RX Rate ', 'Lease ']);
333 ref
.initPage(3000, 3);
337 <body onload='init()'
>
338 <table id='container' cellspacing=
0>
339 <tr><td colspan=
2 id='header'
>
340 <div class='title'
>Tomato
</div>
341 <div class='version'
>Version <%
version(); %></div>
343 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
345 <div id='ident'
><%
ident(); %></div>
349 <div class='section-title'
>Device List
</div>
350 <div class='section'
>
351 <table id='dev-grid' class='tomato-grid' cellspacing=
0></table>
353 <script type='text/javascript'
>
355 for (var uidx
= 0; uidx
< wl_ifaces
.length
; ++uidx
) {
356 var u
= wl_unit(uidx
);
357 if (nvram
['wl'+u
+'_radio'] == '1') {
358 if (wl_sunit(uidx
)<0) {
360 if ((nvram
['wl'+u
+'_mode'] == 'ap') || (nvram
['wl'+u
+'_mode'] == 'wds'))
361 a
= ' <input type="button" value="Measure" onclick="javascript:window.location=\'wlmnoise.cgi?_http_id=' + nvram
.http_id
+ '&_wl_unit=' + u
+'\'">';
362 f
.push( { title
: '<b>Noise Floor (' + wl_ifaces
[uidx
][0] + ') :</b>',
363 prefix
: '<span id="noise'+uidx
+'">',
364 custom
: wlnoise
[uidx
],
365 suffix
: '</span> <small>dBm</small>' + a
} );
369 createFieldTable('', f
);
377 <tr><td id='footer' colspan=
2><script type='text/javascript'
>genStdRefresh(1,0,'ref.toggle()');</script></td></tr>
379 <script type='text/javascript'
>earlyInit();</script>