MDL-71644 Quiz: The issues outstanding from MDL-70947.

Issue 1: While essay question's uploading progress, we need to disable submit
buttons to prevent submit form event.

Issue 2: Enable buttons after pressing cancel button on the popup
confirming overwrite file existed.
This commit is contained in:
Thong Bui 2021-05-18 18:15:25 +07:00
parent 0b69b37f04
commit f81cdd42b2
5 changed files with 38 additions and 10 deletions

View file

@ -256,12 +256,14 @@ echo $quba->render_question($slot, $options, $displaynumber);
echo html_writer::start_tag('div', array('id' => 'previewcontrols', 'class' => 'controls'));
echo html_writer::empty_tag('input', $restartdisabled + array('type' => 'submit',
'name' => 'restart', 'value' => get_string('restart', 'question'), 'class' => 'btn btn-secondary'));
echo html_writer::empty_tag('input', $finishdisabled + array('type' => 'submit',
'name' => 'save', 'value' => get_string('save', 'question'), 'class' => 'btn btn-secondary'));
echo html_writer::empty_tag('input', $finishdisabled + array('type' => 'submit',
'name' => 'save', 'value' => get_string('save', 'question'), 'class' => 'btn btn-secondary',
'id' => 'id_save_question_preview'));
echo html_writer::empty_tag('input', $filldisabled + array('type' => 'submit',
'name' => 'fill', 'value' => get_string('fillincorrect', 'question'), 'class' => 'btn btn-secondary'));
echo html_writer::empty_tag('input', $finishdisabled + array('type' => 'submit',
'name' => 'finish', 'value' => get_string('submitandfinish', 'question'), 'class' => 'btn btn-secondary'));
echo html_writer::empty_tag('input', $finishdisabled + array('type' => 'submit',
'name' => 'finish', 'value' => get_string('submitandfinish', 'question'), 'class' => 'btn btn-secondary',
'id' => 'id_finish_question_preview'));
echo html_writer::end_tag('div');
echo html_writer::end_tag('form');
@ -291,5 +293,7 @@ $PAGE->requires->strings_for_js(array(
'closepreview',
), 'question');
$PAGE->requires->yui_module('moodle-question-preview', 'M.question.preview.init');
$PAGE->requires->js_call_amd('core_form/submit', 'init', ['id_save_question_preview']);
$PAGE->requires->js_call_amd('core_form/submit', 'init', ['id_finish_question_preview']);
echo $OUTPUT->footer();

View file

@ -126,6 +126,9 @@ M.core_question_engine.questionformalreadysubmitted = false;
* @param button the id of the button in the HTML.
*/
M.core_question_engine.init_submit_button = function(Y, button) {
require(['core_form/submit'], function(submit) {
submit.init(button);
});
var totalQuestionsInPage = document.querySelectorAll('div.que').length;
var buttonel = document.getElementById(button);
var outeruniqueid = buttonel.closest('.que').id;