Merge branch 'VLAN-MultiSSID' into Toastman-VLAN
[tomato.git] / release / src / router / www / status-overview.asp
blob4fd4cd86c389ca681805b96913d1b96af120a280
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 show_radio.push((nvram['wl'+wl_fface(uidx)+'_radio'] == '1'));
58 nphy = features('11n');
60 function dhcpc(what)
62 form.submitHidden('dhcpc.cgi', { exec: what, _redirect: 'status-overview.asp' });
65 function serv(service, sleep)
67 form.submitHidden('service.cgi', { _service: service, _redirect: 'status-overview.asp', _sleep: sleep });
70 function wan_connect()
72 serv('wan-restart', 5);
75 function wan_disconnect()
77 serv('wan-stop', 2);
80 function wlenable(uidx, n)
82 form.submitHidden('wlradio.cgi', { enable: '' + n, _nextpage: 'status-overview.asp', _nextwait: n ? 6 : 3, _wl_unit: wl_unit(uidx) });
85 var ref = new TomatoRefresh('status-data.jsx', '', 0, 'status_overview_refresh');
87 ref.refresh = function(text)
89 stats = {};
90 try {
91 eval(text);
93 catch (ex) {
94 stats = {};
96 show();
100 function c(id, htm)
102 E(id).cells[1].innerHTML = htm;
105 function show()
107 c('cpu', stats.cpuload);
108 c('uptime', stats.uptime);
109 c('time', stats.time);
110 c('wanip', stats.wanip);
111 c('wanprebuf',stats.wanprebuf); //Victek
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 /* IPV6-BEGIN */
120 c('ip6_wan', stats.ip6_wan);
121 elem.display('ip6_wan', stats.ip6_wan != '');
122 c('ip6_lan', stats.ip6_lan);
123 elem.display('ip6_lan', stats.ip6_lan != '');
124 c('ip6_lan_ll', stats.ip6_lan_ll);
125 elem.display('ip6_lan_ll', stats.ip6_lan_ll != '');
126 /* IPV6-END */
128 c('wanstatus', stats.wanstatus);
129 c('wanuptime', stats.wanuptime);
130 if (show_dhcpc) c('wanlease', stats.wanlease);
131 if (show_codi) {
132 E('b_connect').disabled = stats.wanup;
133 E('b_disconnect').disabled = !stats.wanup;
136 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
137 c('radio'+uidx, wlstats[uidx].radio ? 'Enabled' : '<b>Disabled</b>');
138 c('rate'+uidx, wlstats[uidx].rate);
139 if (show_radio[uidx]) {
140 E('b_wl'+uidx+'_enable').disabled = wlstats[uidx].radio;
141 E('b_wl'+uidx+'_disable').disabled = !wlstats[uidx].radio;
143 c('channel'+uidx, stats.channel[uidx]);
144 if (nphy) {
145 c('nbw'+uidx, wlstats[uidx].nbw);
147 c('interference'+uidx, stats.interference[uidx]);
148 elem.display('interference'+uidx, stats.interference[uidx] != '');
150 if (wlstats[uidx].client) {
151 c('rssi'+uidx, wlstats[uidx].rssi || '');
152 c('noise'+uidx, wlstats[uidx].noise || '');
153 c('qual'+uidx, stats.qual[uidx] || '');
158 function earlyInit()
160 elem.display('b_dhcpc', show_dhcpc);
161 elem.display('b_connect', 'b_disconnect', show_codi);
162 elem.display('wan-title', 'wan-section', nvram.wan_proto != 'disabled');
163 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
164 elem.display('b_wl'+uidx+'_enable', 'b_wl'+uidx+'_disable', show_radio[uidx]);
166 show();
169 function init()
171 ref.initPage(3000, 3);
173 </script>
175 </head>
176 <body onload='init()'>
177 <form>
178 <table id='container' cellspacing=0>
179 <tr><td colspan=2 id='header'>
180 <div class='title'>Tomato</div>
181 <div class='version'>Version <% version(); %></div>
182 </td></tr>
183 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
184 <td id='content'>
185 <div id='ident'><% ident(); %></div>
187 <!-- / / / -->
189 <div class='section-title'>System</div>
190 <div class='section'>
191 <script type='text/javascript'>
192 createFieldTable('', [
193 { title: 'Name', text: nvram.router_name },
194 { title: 'Model', text: nvram.t_model_name },
195 { title: 'Chipset', text: stats.systemtype },
196 { title: 'CPU Freq', text: stats.cpumhz },
197 { title: 'Flash RAM Size', text: stats.flashsize },
198 null,
199 { title: 'Time', rid: 'time', text: stats.time },
200 { title: 'Uptime', rid: 'uptime', text: stats.uptime },
201 { title: 'CPU Load <small>(1 / 5 / 15 mins)</small>', rid: 'cpu', text: stats.cpuload },
202 { title: 'Total / Free Memory', rid: 'memory', text: stats.memory },
203 { title: 'Total / Free Swap', rid: 'swap', text: stats.swap, hidden: (stats.swap == '') },
205 </script>
206 </div>
208 <div class='section-title' id='wan-title'>WAN</div>
209 <div class='section' id='wan-section'>
210 <script type='text/javascript'>
211 createFieldTable('', [
212 { title: 'MAC Address', text: nvram.wan_hwaddr },
213 { title: 'Connection Type', text: { 'dhcp':'DHCP', 'static':'Static IP', 'pppoe':'PPPoE', 'pptp':'PPTP', 'l2tp':'L2TP' }[nvram.wan_proto] || '-' },
214 { title: 'IP Address', rid: 'wanip', text: stats.wanip },
215 { title: 'Previous WAN IP', rid: 'wanprebuf',text:stats.wanprebuf }, //Victek
216 { title: 'Subnet Mask', rid: 'wannetmask', text: stats.wannetmask },
217 { title: 'Gateway', rid: 'wangateway', text: stats.wangateway },
218 /* IPV6-BEGIN */
219 { title: 'IPv6 Address', rid: 'ip6_wan', text: stats.ip6_wan, hidden: (stats.ip6_wan == '') },
220 /* IPV6-END */
221 { title: 'DNS', rid: 'dns', text: stats.dns },
222 { title: 'MTU', text: nvram.wan_run_mtu },
223 null,
224 { title: 'Status', rid: 'wanstatus', text: stats.wanstatus },
225 { title: 'Connection Uptime', rid: 'wanuptime', text: stats.wanuptime },
226 { title: 'Remaining Lease Time', rid: 'wanlease', text: stats.wanlease, ignore: !show_dhcpc }
228 </script>
229 <span id='b_dhcpc' style='display:none'>
230 <input type='button' class='controls' onclick='dhcpc("renew")' value='Renew'>
231 <input type='button' class='controls' onclick='dhcpc("release")' value='Release'> &nbsp;
232 </span>
233 <input type='button' class='controls' onclick='wan_connect()' value='Connect' id='b_connect' style='display:none'>
234 <input type='button' class='controls' onclick='wan_disconnect()' value='Disconnect' id='b_disconnect' style='display:none'>
235 </div>
238 <div class='section-title'>LAN</div>
239 <div class='section'>
240 <script type='text/javascript'>
241 var s='';
242 var t='';
243 for (var i = 0 ; i <= MAX_BRIDGE_ID ; i++) {
244 var j = (i == 0) ? '' : i.toString();
245 if (nvram['lan' + j + '_ifname'].length > 0) {
246 if (nvram['lan' + j + '_proto'] == 'dhcp') {
247 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
248 var x = nvram['lan' + j + '_ipaddr'].split('.').splice(0, 3).join('.') + '.';
249 nvram['dhcpd' + j + '_startip'] = x + nvram['dhcp' + j + '_start'];
250 nvram['dhcpd' + j + '_endip'] = x + ((nvram['dhcp' + j + '_start'] * 1) + (nvram['dhcp' + j + '_num'] * 1) - 1);
252 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
253 s += '<a href="status-devices.asp">' + nvram['dhcpd' + j + '_startip'] + ' - ' + nvram['dhcpd' + j + '_endip'] + '</a> on LAN' + j + ' (br' + i + ')';
254 } else {
255 s += ((s.length>0)&&(s.charAt(s.length-1) != ' ')) ? ', ' : '';
256 s += 'Disabled on LAN' + j + ' (br' + i + ')';
258 t += ((t.length>0)&&(t.charAt(t.length-1) != ' ')) ? ', ' : '';
259 t += nvram['lan' + j + '_ipaddr'] + '/' + numberOfBitsOnNetMask(nvram['lan' + j + '_netmask']) + ' on LAN' + j + ' (br' + i + ')';
263 createFieldTable('', [
264 { title: 'Router MAC Address', text: nvram.et0macaddr },
265 { title: 'Router IP Addresses', text: t },
266 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
267 /* IPV6-BEGIN */
268 { title: 'Router IPv6 Address', rid: 'ip6_lan', text: stats.ip6_lan, hidden: (stats.ip6_lan == '') },
269 { title: 'IPv6 Link-local Address', rid: 'ip6_lan_ll', text: stats.ip6_lan_ll, hidden: (stats.ip6_lan_ll == '') },
270 /* IPV6-END */
271 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
272 { title: 'DHCP', text: s }
274 </script>
275 </div>
277 <script type='text/javascript'>
278 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
279 /* REMOVE-BEGIN
280 //u = wl_unit(uidx);
281 REMOVE-END */
282 u = wl_fface(uidx);
283 W('<div class=\'section-title\' id=\'wl'+uidx+'-title\'>Wireless');
284 if (wl_ifaces.length > 0)
285 W(' (' + wl_display_ifname(uidx) + ')');
286 W('</div>');
287 W('<div class=\'section\' id=\'wl'+uidx+'-section\'>');
288 sec = auth[nvram['wl'+u+'_security_mode']] + '';
289 if (sec.indexOf('WPA') != -1) sec += ' + ' + enc[nvram['wl'+u+'_crypto']];
291 wmode = wmo[nvram['wl'+u+'_mode']] + '';
292 if ((nvram['wl'+u+'_mode'] == 'ap') && (nvram['wl'+u+'_wds_enable'] * 1)) wmode += ' + WDS';
294 createFieldTable('', [
295 { title: 'MAC Address', text: nvram['wl'+u+'_hwaddr'] },
296 { title: 'Wireless Mode', text: wmode },
297 { title: 'Wireless Network Mode', text: bgmo[nvram['wl'+u+'_net_mode']] },
298 { title: 'Radio', rid: 'radio'+uidx, text: (wlstats[uidx].radio == 0) ? '<b>Disabled</b>' : 'Enabled' },
299 { title: 'SSID', text: nvram['wl'+u+'_ssid'] },
300 { title: 'Security', text: sec },
301 { title: 'Channel', rid: 'channel'+uidx, text: stats.channel[uidx] },
302 { title: 'Channel Width', rid: 'nbw'+uidx, text: wlstats[uidx].nbw, ignore: !nphy },
303 { title: 'Interference Level', rid: 'interference'+uidx, text: stats.interference[uidx], hidden: (stats.interference[uidx] == '') },
304 { title: 'Rate', rid: 'rate'+uidx, text: wlstats[uidx].rate },
305 { title: 'RSSI', rid: 'rssi'+uidx, text: wlstats[uidx].rssi || '', ignore: !wlstats[uidx].client },
306 { title: 'Noise', rid: 'noise'+uidx, text: wlstats[uidx].noise || '', ignore: !wlstats[uidx].client },
307 { title: 'Signal Quality', rid: 'qual'+uidx, text: stats.qual[uidx] || '', ignore: !wlstats[uidx].client }
310 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 1)\' id=\'b_wl'+uidx+'_enable\' value=\'Enable\' style=\'display:none\'>');
311 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 0)\' id=\'b_wl'+uidx+'_disable\' value=\'Disable\' style=\'display:none\'>');
312 W('</div>');
314 </script>
317 <!-- / / / -->
319 </td></tr>
320 <tr><td id='footer' colspan=2>
321 <script type='text/javascript'>genStdRefresh(1,1,'ref.toggle()');</script>
322 </td></tr>
323 </table>
324 </form>
325 <script type='text/javascript'>earlyInit()</script>
326 </body>
327 </html>