]> git.mjollnir.org Git - moodle.git/commitdiff
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 3ac97fef8d4c553d03f5b174a1f6d2bb2fa9b4c1..07fe867776632499a87809bb9e1299d32f6548f2 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 864756a90d70175209efad46d41a79f09580edfc..a7e3c28d231db3355374b7da671e51954f964d90 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 cd3081d26f4a90f96b779ddcbb8dc27f8d333708..85337c76a88c3c13b50584e4cfec16ce2993947e 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 4888de15acf5230bfe35e144cf949db0451afde9..2219811c9f5bc4d849019c6a82ebc1a4136caf98 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 3d0cefc12fcc35dfbc3a77fd3e0deb30a1273ba2..7812ea3667344570d308df655de1c11c9ad3fa44 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 9c37459dca26580b048d82f83ff7107bb9270bd4..c8ebe40b4671377f97e61dc5dd9f78edce2deee6 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 8e1a5cf4f76ed9da27bc709907e3acd75d530057..ffafe10ee9be2ede473a489e27a4ba409e9a7b50 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 797017241704a4d9bfc60ecc794e128b57408fc9..d52b72d60759235c06fc766af30d9cf763c8a68e 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 10141718db44da55953718599398b60e2f921c3e..46ccb985546bc6471a95607ded39e0071e4ab5db 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 b5d5cc84f450dbc4a6faa4a91fa51d1ad4d72486..074db2878cb89878e3e291d4851591f6a4213706 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 ddf802b02f01a40f4e1975cd33e1f3e3b19d99e7..f3e50e72a65ba3c5803a22376ecd487fcb70b698 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 050993160c77f29d33d023e8fc471846b2df3d53..c0bf59937682e6cceedc27573244d9d61d6e4b94 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 7de4822d3bd5a863d2db2c7736a1c2fda5662104..8763493b4e59dc0939d31d366aa7653228d68b87 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;
     }