first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
define("mod_survey/validation",["exports","core/str","core/notification"],(function(_exports,_str,_notification){var obj;
/**
* Javascript to handle survey validation.
*
* @module mod_survey/validation
* @copyright 2017 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 3.3
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.ensureRadiosChosen=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};_exports.ensureRadiosChosen=formid=>{const form=document.getElementById(formid);form.addEventListener("submit",(e=>{0!==form.querySelectorAll('input[type="radio"][data-survey-default="true"]:checked').length&&(_notification.default.alert((0,_str.get_string)("error"),(0,_str.get_string)("questionsnotanswered","survey"),(0,_str.get_string)("ok")),e.preventDefault())}))}}));
//# sourceMappingURL=validation.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"validation.min.js","sources":["../src/validation.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 * Javascript to handle survey validation.\n *\n * @module mod_survey/validation\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 */\nimport {get_string as getString} from 'core/str';\nimport Notification from 'core/notification';\n\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 */\nexport const ensureRadiosChosen = (formid) => {\n const form = document.getElementById(formid);\n form.addEventListener('submit', (e) => {\n const optionsToSet = form.querySelectorAll('input[type=\"radio\"][data-survey-default=\"true\"]:checked');\n if (optionsToSet.length !== 0) {\n Notification.alert(\n getString('error'),\n getString('questionsnotanswered', 'survey'),\n getString('ok'),\n );\n e.preventDefault();\n }\n });\n};\n"],"names":["formid","form","document","getElementById","addEventListener","e","querySelectorAll","length","alert","preventDefault"],"mappings":";;;;;;;;gMAgCmCA,eACzBC,KAAOC,SAASC,eAAeH,QACrCC,KAAKG,iBAAiB,UAAWC,IAED,IADPJ,KAAKK,iBAAiB,2DAC1BC,+BACAC,OACT,mBAAU,UACV,mBAAU,uBAAwB,WAClC,mBAAU,OAEdH,EAAEI"}
+46
View File
@@ -0,0 +1,46 @@
// 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/>.
/**
* Javascript to handle survey validation.
*
* @module mod_survey/validation
* @copyright 2017 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since 3.3
*/
import {get_string as getString} from 'core/str';
import Notification from 'core/notification';
/**
* Prevents form submission until all radio buttons are chosen, displays
* modal error if any choices are missing.
*
* @param {String} formid HTML id of form
*/
export const ensureRadiosChosen = (formid) => {
const form = document.getElementById(formid);
form.addEventListener('submit', (e) => {
const optionsToSet = form.querySelectorAll('input[type="radio"][data-survey-default="true"]:checked');
if (optionsToSet.length !== 0) {
Notification.alert(
getString('error'),
getString('questionsnotanswered', 'survey'),
getString('ok'),
);
e.preventDefault();
}
});
};