diff --git a/phpBB/styles/subsilver2/template/timezone.js b/phpBB/styles/subsilver2/template/timezone.js new file mode 100644 index 0000000000..deebbf36a8 --- /dev/null +++ b/phpBB/styles/subsilver2/template/timezone.js @@ -0,0 +1,95 @@ +function phpbb_switch_tz_date(keep_selection) +{ + var timezone_groups = document.getElementById("timezone"); + for (var i = 0; i < timezone_groups.childElementCount; i++) { + if (timezone_groups.children[i].tagName == "OPTGROUP" && + timezone_groups.children[i].label != document.getElementById("tz_date").value) + { + timezone_groups.children[i].style.display = "none"; + } + else if (timezone_groups.children[i].tagName == "OPTGROUP") + { + // Display other options + timezone_groups.children[i].style.display = "block"; + } + } + if (typeof keep_selection !== 'undefined') + { + if (!keep_selection) + { + timezone_groups.children[0].selected = true; + } + } +} + +function phpbb_enable_tz_dates() +{ + var tz_select_date = document.getElementById("tz_select_date"); + tz_select_date.style.display = "block"; +} + +function phpbb_preselect_tz_select(force_selector, l_suggestion) +{ + + var selector = document.getElementById('tz_date'); + // The offset returned here is in minutes and negated. + // http://www.w3schools.com/jsref/jsref_getTimezoneOffset.asp + var offset = (new Date()).getTimezoneOffset(); + if (offset < 0) + { + var sign = '+'; + offset = -offset; + } + else + { + var sign = '-'; + } + var minutes = offset % 60; + var hours = (offset - minutes) / 60; + if (hours < 10) + { + hours = '0' + hours.toString(); + } + else + { + hours = hours.toString(); + } + if (minutes < 10) + { + minutes = '0' + minutes.toString(); + } + else + { + minutes = minutes.toString(); + } + var prefix = 'GMT' + sign + hours + ':' + minutes; + var prefix_length = prefix.length; + for (var i = 0; i < selector.options.length; ++i) + { + var option = selector.options[i]; + if (option.value.substring(0, prefix_length) == prefix) + { + if (selector.value && selector.value != option.value && !force_selector) + { + // We do not select the option for the user, but notify him, + // that we would suggest a different setting. + document.getElementById("tz_select_date_suggest").style.display = "inline"; + document.getElementById("tz_select_date_suggest").title = l_suggestion.replace("%s", option.innerHTML); + document.getElementById("tz_select_date_suggest").innerHTML = l_suggestion.replace("%s", option.innerHTML.substring(0, 9)); + phpbb_switch_tz_date(true); + } + else + { + // Firefox scrolls the selector only to put the option into view; + // for negative-offset timezones, this means the first timezone + // of a particular offset will be the bottom one, and selected, + // with all other timezones not visible. Not much can be done + // about that here unfortunately. + option.selected = true; + phpbb_switch_tz_date(!force_selector); + document.getElementById("tz_select_date_suggest").style.display = "none"; + } + break; + } + } +} diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html new file mode 100644 index 0000000000..184722ef7e --- /dev/null +++ b/phpBB/styles/subsilver2/template/timezone_option.html @@ -0,0 +1,22 @@ + + {L_BOARD_TIMEZONE}: + + + + + + + + + + + diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html index 357e1fe100..bf0e67d68b 100644 --- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html +++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html @@ -71,12 +71,7 @@ - - {L_BOARD_TIMEZONE}: - - - - + {L_BOARD_DATE_FORMAT}:
{L_BOARD_DATE_FORMAT_EXPLAIN} diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index 0c3533292d..095c97ed49 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -53,10 +53,9 @@ {L_LANGUAGE}: - - {L_TIMEZONE}: - - + + + {L_ITEMS_REQUIRED}