Merge branch 'VLAN-GUI' into VLAN-MultiSSID
[tomato.git] / release / src / router / www / status-overview.asp
blob8fbe5bff26a007cc5a04b6bf894554207685d818
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] || '');
148 c('ifstatus'+uidx, wlstats[uidx].ifstatus || '');
152 function earlyInit()
154 elem.display('b_dhcpc', show_dhcpc);
155 elem.display('b_connect', 'b_disconnect', show_codi);
156 elem.display('wan-title', 'wan-section', nvram.wan_proto != 'disabled');
157 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
158 if (wl_sunit(uidx)<0)
159 elem.display('b_wl'+uidx+'_enable', 'b_wl'+uidx+'_disable', show_radio[uidx]);
161 show();
164 function init()
166 ref.initPage(3000, 3);
168 </script>
170 </head>
171 <body onload='init()'>
172 <form>
173 <table id='container' cellspacing=0>
174 <tr><td colspan=2 id='header'>
175 <div class='title'>Tomato</div>
176 <div class='version'>Version <% version(); %></div>
177 </td></tr>
178 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
179 <td id='content'>
180 <div id='ident'><% ident(); %></div>
182 <!-- / / / -->
184 <div class='section-title'>System</div>
185 <div class='section'>
186 <script type='text/javascript'>
187 createFieldTable('', [
188 { title: 'Name', text: nvram.router_name },
189 { title: 'Model', text: nvram.t_model_name },
190 null,
191 { title: 'Time', rid: 'time', text: stats.time },
192 { title: 'Uptime', rid: 'uptime', text: stats.uptime },
193 { title: 'CPU Load <small>(1 / 5 / 15 mins)</small>', rid: 'cpu', text: stats.cpuload },
194 { title: 'Total / Free Memory', rid: 'memory', text: stats.memory },
195 { title: 'Total / Free Swap', rid: 'swap', text: stats.swap, hidden: (stats.swap == '') }
197 </script>
198 </div>
200 <div class='section-title' id='wan-title'>WAN</div>
201 <div class='section' id='wan-section'>
202 <script type='text/javascript'>
203 createFieldTable('', [
204 { title: 'MAC Address', text: nvram.wan_hwaddr },
205 { title: 'Connection Type', text: { 'dhcp':'DHCP', 'static':'Static IP', 'pppoe':'PPPoE', 'pptp':'PPTP', 'l2tp':'L2TP' }[nvram.wan_proto] || '-' },
206 { title: 'IP Address', rid: 'wanip', text: stats.wanip },
207 { title: 'Subnet Mask', rid: 'wannetmask', text: stats.wannetmask },
208 { title: 'Gateway', rid: 'wangateway', text: stats.wangateway },
209 { title: 'DNS', rid: 'dns', text: stats.dns },
210 { title: 'MTU', text: nvram.wan_run_mtu },
211 null,
212 { title: 'Status', rid: 'wanstatus', text: stats.wanstatus },
213 { title: 'Connection Uptime', rid: 'wanuptime', text: stats.wanuptime },
214 { title: 'Remaining Lease Time', rid: 'wanlease', text: stats.wanlease, ignore: !show_dhcpc }
216 </script>
217 <span id='b_dhcpc' style='display:none'>
218 <input type='button' class='controls' onclick='dhcpc("renew")' value='Renew'>
219 <input type='button' class='controls' onclick='dhcpc("release")' value='Release'> &nbsp;
220 </span>
221 <input type='button' class='controls' onclick='wan_connect()' value='Connect' id='b_connect' style='display:none'>
222 <input type='button' class='controls' onclick='wan_disconnect()' value='Disconnect' id='b_disconnect' style='display:none'>
223 </div>
226 <div class='section-title'>LAN</div>
227 <div class='section'>
228 <script type='text/javascript'>
230 /* VLAN-BEGIN */
231 var s='';
232 var t='';
233 for (var i = 0 ; i <= MAX_BRIDGE_ID ; i++) {
234 var j = (i == 0) ? '' : i.toString();
235 if (nvram['lan' + j + '_ifname'].length > 0) {
236 if (nvram['lan' + j + '_proto'] == 'dhcp') {
237 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
238 var x = nvram['lan' + j + '_ipaddr'].split('.').splice(0, 3).join('.') + '.';
239 nvram['dhcpd' + j + '_startip'] = x + nvram['dhcp' + j + '_start'];
240 nvram['dhcpd' + j + '_endip'] = x + ((nvram['dhcp' + j + '_start'] * 1) + (nvram['dhcp' + j + '_num'] * 1) - 1);
242 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
243 s += '<a href="status-devices.asp">' + nvram['dhcpd' + j + '_startip'] + ' - ' + nvram['dhcpd' + j + '_endip'] + '</a> on LAN' + j + ' (br' + i + ')';
244 } else {
245 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
246 s += 'Disabled on LAN' + j + ' (br' + i + ')';
248 t += ((t.length>0)&&(t.charAt(t.length-1) != ' ')) ? ', ' : '';
249 t += nvram['lan' + j + '_ipaddr'] + '/' + numberOfBitsOnNetMask(nvram['lan' + j + '_netmask']) + ' on LAN' + j + ' (br' + i + ')';
253 createFieldTable('', [
254 { title: 'Router MAC Address', text: nvram.et0macaddr },
255 { title: 'Router IP Addresses', text: t },
256 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
257 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
258 { title: 'DHCP', text: s }
260 /* VLAN-END */
262 /* NOVLAN-BEGIN */
263 if (nvram.lan_proto == 'dhcp') {
264 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
265 var x = nvram.lan_ipaddr.split('.').splice(0, 3).join('.') + '.';
266 nvram.dhcpd_startip = x + nvram.dhcp_start;
267 nvram.dhcpd_endip = x + ((nvram.dhcp_start * 1) + (nvram.dhcp_num * 1) - 1);
269 s = '<a href="status-devices.asp">' + nvram.dhcpd_startip + ' - ' + nvram.dhcpd_endip + '</a>';
271 else {
272 s = 'Disabled';
274 createFieldTable('', [
275 { title: 'Router MAC Address', text: nvram.et0macaddr },
276 { title: 'Router IP Address', text: nvram.lan_ipaddr },
277 { title: 'Subnet Mask', text: nvram.lan_netmask },
278 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
279 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
280 { title: 'DHCP', text: s }
282 /* NOVLAN-END */
284 </script>
285 </div>
287 <script type='text/javascript'>
288 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
289 /* REMOVE-BEGIN
290 // u = wl_unit(uidx);
291 REMOVE-END */
292 u = wl_fface(uidx);
293 W('<div class=\'section-title\' id=\'wl'+uidx+'-title\'>Wireless');
294 if (wl_ifaces.length > 0)
295 W(' (' + wl_display_ifname(uidx) + ')');
296 W('</div>');
297 W('<div class=\'section\' id=\'wl'+uidx+'-section\'>');
298 sec = auth[nvram['wl'+u+'_security_mode']] + '';
299 if (sec.indexOf('WPA') != -1) sec += ' + ' + enc[nvram['wl'+u+'_crypto']];
301 wmode = wmo[nvram['wl'+u+'_mode']] + '';
302 if ((nvram['wl'+u+'_mode'] == 'ap') && (nvram['wl'+u+'_wds_enable'] * 1)) wmode += ' + WDS';
304 createFieldTable('', [
305 { title: 'MAC Address', text: nvram['wl'+u+'_hwaddr'] },
306 { title: 'Wireless Mode', text: wmode },
307 { title: 'Wireless Network Mode', text: bgmo[nvram['wl'+u+'_net_mode']], ignore: (wl_sunit(uidx)>=0) },
308 { title: 'Interface Status', rid: 'ifstatus'+uidx, text: wlstats[uidx].ifstatus },
309 { title: 'Radio', rid: 'radio'+uidx, text: (wlstats[uidx].radio == 0) ? '<b>Disabled</b>' : 'Enabled', ignore: (wl_sunit(uidx)>=0) },
310 /* REMOVE-BEGIN */
311 // { 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>') },
312 /* REMOVE-END */
313 { title: 'SSID', text: nvram['wl'+u+'_ssid'] },
314 { title: 'Broadcast', text: (nvram['wl'+u+'_closed'] == 0) ? 'Enabled' : '<b>Disabled</b>', ignore: (nvram['wl'+u+'_mode'] != 'ap') },
315 { title: 'Security', text: sec },
316 { title: 'Channel', rid: 'channel'+uidx, text: stats.channel[uidx], ignore: (wl_sunit(uidx)>=0) },
317 { title: 'Channel Width', rid: 'nbw'+uidx, text: wlstats[uidx].nbw, ignore: ((!nphy) || (wl_sunit(uidx)>=0)) },
318 { title: 'Interference Level', rid: 'interference'+uidx, text: stats.interference[uidx], hidden: ((stats.interference[uidx] == '') || (wl_sunit(uidx)>=0)) },
319 { title: 'Rate', rid: 'rate'+uidx, text: wlstats[uidx].rate, ignore: (wl_sunit(uidx)>=0) },
320 { title: 'RSSI', rid: 'rssi'+uidx, text: wlstats[uidx].rssi || '', ignore: ((!wlstats[uidx].client) || (wl_sunit(uidx)>=0)) },
321 { title: 'Noise', rid: 'noise'+uidx, text: wlstats[uidx].noise || '', ignore: ((!wlstats[uidx].client) || (wl_sunit(uidx)>=0)) },
322 { title: 'Signal Quality', rid: 'qual'+uidx, text: stats.qual[uidx] || '', ignore: ((!wlstats[uidx].client) || (wl_sunit(uidx)>=0)) }
325 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 1)\' id=\'b_wl'+uidx+'_enable\' value=\'Enable\' style=\'display:none\'>');
326 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 0)\' id=\'b_wl'+uidx+'_disable\' value=\'Disable\' style=\'display:none\'>');
327 W('</div>');
329 </script>
332 <!-- / / / -->
334 </td></tr>
335 <tr><td id='footer' colspan=2>
336 <script type='text/javascript'>genStdRefresh(1,0,'ref.toggle()');</script>
337 </td></tr>
338 </table>
339 </form>
340 <script type='text/javascript'>earlyInit()</script>
341 </body>
342 </html>