diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-06-04 18:09:35 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-06-04 18:09:35 +0200 |
| commit | 8f027b68d64c1baa99b272d45f382c17310f1480 (patch) | |
| tree | 396e3a0db22b10060c42ad3cec8640e87a96c3c2 /phpBB/styles | |
| parent | 4af503e11bc2c42654cf783f031bdb074fdd91ed (diff) | |
| parent | b672fc7ae113c0e01f1d7ce4ffae3eb26e57b586 (diff) | |
| download | forums-8f027b68d64c1baa99b272d45f382c17310f1480.tar forums-8f027b68d64c1baa99b272d45f382c17310f1480.tar.gz forums-8f027b68d64c1baa99b272d45f382c17310f1480.tar.bz2 forums-8f027b68d64c1baa99b272d45f382c17310f1480.tar.xz forums-8f027b68d64c1baa99b272d45f382c17310f1480.zip | |
Merge branch 'feature/new-tz-handling' of https://github.com/p/phpbb3 into feature/new-tz-handling
Conflicts:
phpBB/includes/functions_profile_fields.php
phpBB/includes/session.php
phpBB/install/database_update.php
Diffstat (limited to 'phpBB/styles')
4 files changed, 70 insertions, 11 deletions
diff --git a/phpBB/styles/prosilver/template/timezone.js b/phpBB/styles/prosilver/template/timezone.js new file mode 100644 index 0000000000..5d07b1d3ad --- /dev/null +++ b/phpBB/styles/prosilver/template/timezone.js @@ -0,0 +1,54 @@ +function phpbb_preselect_tz_select() +{ + var selector = document.getElementsByClassName('tz_select')[0]; + if (selector.value) + { + return; + } + // 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) + { + // 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; + break; + } + } +} diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html index 1c829899fd..b09e7b1591 100644 --- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html +++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html @@ -75,13 +75,11 @@ <!-- ENDIF --> <dl> <dt><label for="timezone">{L_BOARD_TIMEZONE}:</label></dt> - <dd><select name="tz" id="timezone" class="autowidth">{S_TZ_OPTIONS}</select></dd> - </dl> - <dl> - <dt><label for="dst1">{L_BOARD_DST}:</label></dt> <dd> - <label for="dst1"><input type="radio" name="dst" id="dst1" value="1"<!-- IF S_DST --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> - <label for="dst0"><input type="radio" name="dst" id="dst0" value="0"<!-- IF not S_DST --> checked="checked"<!-- ENDIF --> /> {L_NO}</label> + <select name="tz" id="timezone" class="autowidth tz_select"> + <option value="">{L_SELECT_TIMEZONE}</option> + {S_TZ_OPTIONS} + </select> </dd> </dl> <dl> @@ -141,4 +139,7 @@ // ]]> </script> +<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/timezone.js"></script> +<script type="text/javascript">phpbb_preselect_tz_select();</script> + <!-- INCLUDE ucp_footer.html --> diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 47253af37c..95e125fdea 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -55,7 +55,12 @@ </dl> <dl> <dt><label for="tz">{L_TIMEZONE}:</label></dt> - <dd><select name="tz" id="tz" tabindex="7" class="autowidth">{S_TZ_OPTIONS}</select></dd> + <dd> + <select name="tz" id="tz" tabindex="7" class="autowidth tz_select"> + <option value="">{L_SELECT_TIMEZONE}</option> + {S_TZ_OPTIONS} + </select> + </dd> </dl> <!-- IF .profile_fields --> @@ -106,4 +111,7 @@ </div> </form> +<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/timezone.js"></script> +<script type="text/javascript">phpbb_preselect_tz_select();</script> + <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html index 8e4b04fc10..357e1fe100 100644 --- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html +++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html @@ -78,10 +78,6 @@ </td> </tr> <tr> - <td class="row1" width="50%"><b class="genmed">{L_BOARD_DST}:</b></td> - <td class="row2"><input type="radio" class="radio" name="dst" value="1"<!-- IF S_DST --> checked="checked"<!-- ENDIF --> /> <span class="genmed">{L_YES}</span> <input type="radio" class="radio" name="dst" value="0"<!-- IF not S_DST --> checked="checked"<!-- ENDIF --> /> <span class="genmed">{L_NO}</span></td> -</tr> -<tr> <td class="row1" width="50%"><b class="genmed">{L_BOARD_DATE_FORMAT}:</b><br /><span class="gensmall">{L_BOARD_DATE_FORMAT_EXPLAIN}</span></td> <td class="row2"> <select name="dateoptions" id="dateoptions" onchange="if(this.value=='custom'){dE('custom_date',1);}else{dE('custom_date',-1);} if (this.value == 'custom') { document.getElementById('dateformat').value = default_dateformat; } else { document.getElementById('dateformat').value = this.value; }"> |
