From 8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5 Mon Sep 17 00:00:00 2001 From: Joas Schilling <nickvergessen@gmx.de> Date: Wed, 29 Aug 2012 18:42:14 +0200 Subject: [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 --- phpBB/includes/mcp/mcp_queue.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'phpBB/includes') 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, )); } -- cgit v1.2.1