mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-43687, convert question/preview.js to the new yui format
This commit is contained in:
parent
9788e26805
commit
7258470276
@ -275,12 +275,6 @@ print_collapsible_region_end();
|
||||
// Display the settings form.
|
||||
$optionsform->display();
|
||||
|
||||
$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'),
|
||||
)));
|
||||
$PAGE->requires->yui_module('moodle-question-preview', 'M.question.preview.init');
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
|
45
question/yui/build/moodle-question-preview/moodle-question-preview-debug.js
vendored
Normal file
45
question/yui/build/moodle-question-preview/moodle-question-preview-debug.js
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
YUI.add('moodle-question-preview', function (Y, NAME) {
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* JavaScript required by the question preview pop-up.
|
||||
*
|
||||
* @module moodle-question-preview
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
M.question = M.question || {};
|
||||
|
||||
/**
|
||||
* Initialise JavaScript-specific parts of the question preview popup.
|
||||
*/
|
||||
M.question.preview.init = function(Y) {
|
||||
M.core_question_engine.init_form(Y, '#responseform');
|
||||
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" />');
|
||||
closebutton.set('value', M.str.question.closepreview);
|
||||
Y.one('#previewcontrols').append(closebutton);
|
||||
Y.on('click', function() { window.close(); }, closebutton);
|
||||
|
||||
// Stop a question form being submitted more than once.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "dom", "event-delegate", "event-key", "core_question_engine"]});
|
1
question/yui/build/moodle-question-preview/moodle-question-preview-min.js
vendored
Normal file
1
question/yui/build/moodle-question-preview/moodle-question-preview-min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
YUI.add("moodle-question-preview",function(e,t){M.question=M.question||{},M.question.preview.init=function(e){M.core_question_engine.init_form(e,"#responseform");var t=e.Node.create('<input type="button" />');t.set("value",M.str.question.closepreview),e.one("#previewcontrols").append(t),e.on("click",function(){window.close()},t),e.on("submit",M.core_question_engine.prevent_repeat_submission,"#mform1",null,e)}},"@VERSION@",{requires:["base","dom","event-delegate","event-key","core_question_engine"]});
|
45
question/yui/build/moodle-question-preview/moodle-question-preview.js
vendored
Normal file
45
question/yui/build/moodle-question-preview/moodle-question-preview.js
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
YUI.add('moodle-question-preview', function (Y, NAME) {
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* JavaScript required by the question preview pop-up.
|
||||
*
|
||||
* @module moodle-question-preview
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
M.question = M.question || {};
|
||||
|
||||
/**
|
||||
* Initialise JavaScript-specific parts of the question preview popup.
|
||||
*/
|
||||
M.question.preview.init = function(Y) {
|
||||
M.core_question_engine.init_form(Y, '#responseform');
|
||||
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" />');
|
||||
closebutton.set('value', M.str.question.closepreview);
|
||||
Y.one('#previewcontrols').append(closebutton);
|
||||
Y.on('click', function() { window.close(); }, closebutton);
|
||||
|
||||
// Stop a question form being submitted more than once.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y);
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "dom", "event-delegate", "event-key", "core_question_engine"]});
|
10
question/yui/src/preview/build.json
Normal file
10
question/yui/src/preview/build.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-question-preview",
|
||||
"builds": {
|
||||
"moodle-question-preview": {
|
||||
"jsfiles": [
|
||||
"preview.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -16,29 +16,25 @@
|
||||
/**
|
||||
* JavaScript required by the question preview pop-up.
|
||||
*
|
||||
* @package moodlecore
|
||||
* @subpackage questionengine
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @module moodle-question-preview
|
||||
* @copyright 2014 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
M.core_question_preview = M.core_question_preview || {};
|
||||
|
||||
M.question = M.question || {};
|
||||
|
||||
/**
|
||||
* Initialise JavaScript-specific parts of the question preview popup.
|
||||
*/
|
||||
M.core_question_preview.init = function(Y) {
|
||||
M.question.preview.init = function(Y) {
|
||||
M.core_question_engine.init_form(Y, '#responseform');
|
||||
|
||||
// Add a close button to the window.
|
||||
var closebutton = Y.Node.create('<input type="button" />');
|
||||
closebutton.set('value', M.str.question.closepreview);
|
||||
Y.one('#previewcontrols').append(closebutton);
|
||||
Y.on('click', function() { window.close() }, closebutton);
|
||||
Y.on('click', function() { window.close(); }, closebutton);
|
||||
|
||||
// Make changing the settings disable all submit buttons, like clicking one
|
||||
// of the question buttons does.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y)
|
||||
}
|
||||
// Stop a question form being submitted more than once.
|
||||
Y.on('submit', M.core_question_engine.prevent_repeat_submission, '#mform1', null, Y);
|
||||
};
|
11
question/yui/src/preview/meta/preview.json
Normal file
11
question/yui/src/preview/meta/preview.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"moodle-question-preview": {
|
||||
"requires": [
|
||||
"base",
|
||||
"dom",
|
||||
"event-delegate",
|
||||
"event-key",
|
||||
"core_question_engine"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user