MDL-32087 question preview: make more technical info available.

... but hide it in a collapsible region.
This commit is contained in:
Tim Hunt 2012-05-14 18:53:30 +01:00
parent e16e2300c5
commit 802f8d2af4
3 changed files with 28 additions and 4 deletions

View 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}.';

View 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();

View 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;}