cosmetics
[tomato.git] / release / src / router / www / status-overview.asp
blob065aa01f30bc899094ef595c87a6a36f061cda80
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 For use with Tomato Firmware only.
8 No part of this file may be used without permission.
9 -->
10 <html>
11 <head>
12 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
13 <meta name='robots' content='noindex,nofollow'>
14 <title>[<% ident(); %>] Status: Overview</title>
15 <link rel='stylesheet' type='text/css' href='tomato.css'>
16 <link rel='stylesheet' type='text/css' href='color.css'>
17 <script type='text/javascript' src='tomato.js'></script>
19 <!-- / / / -->
21 <style type='text/css'>
22 .controls {
23 width: 90px;
24 margin-top: 5px;
25 margin-bottom: 10px;
27 </style>
29 <script type='text/javascript' src='debug.js'></script>
31 <script type='text/javascript'>
32 wmo = {'ap':'Access Point','sta':'Wireless Client','wet':'Wireless Ethernet Bridge','wds':'WDS'};
33 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'};
34 enc = {'tkip':'TKIP','aes':'AES','tkip+aes':'TKIP / AES'};
35 bgmo = {'disabled':'-','mixed':'Auto','b-only':'B Only','g-only':'G Only','bg-mixed':'B/G Mixed','lrs':'LRS','n-only':'N Only'};
36 </script>
38 <script type='text/javascript' src='wireless.jsx?_http_id=<% nv(http_id); %>'></script>
39 <script type='text/javascript' src='status-data.jsx?_http_id=<% nv(http_id); %>'></script>
41 <script type='text/javascript'>
42 show_dhcpc = ((nvram.wan_proto == 'dhcp') || (((nvram.wan_proto == 'l2tp') || (nvram.wan_proto == 'pptp')) && (nvram.pptp_dhcp == '1')));
43 show_codi = ((nvram.wan_proto == 'pppoe') || (nvram.wan_proto == 'l2tp') || (nvram.wan_proto == 'pptp'));
45 show_radio = [];
46 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
47 show_radio.push((nvram['wl'+wl_unit(uidx)+'_radio'] == '1'));
50 nphy = features('11n');
52 function dhcpc(what)
54 form.submitHidden('dhcpc.cgi', { exec: what, _redirect: 'status-overview.asp' });
57 function serv(service, sleep)
59 form.submitHidden('service.cgi', { _service: service, _redirect: 'status-overview.asp', _sleep: sleep });
62 function wan_connect()
64 serv('wan-restart', 5);
67 function wan_disconnect()
69 serv('wan-stop', 2);
72 function wlenable(uidx, n)
74 form.submitHidden('wlradio.cgi', { enable: '' + n, _nextpage: 'status-overview.asp', _nextwait: n ? 6 : 3, _wl_unit: wl_unit(uidx) });
77 var ref = new TomatoRefresh('status-data.jsx', '', 0, 'status_overview_refresh');
79 ref.refresh = function(text)
81 stats = {};
82 try {
83 eval(text);
85 catch (ex) {
86 stats = {};
88 show();
92 function c(id, htm)
94 E(id).cells[1].innerHTML = htm;
97 function show()
99 c('cpu', stats.cpuload);
100 c('uptime', stats.uptime);
101 c('time', stats.time);
102 c('wanip', stats.wanip);
103 c('wanprebuf',stats.wanprebuf); //Victek
104 c('wannetmask', stats.wannetmask);
105 c('wangateway', stats.wangateway);
106 c('dns', stats.dns);
107 c('memory', stats.memory);
108 c('swap', stats.swap);
109 elem.display('swap', stats.swap != '');
111 /* IPV6-BEGIN */
112 c('ip6_wan', stats.ip6_wan);
113 elem.display('ip6_wan', stats.ip6_wan != '');
114 c('ip6_lan', stats.ip6_lan);
115 elem.display('ip6_lan', stats.ip6_lan != '');
116 c('ip6_lan_ll', stats.ip6_lan_ll);
117 elem.display('ip6_lan_ll', stats.ip6_lan_ll != '');
118 /* IPV6-END */
120 c('wanstatus', stats.wanstatus);
121 c('wanuptime', stats.wanuptime);
122 if (show_dhcpc) c('wanlease', stats.wanlease);
123 if (show_codi) {
124 E('b_connect').disabled = stats.wanup;
125 E('b_disconnect').disabled = !stats.wanup;
128 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
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] || '');
150 function earlyInit()
152 elem.display('b_dhcpc', show_dhcpc);
153 elem.display('b_connect', 'b_disconnect', show_codi);
154 elem.display('wan-title', 'wan-section', nvram.wan_proto != 'disabled');
155 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
156 elem.display('b_wl'+uidx+'_enable', 'b_wl'+uidx+'_disable', show_radio[uidx]);
158 show();
161 function init()
163 ref.initPage(3000, 3);
165 </script>
167 </head>
168 <body onload='init()'>
169 <form>
170 <table id='container' cellspacing=0>
171 <tr><td colspan=2 id='header'>
172 <div class='title'>Tomato</div>
173 <div class='version'>Version <% version(); %></div>
174 </td></tr>
175 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
176 <td id='content'>
177 <div id='ident'><% ident(); %></div>
179 <!-- / / / -->
181 <div class='section-title'>System</div>
182 <div class='section'>
183 <script type='text/javascript'>
184 createFieldTable('', [
185 { title: 'Name', text: nvram.router_name },
186 { title: 'Model', text: nvram.t_model_name },
187 { title: 'Chipset', text: stats.systemtype },
188 { title: 'CPU Freq', text: stats.cpumhz },
189 { title: 'Flash RAM Size', text: stats.flashsize },
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: 'Previous WAN IP', rid: 'wanprebuf',text:stats.wanprebuf }, //Victek
208 { title: 'Subnet Mask', rid: 'wannetmask', text: stats.wannetmask },
209 { title: 'Gateway', rid: 'wangateway', text: stats.wangateway },
210 /* IPV6-BEGIN */
211 { title: 'IPv6 Address', rid: 'ip6_wan', text: stats.ip6_wan, hidden: (stats.ip6_wan == '') },
212 /* IPV6-END */
213 { title: 'DNS', rid: 'dns', text: stats.dns },
214 { title: 'MTU', text: nvram.wan_run_mtu },
215 null,
216 { title: 'Status', rid: 'wanstatus', text: stats.wanstatus },
217 { title: 'Connection Uptime', rid: 'wanuptime', text: stats.wanuptime },
218 { title: 'Remaining Lease Time', rid: 'wanlease', text: stats.wanlease, ignore: !show_dhcpc }
220 </script>
221 <span id='b_dhcpc' style='display:none'>
222 <input type='button' class='controls' onclick='dhcpc("renew")' value='Renew'>
223 <input type='button' class='controls' onclick='dhcpc("release")' value='Release'> &nbsp;
224 </span>
225 <input type='button' class='controls' onclick='wan_connect()' value='Connect' id='b_connect' style='display:none'>
226 <input type='button' class='controls' onclick='wan_disconnect()' value='Disconnect' id='b_disconnect' style='display:none'>
227 </div>
230 <div class='section-title'>LAN</div>
231 <div class='section'>
232 <script type='text/javascript'>
233 if (nvram.lan_proto == 'dhcp') {
234 if ((!fixIP(nvram.dhcpd_startip)) || (!fixIP(nvram.dhcpd_endip))) {
235 var x = nvram.lan_ipaddr.split('.').splice(0, 3).join('.') + '.';
236 nvram.dhcpd_startip = x + nvram.dhcp_start;
237 nvram.dhcpd_endip = x + ((nvram.dhcp_start * 1) + (nvram.dhcp_num * 1) - 1);
239 s = '<a href="status-devices.asp">' + nvram.dhcpd_startip + ' - ' + nvram.dhcpd_endip + '</a>';
241 else {
242 s = 'Disabled';
244 createFieldTable('', [
245 { title: 'Router MAC Address', text: nvram.et0macaddr },
246 { title: 'Router IP Address', text: nvram.lan_ipaddr },
247 { title: 'Subnet Mask', text: nvram.lan_netmask },
248 { title: 'Gateway', text: nvram.lan_gateway, ignore: nvram.wan_proto != 'disabled' },
249 /* IPV6-BEGIN */
250 { title: 'Router IPv6 Address', rid: 'ip6_lan', text: stats.ip6_lan, hidden: (stats.ip6_lan == '') },
251 { title: 'IPv6 Link-local Address', rid: 'ip6_lan_ll', text: stats.ip6_lan_ll, hidden: (stats.ip6_lan_ll == '') },
252 /* IPV6-END */
253 { title: 'DNS', rid: 'dns', text: stats.dns, ignore: nvram.wan_proto != 'disabled' },
254 { title: 'DHCP', text: s }
256 </script>
257 </div>
260 <script type='text/javascript'>
261 for (var uidx = 0; uidx < wl_ifaces.length; ++uidx) {
262 u = wl_unit(uidx);
263 W('<div class=\'section-title\' id=\'wl'+uidx+'-title\'>Wireless');
264 if (wl_ifaces.length > 1)
265 W(' (' + wl_display_ifname(uidx) + ')');
266 W('</div>');
267 W('<div class=\'section\' id=\'wl'+uidx+'-section\'>');
268 sec = auth[nvram['wl'+u+'_security_mode']] + '';
269 if (sec.indexOf('WPA') != -1) sec += ' + ' + enc[nvram['wl'+u+'_crypto']];
271 wmode = wmo[nvram['wl'+u+'_mode']] + '';
272 if ((nvram['wl'+u+'_mode'] == 'ap') && (nvram['wl'+u+'_wds_enable'] * 1)) wmode += ' + WDS';
274 createFieldTable('', [
275 { title: 'MAC Address', text: nvram['wl'+u+'_hwaddr'] },
276 { title: 'Wireless Mode', text: wmode },
277 { title: 'Wireless Network Mode', text: bgmo[nvram['wl'+u+'_net_mode']] },
278 { title: 'Radio', rid: 'radio'+uidx, text: (wlstats[uidx].radio == 0) ? '<b>Disabled</b>' : 'Enabled' },
279 { title: 'SSID', text: nvram['wl'+u+'_ssid'] },
280 { title: 'Security', text: sec },
281 { title: 'Channel', rid: 'channel'+uidx, text: stats.channel[uidx] },
282 { title: 'Channel Width', rid: 'nbw'+uidx, text: wlstats[uidx].nbw, ignore: !nphy },
283 { title: 'Interference Level', rid: 'interference'+uidx, text: stats.interference[uidx], hidden: (stats.interference[uidx] == '') },
284 { title: 'Rate', rid: 'rate'+uidx, text: wlstats[uidx].rate },
285 { title: 'RSSI', rid: 'rssi'+uidx, text: wlstats[uidx].rssi || '', ignore: !wlstats[uidx].client },
286 { title: 'Noise', rid: 'noise'+uidx, text: wlstats[uidx].noise || '', ignore: !wlstats[uidx].client },
287 { title: 'Signal Quality', rid: 'qual'+uidx, text: stats.qual[uidx] || '', ignore: !wlstats[uidx].client }
290 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 1)\' id=\'b_wl'+uidx+'_enable\' value=\'Enable\' style=\'display:none\'>');
291 W('<input type=\'button\' class=\'controls\' onclick=\'wlenable('+uidx+', 0)\' id=\'b_wl'+uidx+'_disable\' value=\'Disable\' style=\'display:none\'>');
292 W('</div>');
294 </script>
297 <!-- / / / -->
299 </td></tr>
300 <tr><td id='footer' colspan=2>
301 <script type='text/javascript'>genStdRefresh(1,1,'ref.toggle()');</script>
302 </td></tr>
303 </table>
304 </form>
305 <script type='text/javascript'>earlyInit()</script>
306 </body>
307 </html>