From 43ff78fdb4ccd814cc9346b19acb89946ab1392f Mon Sep 17 00:00:00 2001 From: Aparup Banerjee Date: Thu, 30 Sep 2010 02:40:41 +0000 Subject: [PATCH] tags MDL-22030 fixed redirection error after adding a tag. fixed course tags links rendering on only first tag block. --- blocks/tags/block_tags.php | 6 ++++-- tag/coursetags_add.php | 5 +++-- tag/coursetagslib.php | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/blocks/tags/block_tags.php b/blocks/tags/block_tags.php index 1e53da33ee6bd..0a35df176e473 100644 --- a/blocks/tags/block_tags.php +++ b/blocks/tags/block_tags.php @@ -237,6 +237,7 @@ function get_content() {
+ @@ -273,8 +274,9 @@ function get_content() { // Navigation elements at the bottom of the block // show the alternative displays options if available + $elementid = 'coursetagslinks_'.$this->instance->id; if ($mytags or $officialtags or $commtags or $coursetags) { - $this->content->footer .= ''; + $this->content->footer .= '
'; } // This section sets the order of the links $coursetagslinks = array(); @@ -304,7 +306,7 @@ function get_content() { 'onclick'=>'f_coursetags', 'text'=>get_string('coursetags1', $tagslang)); } - coursetag_get_jscript_links($coursetagslinks); + coursetag_get_jscript_links($elementid, $coursetagslinks); } else { //if not logged in diff --git a/tag/coursetags_add.php b/tag/coursetags_add.php index b61bba1e99d1d..e5c316a3f8c07 100644 --- a/tag/coursetags_add.php +++ b/tag/coursetags_add.php @@ -15,6 +15,7 @@ print_error('tagsaredisabled', 'tag'); } +$returnurl = optional_param('returnurl', null, PARAM_TEXT); $keyword = optional_param('coursetag_new_tag', '', PARAM_TEXT); $courseid = optional_param('entryid', 0, PARAM_INT); $userid = optional_param('userid', 0, PARAM_INT); @@ -32,8 +33,8 @@ } // send back to originating page, where the new tag will be visible in the block -if ($courseid > 0) { - $myurl = $CFG->wwwroot.'/course/view.php?id='.$courseid; +if ($returnurl) { + redirect($returnurl); } else { $myurl = $CFG->wwwroot.'/'; } diff --git a/tag/coursetagslib.php b/tag/coursetagslib.php index 264e560322455..cb0e10afa5ebd 100644 --- a/tag/coursetagslib.php +++ b/tag/coursetagslib.php @@ -264,12 +264,12 @@ function coursetag_get_jscript($coursetagdivs = '') { /** * Returns javascript to create the links in the tag block footer. */ -function coursetag_get_jscript_links($coursetagslinks) { +function coursetag_get_jscript_links($elementid, $coursetagslinks) { global $PAGE; if (!empty($coursetagslinks)) { foreach ($coursetagslinks as $a) { - $PAGE->requires->js_function_call('add_tag_footer_link', array('coursetagslinks', $a['title'], $a['onclick'], $a['text']), true); + $PAGE->requires->js_function_call('add_tag_footer_link', array($elementid, $a['title'], $a['onclick'], $a['text']), true); } }