[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 YUI.add('moodle-mod_quiz-randomquestion', function (Y, NAME) { 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 19 /** 20 * Add a random question functionality for a popup in quiz editing page. 21 * 22 * @package mod_quiz 23 * @copyright 2014 The Open University 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 27 var CSS = { 28 RANDOMQUESTIONFORM: 'div.randomquestionformforpopup', 29 PAGEHIDDENINPUT: 'input#rform_qpage', 30 RANDOMQUESTIONLINKS: 'ul.menu a.addarandomquestion' 31 }; 32 33 var PARAMS = { 34 PAGE: 'addonpage', 35 HEADER: 'header', 36 FORM: 'form' 37 }; 38 39 var POPUP = function() { 40 POPUP.superclass.constructor.apply(this, arguments); 41 }; 42 43 Y.extend(POPUP, Y.Base, { 44 45 dialogue: function(header) { 46 // Create a dialogue on the page and hide it. 47 var config = { 48 headerContent: header, 49 bodyContent: Y.one(CSS.RANDOMQUESTIONFORM), 50 draggable: true, 51 modal: true, 52 zIndex: 1000, 53 centered: false, 54 width: 'auto', 55 visible: false, 56 postmethod: 'form', 57 footerContent: null 58 }; 59 var popup = {dialog: null}; 60 popup.dialog = new M.core.dialogue(config); 61 popup.dialog.show(); 62 }, 63 64 initializer: function() { 65 Y.one('body').delegate('click', this.display_dialogue, CSS.RANDOMQUESTIONLINKS, this); 66 }, 67 68 display_dialogue: function(e) { 69 e.preventDefault(); 70 71 Y.one(CSS.RANDOMQUESTIONFORM + ' ' + CSS.PAGEHIDDENINPUT).set('value', 72 e.currentTarget.getData(PARAMS.PAGE)); 73 74 this.dialogue(e.currentTarget.getData(PARAMS.HEADER)); 75 } 76 }); 77 78 M.mod_quiz = M.mod_quiz || {}; 79 M.mod_quiz.randomquestion = M.mod_quiz.randomquestion || {}; 80 M.mod_quiz.randomquestion.init = function() { 81 return new POPUP(); 82 }; 83 84 85 }, '@VERSION@', {"requires": ["base", "event", "node", "io", "moodle-core-notification-dialogue"]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |