Merge branch 'Teaman-ND' into Toastman-IPT-ND
[tomato.git] / release / src / router / www / status-overview.asp
blob6fa5b022272d8f0f0d57c67385f21781976ca6ee
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2006-2010 Jonathan Zarate
5 http://www.polarcloud.com/tomato/
7 Tomato VLAN GUI
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.
13 -->
14 <html>
15 <head>
16 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
17 <meta name='robots' content='noindex,nofollow'>
18 <title>[<% ident(); %>] Status: Overview</title>
19 <link rel='stylesheet' type='text/css' href='tomato.css'>
20 <% css(); %>
21 <script type='text/javascript' src='tomato.js'></script>
22 <script type='text/javascript' src='interfaces.js'></script>
24 <!-- / / / -->
26 <style type='text/css'>
27 .controls {
28 width: 90px;
29 margin-top: 5px;
30 margin-bottom: 10px;
32 </style>
34 <script type='text/javascript' src='debug.js'></script>
36 <script type='text/javascript'>
37 wmo = {'ap':'Access Point','sta':'Wireless Client','wet':'Wireless Ethernet Bridge','wds':'WDS'};
38 auth = {'disabled':'-','wep':'WEP','wpa_personal':'WPA Personal (PSK)','wpa_enterprise':'WPA Enterprise','wpa2_personal':'WPA2 Personal (PSK)','wpa2_enterprise':'WPA2 Enterprise','wpaX_personal':'WPA / WPA2 Personal','wpaX_enterprise':'WPA / WPA2 Enterprise','radius':'Radius'};
39 enc = {'tkip':'TKIP','aes':'AES','tkip+aes':'TKIP / AES'};
40 bgmo = {'disabled':'-','mixed':'Auto','b-only':'B Only','g-only':'G Only','bg-mixed':'B/G Mixed','lrs':'LRS','n-only':'N Only'};
42 lastjiffiestotal = 0;
43 lastjiffiesidle = 0;
44 lastjiffiesusage = 100;
45 </script>
47 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
48 <script type='text/javascript' src='status-data.jsx?_http_id=<% nv(http_id); %>'></script>
50 <script type='text/javascript'>
51 show_dhcpc = ((nvram.wan_proto == 'dhcp') || (((nvram.wan_proto == 'l2tp') || (nvram.wan_proto == 'pptp')) && (nvram.pptp_dhcp == '1')));
52 show_codi = ((nvram.wan_proto == 'pppoe') || (nvram.wan_proto == 'l2tp') || (nvram.wan_proto == 'pptp'));
54 show_radio = [];
55 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
56 /* REMOVE-BEGIN
57 // show_radio.push((nvram['wl'+wl_unit(uidx)+'_radio'] == '1'));
58 REMOVE-END */
59 if (wl_sunit(uidx)<0)
60 show_radio.push((nvram['wl'+wl_fface(uidx)+'_radio'] == '1'));
63 nphy = features('11n');
65 function dhcpc(what)
67 form.submitHidden('dhcpc.cgi', { exec: what, _redirect: 'status-overview.asp' });
70 function serv(service, sleep)
72 form.submitHidden('service.cgi', { _service: service, _redirect: 'status-overview.asp', _sleep: sleep });
75 function wan_connect()
77 serv('wan-restart', 5);
80 function wan_disconnect()
82 serv('wan-stop', 2);
85 function wlenable(uidx, n)
87 form.submitHidden('wlradio.cgi', { enable: '' + n, _nextpage: 'status-overview.asp', _nextwait: n ? 6 : 3, _wl_unit: wl_unit(uidx) });
90 var ref = new TomatoRefresh('status-data.jsx', '', 0, 'status_overview_refresh');
92 ref.refresh = function(text)
94 stats = {};
95 try {
96 eval(text);
98 catch (ex) {
99 stats = {};
101 show();
105 function c(id, htm)
107 E(id).cells[1].innerHTML = htm;
110 function show()
112 c('cpu', stats.cpuload);
113 c('cpupercent', stats.cpupercent);
114 c('uptime', stats.uptime);
115 c('time', stats.time);
116 c('wanip', stats.wanip);
117 c('wanprebuf',stats.wanprebuf); //Victek
118 c('wannetmask', stats.wannetmask);
119 c('wangateway', stats.wangateway);
120 c('dns', stats.dns);
121 c('memory', stats.memory);
122 c('swap', stats.swap);
123 elem.display('swap', stats.swap != '');
125 /* IPV6-BEGIN */
126 c('ip6_wan', stats.ip6_wan);
127 elem.display('ip6_wan', stats.ip6_wan != '');
128 c('ip6_lan', stats.ip6_lan);
129 elem.display('ip6_lan', stats.ip6_lan != '');
130 c('ip6_lan_ll', stats.ip6_lan_ll);
131 elem.display('ip6_lan_ll', stats.ip6_lan_ll != '');
132 /* IPV6-END */
134 c('wanstatus', stats.wanstatus);
135 c('wanuptime', stats.wanuptime);
136 if (show_dhcpc) c('wanlease', stats.wanlease);
137 if (show_codi) {
138 E('b_connect').disabled = stats.wanup;
139 E('b_disconnect').disabled = !stats.wanup;
142 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
143 if (wl_sunit(uidx)<0) {
144 c('radio'+uidx, wlstats[uidx].radio ? 'Enabled' : '<b>Disabled</b>');
145 c('rate'+uidx, wlstats[uidx].rate);
146 if (show_radio[uidx]) {
147 E('b_wl'+uidx+'_enable').disabled = wlstats[uidx].radio;
148 E('b_wl'+uidx+'_disable').disabled = !wlstats[uidx].radio;
150 c('channel'+uidx, stats.channel[uidx]);
151 if (nphy) {
152 c('nbw'+uidx, wlstats[uidx].nbw);
154 c('interference'+uidx, stats.interference[uidx]);
155 elem.display('interference'+uidx, stats.interference[uidx] != '');
157 if (wlstats[uidx].client) {
158 c('rssi'+uidx, wlstats[uidx].rssi || '');
159 c('noise'+uidx, wlstats[uidx].noise || '');
160 c('qual'+uidx, stats.qual[uidx] || '');
163 c('ifstatus'+uidx, wlstats[uidx].ifstatus || '');
167 function earlyInit()
169 elem.display('b_dhcpc', show_dhcpc);
170 elem.display('b_connect', 'b_disconnect', show_codi);
171 if (nvram.wan_proto == 'disabled')
172 elem.display('wan-title', 'sesdiv_wan', 0);
173 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
174 if (wl_sunit(uidx)<0)
175 elem.display('b_wl'+wl_fface(uidx)+'_enable', 'b_wl'+wl_fface(uidx)+'_disable', show_radio[uidx]);
177 show();
180 function init() {
181 var c;
182 if (((c = cookie.get('status_overview_system_vis')) != null) && (c != '1')) toggleVisibility("system");
183 if (((c = cookie.get('status_overview_wan_vis')) != null) && (c != '1')) toggleVisibility("wan");
184 if (((c = cookie.get('status_overview_lan_vis')) != null) && (c != '1')) toggleVisibility("lan");
185 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
186 u = wl_fface(uidx);
187 if (((c = cookie.get('status_overview_wl_'+u+'_vis')) != null) && (c != '1')) toggleVisibility("wl_"+u);
190 ref.initPage(3000, 3);
193 function toggleVisibility(whichone) {
194 if (E('sesdiv_' + whichone).style.display == '') {
195 E('sesdiv_' + whichone).style.display = 'none';
196 E('sesdiv_' + whichone + '_showhide').innerHTML = '(Click here to show)';
197 cookie.set('status_overview_' + whichone + '_vis', 0);
198 } else {
199 E('sesdiv_' + whichone).style.display='';
200 E('sesdiv_' + whichone + '_showhide').innerHTML = '(Click here to hide)';
201 cookie.set('status_overview_' + whichone + '_vis', 1);
204 </script>
206 </head>
207 <body onload='init()'>
208 <form>
209 <table id='container' cellspacing=0>
210 <tr><td colspan=2 id='header'>
211 <div class='title'>Tomato</div>
212 <div class='version'>Version <% version(); %></div>
213 </td></tr>
214 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
215 <td id='content'>
216 <div id='ident'><% ident(); %></div>
218 <!-- / / / -->
220 <div class='section-title'>System <small><i><a href='javascript:toggleVisibility("system");'><span id='sesdiv_system_showhide'>(Click here to hide)</span></a></i></small></div>
221 <div class='section' id='sesdiv_system'>
222 <script type='text/javascript'>
223 createFieldTable('', [
224 { title: 'Name', text: nvram.router_name },
225 { title: 'Model', text: nvram.t_model_name },
226 { title: 'Chipset', text: stats.systemtype },
227 { title: 'CPU Freq', text: stats.cpumhz },
228 { title: 'Flash RAM Size', text: stats.flashsize },
229 null,
230 { title: 'Time', rid: 'time', text: stats.time },
231 { title: 'Uptime', rid: 'uptime', text: stats.uptime },
232 { title: 'CPU Load <small>(1 / 5 / 15 mins)</small>', rid: 'cpu', text: stats.cpuload },
233 { title: 'CPU Usage', rid: 'cpupercent', text: stats.cpupercent },
234 { title: 'Total / Free Memory', rid: 'memory', text: stats.memory },
235 { title: 'Total / Free Swap', rid: 'swap', text: stats.swap, hidden: (stats.swap == '') },
237 </script>
238 </div>
240 <div class='section-title' id='wan-title'>WAN <small><i><a href='javascript:toggleVisibility("wan");'><span id='sesdiv_wan_showhide'>(Click here to hide)</span></a></i></small></div>
241 <div class='section' id='sesdiv_wan'>
242 <script type='text/javascript'>
243 createFieldTable('', [
244 { title: 'MAC Address', text: nvram.wan_hwaddr },
245 { title: 'Connection Type', text: { 'dhcp':'DHCP', 'static':'Static IP', 'pppoe':'PPPoE', 'pptp':'PPTP', 'l2tp':'L2TP' }[nvram.wan_proto] || '-' },
246 { title: 'IP Address', rid: 'wanip', text: stats.wanip },
247 { title: 'Previous WAN IP', rid: 'wanprebuf',text:stats.wanprebuf }, //Victek
248 { title: 'Subnet Mask', rid: 'wannetmask', text: stats.wannetmask },
249 { title: 'Gateway', rid: 'wangateway', text: stats.wangateway },
250 /* IPV6-BEGIN */
251 { title: 'IPv6 Address', rid: 'ip6_wan', text: stats.ip6_wan, hidden: (stats.ip6_wan == '') },
252 /* IPV6-END */
253 { title: 'DNS', rid: 'dns', text: stats.dns },
254 { title: 'MTU', text: nvram.wan_run_mtu },
255 null,
256 { title: 'Status', rid: 'wanstatus', text: stats.wanstatus },
257 { title: 'Connection Uptime', rid: 'wanuptime', text: stats.wanuptime },
258 { title: 'Remaining Lease Time', rid: 'wanlease', text: stats.wanlease, ignore: !show_dhcpc }
260 </script>
261 <span id='b_dhcpc' style='display:none'>
262 <input type='button' class='controls' onclick='dhcpc("renew")' value='Renew'>
263 <input type='button' class='controls' onclick='dhcpc("release")' value='Release'> &nbsp;
264 </span>
265 <input type='button' class='controls' onclick='wan_connect()' value='Connect' id='b_connect' style='display:none'>
266 <input type='button' class='controls' onclick='wan_disconnect()' value='Disconnect' id='b_disconnect' style='display:none'>
267 </div>
270 <div class='section-title'>LAN <small><i><a href='javascript:toggleVisibility("lan");'><span id='sesdiv_lan_showhide'>(Click here to hide)</span></a></i></small></div>
271 <div class='section' id='sesdiv_lan'>
272 <script type='text/javascript'>
274 /* VLAN-BEGIN */
275 var s='';
276 var t='';
277 for (var i = 0 ; i <= MAX_BRIDGE_ID ; i++) {
278 var j = (i == 0) ? '' : i.toString();
279 if (nvram['lan' + j + '_ifname'].length > 0) {
280 if (nvram['lan' + j + '_proto'] == 'dhcp') {
281 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
282 var x = nvram['lan' + j + '_ipaddr'].split('.').splice(0, 3).join('.') + '.';
283 nvram['dhcpd' + j + '_startip'] = x + nvram['dhcp' + j + '_start'];
284 nvram['dhcpd' + j + '_endip'] = x + ((nvram['dhcp' + j + '_start'] * 1) + (nvram['dhcp' + j + '_num'] * 1) - 1);
286 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
287 s += '<a href="status-devices.asp">' + nvram['dhcpd' + j + '_startip'] + ' - ' + nvram['dhcpd' + j + '_endip'] + '</a> on LAN' + j + ' (br' + i + ')';
288 } else {
289 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
290 s += 'Disabled on LAN' + j + ' (br' + i + ')';
292 t += ((t.length>0)&&(t.charAt(t.length-1) != ' ')) ? ', ' : '';
293 t += nvram['lan' + j + '_ipaddr'] + '/' + numberOfBitsOnNetMask(nvram['lan' + j + '_netmask']) + ' on LAN' + j + ' (br' + i + ')';
297 createFieldTable('', [
298 { title: 'Router MAC Address', text: nvram.et0macaddr },
299 { title: 'Router IP Addresses', text: t },
300 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
301 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
302 { title: 'DHCP', text: s }
304 /* VLAN-END */
306 /* NOVLAN-BEGIN */
307 if (nvram.lan_proto == 'dhcp') {
308 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
309 var x = nvram.lan_ipaddr.split('.').splice(0, 3).join('.') + '.';
310 nvram.dhcpd_startip = x + nvram.dhcp_start;
311 nvram.dhcpd_endip = x + ((nvram.dhcp_start * 1) + (nvram.dhcp_num * 1) - 1);
313 return(Number.NaN);
316 function numberOfBitsOnNetMask(netmask) {
317 var total = 0;
318 var t = netmask.split('.');
319 for (var i = 0; i<= 3 ; i++) {
320 total += h_countbitsfromleft(t[i]);
322 return total;
325 var s='';
326 var t='';
327 MAX_BRIDGE_ID=3;
328 for (var i = 0 ; i <= MAX_BRIDGE_ID ; i++) {
329 var j = (i == 0) ? '' : i.toString();
330 if (nvram['lan' + j + '_ifname'].length > 0) {
331 if (nvram['lan' + j + '_proto'] == 'dhcp') {
332 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
333 var x = nvram['lan' + j + '_ipaddr'].split('.').splice(0, 3).join('.') + '.';
334 nvram['dhcpd' + j + '_startip'] = x + nvram['dhcp' + j + '_start'];
335 nvram['dhcpd' + j + '_endip'] = x + ((nvram['dhcp' + j + '_start'] * 1) + (nvram['dhcp' + j + '_num'] * 1) - 1);
337 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
338 s += '<a href="status-devices.asp">' + nvram['dhcpd' + j + '_startip'] + ' - ' + nvram['dhcpd' + j + '_endip'] + '</a> on LAN' + j + ' (br' + i + ')';
339 } else {
340 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
341 s += 'Disabled on LAN' + j + ' (br' + i + ')';
343 t += ((t.length>0)&&(t.charAt(t.length-1) != ' ')) ? ', ' : '';
344 t += nvram['lan' + j + '_ipaddr'] + '/' + numberOfBitsOnNetMask(nvram['lan' + j + '_netmask']) + ' on LAN' + j + ' (br' + i + ')';
348 createFieldTable('', [
349 { title: 'Router MAC Address', text: nvram.et0macaddr },
350 { title: 'Router IP Addresses', text: t },
351 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
352 /* IPV6-BEGIN */
353 { title: 'Router IPv6 Address', rid: 'ip6_lan', text: stats.ip6_lan, hidden: (stats.ip6_lan == '') },
354 { title: 'IPv6 Link-local Address', rid: 'ip6_lan_ll', text: stats.ip6_lan_ll, hidden: (stats.ip6_lan_ll == '') },
355 /* IPV6-END */
356 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
357 { title: 'DHCP', text: s }
359 /* NOVLAN-END */
361 </script>
362 </div>
364 <script type='text/javascript'>
365 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
366 /* REMOVE-BEGIN
367 // u = wl_unit(uidx);
368 REMOVE-END */
369 u = wl_fface(uidx);
370 W('<div class=\'section-title\' id=\'wl'+u+'-title\'>Wireless');
371 if (wl_ifaces.length > 0)
372 W(' (' + wl_display_ifname(uidx) + ')');
373 W(' <small><i><a href=\'javascript:toggleVisibility("wl_' + u + '");\'><span id=\'sesdiv_wl_' +u + '_showhide\'>(Click here to hide)</span></a></i></small>');
374 W('</div>');
375 W('<div class=\'section\' id=\'sesdiv_wl_'+u+'\'>');
376 sec = auth[nvram['wl'+u+'_security_mode']] + '';
377 if (sec.indexOf('WPA') != -1) sec += ' + ' + enc[nvram['wl'+u+'_crypto']];
379 wmode = wmo[nvram['wl'+u+'_mode']] + '';
380 if ((nvram['wl'+u+'_mode'] == 'ap') && (nvram['wl'+u+'_wds_enable'] * 1)) wmode += ' + WDS';
382 createFieldTable('', [
383 { title: 'MAC Address', text: nvram['wl'+u+'_hwaddr'] },
384 { title: 'Wireless Mode', text: wmode },
385 { title: 'Wireless Network Mode', text: bgmo[nvram['wl'+u+'_net_mode']], ignore: (wl_sunit(uidx)>=0) },
386 { title: 'Interface Status', rid: 'ifstatus'+uidx, text: wlstats[uidx].ifstatus },
387 { title: 'Radio', rid: 'radio'+uidx, text: (wlstats[uidx].radio == 0) ? '<b>Disabled</b>' : 'Enabled', ignore: (wl_sunit(uidx)>=0) },
388 /* REMOVE-BEGIN */
389 // { title: 'SSID', text: (nvram['wl'+u+'_ssid'] + ' <small><i>' + ((nvram['wl'+u+'_mode'] != 'ap') ? '' : ((nvram['wl'+u+'_closed'] == 0) ? '(Broadcast Enabled)' : '(Broadcast Disabled)')) + '</i></small>') },
390 /* REMOVE-END */
391 { title: 'SSID', text: nvram['wl'+u+'_ssid'] },
392 { title: 'Broadcast', text: (nvram['wl'+u+'_closed'] == 0) ? 'Enabled' : '<b>Disabled</b>', ignore: (nvram['wl'+u+'_mode'] != 'ap') },
393 { title: 'Security', text: sec },
394 { title: 'Channel', rid: 'channel'+uidx, text: stats.channel[uidx], ignore: (wl_sunit(uidx)>=0) },
395 { title: 'Channel Width', rid: 'nbw'+uidx, text: wlstats[uidx].nbw, ignore: ((!nphy) || (wl_sunit(uidx)>=0)) },
396 { title: 'Interference Level', rid: 'interference'+uidx, text: stats.interference[uidx], hidden: ((stats.interference[uidx] == '') || (wl_sunit(uidx)>=0)) },
397 { title: 'Rate', rid: 'rate'+uidx, text: wlstats[uidx].rate, ignore: (wl_sunit(uidx)>=0) },
398 { title: 'RSSI', rid: 'rssi'+uidx, text: wlstats[uidx].rssi || '', ignore: ((!wlstats[uidx].client) || (wl_sunit(uidx)>=0)) },
399 { title: 'Noise', rid: 'noise'+uidx, text: wlstats[uidx].noise || '', ignore: ((!wlstats[uidx].client) || (wl_sunit(uidx)>=0)) },
400 { title: 'Signal Quality', rid: 'qual'+uidx, text: stats.qual[uidx] || '', ignore: ((!wlstats[uidx].client) || (wl_sunit(uidx)>=0)) }
403 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 1)\' id=\'b_wl'+uidx+'_enable\' value=\'Enable\' style=\'display:none\'>');
404 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 0)\' id=\'b_wl'+uidx+'_disable\' value=\'Disable\' style=\'display:none\'>');
405 W('</div>');
407 </script>
410 <!-- / / / -->
412 </td></tr>
413 <tr><td id='footer' colspan=2>
414 <script type='text/javascript'>genStdRefresh(1,1,'ref.toggle()');</script>
415 </td></tr>
416 </table>
417 </form>
418 <script type='text/javascript'>earlyInit()</script>
419 </body>
420 </html>