mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
[ticket/12013] Use new dropdown for quickmod tools and jumpbox.
PHPBB3-12013
This commit is contained in:
parent
c1627ef52e
commit
90a8c7e29a
6 changed files with 53 additions and 65 deletions
|
@ -174,8 +174,9 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
|||
$template->assign_block_vars('jumpbox_forums', array(
|
||||
'FORUM_ID' => ($select_all) ? 0 : -1,
|
||||
'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'],
|
||||
'S_FORUM_COUNT' => $iteration)
|
||||
);
|
||||
'S_FORUM_COUNT' => $iteration,
|
||||
'LINK' => phpbb_append_url_param($action, 'f', $forum_id),
|
||||
));
|
||||
|
||||
$iteration++;
|
||||
$display_jumpbox = true;
|
||||
|
@ -188,8 +189,9 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
|
|||
'S_FORUM_COUNT' => $iteration,
|
||||
'S_IS_CAT' => ($row['forum_type'] == FORUM_CAT) ? true : false,
|
||||
'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false,
|
||||
'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false)
|
||||
);
|
||||
'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false,
|
||||
'LINK' => phpbb_append_url_param($action, 'f', $row['forum_id']),
|
||||
));
|
||||
|
||||
for ($i = 0; $i < $padding; $i++)
|
||||
{
|
||||
|
@ -1452,16 +1454,18 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
|
|||
/**
|
||||
* Add an option to the quick-mod tools.
|
||||
*
|
||||
* @param string $url The recepting URL for the quickmod actions.
|
||||
* @param string $option The language key for the value of the option.
|
||||
* @param string $lang_string The language string to use.
|
||||
*/
|
||||
function phpbb_add_quickmod_option($option, $lang_string)
|
||||
function phpbb_add_quickmod_option($url, $option, $lang_string)
|
||||
{
|
||||
global $template, $user;
|
||||
$lang_string = $user->lang($lang_string);
|
||||
$template->assign_block_vars('quickmod', array(
|
||||
'VALUE' => $option,
|
||||
'TITLE' => $lang_string,
|
||||
'VALUE' => $option,
|
||||
'TITLE' => $lang_string,
|
||||
'LINK' => phpbb_append_url_param($url, 'action', $option),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -356,37 +356,6 @@ $('.display_post').click(function(e) {
|
|||
$('#post_hidden' + post_id).hide();
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This AJAXifies the quick-mod tools. The reason it cannot be a standard
|
||||
* callback / data attribute is that it requires filtering - some of the options
|
||||
* can be ajaxified, while others cannot.
|
||||
*/
|
||||
phpbb.ajaxify({
|
||||
selector: '#quickmodform',
|
||||
refresh: true,
|
||||
filter: function (data) {
|
||||
var action = $('#quick-mod-select').val();
|
||||
|
||||
if (action === 'make_normal') {
|
||||
return $(this).find('select option[value="make_global"]').length > 0;
|
||||
} else if (action === 'lock' || action === 'unlock') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action === 'delete_topic' || action === 'make_sticky' || action === 'make_announce' || action === 'make_global') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('#quick-mod-select').change(function () {
|
||||
$('#quickmodform').submit();
|
||||
});
|
||||
|
||||
$('#delete_permanent').click(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$('#delete_reason').hide();
|
||||
|
|
|
@ -10,24 +10,23 @@
|
|||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF S_DISPLAY_JUMPBOX -->
|
||||
<form method="get" id="jumpbox" action="{S_JUMPBOX_ACTION}" onsubmit="if(this.f.value == -1){return false;}">
|
||||
|
||||
<!-- IF $CUSTOM_FIELDSET_CLASS -->
|
||||
<fieldset class="{$CUSTOM_FIELDSET_CLASS}">
|
||||
<!-- ELSE -->
|
||||
<fieldset class="jumpbox">
|
||||
<!-- ENDIF -->
|
||||
{HIDDEN_FIELDS_FOR_JUMPBOX}
|
||||
<label for="f" accesskey="j"><!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->{L_COLON}</label>
|
||||
<select name="f" id="f" onchange="if(this.options[this.selectedIndex].value != -1){ document.forms['jumpbox'].submit() }">
|
||||
<div class="dropdown-container dropdown-container-right<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-left dropdown-button-control">
|
||||
<span title="<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->" class="dropdown-trigger dropdown-select">
|
||||
<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->
|
||||
<span></span>
|
||||
</span>
|
||||
<div class="dropdown hidden">
|
||||
<div class="pointer"><div class="pointer-inner"></div></div>
|
||||
<ul class="dropdown-contents">
|
||||
<!-- BEGIN jumpbox_forums -->
|
||||
<!-- IF jumpbox_forums.S_FORUM_COUNT == 1 --><option value="-1">------------------</option><!-- ENDIF -->
|
||||
<option value="{jumpbox_forums.FORUM_ID}"{jumpbox_forums.SELECTED}><!-- BEGIN level --> <!-- END level -->{jumpbox_forums.FORUM_NAME}</option>
|
||||
<!-- IF jumpbox_forums.FORUM_ID neq -1 -->
|
||||
<li><!-- BEGIN level --> <!-- END level --><a href="{jumpbox_forums.LINK}">{jumpbox_forums.FORUM_NAME}</a></li>
|
||||
<!-- ENDIF -->
|
||||
<!-- END jumpbox_forums -->
|
||||
</select>
|
||||
<input type="submit" value="{L_GO}" class="button2" />
|
||||
</fieldset>
|
||||
</form>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ELSE -->
|
||||
<br /><br />
|
||||
|
|
|
@ -242,6 +242,7 @@
|
|||
<!-- ENDIF -->
|
||||
|
||||
<!-- INCLUDE jumpbox.html -->
|
||||
<span class="clear"></span>
|
||||
|
||||
<!-- IF S_DISPLAY_ONLINE_LIST -->
|
||||
<div class="stat-block online-list">
|
||||
|
|
|
@ -367,19 +367,21 @@
|
|||
<!-- INCLUDE jumpbox.html -->
|
||||
|
||||
<!-- IF .quickmod -->
|
||||
<form method="post" action="{S_MOD_ACTION}" id="quickmodform">
|
||||
<fieldset class="quickmod">
|
||||
<label for="quick-mod-select">{L_QUICK_MOD}{L_COLON}</label>
|
||||
<select name="action" id="quick-mod-select">
|
||||
<div class="dropdown-container dropdown-container-right dropdown-up dropdown-left dropdown-button-control">
|
||||
<span title="{L_QUICK_MOD}" class="dropdown-trigger dropdown-select">{L_QUICK_MOD}<span></span></span>
|
||||
<div class="dropdown hidden">
|
||||
<div class="pointer"><div class="pointer-inner"></div></div>
|
||||
<ul class="dropdown-contents">
|
||||
<!-- BEGIN quickmod -->
|
||||
<option value="{quickmod.VALUE}">{quickmod.TITLE}</option>
|
||||
{% set QUICKMOD_AJAX = (quickmod.VALUE in ['lock', 'unlock', 'delete_topic', 'restore_topic', 'make_normal', 'make_sticky', 'make_announce', 'make_global']) %}
|
||||
<li><a href="{quickmod.LINK}"<!-- IF QUICKMOD_AJAX --> data-ajax="true" data-refresh="true"<!-- ENDIF -->>{quickmod.TITLE}</a></li>
|
||||
<!-- END quickmod -->
|
||||
</select>
|
||||
<input type="submit" value="{L_GO}" class="button2" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
</form>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ENDIF -->
|
||||
<span class="clear"></span>
|
||||
|
||||
<!-- IF S_DISPLAY_ONLINE_LIST -->
|
||||
<div class="stat-block online-list">
|
||||
|
|
|
@ -523,6 +523,19 @@ gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']);
|
|||
// Quick mod tools
|
||||
$allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false;
|
||||
|
||||
$s_quickmod_action = append_sid(
|
||||
"{$phpbb_root_path}mcp.$phpEx",
|
||||
array(
|
||||
'f' => $forum_id,
|
||||
't' => $topic_id,
|
||||
'start' => $start,
|
||||
'quickmod' => 1,
|
||||
'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)),
|
||||
),
|
||||
true,
|
||||
$user->session_id
|
||||
);
|
||||
|
||||
$quickmod_array = array(
|
||||
// 'key' => array('LANG_KEY', $userHasPermissions),
|
||||
|
||||
|
@ -546,7 +559,7 @@ foreach($quickmod_array as $option => $qm_ary)
|
|||
{
|
||||
if (!empty($qm_ary[1]))
|
||||
{
|
||||
phpbb_add_quickmod_option($option, $qm_ary[0]);
|
||||
phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,7 +644,7 @@ $template->assign_vars(array(
|
|||
'S_SELECT_SORT_DAYS' => $s_limit_days,
|
||||
'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true,
|
||||
'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")),
|
||||
'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id),
|
||||
'S_MOD_ACTION' => $s_quickmod_action,
|
||||
|
||||
'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', $topic_data['forum_name']),
|
||||
'S_VIEWTOPIC' => true,
|
||||
|
|
Loading…
Add table
Reference in a new issue