Busybox: Upgrade to 1.21.1 (stable). lsof active.
[tomato.git] / release / src / router / www / basic-time.asp
blobc78d20f7dec402850730074f2c0d75210babce0a
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(); %>] Basic: Time</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 <script type='text/javascript' src='debug.js'></script>
23 <script type='text/javascript'>
25 // <% nvram("tm_sel,tm_dst,tm_tz,ntp_updates,ntp_server,ntp_tdod,ntp_kiss,ntpd_enable,ntpd_server"); %>
28 var ntpList = [
29 ['custom', 'Custom...'],
30 ['', 'Default'],
31 ['africa', 'Africa'],
32 ['asia', 'Asia'],
33 ['europe', 'Europe'],
34 ['oceania', 'Oceania'],
35 ['north-america', 'North America'],
36 ['south-america', 'South America'],
37 ['us', 'US']
40 function ntpString(name)
42 if (name == '') name = 'pool.ntp.org';
43 else name = name + '.pool.ntp.org';
44 return '0.' + name + ' 1.' + name + ' 2.' + name;
47 function ntpdString(name)
49 if (name == '') name = 'pool.ntp.org';
50 else name = name + '.pool.ntp.org';
51 return '-p 0.' + name + '-p 1.' + name + '-p 2.' + name;
55 function verifyFields(focused, quiet)
57 var ok = 1;
59 var s = E('_tm_sel').value;
60 var f_dst = E('_f_tm_dst');
61 var f_ntpd = E('_f_ntpd_enable');
62 var f_tz = E('_f_tm_tz');
63 if (s == 'custom') {
64 f_dst.disabled = true;
65 f_tz.disabled = false;
66 PR(f_dst).style.display = 'none';
67 PR(f_tz).style.display = '';
69 else {
70 f_tz.disabled = true;
71 PR(f_tz).style.display = 'none';
72 PR(f_dst).style.display = '';
73 if (s.match(/^([A-Z]+[\d:-]+)[A-Z]+/)) {
74 if (!f_dst.checked) s = RegExp.$1;
75 f_dst.disabled = false;
77 else {
78 f_dst.disabled = true;
80 f_tz.value = s;
83 var a = 1;
84 var b = 1;
85 switch (E('_ntp_updates').value * 1) {
86 case -1:
87 b = 0;
88 case 0:
89 a = 0;
90 break;
92 elem.display(PR('_f_ntp_tdod'), a);
94 elem.display(PR('_f_ntp_server'), b);
95 a = (E('_f_ntp_server').value == 'custom');
96 elem.display(PR('_f_ntp_1'), PR('_f_ntp_2'), PR('_f_ntp_3'), a && b);
98 elem.display(PR('ntp-preset'), !a && b);
100 if (a) {
101 if ((E('_f_ntp_1').value == '') && (E('_f_ntp_2').value == '') && ((E('_f_ntp_3').value == ''))) {
102 ferror.set('_f_ntp_1', 'At least one NTP server is required', quiet);
103 return 0;
106 else {
107 E('ntp-preset').innerHTML = ntpString(E('_f_ntp_server').value).replace(/\s+/, ', ');
110 ferror.clear('_f_ntp_1');
111 return 1;
114 function save(clearKiss)
116 if (!verifyFields(null, 0)) return;
118 var fom, a, i;
120 fom = E('_fom');
121 fom.tm_dst.value = fom.f_tm_dst.checked ? 1 : 0;
122 fom.ntpd_enable.value = fom.f_ntpd_enable.checked ? 1 : 0;
123 fom.tm_tz.value = fom.f_tm_tz.value;
125 if (E('_f_ntp_server').value != 'custom') {
126 fom.ntp_server.value = ntpString(E('_f_ntp_server').value);
128 else {
129 a = [fom.f_ntp_1.value, fom.f_ntp_2.value, fom.f_ntp_3.value];
130 for (i = 0; i < a.length; ) {
131 if (a[i] == '') a.splice(i, 1);
132 else ++i;
134 fom.ntp_server.value = a.join(' ');
137 fom.ntp_tdod.value = fom.f_ntp_tdod.checked ? 1 : 0;
138 fom.ntp_kiss.disabled = !clearKiss;
139 form.submit(fom);
142 function earlyInit()
144 if (nvram.ntp_kiss != '') {
145 E('ntpkiss-ip').innerHTML = nvram.ntp_kiss;
146 E('ntpkiss').style.display = '';
148 verifyFields(null, 1);
150 </script>
151 </head>
152 <body>
153 <form id='_fom' method='post' action='tomato.cgi'>
154 <table id='container' cellspacing=0>
155 <tr><td colspan=2 id='header'>
156 <div class='title'>Tomato</div>
157 <div class='version'>Version <% version(); %></div>
158 </td></tr>
159 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
160 <td id='content'>
161 <div id='ident'><% ident(); %></div>
163 <!-- / / / -->
165 <input type='hidden' name='_nextpage' value='basic-time.asp'>
166 <input type='hidden' name='_nextwait' value='5'>
167 <input type='hidden' name='_service' value='ntpc-restart'>
168 <input type='hidden' name='_sleep' value='3'>
169 <input type='hidden' name='tm_dst'>
170 <input type='hidden' name='tm_tz'>
171 <input type='hidden' name='ntp_server'>
172 <input type='hidden' name='ntpd_enable'>
173 <input type='hidden' name='ntp_tdod'>
174 <input type='hidden' name='ntp_kiss' value='' disabled>
177 <div class='section-title'>Time</div>
178 <div class='section'>
179 <script type='text/javascript'>
181 ntp = nvram.ntp_server.split(/\s+/);
183 ntpSel = 'custom';
184 for (i = ntpList.length - 1; i > 0; --i) {
185 if (ntpString(ntpList[i][0]) == nvram.ntp_server) ntpSel = ntpList[i][0];
188 /* REMOVE-BEGIN
190 http://tldp.org/HOWTO/TimePrecision-HOWTO/tz.html
191 http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
193 Canada
194 http://www3.sympatico.ca/c.walton/canada_dst.html
195 http://home-4.tiscali.nl/~t876506/Multizones.html#ca
196 http://www3.sympatico.ca/c.walton/canada_dst.html
198 Brazil
199 http://www.timeanddate.com/worldclock/clockchange.html?n=233
200 http://www.timeanddate.com/worldclock/city.html?n=479
202 Finland
203 http://www.timeanddate.com/worldclock/city.html?n=101
205 New Zeland
206 http://www.dia.govt.nz/diawebsite.nsf/wpg_URL/Services-Daylight-Saving-Index
208 Australia
209 http://en.wikipedia.org/wiki/Time_in_Australia
210 http://www.timeanddate.com/library/abbreviations/timezones/au/
212 REMOVE-END */
214 createFieldTable('', [
215 { title: 'Router Time', text: '<span id="clock"><% time(); %></span>' },
216 null,
217 { title: 'Time Zone', name: 'tm_sel', type: 'select', options: [
218 ['custom','Custom...'],
219 ['UTC12','UTC-12:00 Kwajalein'],
220 ['UTC11','UTC-11:00 Midway Island, Samoa'],
221 ['UTC10','UTC-10:00 Hawaii'],
222 ['NAST9NADT,M3.2.0/2,M11.1.0/2','UTC-09:00 Alaska'],
223 ['PST8PDT,M3.2.0/2,M11.1.0/2','UTC-08:00 Pacific Time'],
224 ['UTC7','UTC-07:00 Arizona'],
225 ['MST7MDT,M3.2.0/2,M11.1.0/2','UTC-07:00 Mountain Time'],
226 ['UTC6','UTC-06:00 Mexico'],
227 ['CST6CDT,M3.2.0/2,M11.1.0/2','UTC-06:00 Central Time'],
228 ['UTC5','UTC-05:00 Colombia, Panama'],
229 ['EST5EDT,M3.2.0/2,M11.1.0/2','UTC-05:00 Eastern Time'],
230 ['VET4:30','UTC-04:30 Venezuela'],
231 ['UTC4','UTC-04:00 Aruba, Bermuda, Guyana, Puerto Rico'],
232 ['BOT4','UTC-04:00 Bolivia'],
233 ['AST4ADT,M3.2.0/2,M11.1.0/2','UTC-04:00 Atlantic Time'],
234 ['BRWST4BRWDT,M10.3.0/0,M2.5.0/0','UTC-04:00 Brazil West'],
235 ['NST3:30NDT,M3.2.0/0:01,M11.1.0/0:01','UTC-03:30 Newfoundland'],
236 ['WGST3WGDT,M3.5.6/22,M10.5.6/23','UTC-03:00 Greenland'],
237 ['BRST3BRDT,M10.3.0/0,M2.5.0/0','UTC-03:00 Brazil East'],
238 ['UTC3','UTC-03:00 Argentina, French Guiana, Surinam'],
239 ['UTC2','UTC-02:00 Mid-Atlantic'],
240 ['STD1DST,M3.5.0/2,M10.5.0/2','UTC-01:00 Azores'],
241 ['UTC0','UTC+00:00 Gambia, Liberia, Morocco'],
242 ['GMT0BST,M3.5.0/2,M10.5.0/2','UTC+00:00 England'],
243 ['UTC-1','UTC+01:00 Canary Islands, Tunisia'],
244 ['CET-1CEST,M3.5.0/2,M10.5.0/3','UTC+01:00 Andorra, France, Germany, Italy, Poland, Spain, Sweden'],
245 ['EET-2EEST-3,M3.5.0/3,M10.5.0/4','UTC+02:00 Estonia, Finland, Latvia, Lithuania'],
246 ['UTC-2','UTC+02:00 South Africa, Israel'],
247 ['STD-2DST,M3.5.0/2,M10.5.0/2','UTC+02:00 Greece, Ukraine, Romania, Turkey, Latvia'],
248 ['UTC-3','UTC+03:00 Iraq, Jordan, Kuwait'],
249 ['MSK-3MSD,M3.5.0,M10.5.0/3','UTC+03:00 Moscow'],
250 ['UTC-4','UTC+04:00 Oman, UAE'],
251 ['AMT-4AMST,M3.5.0,M10.5.0/3','UTC+04:00 Armenia'],
252 ['UTC-4:30','UTC+04:30 Kabul'],
253 ['UTC-5','UTC+05:00 Pakistan'],
254 ['YEKT-5YEKST,M3.5.0,M10.5.0/3','UTC+05:00 Russia, Yekaterinburg'],
255 ['UTC-5:30','UTC+05:30 Bombay, Calcutta, Madras, New Delhi'],
256 ['UTC-6','UTC+06:00 Bangladesh'],
257 ['NOVT-6NOVST,M3.5.0,M10.5.0/3','UTC+06:00 Russia, Novosibirsk'],
258 ['UTC-7','UTC+07:00 Thailand'],
259 ['KRAT-7KRAST,M3.5.0,M10.5.0/3','UTC+07:00 Russia, Krasnoyarsk'],
260 ['UTC-8','UTC+08:00 China, Hong Kong, Western Australia, Singapore, Taiwan'],
261 ['IRKT-8IRKST,M3.5.0,M10.5.0/3','UTC+08:00 Russia, Irkutsk'],
262 ['UTC-9','UTC+09:00 Japan, Korea'],
263 ['YAKT-9YAKST,M3.5.0,M10.5.0/3','UTC+09:00 Russia, Yakutsk'],
264 ['ACST-9:30ACDT,M10.1.0/2,M4.1.0/3', 'UTC+09:30 South Australia'],
265 ['ACST-9:30', 'UTC+09:30 Darwin'],
266 ['UTC-10','UTC+10:00 Guam, Russia'],
267 ['AEST-10AEDT,M10.1.0,M4.1.0/3', 'UTC+10:00 Australia'],
268 ['AEST-10', 'UTC+10:00 Brisbane'],
269 ['UTC-11','UTC+11:00 Solomon Islands'],
270 ['UTC-12','UTC+12:00 Fiji'],
271 ['NZST-12NZDT,M9.5.0/2,M4.1.0/3','UTC+12:00 New Zealand']
272 ], value: nvram.tm_sel },
273 { title: 'Auto Daylight Savings Time', indent: 2, name: 'f_tm_dst', type: 'checkbox', value: nvram.tm_dst != '0' },
274 { title: 'Custom Time Zone String', indent: 2, name: 'f_tm_tz', type: 'text', maxlen: 32, size: 34, value: nvram.tm_tz || '' },
275 null,
276 { title: 'Provide NTPD Service', ident:2, name: 'f_ntpd_enable', type:'checkbox', value: nvram.ntpd_enable != '0'},
277 { title: 'Auto Update Time', name: 'ntp_updates', type: 'select', options: [[-1,'Never'],[0,'Only at startup'],[1,'Every hour'],[2,'Every 2 hours'],[4,'Every 4 hours'],[6,'Every 6 hours'],[8,'Every 8 hours'],[12,'Every 12 hours'],[24,'Every 24 hours']],
278 value: nvram.ntp_updates },
279 { title: 'Push to Connect On Demand', indent: 2, name: 'f_ntp_tdod', type: 'checkbox', value: nvram.ntp_tdod != '0' },
280 { title: 'NTP Server Candidates', name: 'f_ntp_server', type: 'select', options: ntpList, value: ntpSel },
281 { title: '&nbsp;', text: '<small><span id="ntp-preset">xx</span></small>', hidden: 1 },
282 { title: '', name: 'f_ntp_1', type: 'text', maxlen: 48, size: 50, value: ntp[0] || 'pool.ntp.org', hidden: 1 },
283 { title: '', name: 'f_ntp_2', type: 'text', maxlen: 48, size: 50, value: ntp[1] || '', hidden: 1 },
284 { title: '', name: 'f_ntp_3', type: 'text', maxlen: 48, size: 50, value: ntp[2] || '', hidden: 1 }
286 </script>
287 </div>
288 <br><br>
290 <div id='ntpkiss' style='display:none'>
291 The following NTP servers have been automatically blocked by request from the server:
292 <b id='ntpkiss-ip'></b>
293 <div>
294 <input type='button' value='Clear' onclick='save(1)'>
295 </div>
296 </div>
298 <!-- / / / -->
300 </td></tr>
301 <tr><td id='footer' colspan=2>
302 <span id='footer-msg'></span>
303 <input type='button' value='Save' id='save-button' onclick='save(0)'>
304 <input type='button' value='Cancel' id='cancel-button' onclick='reloadPage();'>
305 </td></tr>
306 </table>
307 </form>
308 <script type='text/javascript'>earlyInit()</script>
309 </body>
310 </html>