Skip to content

Commit

Permalink
tags MDL-22030 fixed redirection error after adding a tag. fixed cour…
Browse files Browse the repository at this point in the history
…se tags links rendering on only first tag block.
  • Loading branch information
nebgor committed Sep 30, 2010
1 parent 0159e3b commit 43ff78f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions blocks/tags/block_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ function get_content() {
<form action="{$CFG->wwwroot}/tag/coursetags_add.php" method="post" id="coursetag"
onsubmit="return ctags_checkinput(this.coursetag_new_tag.value)">
<div style="display: none;">
<input type="hidden" name="returnurl" value="{$this->page->url}" />
<input type="hidden" name="entryid" value="$COURSE->id" />
<input type="hidden" name="userid" value="$USER->id" />
<input type="hidden" name="sesskey" value="$sesskey" />
Expand Down Expand Up @@ -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 .= '<div id="coursetagslinks"></div>';
$this->content->footer .= '<div id="'.$elementid.'"></div>';
}
// This section sets the order of the links
$coursetagslinks = array();
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tag/coursetags_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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.'/';
}
Expand Down
4 changes: 2 additions & 2 deletions tag/coursetagslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 43ff78f

Please sign in to comment.