Visual improvements on the GUI, fixed nas so it work when more than one SSID is confi...
[tomato.git] / release / src / router / www / status-overview.asp
blobe548359e381e504b7b112e6fa53c7acd18714a24
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'};
41 </script>
43 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
44 <script type='text/javascript' src='status-data.jsx?_http_id=<% nv(http_id); %>'></script>
46 <script type='text/javascript'>
47 show_dhcpc = ((nvram.wan_proto == 'dhcp') || (((nvram.wan_proto == 'l2tp') || (nvram.wan_proto == 'pptp')) && (nvram.pptp_dhcp == '1')));
48 show_codi = ((nvram.wan_proto == 'pppoe') || (nvram.wan_proto == 'l2tp') || (nvram.wan_proto == 'pptp'));
50 show_radio = [];
51 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
52 /* REMOVE-BEGIN
53 // show_radio.push((nvram['wl'+wl_unit(uidx)+'_radio'] == '1'));
54 REMOVE-END */
55 if (wl_sunit(uidx)<0)
56 show_radio.push((nvram['wl'+wl_fface(uidx)+'_radio'] == '1'));
59 nphy = features('11n');
61 function dhcpc(what)
63 form.submitHidden('dhcpc.cgi', { exec: what, _redirect: 'status-overview.asp' });
66 function serv(service, sleep)
68 form.submitHidden('service.cgi', { _service: service, _redirect: 'status-overview.asp', _sleep: sleep });
71 function wan_connect()
73 serv('wan-restart', 5);
76 function wan_disconnect()
78 serv('wan-stop', 2);
81 function wlenable(uidx, n)
83 form.submitHidden('wlradio.cgi', { enable: '' + n, _nextpage: 'status-overview.asp', _nextwait: n ? 6 : 3, _wl_unit: wl_unit(uidx) });
86 var ref = new TomatoRefresh('/status-data.jsx', '', 0, 'status_overview_refresh');
88 ref.refresh = function(text)
90 stats = {};
91 try {
92 eval(text);
94 catch (ex) {
95 stats = {};
97 show();
101 function c(id, htm)
103 E(id).cells[1].innerHTML = htm;
106 function show()
108 c('cpu', stats.cpuload);
109 c('uptime', stats.uptime);
110 c('time', stats.time);
111 c('wanip', stats.wanip);
112 c('wannetmask', stats.wannetmask);
113 c('wangateway', stats.wangateway);
114 c('dns', stats.dns);
115 c('memory', stats.memory);
116 c('swap', stats.swap);
117 elem.display('swap', stats.swap != '');
119 c('wanstatus', stats.wanstatus);
120 c('wanuptime', stats.wanuptime);
121 if (show_dhcpc) c('wanlease', stats.wanlease);
122 if (show_codi) {
123 E('b_connect').disabled = stats.wanup;
124 E('b_disconnect').disabled = !stats.wanup;
127 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
128 if (wl_sunit(uidx)<0) {
129 c('radio'+uidx, wlstats[uidx].radio ? 'Enabled' : '<b>Disabled</b>');
130 c('rate'+uidx, wlstats[uidx].rate);
131 if (show_radio[uidx]) {
132 E('b_wl'+uidx+'_enable').disabled = wlstats[uidx].radio;
133 E('b_wl'+uidx+'_disable').disabled = !wlstats[uidx].radio;
135 c('channel'+uidx, stats.channel[uidx]);
136 if (nphy) {
137 c('nbw'+uidx, wlstats[uidx].nbw);
139 c('interference'+uidx, stats.interference[uidx]);
140 elem.display('interference'+uidx, stats.interference[uidx] != '');
142 if (wlstats[uidx].client) {
143 c('rssi'+uidx, wlstats[uidx].rssi || '');
144 c('noise'+uidx, wlstats[uidx].noise || '');
145 c('qual'+uidx, stats.qual[uidx] || '');
151 function earlyInit()
153 elem.display('b_dhcpc', show_dhcpc);
154 elem.display('b_connect', 'b_disconnect', show_codi);
155 elem.display('wan-title', 'wan-section', nvram.wan_proto != 'disabled');
156 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
157 if (wl_sunit(uidx)<0)
158 elem.display('b_wl'+uidx+'_enable', 'b_wl'+uidx+'_disable', show_radio[uidx]);
160 show();
163 function init()
165 ref.initPage(3000, 3);
167 </script>
169 </head>
170 <body onload='init()'>
171 <form>
172 <table id='container' cellspacing=0>
173 <tr><td colspan=2 id='header'>
174 <div class='title'>Tomato</div>
175 <div class='version'>Version <% version(); %></div>
176 </td></tr>
177 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
178 <td id='content'>
179 <div id='ident'><% ident(); %></div>
181 <!-- / / / -->
183 <div class='section-title'>System</div>
184 <div class='section'>
185 <script type='text/javascript'>
186 createFieldTable('', [
187 { title: 'Name', text: nvram.router_name },
188 { title: 'Model', text: nvram.t_model_name },
189 null,
190 { title: 'Time', rid: 'time', text: stats.time },
191 { title: 'Uptime', rid: 'uptime', text: stats.uptime },
192 { title: 'CPU Load <small>(1 / 5 / 15 mins)</small>', rid: 'cpu', text: stats.cpuload },
193 { title: 'Total / Free Memory', rid: 'memory', text: stats.memory },
194 { title: 'Total / Free Swap', rid: 'swap', text: stats.swap, hidden: (stats.swap == '') }
196 </script>
197 </div>
199 <div class='section-title' id='wan-title'>WAN</div>
200 <div class='section' id='wan-section'>
201 <script type='text/javascript'>
202 createFieldTable('', [
203 { title: 'MAC Address', text: nvram.wan_hwaddr },
204 { title: 'Connection Type', text: { 'dhcp':'DHCP', 'static':'Static IP', 'pppoe':'PPPoE', 'pptp':'PPTP', 'l2tp':'L2TP' }[nvram.wan_proto] || '-' },
205 { title: 'IP Address', rid: 'wanip', text: stats.wanip },
206 { title: 'Subnet Mask', rid: 'wannetmask', text: stats.wannetmask },
207 { title: 'Gateway', rid: 'wangateway', text: stats.wangateway },
208 { title: 'DNS', rid: 'dns', text: stats.dns },
209 { title: 'MTU', text: nvram.wan_run_mtu },
210 null,
211 { title: 'Status', rid: 'wanstatus', text: stats.wanstatus },
212 { title: 'Connection Uptime', rid: 'wanuptime', text: stats.wanuptime },
213 { title: 'Remaining Lease Time', rid: 'wanlease', text: stats.wanlease, ignore: !show_dhcpc }
215 </script>
216 <span id='b_dhcpc' style='display:none'>
217 <input type='button' class='controls' onclick='dhcpc("renew")' value='Renew'>
218 <input type='button' class='controls' onclick='dhcpc("release")' value='Release'> &nbsp;
219 </span>
220 <input type='button' class='controls' onclick='wan_connect()' value='Connect' id='b_connect' style='display:none'>
221 <input type='button' class='controls' onclick='wan_disconnect()' value='Disconnect' id='b_disconnect' style='display:none'>
222 </div>
225 <div class='section-title'>LAN</div>
226 <div class='section'>
227 <script type='text/javascript'>
228 var s='';
229 var t='';
230 for (var i = 0 ; i <= MAX_BRIDGE_ID ; i++) {
231 var j = (i == 0) ? '' : i.toString();
232 if (nvram['lan' + j + '_ifname'].length > 0) {
233 if (nvram['lan' + j + '_proto'] == 'dhcp') {
234 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
235 var x = nvram['lan' + j + '_ipaddr'].split('.').splice(0, 3).join('.') + '.';
236 nvram['dhcpd' + j + '_startip'] = x + nvram['dhcp' + j + '_start'];
237 nvram['dhcpd' + j + '_endip'] = x + ((nvram['dhcp' + j + '_start'] * 1) + (nvram['dhcp' + j + '_num'] * 1) - 1);
239 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
240 s += '<a href="status-devices.asp">' + nvram['dhcpd' + j + '_startip'] + ' - ' + nvram['dhcpd' + j + '_endip'] + '</a> on LAN' + j + ' (br' + i + ')';
241 } else {
242 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
243 s += 'Disabled on LAN' + j + ' (br' + i + ')';
245 t += ((t.length>0)&&(t.charAt(t.length-1) != ' ')) ? ', ' : '';
246 t += nvram['lan' + j + '_ipaddr'] + '/' + numberOfBitsOnNetMask(nvram['lan' + j + '_netmask']) + ' on LAN' + j + ' (br' + i + ')';
250 createFieldTable('', [
251 { title: 'Router MAC Address', text: nvram.et0macaddr },
252 { title: 'Router IP Addresses', text: t },
253 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
254 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
255 { title: 'DHCP', text: s }
257 </script>
258 </div>
260 <script type='text/javascript'>
261 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
262 /* REMOVE-BEGIN
263 // u = wl_unit(uidx);
264 REMOVE-END */
265 u = wl_fface(uidx);
266 W('<div class=\'section-title\' id=\'wl'+uidx+'-title\'>Wireless');
267 if (wl_ifaces.length > 0)
268 W(' (' + wl_display_ifname(uidx) + ')');
269 W('</div>');
270 W('<div class=\'section\' id=\'wl'+uidx+'-section\'>');
271 sec = auth[nvram['wl'+u+'_security_mode']] + '';
272 if (sec.indexOf('WPA') != -1) sec += ' + ' + enc[nvram['wl'+u+'_crypto']];
274 wmode = wmo[nvram['wl'+u+'_mode']] + '';
275 if ((nvram['wl'+u+'_mode'] == 'ap') && (nvram['wl'+u+'_wds_enable'] * 1)) wmode += ' + WDS';
277 createFieldTable('', [
278 { title: 'MAC Address', text: nvram['wl'+u+'_hwaddr'] },
279 { title: 'Wireless Mode', text: wmode },
280 { title: 'Wireless Network Mode', text: bgmo[nvram['wl'+u+'_net_mode']], ignore: (wl_sunit(uidx)>=0) },
281 { title: 'Radio', rid: 'radio'+uidx, text: (wlstats[uidx].radio == 0) ? '<b>Disabled</b>' : 'Enabled', ignore: (wl_sunit(uidx)>=0) },
282 { title: 'SSID', text: nvram['wl'+u+'_ssid'] },
283 { title: 'Security', text: sec },
284 { title: 'Channel', rid: 'channel'+uidx, text: stats.channel[uidx], ignore: (wl_sunit(uidx)>=0) },
285 { title: 'Channel Width', rid: 'nbw'+uidx, text: wlstats[uidx].nbw, ignore: !nphy },
286 { title: 'Interference Level', rid: 'interference'+uidx, text: stats.interference[uidx], hidden: (stats.interference[uidx] == '') },
287 { title: 'Rate', rid: 'rate'+uidx, text: wlstats[uidx].rate, ignore: (wl_sunit(uidx)>=0) },
288 { title: 'RSSI', rid: 'rssi'+uidx, text: wlstats[uidx].rssi || '', ignore: !wlstats[uidx].client },
289 { title: 'Noise', rid: 'noise'+uidx, text: wlstats[uidx].noise || '', ignore: !wlstats[uidx].client },
290 { title: 'Signal Quality', rid: 'qual'+uidx, text: stats.qual[uidx] || '', ignore: !wlstats[uidx].client }
293 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 1)\' id=\'b_wl'+uidx+'_enable\' value=\'Enable\' style=\'display:none\'>');
294 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 0)\' id=\'b_wl'+uidx+'_disable\' value=\'Disable\' style=\'display:none\'>');
295 W('</div>');
297 </script>
300 <!-- / / / -->
302 </td></tr>
303 <tr><td id='footer' colspan=2>
304 <script type='text/javascript'>genStdRefresh(1,0,'ref.toggle()');</script>
305 </td></tr>
306 </table>
307 </form>
308 <script type='text/javascript'>earlyInit()</script>
309 </body>
310 </html>