Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"preflightcheck.min.js","sources":["../src/preflightcheck.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * This class manages the confirmation pop-up (also called the pre-flight check)\n * that is sometimes shown when a use clicks the start attempt button.\n *\n * This is also responsible for opening the pop-up window, if the quiz requires to be in one.\n *\n * @module    mod_quiz/preflightcheck\n * @copyright 2016 The Open University\n * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since     3.1\n */\ndefine(['jquery', 'core/yui', 'core_form/changechecker'], function($, Y, FormChangeChecker) {\n\n    /**\n     * @alias module:mod_quiz/preflightcheck\n     */\n    var t = {\n        confirmDialogue: null,\n\n        /**\n         * Initialise the start attempt button.\n         *\n         * @param {String} startButton the id of the start attempt button that we will be enhancing.\n         * @param {String} confirmationTitle the title of the dialogue.\n         * @param {String} confirmationForm selector for the confirmation form to show in the dialogue.\n         * @param {String} popupoptions If not null, the quiz should be launced in a pop-up.\n         */\n        init: function(startButton, confirmationTitle, confirmationForm, popupoptions) {\n            var finalStartButton = startButton;\n\n            Y.use('moodle-core-notification', function() {\n                if (Y.one(confirmationForm)) {\n                    t.confirmDialogue = new M.core.dialogue({\n                        headerContent: confirmationTitle,\n                        bodyContent: Y.one(confirmationForm),\n                        draggable: true,\n                        visible: false,\n                        center: true,\n                        modal: true,\n                        width: null,\n                        extraClasses: ['mod_quiz_preflight_popup']\n                    });\n\n                    Y.one(startButton).on('click', t.displayDialogue);\n                    Y.one('#id_cancel').on('click', t.hideDialogue);\n\n                    finalStartButton = t.confirmDialogue.get('boundingBox').one('[name=\"submitbutton\"]');\n                }\n\n                if (popupoptions) {\n                    Y.one(finalStartButton).on('click', t.launchQuizPopup, t, popupoptions);\n                }\n            });\n        },\n\n        /**\n         * Display the dialogue.\n         * @param {Y.EventFacade} e the event being responded to, if any.\n         */\n        displayDialogue: function(e) {\n            if (e) {\n                e.halt();\n            }\n            t.confirmDialogue.show();\n        },\n\n        /**\n         * Hide the dialogue.\n         * @param {Y.EventFacade} e the event being responded to, if any.\n         */\n        hideDialogue: function(e) {\n            if (e) {\n                e.halt();\n            }\n            t.confirmDialogue.hide(e);\n        },\n\n        /**\n         * Event handler for the quiz start attempt button.\n         * @param {Event} e the event being responded to\n         * @param {Object} popupoptions\n         */\n        launchQuizPopup: function(e, popupoptions) {\n            e.halt();\n            Y.use('io-form', function() {\n                var form = e.target.ancestor('form');\n\n                FormChangeChecker.resetFormDirtyState(form.getDOMNode());\n                window.openpopup(e, {\n                    url: form.get('action') + '?' + Y.IO.stringify(form).replace(/\\bcancel=/, 'x='),\n                    windowname: 'quizpopup',\n                    options: popupoptions,\n                    fullscreen: true,\n                });\n            });\n        }\n    };\n\n    return t;\n});\n"],"names":["define","$","Y","FormChangeChecker","t","confirmDialogue","init","startButton","confirmationTitle","confirmationForm","popupoptions","finalStartButton","use","one","M","core","dialogue","headerContent","bodyContent","draggable","visible","center","modal","width","extraClasses","on","displayDialogue","hideDialogue","get","launchQuizPopup","e","halt","show","hide","form","target","ancestor","resetFormDirtyState","getDOMNode","window","openpopup","url","IO","stringify","replace","windowname","options","fullscreen"],"mappings":";;;;;;;;;;;AA0BAA,iCAAO,CAAC,SAAU,WAAY,4BAA4B,SAASC,EAAGC,EAAGC,uBAKjEC,EAAI,CACJC,gBAAiB,KAUjBC,KAAM,SAASC,YAAaC,kBAAmBC,iBAAkBC,kBACzDC,iBAAmBJ,YAEvBL,EAAEU,IAAI,4BAA4B,WAC1BV,EAAEW,IAAIJ,oBACNL,EAAEC,gBAAkB,IAAIS,EAAEC,KAAKC,SAAS,CACpCC,cAAeT,kBACfU,YAAahB,EAAEW,IAAIJ,kBACnBU,WAAW,EACXC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,MAAO,KACPC,aAAc,CAAC,8BAGnBtB,EAAEW,IAAIN,aAAakB,GAAG,QAASrB,EAAEsB,iBACjCxB,EAAEW,IAAI,cAAcY,GAAG,QAASrB,EAAEuB,cAElChB,iBAAmBP,EAAEC,gBAAgBuB,IAAI,eAAef,IAAI,0BAG5DH,cACAR,EAAEW,IAAIF,kBAAkBc,GAAG,QAASrB,EAAEyB,gBAAiBzB,EAAGM,kBAStEgB,gBAAiB,SAASI,GAClBA,GACAA,EAAEC,OAEN3B,EAAEC,gBAAgB2B,QAOtBL,aAAc,SAASG,GACfA,GACAA,EAAEC,OAEN3B,EAAEC,gBAAgB4B,KAAKH,IAQ3BD,gBAAiB,SAASC,EAAGpB,cACzBoB,EAAEC,OACF7B,EAAEU,IAAI,WAAW,eACTsB,KAAOJ,EAAEK,OAAOC,SAAS,QAE7BjC,kBAAkBkC,oBAAoBH,KAAKI,cAC3CC,OAAOC,UAAUV,EAAG,CAChBW,IAAKP,KAAKN,IAAI,UAAY,IAAM1B,EAAEwC,GAAGC,UAAUT,MAAMU,QAAQ,YAAa,MAC1EC,WAAY,YACZC,QAASpC,aACTqC,YAAY,gBAMrB3C"}