diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 18:42:14 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2012-08-29 18:42:14 +0200 |
commit | 8a036fa3e4e1fc51a3eb7fded346ccbd84a291b5 (patch) | |
tree | 48f27dd0727d879a620d3ebc39cdc45f3c5db9cc /phpBB/includes | |
parent | b774c09c7f25e3119eeffe7363c91c7b9fd6dbf7 (diff) | |
download | forums-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
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 23 |
1 files changed, 18 insertions, 5 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, )); } |