Files
webgui/plugins/dynamix/DateTime.page
bergware 674613c656 Update of date and time selection list
This removes the world map feature and is just a update of the selection
list (time zones as of July 2016)
2016-08-24 14:40:44 +02:00

93 lines
3.3 KiB
Plaintext

Menu="OtherSettings"
Title="Date and Time"
Icon="date-time.png"
---
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?$keys = explode("\n", file_get_contents('webGui/include/timezones.key'));?>
<form markdown="1" name="datetime_settings" method="POST" action="/update.htm" target="progressFrame">
Current date and time:
: <?=my_time($var['currTime'])?>
Time zone:
: <select name="timeZone" size="1"><?
if (file_exists("/boot/config/timezone")) {
$yr = date('Y') + 1;
$tz = exec("zdump -V -c $yr /boot/config/timezone|tail -2|grep -Po 'isdst=0 gmtoff=\K.*'");
$hh = strlen($tz) ? sprintf("%'.02d",floor(abs($tz)/3600)) : '??';
$mm = strlen($tz) ? sprintf("%'.02d",abs($tz)%3600/60) : '??';
$tt = $tz < 0 ? 'UTC-' : 'UTC+';
echo mk_option($var['timeZone'], "custom", "($tt$hh:$mm) Custom time zone");
}
foreach ($keys as $key) {
list($timezone, $city) = explode('|', $key);
echo mk_option($var['timeZone'], $timezone, $city);
}
?></select>
> Select your time zone. You may also define a custom time zone file and have it appear as a selection in the drop-down list.
>
> To do this, copy your time zone file with name **timezone** to the folder **config** on your flash device.
Use NTP:
: <select name="USE_NTP" size="1" class="narrow" onchange="checkDateTimeSettings(this.form)">
<?=mk_option($var['USE_NTP'], "yes", "Yes")?>
<?=mk_option($var['USE_NTP'], "no", "No")?>
</select>
> Select 'Yes' to use Network Time Protocol to keep your server time accurate.
> We **highly** recommend the use of a network time server, especially if you plan on using Active Directory.
NTP server 1:
: <input type="text" name="NTP_SERVER1" maxlength="80" value="<?=$var['NTP_SERVER1']?>">
> This is the primary NTP server to use. Enter a FQDN or an IP address.
NTP server 2:
: <input type="text" name="NTP_SERVER2" maxlength="80" value="<?=$var['NTP_SERVER2']?>">
> This is the alternate NTP server to use if NTP Server 1 is down.
NTP server 3:
: <input type="text" name="NTP_SERVER3" maxlength="80" value="<?=$var['NTP_SERVER3']?>">
> This is the alternate NTP Server to use if NTP Servers 1 and 2 are both down.
New date and time:
: <input type="text" name="newDateTime" maxlength="40" value="<?=my_time($var['currTime'], "%F %T")?>">
> Enter the current time-of-day. Use format YYYY-MM-DD HH:MM:SS. Greyed out when using NTP.
&nbsp;
: <input type="submit" name="setDateTime" value="Apply"><input type="button" value="Done" onclick="done()">
</form>
<script>
function checkDateTimeSettings() {
form = document.datetime_settings;
if (form.USE_NTP.value=="yes") {
form.newDateTime.disabled=true;
form.NTP_SERVER1.disabled=false;
form.NTP_SERVER2.disabled=false;
form.NTP_SERVER3.disabled=false;
} else {
form.newDateTime.disabled=false;
form.NTP_SERVER1.disabled=true;
form.NTP_SERVER2.disabled=true;
form.NTP_SERVER3.disabled=true;
}
}
$(checkDateTimeSettings);
</script>