Permalink
Browse files

MDL-30764 Activity settings: do not disable grouping dropdown if it i…

…s already set
  • Loading branch information...
1 parent acb3bf8 commit 782b21dc0f57cfaa491b14743f73bc8efcfeafbc @sammarshallou sammarshallou committed Dec 15, 2011
Showing with 15 additions and 10 deletions.
  1. +15 −10 course/moodleform_mod.php
View
@@ -173,16 +173,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 782b21d

Please sign in to comment.