1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 00:07:44 +02:00

Merge branch 'develop-ascraeus' into develop

* develop-ascraeus:
  [ticket/12013] Fix functional tests and sniffer issue.
  [ticket/12013] Clear the jumpbox.
  [ticket/12013] Add moderator tools icon.
  [ticket/12013] Remove obsolete jumpbox and quickmod CSS.
  [ticket/12013] Prevent the dropdown scrollbar from overlapping the content.
  [ticket/12013] Update to use the new .button class.
  [ticket/12013] Add missing class to place the buttons on the rightside.
  [ticket/12013] Use the correct variable for the forum id.
  [ticket/12013] Use DEFINE instead of Twig's set.
  [ticket/12013] Use path helper.
  [ticket/12013] Use new dropdown for quickmod tools and jumpbox.
This commit is contained in:
Joas Schilling
2014-07-04 13:32:10 +02:00
17 changed files with 148 additions and 156 deletions

View File

@@ -1296,6 +1296,10 @@ phpbb.toggleDropdown = function() {
else if ((offset + width + 2) > windowWidth) {
$this.css('margin-left', (windowWidth - offset - width - 2) + 'px');
}
// Check whether the vertical scrollbar is present.
$this.toggleClass('dropdown-nonscroll', this.scrollHeight === $this.innerHeight());
});
var freeSpace = parent.offset().left - 4;

View File

@@ -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_path_helper->append_url_params($action, array('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_path_helper->append_url_params($action, array('f' => $row['forum_id'])),
));
for ($i = 0; $i < $padding; $i++)
{
@@ -1452,16 +1454,19 @@ 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;
global $template, $user, $phpbb_path_helper;
$lang_string = $user->lang($lang_string);
$template->assign_block_vars('quickmod', array(
'VALUE' => $option,
'TITLE' => $lang_string,
'VALUE' => $option,
'TITLE' => $lang_string,
'LINK' => $phpbb_path_helper->append_url_params($url, array('action' => $option)),
));
}

View File

@@ -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();

View File

@@ -10,24 +10,22 @@
<!-- 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-{S_CONTENT_FLOW_END}<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-{S_CONTENT_FLOW_BEGIN} dropdown-button-control" id="jumpbox">
<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 button 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>
<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 -->&nbsp; &nbsp;<!-- END level -->{jumpbox_forums.FORUM_NAME}</option>
<!-- IF jumpbox_forums.FORUM_ID neq -1 -->
<li><!-- BEGIN level -->&nbsp; &nbsp;<!-- 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 />

View File

@@ -350,6 +350,21 @@
<!-- INCLUDE viewtopic_topic_tools.html -->
<!-- IF .quickmod -->
<div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_BEGIN} dropdown-up dropdown-{S_CONTENT_FLOW_END} dropdown-button-control" id="quickmod">
<span title="{L_QUICK_MOD}" class="dropdown-trigger button icon-button modtools-icon dropdown-select">{L_QUICK_MOD}</span>
<div class="dropdown hidden">
<div class="pointer"><div class="pointer-inner"></div></div>
<ul class="dropdown-contents">
<!-- BEGIN quickmod -->
<!-- DEFINE $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 -->
</ul>
</div>
</div>
<!-- ENDIF -->
<!-- IF .pagination or TOTAL_POSTS -->
<div class="pagination">
{TOTAL_POSTS}
@@ -366,21 +381,6 @@
<!-- EVENT viewtopic_body_footer_before -->
<!-- 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">
<!-- BEGIN quickmod -->
<option value="{quickmod.VALUE}">{quickmod.TITLE}</option>
<!-- END quickmod -->
</select>
<input type="submit" value="{L_GO}" class="button2" />
{S_FORM_TOKEN}
</fieldset>
</form>
<!-- ENDIF -->
<!-- IF S_DISPLAY_ONLINE_LIST -->
<div class="stat-block online-list">
<h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3>

View File

@@ -21,8 +21,8 @@
vertical-align: bottom;
}
.icon-button.dropdown-select {
padding-right: 28px;
.dropdown-select {
padding-right: 24px;
}
.icon-button:before {
@@ -35,6 +35,10 @@
width: 12px;
}
.dropdown-select.icon-button:before {
margin-right: 4px;
}
.dropdown-select:after {
background-position: -103px 10px;
border-left: 1px solid;
@@ -58,6 +62,10 @@
margin-right: 5px;
}
#jumpbox .dropdown-select {
margin: 0;
}
/* Big button images */
.reply-icon:before, .pmreply-icon:before { background-position: -20px 0; }
.reply-icon:hover:before, .pmreply-icon:hover:before { background-position: -20px -20px; }
@@ -73,7 +81,11 @@
.forwardpm-icon:before { background-position: -40px 0; }
.forwardpm-icon:hover:before { background-position: -40px -20px; }
.tools-icon:before {
.modtools-icon {
font-size: 0;
}
.tools-icon:before, .modtools-icon:before {
background-position: -80px 0;
height: 16px;
margin-top: 2px;
@@ -83,6 +95,10 @@
.dropdown-visible .tools-icon:before,
.nojs .dropdown-container:hover .tools-icon:before { background-position: -80px -20px; }
.modtools-icon:before { background-position: -225px 0; }
.dropdown-visible .modtools-icon:before,
.nojs .dropdown-container:hover .modtools-icon:before { background-position: -225px -20px; }
/* Icon images
---------------------------------------- */
.small-icon {

View File

@@ -614,6 +614,10 @@ Colours and backgrounds for buttons.css
color: #D31141;
}
.dropdown-select, .dropdown-select:visited {
color: #536482;
}
.button:hover, .dropdown-visible .dropdown-select, .nojs .dropdown-container:hover .dropdown-select {
border-color: #0a8ed0;
background-image: -moz-linear-gradient(top, #E9E9E9, #FFFFFF);

View File

@@ -477,6 +477,14 @@ ul.linklist.bulletin > li.no-bulletin:before {
position: relative;
}
.dropdown-container-right {
float: right;
}
.dropdown-container-left {
float: left;
}
.nojs .dropdown-container:hover .dropdown {
display: block !important;
}
@@ -595,6 +603,14 @@ ul.linklist.bulletin > li.no-bulletin:before {
text-align: left;
}
.dropdown-contents > li {
padding-right: 15px;
}
.dropdown-nonscroll > li {
padding-right: 0;
}
.dropdown li:first-child, .dropdown li.separator + li, .dropdown li li {
border-top: 0;
}
@@ -1089,6 +1105,14 @@ form > p.post-notice strong {
line-height: 20px;
}
#jumpbox {
margin: 5px 0;
}
.stat-block {
clear: both;
}
#top {
position: absolute;
top: -20px;

View File

@@ -201,24 +201,6 @@ fieldset.forum-selection2 {
float: right;
}
/* Jumpbox */
fieldset.jumpbox {
text-align: right;
margin-top: 15px;
min-height: 2.5em;
}
fieldset.jumpbox select {
max-width: 50%;
}
fieldset.quickmod {
width: 50%;
float: right;
text-align: right;
height: 2.5em;
}
/* Submit button fieldset */
fieldset.submit-buttons {
text-align: center;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -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('&amp;', '&', $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&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start")),
'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&amp;t=$topic_id" . (($start == 0) ? '' : "&amp;start=$start") . "&amp;quickmod=1&amp;redirect=" . urlencode(str_replace('&amp;', '&', $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,