MDL-21009 Group selector must use absolute links in order to work with javascript off
authorSam Marshall <s.marshall@open.ac.uk>
Mon, 30 Nov 2009 17:12:48 +0000 (17:12 +0000)
committerSam Marshall <s.marshall@open.ac.uk>
Mon, 30 Nov 2009 17:12:48 +0000 (17:12 +0000)
13 files changed:
lib/grouplib.php
mod/assignment/lib.php
mod/chat/report.php
mod/chat/view.php
mod/choice/report.php
mod/choice/view.php
mod/data/edit.php
mod/data/view.php
mod/feedback/analysis.php
mod/feedback/show_entries.php
mod/forum/subscribers.php
mod/forum/view.php
mod/survey/report.php

index 3ac97fe..07fe867 100644 (file)
@@ -500,7 +500,7 @@ function groups_print_course_menu($course, $urlroot, $return=false) {
  * @global object
  * @param object $cm course module object
  * @param string $urlroot return address that users get to if they choose an option;
- *   should include any parameters needed, e.g. 'view.php?id=34'
+ *   should include any parameters needed, e.g. "$CFG->wwwroot/mod/forum/view.php?id=34"
  * @param boolean $return return as string instead of printing
  * @param boolean $hideallparticipants If true, this prevents the 'All participants'
  *   option from appearing in cases where it normally would. This is intended for
@@ -513,6 +513,15 @@ function groups_print_course_menu($course, $urlroot, $return=false) {
 function groups_print_activity_menu($cm, $urlroot, $return=false, $hideallparticipants=false) {
     global $CFG, $USER, $SESSION, $OUTPUT;
 
+    // Display error if urlroot is not absolute (this causes the non-JS version
+    // to break)
+    if (strpos($urlroot, 'http') !== 0) { // Will also work for https
+        debugging('groups_print_activity_menu requires absolute URL for ' .
+            '$urlroot, not <tt>' . s($urlroot) . '</tt>. Example: ' .
+            'groups_print_activity_menu($cm, $CFG->wwwroot . \'/mod/mymodule/view.php?id=13\');',
+            DEBUG_DEVELOPER);
+    }
+
     // groupings are ignored when not enabled
     if (empty($CFG->enablegroupings)) {
         $cm->groupingid = 0;
index 864756a..a7e3c28 100644 (file)
@@ -192,7 +192,7 @@ class assignment_base {
 
         echo $OUTPUT->header();
 
-        groups_print_activity_menu($this->cm, 'view.php?id=' . $this->cm->id);
+        groups_print_activity_menu($this->cm, $CFG->wwwroot . '/mod/assignment/view.php?id=' . $this->cm->id);
 
         echo '<div class="reportlink">'.$this->submittedlink().'</div>';
         echo '<div class="clearer"></div>';
@@ -1148,7 +1148,7 @@ class assignment_base {
         /// find out current groups mode
         $groupmode = groups_get_activity_groupmode($cm);
         $currentgroup = groups_get_activity_group($cm, true);
-        groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id);
 
         /// Get all ppl that are allowed to submit assignments
         if ($users = get_users_by_capability($context, 'mod/assignment:submit', 'u.id', '', '', '', $currentgroup, '', false)) {
index cd3081d..85337c7 100644 (file)
@@ -61,7 +61,7 @@
     /// Check to see if groups are being used here
         $groupmode = groups_get_activity_groupmode($cm);
         $currentgroup = groups_get_activity_group($cm, true);
-        groups_print_activity_menu($cm, "report.php?id=$cm->id");
+        groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/report.php?id=$cm->id");
 
         $params = array('currentgroup'=>$currentgroup, 'chatid'=>$chat->id, 'start'=>$start, 'end'=>$end);
 
 /// Check to see if groups are being used here
     if ($groupmode = groups_get_activity_groupmode($cm)) {   // Groups are being used
         $currentgroup = groups_get_activity_group($cm, true);
-        groups_print_activity_menu($cm, "report.php?id=$cm->id");
+        groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/report.php?id=$cm->id");
     } else {
         $currentgroup = false;
     }
index 4888de1..2219811 100644 (file)
@@ -89,7 +89,7 @@
     /// Check to see if groups are being used here
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
-    groups_print_activity_menu($cm, "view.php?id=$cm->id");
+    groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/view.php?id=$cm->id");
 
     if ($currentgroup) {
         $groupselect = " AND groupid = '$currentgroup'";
index 3d0cefc..7812ea3 100644 (file)
@@ -59,7 +59,7 @@
         $groupmode = groups_get_activity_groupmode($cm);
         if ($groupmode) {
             groups_get_activity_group($cm, true);
-            groups_print_activity_menu($cm, 'report.php?id='.$id);
+            groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/choice/report.php?id='.$id);
         }
     } else {
         $groupmode = groups_get_activity_groupmode($cm);
index 9c37459..c8ebe40 100644 (file)
@@ -74,7 +74,7 @@
 
     if ($groupmode) {
         groups_get_activity_group($cm, true);
-        groups_print_activity_menu($cm, 'view.php?id='.$id);
+        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/choice/view.php?id='.$id);
     }
     $allresponses = choice_get_response_data($choice, $cm, $groupmode);   // Big function, approx 6 SQL calls per user
 
index 8e1a5cf..ffafe10 100755 (executable)
@@ -135,7 +135,7 @@ $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'data'));
 echo $OUTPUT->header();
 
 /// Check to see if groups are being used here
-groups_print_activity_menu($cm, 'edit.php?d='.$data->id);
+groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/data/edit.php?d='.$data->id);
 $currentgroup = groups_get_activity_group($cm);
 $groupmode = groups_get_activity_groupmode($cm);
 
index 7970172..d52b72d 100755 (executable)
     echo $OUTPUT->header();
 
 /// Check to see if groups are being used here
-    $returnurl = 'view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).'&amp;order='.s($order).'&amp;';
+    $returnurl = $CFG->wwwroot . '/mod/data/view.php?d='.$data->id.'&amp;search='.s($search).'&amp;sort='.s($sort).'&amp;order='.s($order).'&amp;';
     groups_print_activity_menu($cm, $returnurl);
     $currentgroup = groups_get_activity_group($cm);
     $groupmode = groups_get_activity_groupmode($cm);
index 1014171..46ccb98 100644 (file)
@@ -76,7 +76,7 @@ include('tabs.php');
 echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
 
 //get the groupid
-$groupselect = groups_print_activity_menu($cm, 'analysis.php?id=' . $cm->id.'&do_show=analysis', true);
+$groupselect = groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/feedback/analysis.php?id=' . $cm->id.'&do_show=analysis', true);
 $mygroupid = groups_get_activity_group($cm);
 
 if( $capabilities->viewreports ) {
index b5d5cc8..074db28 100644 (file)
@@ -94,7 +94,7 @@ if($do_show == 'showentries'){
             $groupmode = $course->groupmode;
         }
 
-        $groupselect = groups_print_activity_menu($cm, 'show_entries.php?id=' . $cm->id.'&do_show=showentries', true);
+        $groupselect = groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/feedback/show_entries.php?id=' . $cm->id.'&do_show=showentries', true);
         $mygroupid = groups_get_activity_group($cm);
 
         //get students in conjunction with groupmode
index ddf802b..f3e50e7 100644 (file)
@@ -58,7 +58,7 @@ if (has_capability('mod/forum:managesubscriptions', $context)) {
 echo $OUTPUT->header();
 
 /// Check to see if groups are being used in this forum
-groups_print_activity_menu($cm, "subscribers.php?id=$forum->id");
+groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/forum/subscribers.php?id=$forum->id");
 $currentgroup = groups_get_activity_group($cm);
 $groupmode = groups_get_activity_groupmode($cm);
 
index 0509931..c0bf599 100644 (file)
@@ -92,7 +92,7 @@
     }
 
 /// find out current groups mode
-    groups_print_activity_menu($cm, 'view.php?id=' . $cm->id);
+    groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/forum/view.php?id=' . $cm->id);
     $currentgroup = groups_get_activity_group($cm);
     $groupmode = groups_get_activity_groupmode($cm);
 
index 7de4822..8763493 100644 (file)
     if ($groupmode = groups_get_activity_groupmode($cm)) {   // Groups are being used
         $menuaction = $action == "student" ? "students" : $action;
         $currentgroup = groups_get_activity_group($cm, true);
-        groups_print_activity_menu($cm, "report.php?id=$cm->id&amp;action=$menuaction&amp;qid=$qid");
+        groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/survey/report.php?id=$cm->id&amp;action=$menuaction&amp;qid=$qid");
     } else {
         $currentgroup = 0;
     }