aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-11-09 11:46:17 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-11-09 11:46:17 +0100
commit1c584ef8ba861ce361135dc44aeabd76423c0c94 (patch)
tree010be461ed5d5c53e05629d50bb862b044070fa7
parentbb173afe3fee816dab9d11764a8b9ff53dc5a1df (diff)
downloadforums-1c584ef8ba861ce361135dc44aeabd76423c0c94.tar
forums-1c584ef8ba861ce361135dc44aeabd76423c0c94.tar.gz
forums-1c584ef8ba861ce361135dc44aeabd76423c0c94.tar.bz2
forums-1c584ef8ba861ce361135dc44aeabd76423c0c94.tar.xz
forums-1c584ef8ba861ce361135dc44aeabd76423c0c94.zip
[feature/soft-delete] Use JS to display softdeleted/ignored posts
PHPBB3-9567
-rw-r--r--phpBB/language/en/common.php5
-rw-r--r--phpBB/styles/prosilver/template/ajax.js14
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html29
-rw-r--r--phpBB/viewtopic.php19
4 files changed, 53 insertions, 14 deletions
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index d7e4f12477..d8596a99f7 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -473,9 +473,12 @@ $lang = array_merge($lang, array(
'POSTS' => 'Posts',
'POSTS_UNAPPROVED' => 'At least one post in this topic has not been approved.',
'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_BY_FOE' => 'This post was made by <strong>%1$s</strong> who is currently on your ignore list.',
+ 'POST_DISPLAY' => '%1$sDisplay this post%2$s.',
'POST_DAY' => '%.2f posts per day',
'POST_DELETED' => 'Deleted post:',
+ 'POST_DELETED_BY' => 'This post was deleted by <strong>%1$s</strong> on %2$s.',
+ 'POST_DELETED_BY_REASON'=> 'This post was deleted by <strong>%1$s</strong> on %2$s for reason: %3$s',
'POST_DETAILS' => 'Post details',
'POST_NEW_TOPIC' => 'Post new topic',
'POST_PCT' => '%.2f%% of all posts',
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index b473e608dc..c29a38d080 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -77,6 +77,20 @@ $('#qr_full_editor').click(function() {
});
+/**
+ * Make the display post links to use JS
+ */
+$('.display_post').click(function(e) {
+ // Do not follow the link
+ e.preventDefault();
+
+ var post_id = $(this).attr('data-post-id');
+ $('#post_content' + post_id).show();
+ $('#profile' + post_id).show();
+ $('#post_hidden' + post_id).hide();
+});
+
+
/**
* This AJAXifies the quick-mod tools. The reason it cannot be a standard
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 9e49e91be5..14c03dbb08 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -114,13 +114,24 @@
<!-- BEGIN postrow -->
<!-- IF postrow.S_FIRST_UNREAD --><a id="unread"></a><!-- ENDIF -->
- <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_IGNORE_POST --> online<!-- ENDIF -->">
+ <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF -->">
<div class="inner">
<div class="postbody">
- <!-- IF postrow.S_IGNORE_POST -->
- <div class="ignore">{postrow.L_IGNORE_POST}</div>
- <!-- ELSE -->
+ <!-- IF postrow.S_POST_HIDDEN -->
+ <!-- IF postrow.S_POST_DELETED -->
+ <div class="ignore" id="post_hidden{postrow.POST_ID}">
+ {postrow.L_POST_DELETED_MESSAGE}<br />
+ {postrow.L_POST_DISPLAY}
+ </div>
+ <!-- ELSEIF postrow.S_IGNORE_POST -->
+ <div class="ignore" id="post_hidden{postrow.POST_ID}">
+ {postrow.L_IGNORE_POST}<br />
+ {postrow.L_POST_DISPLAY}
+ </div>
+ <!-- ENDIF -->
+ <!-- ENDIF -->
+ <div id="post_content{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
<!-- IF not S_IS_BOT -->
<!-- IF postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE -->
@@ -156,7 +167,9 @@
{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 -->
+ <!-- IF postrow.S_POST_REPORTED -->
+ {REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a>
+ <!-- ENDIF -->
</p>
</form>
<!-- ENDIF -->
@@ -197,12 +210,11 @@
<!-- IF postrow.BUMPED_MESSAGE --><div class="notice"><br /><br />{postrow.BUMPED_MESSAGE}</div><!-- ENDIF -->
<!-- IF postrow.SIGNATURE --><div id="sig{postrow.POST_ID}" class="signature">{postrow.SIGNATURE}</div><!-- ENDIF -->
- <!-- ENDIF -->
+ </div>
</div>
- <!-- IF not postrow.S_IGNORE_POST -->
- <dl class="postprofile" id="profile{postrow.POST_ID}">
+ <dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
<dt>
<!-- IF postrow.POSTER_AVATAR -->
<!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}">{postrow.POSTER_AVATAR}</a><!-- ELSE -->{postrow.POSTER_AVATAR}<!-- ENDIF --><br />
@@ -245,7 +257,6 @@
<!-- ENDIF -->
</dl>
- <!-- ENDIF -->
<div class="back2top"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></div>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 2e04b660b2..9dfef607b7 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -1038,7 +1038,7 @@ while ($row = $db->sql_fetchrow($result))
}
$rowset[$row['post_id']] = array(
- 'hide_post' => ($row['foe'] && ($view != 'show' || $post_id != $row['post_id'])) ? true : false,
+ 'hide_post' => (($row['foe'] || $row['post_visibility'] == ITEM_DELETED) && ($view != 'show' || $post_id != $row['post_id'])) ? true : false,
'post_id' => $row['post_id'],
'post_time' => $row['post_time'],
@@ -1548,11 +1548,19 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
$display_username = get_username_string('full', $row['post_delete_user'], $user_cache[$row['post_delete_user']]['username'], $user_cache[$row['post_delete_user']]['user_colour']);
}
+ if ($row['post_delete_reason'])
+ {
+ $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']);
+ }
+ else
+ {
+ $l_deleted_message = $user->lang('POST_DELETED_BY', $display_username, $user->format_date($row['post_delete_time'], false, true));
+ }
$l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($row['post_delete_time'], false, true));
}
else
{
- $l_deleted_by = '';
+ $l_deleted_by = $l_deleted_message = '';
}
// Bump information
@@ -1670,6 +1678,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1,
'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED) ? true : false,
'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false,
+ 'L_POST_DELETED_MESSAGE' => $l_deleted_message,
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false,
'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'],
'S_FRIEND' => ($row['friend']) ? true : false,
@@ -1678,8 +1687,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && sizeof($cp_row['row'])) ? true : false,
'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false,
- 'S_IGNORE_POST' => ($row['hide_post']) ? true : false,
- 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . $viewtopic_url . "&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}" . '">', '</a>') : '',
+ 'S_IGNORE_POST' => ($row['foe']) ? true : false,
+ 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . $viewtopic_url . "&amp;p={$row['post_id']}&amp;view=show#p{$row['post_id']}" . '">', '</a>') : '',
+ 'S_POST_HIDDEN' => $row['hide_post'],
+ 'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $row['post_id'] . '" href="#">', '</a>') : '',
);
$user_poster_data = $user_cache[$poster_id];