1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +02:00

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
This commit is contained in:
Joas Schilling
2012-06-04 18:09:35 +02:00
26 changed files with 395 additions and 211 deletions

View File

@@ -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;
}
}
}

View File

@@ -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 -->

View File

@@ -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 -->

View File

@@ -77,10 +77,6 @@
<select id="tz" name="tz">{S_TZ_OPTIONS}</select>
</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>&nbsp;&nbsp;<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">