2010-12-20 16:16:09 +00:00
|
|
|
// 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/>.
|
|
|
|
|
|
|
|
/**
|
2010-12-21 17:01:46 +00:00
|
|
|
* JavaScript required by the question preview pop-up.
|
2010-12-20 16:16:09 +00:00
|
|
|
*
|
2011-02-21 18:00:15 +00:00
|
|
|
* @package moodlecore
|
2010-12-20 16:16:09 +00:00
|
|
|
* @subpackage questionengine
|
2011-02-21 18:00:15 +00:00
|
|
|
* @copyright 2009 The Open University
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
2010-12-20 16:16:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-12-21 17:01:46 +00:00
|
|
|
M.core_question_preview = M.core_question_preview || {};
|
|
|
|
|
|
|
|
|
2010-12-20 16:16:09 +00:00
|
|
|
/**
|
|
|
|
* Initialise JavaScript-specific parts of the question preview popup.
|
|
|
|
*/
|
2010-12-24 23:25:58 +00:00
|
|
|
M.core_question_preview.init = function(Y) {
|
2010-12-21 17:01:46 +00:00
|
|
|
M.core_question_engine.init_form(Y, '#responseform');
|
2010-12-20 16:16:09 +00:00
|
|
|
|
2010-12-21 17:01:46 +00:00
|
|
|
// Add a close button to the window.
|
|
|
|
var closebutton = Y.Node.create('<input type="button" />');
|
2011-02-02 19:03:38 +00:00
|
|
|
closebutton.set('value', M.str.question.closepreview);
|
2010-12-21 17:01:46 +00:00
|
|
|
Y.one('#previewcontrols').append(closebutton);
|
|
|
|
Y.on('click', function() { window.close() }, closebutton);
|
2010-12-20 16:16:09 +00:00
|
|
|
|
2010-12-21 17:01:46 +00:00
|
|
|
// 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)
|
|
|
|
}
|