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';
155 var ref
= new TomatoRefresh('update.cgi', 'exec=devlist', 0, 'status_devices_refresh');
157 ref
.refresh = function(text
)
163 for (var uidx
= 0; uidx
< wl_ifaces
.length
; ++uidx
) {
164 if (wl_sunit(uidx
)<0)
165 E("noise"+uidx
).innerHTML
= wlnoise
[uidx
];
170 var dg
= new TomatoGrid();
172 dg
.sortCompare = function(a
, b
) {
173 var col
= this.sortColumn
;
174 var ra
= a
.getRowData();
175 var rb
= b
.getRowData();
180 r
= cmpIP(ra
.ip
, rb
.ip
);
183 r
= cmpInt(ra
.rssi
, rb
.rssi
);
186 r
= cmpInt(ra
.qual
, rb
.qual
);
189 r
= cmpText(a
.cells
[col
].innerHTML
, b
.cells
[col
].innerHTML
);
192 r
= cmpIP(ra
.ip
, rb
.ip
);
193 if (r
== 0) r
= cmpText(ra
.ifname
, rb
.ifname
);
195 return this.sortAscending
? r
: -r
;
198 dg
.populate = function()
205 for (i
= 0; i
< list
.length
; ++i
) {
215 for (i
= dhcpd_lease
.length
- 1; i
>= 0; --i
) {
218 e
.lease
= '<small><a href="javascript:deleteLease(\'L' + i
+ '\',\'' + a
[1] + '\')" title="Delete Lease" id="L' + i
+ '">' + a
[3] + '</a></small>';
220 e
.ifname
= nvram
.lan_ifname
;
223 for (i
= wldev
.length
- 1; i
>= 0; --i
) {
225 if (a
[0].indexOf('wds') == 0) {
235 if ((a
[3] > 1000) || (a
[4] > 1000))
236 e
.txrx
= ((a
[3] > 1000) ? Math
.round(a
[3] / 1000) : '-') + ' / ' + ((a
[4] > 1000) ? Math
.round(a
[4] / 1000) : '-'); //+ '<br><small>Mbps</small>';
239 for (i
= arplist
.length
- 1; i
>= 0; --i
) {
242 if ((e
= get(a
[1], a
[0])) != null) {
243 if (e
.ifname
== '') e
.ifname
= a
[2];
247 for (i
= dhcpd_static
.length
- 1; i
>= 0; --i
) {
248 a
= dhcpd_static
[i
].split('<');
249 if (a
.length
< 3) continue;
251 if (a
[1].indexOf('.') == -1) a
[1] = (ipp
+ a
[1]);
254 for (j
= c
.length
- 1; j
>= 0; --j
) {
255 if ((e
= find(c
[j
], a
[1])) != null) break;
263 b
= e
.name
.toLowerCase();
264 c
= a
[2].toLowerCase();
265 if ((b
.indexOf(c
) == -1) && (c
.indexOf(b
) == -1)) {
266 if (e
.name
!= '') e
.name
+= ', ';
272 for (i
= list
.length
- 1; i
>= 0; --i
) {
276 if (e
.mac
.match(/^(..):(..):(..)/)) {
278 '<a href="http://standards.ieee.org/cgi-bin/ouisearch?' + RegExp
.$1 + '-' + RegExp
.$2 + '-' + RegExp
.$3 + '" target="_new" title="OUI Search">[oui]</a> ' +
279 '<a href="javascript:addStatic(' + i
+ ')" title="Static Lease...">[static]</a>';
282 b
+= ' <a href="javascript:addWF(' + i
+ ')" title="Wireless Filter...">[wfilter]</a>';
290 var ifidx
= wl_uidx(e
.unit
);
291 if ((e
.rssi
!== '') && (ifidx
>= 0) && (wlnoise
[ifidx
] < 0)) {
292 e
.qual
= MAX(e
.rssi
- wlnoise
[ifidx
], 0);
299 e
.ifname
, b
, (e
.ip
== '-') ? '' : e
.ip
, e
.name
,
300 (e
.rssi
!= 0) ? e
.rssi
+ ' <small>dBm</small>' : '',
301 (e
.qual
< 0) ? '' : '<small>' + e
.qual
+ '</small> <img src="bar' + MIN(MAX(Math
.floor(e
.qual
/ 10), 1), 6) + '.gif">',
302 e
.txrx
, e
.lease
], false);
306 dg
.setup = function()
308 this.init('dev-grid', 'sort');
309 this.headerSet(['Interface', 'MAC Address', 'IP Address', 'Name', 'RSSI ', 'Quality', 'TX/RX Rate ', 'Lease ']);
322 ref
.initPage(3000, 3);
326 <body onload='init()'
>
327 <table id='container' cellspacing=
0>
328 <tr><td colspan=
2 id='header'
>
329 <div class='title'
>Tomato
</div>
330 <div class='version'
>Version <%
version(); %></div>
332 <tr id='body'
><td id='navi'
><script type='text/javascript'
>navi()</script></td>
334 <div id='ident'
><%
ident(); %></div>
338 <div class='section-title'
>Device List
</div>
339 <div class='section'
>
340 <table id='dev-grid' class='tomato-grid' cellspacing=
0></table>
342 <script type='text/javascript'
>
344 for (var uidx
= 0; uidx
< wl_ifaces
.length
; ++uidx
) {
345 var u
= wl_unit(uidx
);
346 if (nvram
['wl'+u
+'_radio'] == '1') {
347 if (wl_sunit(uidx
)<0) {
349 if ((nvram
['wl'+u
+'_mode'] == 'ap') || (nvram
['wl'+u
+'_mode'] == 'wds'))
350 a
= ' <input type="button" value="Measure" onclick="javascript:window.location=\'wlmnoise.cgi?_http_id=' + nvram
.http_id
+ '&_wl_unit=' + u
+'\'">';
351 f
.push( { title
: '<b>Noise Floor (' + wl_ifaces
[uidx
][0] + ') :</b>',
352 prefix
: '<span id="noise'+uidx
+'">',
353 custom
: wlnoise
[uidx
],
354 suffix
: '</span> <small>dBm</small>' + a
} );
358 createFieldTable('', f
);
366 <tr><td id='footer' colspan=
2><script type='text/javascript'
>genStdRefresh(1,1,'ref.toggle()');</script></td></tr>
368 <script type='text/javascript'
>earlyInit();</script>