Permalink
Browse files

MDL-21009 Group selector must use absolute links in order to work wit…

…h javascript off
  • Loading branch information...
1 parent 92fa5b0 commit dcca8dfb9794c368b9521e1e1f11e061cd2d89e7 @sammarshallou sammarshallou committed Nov 30, 2009
View
@@ -418,7 +418,7 @@ function groups_print_course_menu($course, $urlroot, $return=false) {
* Print group menu selector for activity.
* @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
@@ -431,6 +431,14 @@ function groups_print_course_menu($course, $urlroot, $return=false) {
function groups_print_activity_menu($cm, $urlroot, $return=false, $hideallparticipants=false) {
global $CFG, $USER, $SESSION;
+ // Display error if urlroot is not absolute (this causes the non-JS version
+ // to break)
+ if (strpos($urlroot, 'htxtp') !== 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;
View
@@ -140,7 +140,7 @@ function view_header($subpage='') {
true, update_module_button($this->cm->id, $this->course->id, $this->strassignment),
navmenu($this->course, $this->cm));
- 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>';
@@ -1065,7 +1065,7 @@ function display_submissions($message='') {
/// 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)) {
View
@@ -46,7 +46,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");
if ($currentgroup) {
@@ -99,7 +99,7 @@
/// 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;
}
View
@@ -108,7 +108,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'";
View
@@ -47,7 +47,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);
View
@@ -66,7 +66,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
View
@@ -115,7 +115,7 @@
navmenu($course, $cm), '', '');
/// 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);
View
@@ -296,7 +296,7 @@
}
/// 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);
@@ -50,7 +50,7 @@
}
/// 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);
View
@@ -84,7 +84,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);
@@ -25,7 +25,7 @@ function display($quiz, $cm, $course) { /// This function just displays the
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
if (!$download) {
- groups_print_activity_menu($cm, "report.php?id=$cm->id&amp;mode=analysis");
+ groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/quiz/report.php?id=$cm->id&amp;mode=analysis");
}
}
View
@@ -74,7 +74,7 @@
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;
}
View
@@ -308,7 +308,7 @@
/// find out current groups mode
$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/workshop/view.php?id=$cm->id");
/// Print admin links
echo "<table width=\"100%\"><tr><td>";

0 comments on commit dcca8df

Please sign in to comment.