MDL-32184 - Course - Fixing incorrect redirect when toggling course edit while inside an activity – Patch provided by Kanika Goyal

This commit is contained in:
Jason Fowler
2012-09-24 15:29:31 +08:00
parent f9a85712d5
commit 74d4c9e631
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -17,6 +17,7 @@
$move = optional_param('move', 0, PARAM_INT);
$marker = optional_param('marker',-1 , PARAM_INT);
$switchrole = optional_param('switchrole',-1, PARAM_INT);
$return = optional_param('return', 0, PARAM_LOCALURL);
if (empty($id) && empty($name) && empty($idnumber)) {
print_error('unspecifycourseid', 'error');
@@ -122,6 +123,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);
}
+1 -1
View File
@@ -3177,7 +3177,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/course:update', $coursecontext)) {
// Add the turn on/off settings
$url = new moodle_url('/course/view.php', array('id'=>$course->id, 'sesskey'=>sesskey()));
$url = new moodle_url('/course/view.php', array('id'=>$course->id, 'return'=>str_replace($CFG->wwwroot, '', $this->page->url->out(false)), 'sesskey'=>sesskey()));
if ($this->page->user_is_editing()) {
$url->param('edit', 'off');
$editstring = get_string('turneditingoff');