Permalink
Browse files

Merge branch 'MDL-30764-m21' of git://github.com/sammarshallou/moodle…

… into MOODLE_21_STABLE
  • Loading branch information...
Sam Hemelryk
Sam Hemelryk committed Dec 20, 2011
2 parents bf5bb85 + b756e90 commit 7d97d3ac7e9362fee00f6a6ebce42bd378417092
Showing with 15 additions and 10 deletions.
  1. +15 −10 course/moodleform_mod.php
View
@@ -171,16 +171,21 @@ function definition_after_data() {
}
}
- if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
- $mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
-
- } else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
- $mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
-
- } else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
- // groupings have no use without groupmode or groupmembersonly
- if ($mform->elementExists('groupingid')) {
- $mform->removeElement('groupingid');
+ // Don't disable/remove groupingid if it is currently set to something,
+ // otherwise you cannot turn it off at same time as turning off other
+ // option (MDL-30764)
+ if (empty($this->_cm) || !$this->_cm->groupingid) {
+ if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
+ $mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
+
+ } else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
+ $mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
+
+ } else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
+ // groupings have no use without groupmode or groupmembersonly
+ if ($mform->elementExists('groupingid')) {
+ $mform->removeElement('groupingid');
+ }
}
}

0 comments on commit 7d97d3a

Please sign in to comment.