mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 13:58:54 +00:00
[ticket/10281] AJAXified reordering forums in the ACP.
PHPBB3-10281
This commit is contained in:
parent
22c6953c11
commit
bb7a03f738
4 changed files with 49 additions and 9 deletions
|
@ -443,7 +443,7 @@
|
|||
<col class="row1" /><col class="row1" /><col class="row2" />
|
||||
<tbody>
|
||||
<!-- BEGIN forums -->
|
||||
<tr>
|
||||
<tr data-down="{forums.U_MOVE_DOWN}" data-up="{forums.U_MOVE_UP}">
|
||||
<td style="width: 5%; text-align: center;">{forums.FOLDER_IMAGE}</td>
|
||||
<td>
|
||||
<!-- IF forums.FORUM_IMAGE --><div style="float: {S_CONTENT_FLOW_BEGIN}; margin-right: 5px;">{forums.FORUM_IMAGE}</div><!-- ENDIF -->
|
||||
|
@ -453,17 +453,17 @@
|
|||
</td>
|
||||
<td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
|
||||
<!-- IF forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
|
||||
{ICON_MOVE_UP_DISABLED}
|
||||
<a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
|
||||
<span class="up">{ICON_MOVE_UP_DISABLED}</span>
|
||||
<span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down">{ICON_MOVE_DOWN}</a></span>
|
||||
<!-- ELSEIF not forums.S_FIRST_ROW && not forums.S_LAST_ROW -->
|
||||
<a href="{forums.U_MOVE_UP}">{ICON_MOVE_UP}</a>
|
||||
<a href="{forums.U_MOVE_DOWN}">{ICON_MOVE_DOWN}</a>
|
||||
<span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up">{ICON_MOVE_UP}</a></span>
|
||||
<span class="down"><a href="{forums.U_MOVE_DOWN}" data-ajax="forum_down">{ICON_MOVE_DOWN}</a></span>
|
||||
<!-- ELSEIF forums.S_LAST_ROW && not forums.S_FIRST_ROW -->
|
||||
<a href="{forums.U_MOVE_UP}">{ICON_MOVE_UP}</a>
|
||||
{ICON_MOVE_DOWN_DISABLED}
|
||||
<span class="up"><a href="{forums.U_MOVE_UP}" data-ajax="forum_up">{ICON_MOVE_UP}</a></span>
|
||||
<span class="down">{ICON_MOVE_DOWN_DISABLED}</span>
|
||||
<!-- ELSE -->
|
||||
{ICON_MOVE_UP_DISABLED}
|
||||
{ICON_MOVE_DOWN_DISABLED}
|
||||
<span class="up">{ICON_MOVE_UP_DISABLED}</span>
|
||||
<span class="down">{ICON_MOVE_DOWN_DISABLED}</span>
|
||||
<!-- ENDIF -->
|
||||
<a href="{forums.U_EDIT}">{ICON_EDIT}</a>
|
||||
<!-- IF not forums.S_FORUM_LINK -->
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
<!-- IF S_COPYRIGHT_HTML --><br /><!-- ENDIF -->
|
||||
{DEBUG_OUTPUT}
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- tmp -->
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
|
||||
<script src="../styles/script.js"></script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -255,6 +255,12 @@ class acp_forums
|
|||
add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name);
|
||||
$cache->destroy('sql', FORUMS_TABLE);
|
||||
}
|
||||
|
||||
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')
|
||||
{
|
||||
echo json_encode(array('success' => ($move_forum_name !== false)));
|
||||
exit;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -316,6 +316,36 @@ phpbb.add_ajax_callback('post_delete', function(el) {
|
|||
$(el).parents('form').fadeOut(function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}).add_ajax_callback('forum_down', function(el) {
|
||||
var tr = $(el).parents('tr');
|
||||
if (tr.is(':first-child'))
|
||||
{
|
||||
$(el).parents('span').siblings('.up').html('<a href="' + tr.data('up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>');
|
||||
tr.next().find('.up').html('<img src="./images/icon_up_disabled.gif" alt="Move up" title="Move up" />');
|
||||
phpbb.ajaxify({selector: $(el).parents('span').siblings('.up').children('a')}, false, 'forum_up');
|
||||
}
|
||||
tr.insertAfter(tr.next());
|
||||
if (tr.is(':last-child'))
|
||||
{
|
||||
$(el).html('<img src="./images/icon_down_disabled.gif" alt="Move down" title="Move down" />');
|
||||
tr.prev().find('.down').html('<a href="' + tr.data('down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>');
|
||||
phpbb.ajaxify({selector: tr.prev().find('.down').children('a')}, false, 'forum_down');
|
||||
}
|
||||
}).add_ajax_callback('forum_up', function(el) {
|
||||
var tr = $(el).parents('tr');
|
||||
if (tr.is(':last-child'))
|
||||
{
|
||||
$(el).parents('span').siblings('.down').html('<a href="' + tr.data('down') + '"><img src="./images/icon_down.gif" alt="Move down" title="Move down" /></a>');
|
||||
tr.prev().find('.down').html('<img src="./images/icon_down_disabled.gif" alt="Move down" title="Move down" />');
|
||||
phpbb.ajaxify({selector: $(el).parents('span').siblings('.down').children('a')}, false, 'forum_down');
|
||||
}
|
||||
tr.insertBefore(tr.prev());
|
||||
if (tr.is(':first-child'))
|
||||
{
|
||||
$(el).html('<img src="./images/icon_up_disabled.gif" alt="Move up" title="Move up" />');
|
||||
tr.next().find('.up').html('<a href="' + tr.data('up') + '"><img src="./images/icon_up.gif" alt="Move up" title="Move up" /></a>');
|
||||
phpbb.ajaxify({selector: tr.next().find('.up').children('a')}, false, 'forum_up');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue