Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/mod/survey/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/mod/survey/amd/build/validation.min.js.map

{"version":3,"sources":["../src/validation.js"],"names":["define","$","Str","ModalFactory","Notification","ensureRadiosChosen","formid","modalPromise","get_strings","key","component","then","strings","create","type","types","CANCEL","title","body","catch","exception","form","submit","e","find","length","preventDefault","modal","show"],"mappings":"AAwBAA,OAAM,yBAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAD,CAAoE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA6C,CACnH,MAAO,CAOHC,kBAAkB,CAAE,4BAASC,CAAT,CAAiB,IAE7BC,CAAAA,CAAY,CAAGL,CAAG,CAACM,WAAJ,CAAgB,CAC/B,CAACC,GAAG,CAAE,OAAN,CAAeC,SAAS,CAAE,QAA1B,CAD+B,CAE/B,CAACD,GAAG,CAAE,sBAAN,CAA8BC,SAAS,CAAE,QAAzC,CAF+B,CAAhB,EAGhBC,IAHgB,CAGX,SAASC,CAAT,CAAkB,CACtB,MAAOT,CAAAA,CAAY,CAACU,MAAb,CAAoB,CACvBC,IAAI,CAAEX,CAAY,CAACY,KAAb,CAAmBC,MADF,CAEvBC,KAAK,CAAEL,CAAO,CAAC,CAAD,CAFS,CAGvBM,IAAI,CAAEN,CAAO,CAAC,CAAD,CAHU,CAApB,CAKV,CATkB,EAShBO,KATgB,CASVf,CAAY,CAACgB,SATH,CAFc,CAa7BC,CAAI,CAAGpB,CAAC,CAAC,IAAMK,CAAP,CAbqB,CAcjCe,CAAI,CAACC,MAAL,CAAY,SAASC,CAAT,CAAY,CAEpB,GAA4E,CAAxE,GAAAF,CAAI,CAACG,IAAL,CAAU,mDAAV,EAA6DC,MAAjE,CAA+E,CAC3EF,CAAC,CAACG,cAAF,GAEA,MAAOnB,CAAAA,CAAY,CAACI,IAAb,CAAkB,SAASgB,CAAT,CAAgB,CACrCA,CAAK,CAACC,IAAN,GACA,QACH,CAHM,CAIV,CAED,QACH,CAZD,CAaH,CAlCE,CAoCV,CArCK,CAAN","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 * Javascript to handle survey validation.\n *\n * @module     mod_survey/validation\n * @package    mod_survey\n * @copyright  2017 Dan Poltawski <dan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since      3.3\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, Str, ModalFactory, Notification) {\n    return {\n        /**\n         * Prevents form submission until all radio buttons are chosen, displays\n         * modal error if any choices are missing.\n         *\n         * @param {String} formid HTML id of form\n         */\n        ensureRadiosChosen: function(formid) {\n            // Prepare modal for display in case of problems.\n            var modalPromise = Str.get_strings([\n                {key: 'error', component: 'moodle'},\n                {key: 'questionsnotanswered', component: 'survey'},\n            ]).then(function(strings) {\n                return ModalFactory.create({\n                    type: ModalFactory.types.CANCEL,\n                    title: strings[0],\n                    body: strings[1],\n                });\n            }).catch(Notification.exception);\n\n            var form = $('#' + formid);\n            form.submit(function(e) {\n                // Look for unanswered questions..\n                if (form.find('input:radio[data-survey-default=\"true\"]:checked').length !== 0) {\n                    e.preventDefault();\n                    // Display the modal error.\n                    return modalPromise.then(function(modal) {\n                        modal.show();\n                        return false;\n                    });\n                }\n\n                return true;\n            });\n        }\n    };\n});\n"],"file":"validation.min.js"}