MDL-20636 Fix a bunch of minor errors in the truefalse preview.

Most significantly, all behaviours now work.
This commit is contained in:
Tim Hunt 2010-12-24 23:25:58 +00:00
parent c76145d3e4
commit cce1b6556c
11 changed files with 39 additions and 43 deletions

View File

@ -439,7 +439,7 @@ function xmldb_local_qedatabase_install() {
// Rename the question_attempts table to question_usages.
$table = new xmldb_table('question_attempts');
if (table_exists($table)) {
if ($dbman->table_exists($table)) {
$dbman->rename_table($table, 'question_usages');
}
@ -530,7 +530,7 @@ function xmldb_local_qedatabase_install() {
// Define table question_attempts to be created
$table = new xmldb_table('question_attempts');
if (!table_exists($table)) {
if (!$dbman->table_exists($table)) {
// Adding fields to table question_attempts
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
@ -539,7 +539,7 @@ function xmldb_local_qedatabase_install() {
$table->add_field('behaviour', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null);
$table->add_field('questionid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('maxmark', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null);
$table->add_field('minfraction', XMLDB_TYPE_NUMBER, '12, 7', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('minfraction', XMLDB_TYPE_NUMBER, '12, 7', null, XMLDB_NOTNULL, null, null);
$table->add_field('flagged', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('questionsummary', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
$table->add_field('rightanswer', XMLDB_TYPE_TEXT, 'small', null, null, null, null);
@ -566,7 +566,7 @@ function xmldb_local_qedatabase_install() {
// Define table question_attempt_steps to be created
$table = new xmldb_table('question_attempt_steps');
if (!table_exists($table)) {
if (!$dbman->table_exists($table)) {
// Adding fields to table question_attempt_steps
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
@ -597,7 +597,7 @@ function xmldb_local_qedatabase_install() {
// Define table question_attempt_step_data to be created
$table = new xmldb_table('question_attempt_step_data');
if (!table_exists($table)) {
if (!$dbman->table_exists($table)) {
// Adding fields to table question_attempt_step_data
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
@ -639,7 +639,7 @@ function xmldb_local_qedatabase_install() {
// if ($oldversion < 2008000551) {
// $table = new xmldb_table('question_states');
// if (table_exists($table)) {
// if ($dbman->table_exists($table)) {
// // First delete all data from preview attempts.
// delete_records_select('question_states',
// "attempt IN (SELECT uniqueid FROM {quiz_attempts} WHERE preview = 1)");

View File

@ -85,7 +85,7 @@ function xmldb_quiz_statistics_upgrade($oldversion) {
$table->add_field('anssubqid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null);
$table->add_field('response', XMLDB_TYPE_TEXT, 'big', null, null, null, null);
$table->add_field('rcount', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null);
$table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_field('credit', XMLDB_TYPE_NUMBER, '15, 5', null, XMLDB_NOTNULL, null, null);
/// Adding keys to table quiz_question_response_stats
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));

View File

@ -1,6 +1,6 @@
<?php
$string['adaptive'] = 'Adaptive mode';
$string['gradingdetails'] = 'Marks for this submission: $a->raw/$a->max.';
$string['gradingdetailsadjustment'] = 'With previous penalties this gives <strong>$a->cur/$a->max</strong>.';
$string['gradingdetailspenalty'] = 'This submission attracted a penalty of $a.';
$string['gradingdetails'] = 'Marks for this submission: {$a->raw}/{$a->max}.';
$string['gradingdetailsadjustment'] = 'With previous penalties this gives <strong>{$a->cur}/{$a->max}</strong>.';
$string['gradingdetailspenalty'] = 'This submission attracted a penalty of {$a}.';

View File

@ -5,5 +5,5 @@ $string['certainty1'] = 'Not very (less than 67%)';
$string['certainty2'] = 'Fairly (more than 67%)';
$string['certainty3'] = 'Very (more than 85%)';
$string['deferredcbm'] = 'Deferred feedback with CBM';
$string['howcertainareyou'] = 'How certain are you? $a';
$string['howcertainareyou'] = 'How certain are you? {$a}';
$string['markadjustment'] = 'Based on the certainty you expressed, your base mark of {$a->rawmark} was adjusted to {$a->mark}.';

View File

@ -2,5 +2,5 @@
$string['interactive'] = 'Interactive with multiple tries';
$string['notcomplete'] = 'Not complete';
$string['triesremaining'] = 'Tries remaining: $a';
$string['triesremaining'] = 'Tries remaining: {$a}';
$string['tryagain'] = 'Try again';

View File

@ -54,8 +54,8 @@ class qbehaviour_interactive_renderer extends qbehaviour_renderer {
}
$output = html_writer::empty_tag('input', $attributes);
if (empty($attributes['disabled'])) {
$output .= print_js_call('question_init_submit_button',
array($attributes['id'], $qa->get_slot()), true);
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button',
array($attributes['id'], $qa->get_slot()));
}
return $output;
}

View File

@ -182,8 +182,8 @@ abstract class qbehaviour_renderer extends plugin_renderer_base {
}
$output = html_writer::empty_tag('input', $attributes);
if (!$options->readonly) {
$output .= print_js_call('question_init_submit_button',
array($attributes['id'], $qa->get_slot()), true);
$this->page->requires->js_init_call('M.core_question_engine.init_submit_button',
array($attributes['id'], $qa->get_slot()));
}
return $output;
}

View File

@ -30,7 +30,7 @@ M.core_question_preview = M.core_question_preview || {};
/**
* Initialise JavaScript-specific parts of the question preview popup.
*/
M.core_question_preview.init(Y) {
M.core_question_preview.init = function(Y) {
M.core_question_engine.init_form(Y, '#responseform');
// Add a close button to the window.

View File

@ -164,14 +164,6 @@ if (!$previewid) {
$restartdisabled = ' disabled="disabled"';
}
$PAGE->requires->js_init_call('M.core_question_preview.init', null, array(
'name' => 'core_question_preview',
'fullpath' => '/question/preview.js',
'requires' => array('base', 'dom', 'event-delegate', 'event-key', 'core_question_engine'),
'strings' => array(
array('question', 'closepreview'),
)));
// Output
$title = get_string('previewquestion', 'question', format_string($question->name));
$headtags = question_engine::initialise_js() . $quba->render_question_head_html($slot);
@ -206,8 +198,12 @@ echo '</form>';
// Display the settings form.
$optionsform->display();
echo '<script type="text/javascript">question_preview_init("' .
get_string('closepreview', 'question') . '", "previewcontrols");</script>', "\n";
$PAGE->requires->js_init_call('M.core_question_preview.init', null, false, array(
'name' => 'core_question_preview',
'fullpath' => '/question/preview.js',
'requires' => array('base', 'dom', 'event-delegate', 'event-key', 'core_question_engine'),
'strings' => array(
array('closepreview', 'question'),
)));
echo $OUTPUT->footer();

View File

@ -67,7 +67,7 @@ DONE lib/questionlib.php | 1434 ++--------
mod/quiz/accessrules.php | 828 ++++++
mod/quiz/attempt.php | 742 ++----
mod/quiz/attempt_close_js.php | 27 -
DONE mod/quiz/attempt_close_js.php | 27 -
mod/quiz/attemptlib.php | 1219 +++++++++
mod/quiz/backuplib.php | 16 +-
mod/quiz/comment.php | 171 +-
@ -96,7 +96,7 @@ DONE mod/quiz/defaults.php | 12 +-
mod/quiz/pix/sa.gif | Bin 74 -> 0 bytes
mod/quiz/pix/tf.gif | Bin 190 -> 0 bytes
mod/quiz/processattempt.php | 126 +
mod/quiz/protect_js.php | 56 -
DONE mod/quiz/protect_js.php | 56 -
mod/quiz/quiz.js | 355 ++-
mod/quiz/restorelib.php | 113 +-
mod/quiz/restorelibpre15.php | 41 +-
@ -223,62 +223,62 @@ DONE question/behaviour/behaviourbase.php | 627 +++++
DONE question/behaviour/rendererbase.php | 200 ++
question/behaviour/adaptive/behaviour.php | 181 ++
question/behaviour/adaptive/lang/en_utf8/qbehaviour_adaptive.php | 6 +
DONE question/behaviour/adaptive/lang/en_utf8/qbehaviour_adaptive.php | 6 +
question/behaviour/adaptive/renderer.php | 98 +
question/behaviour/adaptive/simpletest/testwalkthrough.php | 239 ++
question/behaviour/adaptivenopenalty/behaviour.php | 43 +
question/behaviour/adaptivenopenalty/lang/en_utf8/qbehaviour_adaptivenopenalty.php | 3 +
DONE question/behaviour/adaptivenopenalty/lang/en_utf8/qbehaviour_adaptivenopenalty.php | 3 +
question/behaviour/adaptivenopenalty/renderer.php | 34 +
question/behaviour/adaptivenopenalty/simpletest/testwalkthrough.php | 186 ++
question/behaviour/deferredcbm/behaviour.php | 125 +
question/behaviour/deferredcbm/lang/en_utf8/qbehaviour_deferredcbm.php | 9 +
DONE question/behaviour/deferredcbm/lang/en_utf8/qbehaviour_deferredcbm.php | 9 +
question/behaviour/deferredcbm/renderer.php | 87 +
question/behaviour/deferredcbm/simpletest/testwalkthrough.php | 261 ++
question/behaviour/deferredfeedback/behaviour.php | 94 +
question/behaviour/deferredfeedback/lang/en_utf8/qbehaviour_deferredfeedback.php | 3 +
DONE question/behaviour/deferredfeedback/lang/en_utf8/qbehaviour_deferredfeedback.php | 3 +
question/behaviour/deferredfeedback/renderer.php | 30 +
question/behaviour/deferredfeedback/simpletest/testwalkthrough.php | 205 ++
question/behaviour/immediatecbm/behaviour.php | 151 +
question/behaviour/immediatecbm/lang/en_utf8/qbehaviour_immediatecbm.php | 4 +
DONE question/behaviour/immediatecbm/lang/en_utf8/qbehaviour_immediatecbm.php | 4 +
question/behaviour/immediatecbm/renderer.php | 43 +
question/behaviour/immediatecbm/simpletest/testwalkthrough.php | 282 ++
question/behaviour/immediatefeedback/behaviour.php | 131 +
question/behaviour/immediatefeedback/lang/en_utf8/qbehaviour_immediatefeedback.php | 3 +
DONE question/behaviour/immediatefeedback/lang/en_utf8/qbehaviour_immediatefeedback.php | 3 +
question/behaviour/immediatefeedback/renderer.php | 33 +
question/behaviour/immediatefeedback/simpletest/testwalkthrough.php | 237 ++
question/behaviour/informationitem/behaviour.php | 114 +
question/behaviour/informationitem/lang/en_utf8/qbehaviour_informationitem.php | 4 +
DONE question/behaviour/informationitem/lang/en_utf8/qbehaviour_informationitem.php | 4 +
question/behaviour/informationitem/renderer.php | 42 +
question/behaviour/informationitem/simpletest/testwalkthrough.php | 78 +
question/behaviour/interactive/behaviour.php | 232 ++
question/behaviour/interactive/lang/en_utf8/qbehaviour_interactive.php | 6 +
DONE question/behaviour/interactive/lang/en_utf8/qbehaviour_interactive.php | 6 +
question/behaviour/interactive/renderer.php | 62 +
question/behaviour/interactive/interactive/simpletest/testwalkthrough.php | 470 ++++
question/behaviour/interactivecountback/behaviour.php | 91 +
question/behaviour/interactivecountback/en_utf8/qbehaviour_interactivecountback.php | 3 +
DONE question/behaviour/interactivecountback/en_utf8/qbehaviour_interactivecountback.php | 3 +
question/behaviour/interactivecountback/renderer.php | 36 +
question/behaviour/interactivecountback/simpletest/testwalkthrough.php | 135 +
question/behaviour/manualgraded/behaviour.php | 91 +
question/behaviour/manualgraded/lang/en_utf8/qbehaviour_manualgraded.php | 3 +
DONE question/behaviour/manualgraded/lang/en_utf8/qbehaviour_manualgraded.php | 3 +
question/behaviour/manualgraded/renderer.php | 31 +
question/behaviour/manualgraded/simpletest/testwalkthrough.php | 259 ++
question/behaviour/missing/behaviour.php | 65 +
question/behaviour/missing/lang/en_utf8/qbehaviour_missing.php | 3 +
DONE question/behaviour/missing/lang/en_utf8/qbehaviour_missing.php | 3 +
question/behaviour/missing/renderer.php | 35 +
question/behaviour/missing/simpletest/testmissingbehaviour.php | 96 +
question/behaviour/opaque/behaviour.php | 197 ++
question/behaviour/opaque/lang/en_utf8/qbehaviour_opaque.php | 4 +
DONE question/behaviour/opaque/lang/en_utf8/qbehaviour_opaque.php | 4 +
question/behaviour/opaque/renderer.php | 65 +
question/behaviour/opaque/simpletest/testopaquebehaviour.php | 227 ++

View File

@ -61,7 +61,7 @@ $string['forceregeneration'] = 'force regeneration';
$string['forceregenerationall'] = 'forceregeneration of all wildcards';
$string['forceregenerationshared'] = 'forceregeneration of only non-shared wildcards';
$string['getnextnow'] = 'Get New \'Item to Add\' Now';
$string['hexanotallowed'] = 'Dataset <strong>{$a->name}</strong> hexadecimal format value $a->value is not allowed' ;
$string['hexanotallowed'] = 'Dataset <strong>{$a->name}</strong> hexadecimal format value {$a->value} is not allowed' ;
$string['incorrectfeedback'] = 'For any incorrect response';
$string['item(s)'] = 'item(s)';
$string['itemno'] = 'Item {$a}';