Current Path : C:/xampp/htdocs/moodle/mod/workshop/amd/build/ |
Current File : C:/xampp/htdocs/moodle/mod/workshop/amd/build/modform.min.js.map |
{"version":3,"sources":["../src/modform.js"],"names":["define","$","submissionTypes","text","available","required","requiredHidden","file","checkAvailability","checkUnavailable","checkAvailable","prop","val","enableRequired","submissionType","submissionTypeChanged","init","on"],"mappings":"AAsBAA,OAAM,wBAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAE3B,GAAIC,CAAAA,CAAe,CAAG,CAClBC,IAAI,CAAE,CACFC,SAAS,CAAE,IADT,CAEFC,QAAQ,CAAE,IAFR,CAGFC,cAAc,CAAE,IAHd,CADY,CAMlBC,IAAI,CAAE,CACFH,SAAS,CAAE,IADT,CAEFC,QAAQ,CAAE,IAFR,CAGFC,cAAc,CAAE,IAHd,CANY,CAAtB,CAsBA,QAASE,CAAAA,CAAT,CAA2BC,CAA3B,CAA6CC,CAA7C,CAA6D,CACzD,GAAI,CAACD,CAAgB,CAACL,SAAjB,CAA2BO,IAA3B,CAAgC,SAAhC,CAAL,CAAiD,CAC7CF,CAAgB,CAACJ,QAAjB,CAA0BM,IAA1B,CAA+B,UAA/B,KACAF,CAAgB,CAACJ,QAAjB,CAA0BM,IAA1B,CAA+B,SAA/B,KACA,GAAID,CAAc,CAACN,SAAf,CAAyBO,IAAzB,CAA8B,SAA9B,CAAJ,CAA8C,CAC1CD,CAAc,CAACL,QAAf,CAAwBM,IAAxB,CAA6B,UAA7B,KACAD,CAAc,CAACL,QAAf,CAAwBM,IAAxB,CAA6B,SAA7B,KAEAD,CAAc,CAACJ,cAAf,CAA8BM,GAA9B,CAAkC,CAAlC,CACH,CACJ,CACJ,CAOD,QAASC,CAAAA,CAAT,CAAwBC,CAAxB,CAAwC,CACpCA,CAAc,CAACT,QAAf,CAAwBM,IAAxB,CAA6B,UAA7B,KACAG,CAAc,CAACT,QAAf,CAAwBM,IAAxB,CAA6B,SAA7B,KACAG,CAAc,CAACR,cAAf,CAA8BM,GAA9B,CAAkC,CAAlC,CACH,CAKD,QAASG,CAAAA,CAAT,EAAiC,CAC7BP,CAAiB,CAACN,CAAe,CAACK,IAAjB,CAAuBL,CAAe,CAACC,IAAvC,CAAjB,CACAK,CAAiB,CAACN,CAAe,CAACC,IAAjB,CAAuBD,CAAe,CAACK,IAAvC,CAAjB,CACA,GAAIL,CAAe,CAACC,IAAhB,CAAqBC,SAArB,CAA+BO,IAA/B,CAAoC,SAApC,GAAkDT,CAAe,CAACK,IAAhB,CAAqBH,SAArB,CAA+BO,IAA/B,CAAoC,SAApC,CAAtD,CAAsG,CAClGE,CAAc,CAACX,CAAe,CAACC,IAAjB,CAAd,CACAU,CAAc,CAACX,CAAe,CAACK,IAAjB,CACjB,CACJ,CAED,MAAiD,CAI7CS,IAAI,CAAE,eAAW,CACbd,CAAe,CAACC,IAAhB,CAAqBC,SAArB,CAAiCH,CAAC,CAAC,iCAAD,CAAlC,CACAC,CAAe,CAACC,IAAhB,CAAqBE,QAArB,CAAgCJ,CAAC,CAAC,gCAAD,CAAjC,CACAC,CAAe,CAACC,IAAhB,CAAqBG,cAArB,CAAsCL,CAAC,CAAC,6DAAD,CAAvC,CACAC,CAAe,CAACK,IAAhB,CAAqBH,SAArB,CAAiCH,CAAC,CAAC,iCAAD,CAAlC,CACAC,CAAe,CAACK,IAAhB,CAAqBF,QAArB,CAAgCJ,CAAC,CAAC,gCAAD,CAAjC,CACAC,CAAe,CAACK,IAAhB,CAAqBD,cAArB,CAAsCL,CAAC,CAAC,6DAAD,CAAvC,CACAC,CAAe,CAACC,IAAhB,CAAqBC,SAArB,CAA+Ba,EAA/B,CAAkC,QAAlC,CAA4CF,CAA5C,EACAb,CAAe,CAACK,IAAhB,CAAqBH,SAArB,CAA+Ba,EAA/B,CAAkC,QAAlC,CAA4CF,CAA5C,EACAA,CAAqB,EACxB,CAd4C,CAgBpD,CA5EK,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 * Additional javascript for the Workshop module form.\n *\n * @module mod_workshop/modform\n * @copyright The Open University 2018\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'], function($) {\n\n var submissionTypes = {\n text: {\n available: null,\n required: null,\n requiredHidden: null\n },\n file: {\n available: null,\n required: null,\n requiredHidden: null\n }\n };\n\n /**\n * Determine whether one of the submission types has been marked as not available.\n *\n * If it has been marked not available, clear and disable its required checkbox. Then determine if the other submission\n * type is available, and if it is, check and disable its required checkbox.\n *\n * @param {Object} checkUnavailable\n * @param {Object} checkAvailable\n */\n function checkAvailability(checkUnavailable, checkAvailable) {\n if (!checkUnavailable.available.prop('checked')) {\n checkUnavailable.required.prop('disabled', true);\n checkUnavailable.required.prop('checked', false);\n if (checkAvailable.available.prop('checked')) {\n checkAvailable.required.prop('disabled', true);\n checkAvailable.required.prop('checked', true);\n // Also set the checkbox's hidden field to 1 so a 'required' value is submitted for the submission type.\n checkAvailable.requiredHidden.val(1);\n }\n }\n }\n\n /**\n * Enable the submission type's required checkbox and uncheck it.\n *\n * @param {Object} submissionType\n */\n function enableRequired(submissionType) {\n submissionType.required.prop('disabled', false);\n submissionType.required.prop('checked', false);\n submissionType.requiredHidden.val(0);\n }\n\n /**\n * Check which submission types have been marked as available, and disable required checkboxes as necessary.\n */\n function submissionTypeChanged() {\n checkAvailability(submissionTypes.file, submissionTypes.text);\n checkAvailability(submissionTypes.text, submissionTypes.file);\n if (submissionTypes.text.available.prop('checked') && submissionTypes.file.available.prop('checked')) {\n enableRequired(submissionTypes.text);\n enableRequired(submissionTypes.file);\n }\n }\n\n return /** @alias module:mod_workshop/modform */ {\n /**\n * Find all the required fields, set up event listeners, and set the initial state of required checkboxes.\n */\n init: function() {\n submissionTypes.text.available = $('#id_submissiontypetextavailable');\n submissionTypes.text.required = $('#id_submissiontypetextrequired');\n submissionTypes.text.requiredHidden = $('input[name=\"submissiontypetextrequired\"][type=\"hidden\"]');\n submissionTypes.file.available = $('#id_submissiontypefileavailable');\n submissionTypes.file.required = $('#id_submissiontypefilerequired');\n submissionTypes.file.requiredHidden = $('input[name=\"submissiontypefilerequired\"][type=\"hidden\"]');\n submissionTypes.text.available.on('change', submissionTypeChanged);\n submissionTypes.file.available.on('change', submissionTypeChanged);\n submissionTypeChanged();\n }\n };\n});\n"],"file":"modform.min.js"}