From f4f6cef8e4115cc7f9c7301e4db08bb6e928a1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Mon, 3 Feb 2014 22:16:40 +0100 Subject: [PATCH 1/3] MDLSITE-2756 Add permalink to forum post commands --- mod/forum/lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 36d24e6..deba1ad 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3312,6 +3312,11 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa $commands[] = array('url'=>$url, 'text'=>$text); } + // Permalink + $url = new moodle_url($discussionlink); + $url->set_anchor('p'.$post->id); + $commands[] = array('url' => $url, 'text' => get_string('permalink', 'local_moodleorg')); + // Zoom in to the parent specifically if ($post->parent) { $url = new moodle_url($discussionlink); -- 2.2.1 From 5f5debe6753979893cceef11ba1c6cb7c50a6319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Mon, 3 Feb 2014 22:17:39 +0100 Subject: [PATCH 2/3] MDLSITE-2756 Allow forum post commands to specify their CSS type The new optional 'id' attribute of the $commands list determines the eventual CSS class of the command. This (when added to all existing commands) will allow web designers to replace commands with icons, for example. --- mod/forum/lib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index deba1ad..75a49bf 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3315,7 +3315,7 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa // Permalink $url = new moodle_url($discussionlink); $url->set_anchor('p'.$post->id); - $commands[] = array('url' => $url, 'text' => get_string('permalink', 'local_moodleorg')); + $commands[] = array('id' => 'permalink', 'url' => $url, 'text' => get_string('permalink', 'local_moodleorg')); // Zoom in to the parent specifically if ($post->parent) { @@ -3496,7 +3496,12 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa $commandhtml = array(); foreach ($commands as $command) { if (is_array($command)) { - $commandhtml[] = html_writer::link($command['url'], $command['text']); + if (!empty($command['id'])) { + $commandattribs = array('class' => 'command-'.$command['id']); + } else { + $commandattribs = null; + } + $commandhtml[] = html_writer::link($command['url'], $command['text'], $commandattribs); } else { $commandhtml[] = $command; } -- 2.2.1 From 6b0583dd1259090deb972306f0012a6b56abb4b3 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Wed, 14 Jan 2015 13:53:49 +0000 Subject: [PATCH 3/3] MDLSITE-3743 forum permalink: HACK - use blog string The local_moodleorg plugin isn't installed on learn, so instead we abuse the blog string.. --- mod/forum/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 75a49bf..a59218f 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3315,7 +3315,7 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa // Permalink $url = new moodle_url($discussionlink); $url->set_anchor('p'.$post->id); - $commands[] = array('id' => 'permalink', 'url' => $url, 'text' => get_string('permalink', 'local_moodleorg')); + $commands[] = array('id' => 'permalink', 'url' => $url, 'text' => get_string('permalink', 'blog')); // Zoom in to the parent specifically if ($post->parent) { -- 2.2.1