[feature/soft-delete] Display message when the posts are already soft deleted

PHPBB3-9567
This commit is contained in:
Joas Schilling 2012-10-31 17:29:55 +01:00
parent 18dec1026a
commit 8d05dad634
4 changed files with 41 additions and 5 deletions

View file

@ -785,7 +785,21 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
$user->add_lang('posting');
$only_softdeleted = false;
// If there are only soft deleted topics, we display a message why the option is not available
if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))
{
$sql = 'SELECT topic_id
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
AND topic_visibility <> ' . ITEM_DELETED;
$result = $db->sql_query_limit($sql, 1);
$only_softdeleted = (bool) $db->sql_fetchfield('topic_id');
$db->sql_freeresult($result);
}
$template->assign_vars(array(
'S_SOFTDELETED' => $only_softdeleted,
'S_TOPIC_MODE' => true,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
@ -997,8 +1011,21 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '')
$user->add_lang('posting');
$only_softdeleted = false;
// If there are only soft deleted posts, we display a message why the option is not available
if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id))
{
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . '
WHERE ' . $db->sql_in_set('post_id', $post_ids) . '
AND post_visibility <> ' . ITEM_DELETED;
$result = $db->sql_query_limit($sql, 1);
$only_softdeleted = (bool) $db->sql_fetchfield('post_id');
$db->sql_freeresult($result);
}
$template->assign_vars(array(
'S_TOPIC_MODE' => true,
'S_SOFTDELETED' => $only_softdeleted,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id),
'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id),

View file

@ -184,6 +184,7 @@ $lang = array_merge($lang, array(
'POLL_VOTE_CHANGE' => 'Allow re-voting',
'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.',
'POSTED_ATTACHMENTS' => 'Posted attachments',
'POST_ALREADY_SOFTDELETED' => 'The post is already soft deleted, you can only hard delete it.',
'POST_APPROVAL_NOTIFY' => 'You will be notified when your post has been approved.',
'POST_CONFIRMATION' => 'Confirmation of post',
'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.',
@ -240,6 +241,7 @@ $lang = array_merge($lang, array(
'TOO_MANY_URLS' => 'Your message contains too many URLs. The maximum number of URLs allowed is %d.',
'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.',
'TOPIC_BUMPED' => 'Topic has been bumped successfully.',
'TOPIC_ALREADY_SOFTDELETED' => 'The topic is already soft deleted, you can only hard delete it.',
'UNAUTHORISED_BBCODE' => 'You cannot use certain BBCodes: %s.',
'UNGLOBALISE_EXPLAIN' => 'To switch this topic back from being global to a normal topic, you need to select the forum you wish this topic to be displayed.',

View file

@ -1587,6 +1587,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof
global $template;
$template->assign_vars(array(
'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED,
'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id) || $auth->acl_get('f_delete', $forum_id),
'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id) || $auth->acl_get('f_softdelete', $forum_id),
'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id),

View file

@ -7,14 +7,20 @@
<h2>{MESSAGE_TITLE}</h2>
<p>{MESSAGE_TEXT}</p>
<!-- IF S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE) -->
<!-- IF S_SOFTDELETED and S_TOPIC_MODE and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<p>{L_TOPIC_ALREADY_SOFTDELETED}</p>
<!-- ELSEIF S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<p>{L_POST_ALREADY_SOFTDELETED}</p>
<!-- ENDIF -->
<!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) -->
<fieldset class="fields1">
<!-- IF S_TOPIC_MODE and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<dl>
<dt><label for="soft_delete">{L_DELETE_TOPIC_SOFT}:</label></dt>
<dd><label for="soft_delete"><input id="soft_delete" name="soft_delete" type="checkbox" checked="checked" value="1" /> {L_DELETE_TOPIC_SOFT_EXP}</label></dd>
</dl>
<!-- ELSE IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<!-- ELSEIF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE -->
<dl>
<dt><label for="soft_delete">{L_DELETE_POST_SOFT}:</label></dt>
<dd><label for="soft_delete"><input id="soft_delete" name="soft_delete" type="checkbox" checked="checked" value="1" /> {L_DELETE_POST_SOFT_EXP}</label></dd>