From: jamiesensei Date: Tue, 5 Dec 2006 13:23:18 +0000 (+0000) Subject: fix for error in logic about where to redirect to after a cancel or after activity... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0b82f5b9133d00d85ef5cb4da0175690166c4f27;p=moodle.git fix for error in logic about where to redirect to after a cancel or after activity mod is successfully added or update. --- diff --git a/course/mod.php b/course/mod.php index dde0ca3c82..168ac63555 100644 --- a/course/mod.php +++ b/course/mod.php @@ -47,7 +47,7 @@ if (file_exists("../mod/$modname/mod_form.php")) { $id = required_param('id', PARAM_INT); $section = required_param('section', PARAM_INT); - $returntomod = optional_param('return', PARAM_BOOL); + $returntomod = optional_param('return', 0, PARAM_BOOL); redirect("modedit.php?add=$add&course=$id§ion=$section&return=$returntomod"); } @@ -59,7 +59,7 @@ md.id = cm.module")){ error('Invalid course module id!'); } - $returntomod = optional_param('return', PARAM_BOOL); + $returntomod = optional_param('return', 0, PARAM_BOOL); if (file_exists("../mod/$modname/mod_form.php")) { redirect("modedit.php?update=$update&return=$returntomod"); } diff --git a/course/modedit.php b/course/modedit.php index 66da358c7a..0de4746333 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -40,7 +40,7 @@ $form->instance = ""; $form->coursemodule = ""; $form->add=$add; - $form->return=0;//must be false if this is an add, go back to course view + $form->return=0;//must be false if this is an add, go back to course view on cancel if (!empty($type)) { $form->type = $type; } @@ -254,11 +254,7 @@ rebuild_course_cache($course->id); - if ($return && isset($cm)){ - redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id"); - } else { - redirect("view.php?id=$course->id#section-".$cousesection); - } + redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule"); exit; }else{