mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-22 10:57:56 +01: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:
parent
b774c09c7f
commit
8a036fa3e4
@ -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,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
||||
|
@ -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();
|
||||
});
|
||||
|
@ -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> » {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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user