diff -urp multichoice.orginal//multichoice.classes.inc multichoice/multichoice.classes.inc --- multichoice.orginal//multichoice.classes.inc 2010-12-16 15:38:17.000000000 +0000 +++ multichoice/multichoice.classes.inc 2011-02-28 21:35:42.364389129 +0000 @@ -491,12 +491,23 @@ class MultichoiceQuestion extends QuizQu '#type' => 'fieldset', '#title' => t('Alternative !i', array('!i' => ($i+1))), '#collapsible' => TRUE, - '#collapsed' => !($i < 2 || isset($short['answer'])), - // - The two first alternatives won't be collapsed. + '#collapsed' => !($i < variable_get('multichoice_def_num_of_alts', 2) || isset($short['answer'])), + // - The alternatives up to the default number won't be collapsed // - Populated alternatives won't be collapsed ); $form['alternatives'][$i]['#theme'][] = 'multichoice_alternative_creation'; + // make sure we have a sensible default format for answers + if (is_null($short) || !isset($short['answer_format'])) { + // default from admin screen + $answer_format = variable_get('multichoice_def_answer_format', FILTER_FORMAT_DEFAULT); + } + else { + // from database + $answer_format = $short['answer_format']; + } + + if (is_array($short)) { if ($short['score_if_chosen'] == $short['score_if_not_chosen']) $correct_default = $short['correct']; @@ -525,7 +536,7 @@ class MultichoiceQuestion extends QuizQu '#default_value' => $short['answer'], '#required' => $i < 2, ); - $form['alternatives'][$i]['format'] = filter_form($short['answer_format'], NULL, array('alternatives', $i, 'answer_format')); + $form['alternatives'][$i]['format'] = filter_form($answer_format, NULL, array('alternatives', $i, 'answer_format')); $form['alternatives'][$i]['advanced'] = array( '#type' => 'fieldset', @@ -948,4 +959,4 @@ class MultichoiceResponse extends QuizQu if (drupal_strlen($alternative) == 0) return ''; return check_markup($alternative, $format, $check_user_access); } -} \ No newline at end of file +} diff -urp multichoice.orginal//multichoice.module multichoice/multichoice.module --- multichoice.orginal//multichoice.module 2010-11-05 16:14:47.000000000 +0000 +++ multichoice/multichoice.module 2011-02-28 21:20:55.195479368 +0000 @@ -53,6 +53,28 @@ function multichoice_quiz_question_info( * Implementation of hook_config */ function multichoice_config() { + /*$form['multichoice_def_answer_format'] = array( + '#type' => 'checkbox', + '#title' => t('Default answer input format'), + '#default_value' => variable_get('multichoice_def_answer_format', FILTER_FORMAT_DEFAULT), + '#description' => t('The input format to be used as default for answer text.'), + );*/ + $form['multichoice_def_answer_format_intro'] = array( + '#type' => 'markup', + '#title' => t('Default answer input format'), + '#default_value' => variable_get('multichoice_def_answer_format', FILTER_FORMAT_DEFAULT), + '#description' => t('The input format to be used as default for answer text.'), + ); + $form['multichoice_def_answer_format'] = filter_form( + variable_get('multichoice_def_answer_format', FILTER_FORMAT_DEFAULT), + 0, + array('multichoice_def_answer_format') + ); + $form['multichoice_def_answer_format']['#title'] = t('Default answer input format'); + $form['multichoice_def_answer_format']['#description'] = t('The input format to be used as default for answer text.'); + $form['multichoice_def_answer_format']['#collapsible'] = FALSE; + + $form['multichoice_def_num_of_alts'] = array( '#type' => 'textfield', '#title' => t('Default number of alternatives'), @@ -269,4 +291,4 @@ function multichoice_content_extra_field ); } return $extra; -} \ No newline at end of file +}