Skip to content

Commit

Permalink
MDL-32184 - Course - Fixing incorrect redirect when toggling course e…
Browse files Browse the repository at this point in the history
…dit while inside an activity -- Patch provided by Kanika Goyal
  • Loading branch information
jsnfwlr committed Oct 5, 2012
1 parent 5d6285c commit 52fc56a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions course/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$marker = optional_param('marker',-1 , PARAM_INT);
$switchrole = optional_param('switchrole',-1, PARAM_INT);
$modchooser = optional_param('modchooser', -1, PARAM_BOOL);
$return = optional_param('return', 0, PARAM_LOCALURL);

$params = array();
if (!empty($name)) {
Expand Down Expand Up @@ -139,6 +140,8 @@
// Redirect to site root if Editing is toggled on frontpage
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
} else if (!empty($return)) {
redirect($CFG->wwwroot . $return);
} else {
$url = new moodle_url($PAGE->url, array('notifyeditingon' => 1));
redirect($url);
Expand All @@ -152,6 +155,8 @@
// Redirect to site root if Editing is toggled on frontpage
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
} else if (!empty($return)) {
redirect($CFG->wwwroot . $return);
} else {
redirect($PAGE->url);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3562,7 +3562,7 @@ protected function load_course_settings($forceopen = false) {
$baseurl->param('sesskey', sesskey());
} else {
// Edit on the main course page.
$baseurl = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey()));
$baseurl = new moodle_url('/course/view.php', array('id'=>$course->id, 'return'=>$this->page->url->out_as_local_url(false), 'sesskey'=>sesskey()));
}

$editurl = clone($baseurl);
Expand Down

0 comments on commit 52fc56a

Please sign in to comment.