mirror of
https://github.com/unraid/webgui.git
synced 2026-04-23 18:48:49 -05:00
Enhanced date and time settings
This commit is contained in:
@@ -19,29 +19,34 @@ Icon="date-time.png"
|
||||
<script src="/webGui/javascript/jquery.maphilight.js"></script>
|
||||
<script src="/webGui/javascript/jquery.timezone-picker.js"></script>
|
||||
|
||||
<form markdown="1" name="datetime_settings" method="POST" action="/update.htm" target="progressFrame">
|
||||
<form name="datetime_settings" method="POST" action="/update.htm" target="progressFrame" markdown="1">
|
||||
Current date and time:
|
||||
: <?=my_time($var['currTime'])?>
|
||||
|
||||
Time zone:
|
||||
: <select id="timeZone" name="timeZone" class="map">
|
||||
<?if (file_exists("/boot/config/timezone")):?>
|
||||
<?=mk_option($var['timeZone'], "custom", "(custom)")?>
|
||||
<?endif;?>
|
||||
<?foreach ($keys as $key):?>
|
||||
<?list($timezone, $info) = explode('|', $key)?>
|
||||
<?=mk_option($var['timeZone'], $timezone, $info)?>
|
||||
<?endforeach;?>
|
||||
</select>
|
||||
<input type="button" id="mapbtn" value="Show map" onclick="$('#picker').toggle('slow'); $(this).toggleClass('hide').val($(this).hasClass('hide') ? 'Hide map' : 'Show map')" style="margin-top:0">
|
||||
: <select id="timeZone" name="timeZone" class="map"><?
|
||||
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>
|
||||
<input type="button" id="knob" value="Show map" onclick="$('#box').toggle('slow'); $(this).toggleClass('hide').val($(this).hasClass('hide') ? 'Hide map' : 'Show map')" style="margin-top:0">
|
||||
|
||||
> 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.
|
||||
|
||||
<div id="picker" style="display:none;margin-left:123px;margin-right:123px;" markdown="1">
|
||||
<img id="globe" src="/webGui/images/worldmap.png" usemap="#map">
|
||||
<map name="map" id="map"><?require_once 'webGui/include/timezones.map'?></map>
|
||||
<div id="box" style="display:none;margin-left:123px;margin-right:123px;" markdown="1">
|
||||
<img id="map" src="/webGui/images/worldmap.png" usemap="#map">
|
||||
<map name="map"><?require_once 'webGui/include/timezones.map'?></map>
|
||||
|
||||
> The world map highlights the current selected time zone.
|
||||
>
|
||||
@@ -82,7 +87,7 @@ New date and time:
|
||||
</form>
|
||||
|
||||
<script>
|
||||
var previous = null;
|
||||
var focus = null;
|
||||
|
||||
function checkDateTimeSettings() {
|
||||
form = document.datetime_settings;
|
||||
@@ -104,36 +109,34 @@ function setArea(timezone, country, offset) {
|
||||
$('input[value=" Apply "]').removeAttr('disabled');
|
||||
$('input[value=" Done "]').val('Reset').prop('onclick',null).click(function(){sticky(true);});
|
||||
}
|
||||
if (offset == previous) return;
|
||||
if (offset==focus) return;
|
||||
$('area').each(function() {
|
||||
if ($(this).data('offset')==previous) {
|
||||
if ($(this).data('offset')==focus) {
|
||||
var data = $(this).data('maphilight');
|
||||
data.alwaysOn = false;
|
||||
data.fillColor = 'BDF5E8';
|
||||
$(this).data('maphilight', data).trigger('fillColor.maphilight');
|
||||
$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
|
||||
} else if ($(this).data('offset')==offset) {
|
||||
var data = $(this).data('maphilight');
|
||||
data.alwaysOn = true;
|
||||
data.fillColor = 'FF9E9E';
|
||||
$(this).data('maphilight', data).trigger('fillColor.maphilight');
|
||||
$(this).data('maphilight', data).trigger('alwaysOn.maphilight');
|
||||
}
|
||||
});
|
||||
previous = offset;
|
||||
focus = offset;
|
||||
}
|
||||
function sticky(renew) {
|
||||
if ($('#mapbtn').hasClass('hide')) $.cookie('map','map',{path:'/'});
|
||||
if ($('#knob').hasClass('hide')) $.cookie('map','map',{path:'/'});
|
||||
if (renew) refresh();
|
||||
}
|
||||
$(function() {
|
||||
if ($.cookie('map')=='map') {
|
||||
$.removeCookie('map',{path:'/'});
|
||||
$('#mapbtn').addClass('hide').val('Hide map');
|
||||
$('#picker').show();
|
||||
$('#knob').addClass('hide').val('Hide map');
|
||||
$('#box').show();
|
||||
}
|
||||
$('area').each(function(){$(this).attr('data-maphilight','{"alwaysOn":false, "fillColor":"BDF5E8"}');});
|
||||
$('#globe').timezonePicker({target:'#timeZone', fillOpacity:0.6, stroke:false, changeHandler:setArea});
|
||||
$('area').each(function(){$(this).attr('data-maphilight','{"alwaysOn":false,"fillColor":"BDF5E8"}');});
|
||||
$('#map').timezonePicker({target:'#timeZone', fillOpacity:0.5, stroke:false, changeHandler:setArea});
|
||||
$('input[value=" Apply "]').prop('disabled',true);
|
||||
$('form[name="datetime_settings"]').find('select,input').not('.map').each(function(){$(this).on('input change',function() {
|
||||
var form = $(this).parentsUntil('form').parent();
|
||||
|
||||
@@ -85,7 +85,7 @@ Australia/Sydney|(UTC+10:00) Canberra, Melbourne, Sydney
|
||||
Pacific/Port_Moresby|(UTC+10:00) Guam, Port Moresby
|
||||
Australia/Hobart|(UTC+10:00) Hobart
|
||||
Asia/Vladivostok|(UTC+10:00) Vladivostok
|
||||
Asia/Sakhalin|(UTC+11:00) Sakhalin
|
||||
Asia/Sakhalin|(UTC+11:00) Magadan, Yuzhno-Sakhalinsk
|
||||
Pacific/Guadalcanal|(UTC+11:00) New Caledonia, Solomon Is.
|
||||
Asia/Kamchatka|(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky
|
||||
Pacific/Auckland|(UTC+12:00) Auckland, Wellington
|
||||
|
||||
@@ -175,30 +175,29 @@
|
||||
<area data-timezone="Atlantic/Azores" data-country="GL" data-pin="0,0" data-offset="-1" shape="poly" coords="443,50,448,51,446,52,450,52,448,53,450,53,450,54,448,54,450,54,449,54,451,55,444,55,442,54,443,50"/>
|
||||
<area data-timezone="Atlantic/Azores" data-country="PT" data-pin="0,0" data-offset="-1" shape="rect" coords="423,156,441,138"/>
|
||||
<area data-timezone="Atlantic/Cape_Verde" data-country="CV" data-pin="0,0" data-offset="-1" shape="rect" coords="435,219,453,202"/>
|
||||
<area data-timezone="UTC" data-country="GB" data-pin="0,0" data-offset="-0" shape="rect" coords="511,0,512,512"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="CI" data-pin="0,0" data-offset="+0" shape="poly" coords="494,242,491,244,491,239,488,237,488,235,489,233,489,232,490,232,489,228,494,225,494,227,497,227,500,229,503,228,505,232,503,237,504,241,494,242"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GH" data-pin="0,0" data-offset="+0" shape="poly" coords="514,240,506,243,503,242,504,241,503,237,505,233,504,225,512,224,514,232,514,237,515,238,514,240"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="ML" data-pin="0,0" data-offset="+0" shape="poly" coords="499,220,499,221,497,222,496,226,494,227,494,225,492,227,490,226,489,227,488,225,487,225,488,224,486,221,482,222,479,221,480,219,477,215,479,212,481,213,485,211,496,212,493,185,498,185,515,196,517,198,521,200,521,202,524,202,524,208,522,212,510,213,504,216,502,219,501,218,499,220"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GM" data-pin="0,0" data-offset="+0" shape="poly" coords="473,218,464,218,469,217,473,218"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GW" data-pin="0,0" data-offset="+0" shape="poly" coords="467,223,467,223,467,223"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="MA" data-pin="0,0" data-offset="+0" shape="poly" coords="495,171,492,172,487,174,487,177,475,177,483,173,485,170,484,167,486,163,493,159,495,154,497,154,499,156,504,155,507,157,509,165,504,165,504,166,502,166,502,168,498,169,495,171"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GN" data-pin="0,0" data-offset="+0" shape="poly" coords="487,234,485,235,484,232,482,232,482,231,480,228,477,228,474,230,473,228,470,226,470,224,473,223,473,220,479,221,482,222,486,221,488,224,487,225,488,225,489,227,489,229,490,232,489,232,489,234,487,234"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="SN" data-pin="0,0" data-offset="+0" shape="poly" coords="464,219,469,217,473,218,469,217,465,217,462,214,466,209,471,209,477,214,480,221,469,220,464,221,465,220,464,220,464,219"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="SL" data-pin="0,0" data-offset="+0" shape="poly" coords="480,235,479,236,475,233,474,230,477,228,480,228,482,230,482,232,483,233,480,235"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="EH" data-pin="0,0" data-offset="+0" shape="poly" coords="478,182,478,189,475,190,475,195,464,195,463,197,464,194,467,188,466,189,470,186,471,182,473,180,475,177,487,177,487,182,478,182"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="TG" data-pin="0,0" data-offset="+0" shape="poly" coords="516,238,514,237,514,232,512,224,515,225,514,226,516,228,517,238,516,238"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="LR" data-pin="0,0" data-offset="+0" shape="poly" coords="490,242,491,244,488,243,480,237,483,232,485,232,485,235,487,235,488,234,488,236,488,237,491,239,490,242"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="MR" data-pin="0,0" data-offset="+0" shape="poly" coords="479,212,478,214,471,209,466,209,465,210,466,205,465,201,466,199,464,195,464,196,475,195,475,190,478,189,478,182,487,182,487,178,498,185,493,185,496,212,485,211,481,213,479,212"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="BF" data-pin="0,0" data-offset="+0" shape="poly" coords="510,225,504,225,504,229,503,228,499,228,496,226,497,222,499,221,501,218,502,219,505,215,511,213,513,213,513,216,516,218,515,219,518,220,519,222,515,225,510,225"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="ST" data-pin="0,0" data-offset="+0" shape="poly" coords="533,251,533,252,533,251"/>
|
||||
<area data-timezone="Atlantic/Reykjavik" data-country="GL" data-pin="0,0" data-offset="+0" shape="poly" coords="457,30,456,31,459,31,452,32,453,32,450,35,453,34,457,35,458,35,452,36,459,36,460,37,447,38,456,40,450,40,457,41,447,40,448,29,457,30"/>
|
||||
<area data-timezone="Atlantic/Reykjavik" data-country="IS" data-pin="0,0" data-offset="+0" shape="poly" coords="449,74,447,74,451,73,444,71,450,71,448,71,450,70,442,70,446,69,444,69,446,69,444,68,445,68,448,69,447,67,451,68,450,69,452,71,453,69,454,70,454,68,457,69,459,68,461,69,460,68,462,68,466,67,468,68,471,67,469,68,473,70,472,71,474,71,472,71,473,71,469,73,460,75,449,74"/>
|
||||
<area data-timezone="Europe/London" data-country="IE" data-pin="0,0" data-offset="+0" shape="poly" coords="493,102,495,102,494,108,485,110,483,109,485,108,482,109,485,106,487,106,484,106,487,105,483,104,485,103,483,102,488,102,489,101,487,100,491,98,492,99,489,101,493,102"/>
|
||||
<area data-timezone="Europe/London" data-country="GG" data-pin="0,0" data-offset="+0" shape="poly" coords="505,115,505,115,505,115"/>
|
||||
<area data-timezone="Europe/London" data-country="IM" data-pin="0,0" data-offset="+0" shape="poly" coords="500,101,498,102,500,101"/>
|
||||
<area data-timezone="Europe/London" data-country="JE" data-pin="0,0" data-offset="+0" shape="poly" coords="506,116,506,116,506,116"/>
|
||||
<area data-timezone="Europe/London" data-country="PT" data-pin="0,0" data-offset="+0" shape="poly" coords="491,149,490,151,486,151,487,147,486,146,487,145,485,146,488,140,487,137,489,136,489,137,493,137,494,138,492,139,492,143,491,143,492,147,491,149"/>
|
||||
<area data-timezone="Europe/London" data-country="GB" data-pin="0,0" data-offset="+0" shape="poly" coords="504,109,502,110,497,108,501,106,500,105,498,106,500,105,504,104,503,104,504,102,502,101,503,100,497,100,499,98,498,96,497,97,495,99,496,96,498,95,494,95,497,94,495,91,498,92,496,91,498,90,498,89,503,89,499,91,501,91,499,92,507,92,505,95,502,96,505,96,501,96,506,97,508,101,512,102,512,104,510,103,512,104,512,106,517,106,516,108,513,110,516,110,515,111,502,112,502,113,496,114,500,110,503,110,505,109,504,109"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="CI" data-pin="0,0" data-offset="0" shape="poly" coords="494,242,491,244,491,239,488,237,488,235,489,233,489,232,490,232,489,228,494,225,494,227,497,227,500,229,503,228,505,232,503,237,504,241,494,242"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GH" data-pin="0,0" data-offset="0" shape="poly" coords="514,240,506,243,503,242,504,241,503,237,505,233,504,225,512,224,514,232,514,237,515,238,514,240"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="ML" data-pin="0,0" data-offset="0" shape="poly" coords="499,220,499,221,497,222,496,226,494,227,494,225,492,227,490,226,489,227,488,225,487,225,488,224,486,221,482,222,479,221,480,219,477,215,479,212,481,213,485,211,496,212,493,185,498,185,515,196,517,198,521,200,521,202,524,202,524,208,522,212,510,213,504,216,502,219,501,218,499,220"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GM" data-pin="0,0" data-offset="0" shape="poly" coords="473,218,464,218,469,217,473,218"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GW" data-pin="0,0" data-offset="0" shape="poly" coords="467,223,467,223,467,223"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="MA" data-pin="0,0" data-offset="0" shape="poly" coords="495,171,492,172,487,174,487,177,475,177,483,173,485,170,484,167,486,163,493,159,495,154,497,154,499,156,504,155,507,157,509,165,504,165,504,166,502,166,502,168,498,169,495,171"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="GN" data-pin="0,0" data-offset="0" shape="poly" coords="487,234,485,235,484,232,482,232,482,231,480,228,477,228,474,230,473,228,470,226,470,224,473,223,473,220,479,221,482,222,486,221,488,224,487,225,488,225,489,227,489,229,490,232,489,232,489,234,487,234"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="SN" data-pin="0,0" data-offset="0" shape="poly" coords="464,219,469,217,473,218,469,217,465,217,462,214,466,209,471,209,477,214,480,221,469,220,464,221,465,220,464,220,464,219"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="SL" data-pin="0,0" data-offset="0" shape="poly" coords="480,235,479,236,475,233,474,230,477,228,480,228,482,230,482,232,483,233,480,235"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="EH" data-pin="0,0" data-offset="0" shape="poly" coords="478,182,478,189,475,190,475,195,464,195,463,197,464,194,467,188,466,189,470,186,471,182,473,180,475,177,487,177,487,182,478,182"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="TG" data-pin="0,0" data-offset="0" shape="poly" coords="516,238,514,237,514,232,512,224,515,225,514,226,516,228,517,238,516,238"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="LR" data-pin="0,0" data-offset="0" shape="poly" coords="490,242,491,244,488,243,480,237,483,232,485,232,485,235,487,235,488,234,488,236,488,237,491,239,490,242"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="MR" data-pin="0,0" data-offset="0" shape="poly" coords="479,212,478,214,471,209,466,209,465,210,466,205,465,201,466,199,464,195,464,196,475,195,475,190,478,189,478,182,487,182,487,178,498,185,493,185,496,212,485,211,481,213,479,212"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="BF" data-pin="0,0" data-offset="0" shape="poly" coords="510,225,504,225,504,229,503,228,499,228,496,226,497,222,499,221,501,218,502,219,505,215,511,213,513,213,513,216,516,218,515,219,518,220,519,222,515,225,510,225"/>
|
||||
<area data-timezone="Africa/Casablanca" data-country="ST" data-pin="0,0" data-offset="0" shape="poly" coords="533,251,533,252,533,251"/>
|
||||
<area data-timezone="Atlantic/Reykjavik" data-country="GL" data-pin="0,0" data-offset="0" shape="poly" coords="457,30,456,31,459,31,452,32,453,32,450,35,453,34,457,35,458,35,452,36,459,36,460,37,447,38,456,40,450,40,457,41,447,40,448,29,457,30"/>
|
||||
<area data-timezone="Atlantic/Reykjavik" data-country="IS" data-pin="0,0" data-offset="0" shape="poly" coords="449,74,447,74,451,73,444,71,450,71,448,71,450,70,442,70,446,69,444,69,446,69,444,68,445,68,448,69,447,67,451,68,450,69,452,71,453,69,454,70,454,68,457,69,459,68,461,69,460,68,462,68,466,67,468,68,471,67,469,68,473,70,472,71,474,71,472,71,473,71,469,73,460,75,449,74"/>
|
||||
<area data-timezone="Europe/London" data-country="IE" data-pin="0,0" data-offset="0" shape="poly" coords="493,102,495,102,494,108,485,110,483,109,485,108,482,109,485,106,487,106,484,106,487,105,483,104,485,103,483,102,488,102,489,101,487,100,491,98,492,99,489,101,493,102"/>
|
||||
<area data-timezone="Europe/London" data-country="GG" data-pin="0,0" data-offset="0" shape="poly" coords="505,115,505,115,505,115"/>
|
||||
<area data-timezone="Europe/London" data-country="IM" data-pin="0,0" data-offset="0" shape="poly" coords="500,101,498,102,500,101"/>
|
||||
<area data-timezone="Europe/London" data-country="JE" data-pin="0,0" data-offset="0" shape="poly" coords="506,116,506,116,506,116"/>
|
||||
<area data-timezone="Europe/London" data-country="PT" data-pin="0,0" data-offset="0" shape="poly" coords="491,149,490,151,486,151,487,147,486,146,487,145,485,146,488,140,487,137,489,136,489,137,493,137,494,138,492,139,492,143,491,143,492,147,491,149"/>
|
||||
<area data-timezone="Europe/London" data-country="GB" data-pin="0,0" data-offset="0" shape="poly" coords="504,109,502,110,497,108,501,106,500,105,498,106,500,105,504,104,503,104,504,102,502,101,503,100,497,100,499,98,498,96,497,97,495,99,496,96,498,95,494,95,497,94,495,91,498,92,496,91,498,90,498,89,503,89,499,91,501,91,499,92,507,92,505,95,502,96,505,96,501,96,506,97,508,101,512,102,512,104,510,103,512,104,512,106,517,106,516,108,513,110,516,110,515,111,502,112,502,113,496,114,500,110,503,110,505,109,504,109"/>
|
||||
<area data-timezone="Africa/Lagos" data-country="DZ" data-pin="0,0" data-offset="1" shape="poly" coords="539,171,540,177,540,180,539,182,541,186,545,187,546,189,529,201,522,202,521,200,517,198,512,194,487,178,487,174,489,173,497,171,498,169,502,168,502,166,504,166,504,165,509,165,509,163,508,162,507,157,506,156,520,151,537,151,535,152,536,157,533,160,538,165,539,171"/>
|
||||
<area data-timezone="Africa/Lagos" data-country="CF" data-pin="0,0" data-offset="1" shape="poly" coords="582,241,579,243,577,242,575,244,567,241,565,244,565,246,559,246,558,250,554,243,553,239,556,235,565,233,566,231,570,230,574,225,576,225,579,228,579,231,581,231,581,232,584,234,590,242,585,241,583,242,582,241"/>
|
||||
<area data-timezone="Africa/Lagos" data-country="CG" data-pin="0,0" data-offset="1" shape="poly" coords="544,267,546,266,545,263,548,263,548,261,552,263,553,261,553,258,552,255,553,253,552,252,549,252,550,250,558,251,559,246,565,246,562,258,558,262,557,267,554,270,553,268,550,270,548,268,546,270,544,267"/>
|
||||
@@ -404,4 +403,6 @@
|
||||
<area data-timezone="Pacific/Auckland" data-country="NZ" data-pin="0,0" data-offset="12" shape="poly" coords="1014,372,1011,374,1009,373,1010,370,1006,368,1008,367,1009,364,1007,360,1008,359,1007,360,1003,354,1008,356,1009,361,1011,362,1011,360,1014,364,1020,363,1018,367,1016,367,1014,372"/>
|
||||
<area data-timezone="Pacific/Fiji" data-country="FJ" data-pin="0,0" data-offset="12" shape="rect" coords="1013,310,1024,300"/>
|
||||
<area data-timezone="Pacific/Apia" data-country="WS" data-pin="0,0" data-offset="13" shape="rect" coords="10,301,20,291"/>
|
||||
<area data-timezone="Pacific/Tongatapu" data-country="TO" data-pin="0,0" data-offset="13" shape="rect" coords="2,322,12,312"/>
|
||||
<area data-timezone="Pacific/Tongatapu" data-country="TO" data-pin="0,0" data-offset="13" shape="rect" coords="2,322,12,312"/>
|
||||
<area data-timezone="UTC" data-country="XX" data-pin="0,0" data-offset="+" shape="rect" coords="511,0,512,512"/>
|
||||
<area data-timezone="custom" data-country="XX" data-pin="0,0" data-offset="-" shape="rect" coords="0,0,0,0"/>
|
||||
Reference in New Issue
Block a user