From 881fc8a6a76229fa24809b58a5760dfe96b8a070 Mon Sep 17 00:00:00 2001 From: John Yao Date: Fri, 26 Jun 2020 12:28:34 +1000 Subject: [PATCH] Fix #19 - prevent thread content from rendering in html in main view --- renderer.php | 24 +++++++++++++----------- styles.css | 1 - 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/renderer.php b/renderer.php index 3633c697..7f9085f8 100644 --- a/renderer.php +++ b/renderer.php @@ -270,7 +270,7 @@ public function discussions($cm, array $discussions, array $options) { $output = '
'; foreach ($discussions as $discussionpost) { list($discussion, $post) = $discussionpost; - $output .= $this->discussion($cm, $discussion, $post, false); + $output .= $this->discussion($cm, $discussion, $post, false, array(), null, true); } @@ -314,9 +314,10 @@ public function discussion_thread($cm, $discussion, $post, array $posts, $canrep * @param \stdClass $post The discussion's post to render * @param \stdClass[] $posts The discussion posts (optional) * @param null|boolean $canreply If the user can reply or not (optional) + * @param null|boolean $hidethreadcontent for main view(optional) * @return string */ - public function discussion($cm, $discussion, $post, $fullthread, array $posts = array(), $canreply = null) { + public function discussion($cm, $discussion, $post, $fullthread, array $posts = array(), $canreply = null, $hidethreadcontent = null) { global $DB, $PAGE, $USER; $forum = hsuforum_get_cm_forum($cm); @@ -432,7 +433,7 @@ public function discussion($cm, $discussion, $post, $fullthread, array $posts = $data->timed = ''; } - return $this->discussion_template($data, $forum->type); + return $this->discussion_template($data, $forum->type, $hidethreadcontent); } public function article_assets($cm) { @@ -546,7 +547,7 @@ public function post($cm, $discussion, $post, $canreply = false, $parent = null, return $this->post_template($data); } - public function discussion_template($d, $forumtype) { + public function discussion_template($d, $forumtype, $hidethreadcontent = null) { global $PAGE; $replies = ''; @@ -619,7 +620,11 @@ public function discussion_template($d, $forumtype) { $revealed = ''.$nonanonymous.''; } - $arialabeldiscussion = get_string('discussionforum', 'hsuforum', $d->subject); + $threadcontent = ''; + if (!$hidethreadcontent) { + $threadcontent = '
' . $d->message . '
'; + } + $threadheader = << @@ -645,10 +650,7 @@ public function discussion_template($d, $forumtype) { $threadheader - -
- $d->message -
+ $threadcontent $tools @@ -1253,7 +1255,7 @@ public function post_message($post, $cm, $search = '') { 'course' => $cm->course, 'hsuforum' => $cm->instance)); } - + $postcontent = format_text($message, $post->messageformat, $options, $cm->course); if (!empty($search)) { @@ -1711,7 +1713,7 @@ protected function simple_edit_template($t) { } if ($canattach) { $files .= << + HTML; diff --git a/styles.css b/styles.css index 643ada54..e9618a3b 100644 --- a/styles.css +++ b/styles.css @@ -40,7 +40,6 @@ /* Hide things in the main view */ .hsuforum-thread .hsuforum-footer-reply, .hsuforum-thread .hsuforum-thread-body, -.hsuforum-thread .hsuforum-thread-content, .hsuforum-thread .hsuforum-replycount-link, .hsuforum-reply-wrapper + header { display: none;