MDL-34807 question bank: navigation loses place.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 9 Aug 2012 12:48:56 +0000 (13:48 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 13 Aug 2012 10:29:43 +0000 (11:29 +0100)
The symptom is that where we are now is not shown in the settings
navigation. However, the underlying cause is that question/edit.php is
doing some crazy thing of its own to build $PAGE->url, rather than using
the one returned by question_edit_setup.

Not that this patch itentionally removes the returnurl param. It was
added as part of a big change MDL-20276, which I think just got this
detail wrong. That variable is never used.

question/edit.php

index 411cb37..58fe57c 100644 (file)
 require_once(dirname(__FILE__) . '/../config.php');
 require_once($CFG->dirroot . '/question/editlib.php');
 
-$url = new moodle_url('/question/edit.php');
+list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
+        question_edit_setup('questions', '/question/edit.php');
+
+$url = new moodle_url($thispageurl);
 if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
     $url->param('lastchanged', $lastchanged);
 }
-if (($category = optional_param('category', 0, PARAM_TEXT)) !== 0) {
-    $url->param('category', $category);
-}
-if (($qpage = optional_param('qpage', 0, PARAM_INT)) !== 0) {
-    $url->param('qpage', $qpage);
-}
-if (($cat = optional_param('cat', 0, PARAM_TEXT)) !== 0) {
-    $url->param('cat', $cat);
-}
-if (($courseid = optional_param('courseid', 0, PARAM_INT)) !== 0) {
-    $url->param('courseid', $courseid);
-}
-if (($returnurl = optional_param('returnurl', 0, PARAM_INT)) !== 0) {
-    $url->param('returnurl', $returnurl);
-}
-if (($cmid = optional_param('cmid', 0, PARAM_INT)) !== 0) {
-    $url->param('cmid', $cmid);
-}
 $PAGE->set_url($url);
 
-list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
-        question_edit_setup('questions', '/question/edit.php');
 $questionbank = new question_bank_view($contexts, $thispageurl, $COURSE, $cm);
 $questionbank->process_actions();