aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-08-29 18:42:14 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-08-29 18:42:14 +0200
commit8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5 (patch)
tree48f27dd0727d879a620d3ebc39cdc45f3c5db9cc
parentb774c09c7f25e3119eeffe7363c91c7b9fd6dbf7 (diff)
downloadforums-8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5.tar
forums-8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5.tar.gz
forums-8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5.tar.bz2
forums-8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5.tar.xz
forums-8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5.zip
[feature/soft-delete] Update restoring feature to use ajax if requested.
Also fixes the mcp as a hole: - displayes a success message - gives a link to the post, if only one was restored PHPBB3-9657
-rw-r--r--phpBB/includes/mcp/mcp_queue.php23
-rw-r--r--phpBB/language/en/common.php1
-rw-r--r--phpBB/language/en/mcp.php4
-rw-r--r--phpBB/styles/prosilver/template/ajax.js4
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html13
5 files changed, 33 insertions, 12 deletions
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index a20ce10aa6..cbf0ff0089 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -470,7 +470,7 @@ class mcp_queue
function restore_post($post_id_list, $id, $mode)
{
global $db, $template, $user, $config;
- global $phpEx, $phpbb_root_path;
+ global $phpEx, $phpbb_root_path, $request;
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_restore')))
{
@@ -483,7 +483,7 @@ function restore_post($post_id_list, $id, $mode)
$post_info = get_post_data($post_id_list, 'm_restore');
- phpbb_content_visibility::unhide_posts_topics('restore', $post_info, $post_id_list);
+ $success_msg = phpbb_content_visibility::unhide_posts_topics('restore', $post_info, $post_id_list);
if (!$success_msg)
{
@@ -500,7 +500,20 @@ function restore_post($post_id_list, $id, $mode)
$add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
}
- trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message);
+ $message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message;
+
+ if ($request->is_ajax())
+ {
+ $json_response = new phpbb_json_response;
+ $json_response->send(array(
+ 'MESSAGE_TITLE' => $user->lang['INFORMATION'],
+ 'MESSAGE_TEXT' => $message,
+ 'REFRESH_DATA' => null,
+ 'visible' => true,
+ ));
+ }
+
+ trigger_error($message);
}
}
@@ -659,7 +672,7 @@ function approve_post($post_id_list, $id, $mode)
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
'REFRESH_DATA' => null,
- 'approved' => true
+ 'visible' => true,
));
}
@@ -931,7 +944,7 @@ function disapprove_post($post_id_list, $id, $mode)
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
'REFRESH_DATA' => null,
- 'approved' => false
+ 'visible' => false,
));
}
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index e6022e3b79..857b9004ec 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -475,6 +475,7 @@ $lang = array_merge($lang, array(
'POST_BY_AUTHOR' => 'by',
'POST_BY_FOE' => 'This post was made by <strong>%1$s</strong> who is currently on your ignore list. %2$sDisplay this post%3$s.',
'POST_DAY' => '%.2f posts per day',
+ 'POST_DELETED' => 'Soft deleted post:',
'POST_DETAILS' => 'Post details',
'POST_NEW_TOPIC' => 'Post new topic',
'POST_PCT' => '%.2f%% of all posts',
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index 175fa72829..95d09028ce 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -201,8 +201,8 @@ $lang = array_merge($lang, array(
'MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN' => 'This is a list of all posts which require approving before they will be visible to users.',
'MCP_QUEUE_UNAPPROVED_TOPICS' => 'Topics awaiting approval',
'MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN' => 'This is a list of all topics which require approving before they will be visible to users.',
- 'MCP_QUEUE_DELETED_POSTS' => 'Deleted posts',
- 'MCP_QUEUE_DELETED_POSTS_EXPLAIN' => 'This is a list of all posts which have been soft deleted. You can restore or permanently delete the posts from this screen.',
+ 'MCP_QUEUE_DELETED_POSTS' => 'Deleted posts',
+ 'MCP_QUEUE_DELETED_POSTS_EXPLAIN' => 'This is a list of all posts which have been soft deleted. You can restore or permanently delete the posts from this screen.',
'MCP_VIEW_USER' => 'View warnings for a specific user',
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 54f34e4204..b473e608dc 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -24,8 +24,8 @@ phpbb.add_ajax_callback('post_delete', function() {
});
// This callback removes the approve / disapprove div or link.
-phpbb.add_ajax_callback('post_approve', function(res) {
- var remove = (res.approved) ? $(this) : $(this).parents('.post');
+phpbb.add_ajax_callback('post_visibility', function(res) {
+ var remove = (res.visible) ? $(this) : $(this).parents('.post');
$(remove).css('pointer-events', 'none').fadeOut(function() {
$(this).remove();
});
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 6f0dbfc1eb..ddcca7e9aa 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -139,7 +139,7 @@
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> &raquo; {postrow.POST_DATE} </p>
<!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED -->
- <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}" data-ajax="post_approve">
+ <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}" data-ajax="post_visibility">
<p class="rules">
<!-- IF postrow.S_POST_UNAPPROVED -->
{UNAPPROVED_IMG} <strong>{L_POST_UNAPPROVED}</strong>
@@ -147,8 +147,15 @@
<input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" />
<input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
{S_FORM_TOKEN}
- <br /><!-- ENDIF -->
- <!-- IF postrow.S_POST_DELETED -->{DELETED_IMG} <a href="{postrow.U_MCP_RESTORE}"><strong>{L_POST_DELETED_RESTORE}</strong></a><br /><!-- ENDIF -->
+ <br />
+ <!-- ELSEIF postrow.S_POST_DELETED -->
+ {DELETED_IMG} <strong>{L_POST_DELETED}</strong>
+ <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" />
+ <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
+ <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
+ {S_FORM_TOKEN}
+ <br />
+ <!-- ENDIF -->
<!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
</p>
</form>