MDL-29360 quiz comment.php has broken JS for the Cancel button.
This swtichest it to more modern YUI3 approach.
This commit is contained in:
@@ -74,14 +74,15 @@
|
||||
<div class="fgrouplabel"><label> </label></div>
|
||||
</div>
|
||||
<fieldset class="felement fgroup">
|
||||
<input id="id_submitbutton" type="submit" name="submit" value="<?php print_string('save', 'quiz'); ?>"/>
|
||||
<input id="id_cancel" type="button" value="<?php print_string('cancel'); ?>" onclick="close_window"/>
|
||||
<input id="id_submitbutton" type="submit" name="submit" value="<?php
|
||||
print_string('save', 'quiz'); ?>"/>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
echo '</form>';
|
||||
$PAGE->requires->js_init_call('M.mod_quiz.init_comment_popup', null, false, quiz_get_js_module());
|
||||
|
||||
/// End of the page.
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
@@ -1239,11 +1239,13 @@ function quiz_check_safe_browser() {
|
||||
|
||||
function quiz_get_js_module() {
|
||||
global $PAGE;
|
||||
|
||||
return array(
|
||||
'name' => 'mod_quiz',
|
||||
'fullpath' => '/mod/quiz/module.js',
|
||||
'requires' => array('base', 'dom', 'event-delegate', 'event-key', 'core_question_engine'),
|
||||
'strings' => array(
|
||||
array('cancel', 'moodle'),
|
||||
array('timesup', 'quiz'),
|
||||
array('functiondisabledbysecuremode', 'quiz'),
|
||||
array('flagged', 'question'),
|
||||
|
||||
@@ -16,6 +16,14 @@ M.mod_quiz.init_review_form = function(Y) {
|
||||
Y.on('submit', function(e) { e.halt(); }, '.questionflagsaveform');
|
||||
};
|
||||
|
||||
M.mod_quiz.init_comment_popup = function(Y) {
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" />');
|
||||
closebutton.set('value', M.util.get_string('cancel', 'moodle'));
|
||||
Y.one('#id_submitbutton').ancestor().append(closebutton);
|
||||
Y.on('click', function() { window.close() }, closebutton);
|
||||
}
|
||||
|
||||
// Code for updating the countdown timer that is used on timed quizzes.
|
||||
M.mod_quiz.timer = {
|
||||
// YUI object.
|
||||
|
||||
Reference in New Issue
Block a user