1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-31 03:29:23 +02:00

[feature/new-tz-handling] Fix timezone option when editing a user in the ACP

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-06-12 19:54:26 +02:00
parent 435573a9cb
commit 5f96e5d374
5 changed files with 55 additions and 5 deletions

View File

@ -52,10 +52,7 @@
<dt><label for="style">{L_BOARD_STYLE}:</label></dt>
<dd><select id="style" name="style">{S_STYLE_OPTIONS}</select></dd>
</dl>
<dl>
<dt><label for="tz">{L_BOARD_TIMEZONE}:</label></dt>
<dd><select id="tz" name="tz" style="width: 100%;">{S_TZ_OPTIONS}</select></dd>
</dl>
<!-- INCLUDE timezone_option.html -->
<dl>
<dt><label for="dateoptions">{L_BOARD_DATE_FORMAT}:</label><br /><span>{L_BOARD_DATE_FORMAT_EXPLAIN}</span></dt>
<dd><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; }">{S_DATEFORMAT_OPTIONS}</select></dd>

View File

@ -0,0 +1,29 @@
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";
}

View File

@ -0,0 +1,20 @@
<dl>
<dt><label for="timezone">{L_BOARD_TIMEZONE}:</label></dt>
<!-- IF S_TZ_DATE_OPTIONS -->
<dd id="tz_select_date" style="display: none;">
<select name="tz_date" id="tz_date" class="autowidth tz_select" onchange="phpbb_switch_tz_date(false);">
<option value="">{L_SELECT_CURRENT_TIME}</option>
{S_TZ_DATE_OPTIONS}
</select>
</dd>
<!-- ENDIF -->
<dd>
<select name="tz" id="timezone" class="autowidth tz_select">
<option value="">{L_SELECT_TIMEZONE}</option>
{S_TZ_OPTIONS}
</select>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/timezone.js"></script>
<script type="text/javascript">phpbb_enable_tz_dates();</script>
</dd>
</dl>

View File

@ -1639,6 +1639,7 @@ class acp_users
${'s_sort_' . $sort_option . '_dir'} .= '</select>';
}
$tz_select = tz_select($data['tz'], true, false);
$template->assign_vars(array(
'S_PREFS' => true,
'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true,
@ -1678,7 +1679,8 @@ class acp_users
'S_LANG_OPTIONS' => language_select($data['lang']),
'S_STYLE_OPTIONS' => style_select($data['style']),
'S_TZ_OPTIONS' => tz_select($data['tz'], true),
'S_TZ_OPTIONS' => $tz_select['tz_select'],
'S_TZ_DATE_OPTIONS' => $tz_select['tz_dates'],
)
);

View File

@ -401,6 +401,8 @@ $lang = array_merge($lang, array(
'STATISTIC' => 'Statistic',
'STATISTIC_RESYNC_OPTIONS' => 'Resynchronise or reset statistics',
'TIMEZONE_INVALID' => 'The timezone you selected is invalid.',
'TIMEZONE_SELECTED' => '(currently selected)',
'TOPICS_PER_DAY' => 'Topics per day',
'UPLOAD_DIR_SIZE' => 'Size of posted attachments',