1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-25 11:01:48 +02:00

[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
This commit is contained in:
Joas Schilling
2012-08-29 18:42:14 +02:00
parent b774c09c7f
commit 8a036fa3e4
5 changed files with 33 additions and 12 deletions

View File

@@ -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,
));
}