Merge branch 'MDL-37465' of git://github.com/colchambers/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 29 Jan 2013 18:19:29 +0000 (19:19 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 29 Jan 2013 18:19:29 +0000 (19:19 +0100)
1  2 
question/type/edit_question_form.php

@@@ -104,7 -104,7 +104,7 @@@ abstract class question_edit_form exten
          $this->context = context::instance_by_id($record->contextid);
  
          $this->editoroptions = array('subdirs' => 1, 'maxfiles' => EDITOR_UNLIMITED_FILES,
 -                'context' => $this->context);
 +                'context' => $this->context, 'collapsed' => 1);
          $this->fileoptions = array('subdirs' => 1, 'maxfiles' => -1, 'maxbytes' => -1);
  
          $this->category = $category;
          $mform->addRule('name', null, 'required', null, 'client');
  
          $mform->addElement('editor', 'questiontext', get_string('questiontext', 'question'),
 -                array('rows' => 15), $this->editoroptions);
 +                array('rows' => 15), $this->get_non_collabsible_editor_options());
          $mform->setType('questiontext', PARAM_RAW);
  
          $mform->addElement('text', 'defaultmark', get_string('defaultmark', 'question'),
          $mform->addRule('defaultmark', null, 'required', null, 'client');
  
          $mform->addElement('editor', 'generalfeedback', get_string('generalfeedback', 'question'),
 -                array('rows' => 10), $this->editoroptions);
 +                array('rows' => 10), $this->get_non_collabsible_editor_options());
          $mform->setType('generalfeedback', PARAM_RAW);
          $mform->addHelpButton('generalfeedback', 'generalfeedback', 'question');
  
                  $mform->addElement('advcheckbox', 'shownumcorrect',
                          get_string('options', 'question'),
                          get_string('shownumpartscorrectwhenfinished', 'question'));
+                 $mform->setDefault('shownumcorrect', true);
              }
          }
      }
       *      in the question type class.
       */
      public abstract function qtype();
 +
 +    /**
 +     * Returns an array of editor options with collapsed options turned off.
 +     * @return array
 +     */
 +    protected function get_non_collabsible_editor_options() {
 +        return array_merge($this->editoroptions, array('collapsed' => 0));
 +    }
  }