MDL-32087 question preview: make more technical info available.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 14 May 2012 17:53:30 +0000 (18:53 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 14 May 2012 18:26:04 +0000 (19:26 +0100)
... but hide it in a collapsible region.

lang/en/question.php
question/preview.php
theme/base/style/question.css

index 74edbbc..1bbfa93 100644 (file)
@@ -298,7 +298,7 @@ $string['answer'] = 'Answer';
 $string['answersaved'] = 'Answer saved';
 $string['attemptfinished'] = 'Attempt finished';
 $string['attemptfinishedsubmitting'] = 'Attempt finished submitting: ';
-$string['behaviourbeingused'] = 'behaviour being used: {$a}';
+$string['behaviourbeingused'] = 'Behaviour being used: {$a}';
 $string['cannotloadquestion'] = 'Could not load question';
 $string['cannotpreview'] = 'You can\'t preview these questions!';
 $string['category'] = 'Category';
@@ -403,6 +403,11 @@ $string['submissionoutofsequencefriendlymessage'] = "You have entered data outsi
 $string['submit'] = 'Submit';
 $string['submitandfinish'] = 'Submit and finish';
 $string['submitted'] = 'Submit: {$a}';
+$string['technicalinfo'] = 'Technical information';
+$string['technicalinfominfraction'] = 'Minimum fraction: {$a}';
+$string['technicalinfoquestionsummary'] = 'Question summary: {$a}';
+$string['technicalinforightsummary'] = 'Right answer summary: {$a}';
+$string['technicalinfostate'] = 'Question state: {$a}';
 $string['unknownbehaviour'] = 'Unknown behaviour: {$a}.';
 $string['unknownquestion'] = 'Unknown question: {$a}.';
 $string['unknownquestioncatregory'] = 'Unknown question category: {$a}.';
index 8b62e43..e81a101 100644 (file)
@@ -220,6 +220,16 @@ if (!$previewid) {
     $restartdisabled = ' disabled="disabled"';
 }
 
+// Prepare technical info to be output.
+$qa = $quba->get_question_attempt($slot);
+$technical = array();
+$technical[] = get_string('behaviourbeingused', 'question',
+        question_engine::get_behaviour_name($qa->get_behaviour_name()));
+$technical[] = get_string('technicalinfominfraction',     'question', $qa->get_min_fraction());
+$technical[] = get_string('technicalinfoquestionsummary', 'question', s($qa->get_question_summary()));
+$technical[] = get_string('technicalinforightsummary',    'question', s($qa->get_right_answer_summary()));
+$technical[] = get_string('technicalinfostate',           'question', '' . $qa->get_state());
+
 // Output
 $title = get_string('previewquestion', 'question', format_string($question->name));
 $headtags = question_engine::initialise_js() . $quba->render_question_head_html($slot);
@@ -238,9 +248,6 @@ echo '</div>';
 // Output the question.
 echo $quba->render_question($slot, $options, $displaynumber);
 
-echo '<p class="notifytiny">' . get_string('behaviourbeingused', 'question',
-        question_engine::get_behaviour_name(
-        $quba->get_question_attempt($slot)->get_behaviour_name())) . '</p>';
 // Finish the question form.
 echo '<div id="previewcontrols" class="controls">';
 echo '<input type="submit" name="restart"' . $restartdisabled .
@@ -253,6 +260,14 @@ echo '<input type="hidden" name="scrollpos" id="scrollpos" value="" />';
 echo '</div>';
 echo '</form>';
 
+// Output the technical info.
+print_collapsible_region_start('', 'techinfo', get_string('technicalinfo', 'question'),
+        'core_question_preview_techinfo_collapsed', true);
+foreach ($technical as $info) {
+    echo '<p class="notifytiny">' . $info . '</p>';
+}
+print_collapsible_region_end();
+
 // Display the settings form.
 $optionsform->display();
 
index 91e847c..d974e50 100644 (file)
@@ -87,6 +87,10 @@ body.jsenabled #qtypechoicecontainer {display: block;}
 .importerror {margin-top: 10px;border-bottom: 1px solid #555;}
 .mform .que.comment .fitemtitle {width: 20%;}
 
+#page-question-preview #techinfo {
+    margin: 1em 0;
+}
+
 /** Overide for RTL layout **/
 .dir-rtl #qtypechoicecontainer #chooseqtype .instruction,
 .dir-rtl #qtypechoicecontainer #chooseqtype .qtypesummary {right: 60%;left: 0%; border-left:0;border-right: 1px solid grey;}