12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="max80.css" />
- <title>MAX80: Configuration</title>
- <script src="max80.js"></script>
- </head>
- <body>
- <script>inc("head.html")</script>
- <h1 class="config">Configuration</h1>
- <form id="setconfig" action="sys/setconfig" enctype="text/plain" method="post">
- <fieldset class="network">
- <legend>Network</legend>
- <div>
- <label for="wifi.ssid">Network name (SSID):</label>
- <input type="text" id="wifi.ssid" name="wifi.ssid" />
- </div>
- <div>
- <label for="wifi.psk">Network password (PSK):</label>
- <input class="mono" type="password" id="wifi.psk" name="wifi.psk" />
- <button type="button" class="show" onclick="showpwd('wifi.psk',this)"><span class="show">show</span><span class="hide">hide</span></button>
- </div>
- </fieldset>
- <fieldset class="datetime">
- <legend>Date and Time</legend>
- <div>
- <label for="tz">Time zone:</label>
- <select id="tzname" name="tzname" onchange="tzn(event,'tz')">
- </select>
- <input type="text" id="tz" name="TZ" oninput="tzt(event,'tzname')" />
- </div>
- <div>
- <label for="sntp.enabled">Synchronize time from network:</label>
- <input type="checkbox" id="sntp.enabled" name="sntp.enabled" />
- </div>
- <div>
- <label for="sntp.server">NTP server:</label>
- <input type="text" id="sntp.server" name="sntp.server" />
- </div>
- <div>
- <label for="ip4.dhcp.nosntp">Ignore DHCP-provided NTP server:</label>
- <input type="checkbox" id="ip4.dhcp.nosntp" name="ip4.dhcp.nosntp" />
- </div>
- </fieldset>
- <button class="submit" type="submit" disabled>Update configuration</button>
- </form>
- <script>
- function tzn(e,p) {
- var tz = e.target.selectedOptions[0].dataset.tz;
- if (tz) { getelem(p).value = tz; }
- }
- function tzt(e,p) { getelem(p).value = ''; }
- fetchconfig('tz.txt')
- .then(map => {
- function cln(z) { return ('tz/'+z).replaceAll('/','_ ')
- .replaceAll(/[^\w ]+/g,'-'); }
- var elem = getelem('tzname');
- var grp = elem;
- map.set('',''); map.set('UTC','UTC0');
- var zones = Array.from(map.keys());
- zones = zones.filter(v => v && v != 'UTC').sort();
- zones.unshift('','UTC');
- for (const z of zones) {
- const zz = z.match(/^(?:(\S+?)\/)?(\S*)$/,z);
- if (!zz) { continue; }
- if (zz[1] && zz[1] != grp.label) {
- grp = document.createElement('OPTGROUP');
- grp.label = zz[1];
- grp.className = cln(zz[1]);
- elem.append(grp);
- } else if (!zz[1]) {
- grp = elem;
- }
- const pz = zz[2].replaceAll('_',' ').replaceAll('/',': ');
- var opt = new Option(pz, z);
- opt.className = cln(z);
- opt.dataset.tz = map.get(z);
- grp.append(opt);
- }
- })
- .finally(() => {loadform('setconfig','sys/getconfig')});
- </script>
- <script>translate()</script>
- </body>
- </html>
|