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
@@ -0,0 +1,11 @@
define("qbank_editquestion/question_status",["exports","core/ajax","core/notification"],(function(_exports,_ajax,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Status column selector js.
*
* @module qbank_editquestion/question_status
* @copyright 2021 Catalyst IT Australia Pty Ltd
* @author Safat Shahin <safatshahin@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_ajax=_interopRequireDefault(_ajax),_notification=_interopRequireDefault(_notification);_exports.init=questionId=>{document.querySelector("#question_status_dropdown-"+questionId).addEventListener("change",(e=>{const questionStatus=e.target.value;((questionId,status)=>_ajax.default.call([{methodname:"qbank_editquestion_set_status",args:{questionid:questionId,status:status}}])[0])(questionId,questionStatus).then((response=>{response.error&&_notification.default.addNotification({type:"error",message:response.error})})).catch()}))}}));
//# sourceMappingURL=question_status.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"question_status.min.js","sources":["../src/question_status.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 * Status column selector js.\n *\n * @module qbank_editquestion/question_status\n * @copyright 2021 Catalyst IT Australia Pty Ltd\n * @author Safat Shahin <safatshahin@catalyst-au.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Set the question status.\n *\n * @param {Number} questionId The question id.\n * @param {String} status The updated question status.\n * @return {Array} The modified question status\n */\nconst setQuestionStatus = (questionId, status) => Ajax.call([{\n methodname: 'qbank_editquestion_set_status',\n args: {\n questionid: questionId,\n status: status\n }\n}])[0];\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n * @param {Number} questionId Question id.\n */\nexport const init = (questionId) => {\n let target = document.querySelector('#question_status_dropdown-' + questionId);\n target.addEventListener('change', (e) => {\n const questionStatus = e.target.value;\n setQuestionStatus(questionId, questionStatus)\n .then((response) => {\n if (response.error) {\n Notification.addNotification({\n type: 'error',\n message: response.error\n });\n }\n return;\n }).catch();\n });\n};\n"],"names":["questionId","document","querySelector","addEventListener","e","questionStatus","target","value","status","Ajax","call","methodname","args","questionid","setQuestionStatus","then","response","error","addNotification","type","message","catch"],"mappings":";;;;;;;;wLAgDqBA,aACJC,SAASC,cAAc,6BAA+BF,YAC5DG,iBAAiB,UAAWC,UACzBC,eAAiBD,EAAEE,OAAOC,MAjBd,EAACP,WAAYQ,SAAWC,cAAKC,KAAK,CAAC,CACzDC,WAAY,gCACZC,KAAM,CACFC,WAAYb,WACZQ,OAAQA,WAEZ,GAYIM,CAAkBd,WAAYK,gBAC7BU,MAAMC,WACCA,SAASC,6BACIC,gBAAgB,CACzBC,KAAM,QACNC,QAASJ,SAASC,WAI3BI"}
@@ -0,0 +1,64 @@
// 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/>.
/**
* Status column selector js.
*
* @module qbank_editquestion/question_status
* @copyright 2021 Catalyst IT Australia Pty Ltd
* @author Safat Shahin <safatshahin@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import Ajax from 'core/ajax';
import Notification from 'core/notification';
/**
* Set the question status.
*
* @param {Number} questionId The question id.
* @param {String} status The updated question status.
* @return {Array} The modified question status
*/
const setQuestionStatus = (questionId, status) => Ajax.call([{
methodname: 'qbank_editquestion_set_status',
args: {
questionid: questionId,
status: status
}
}])[0];
/**
* Entrypoint of the js.
*
* @method init
* @param {Number} questionId Question id.
*/
export const init = (questionId) => {
let target = document.querySelector('#question_status_dropdown-' + questionId);
target.addEventListener('change', (e) => {
const questionStatus = e.target.value;
setQuestionStatus(questionId, questionStatus)
.then((response) => {
if (response.error) {
Notification.addNotification({
type: 'error',
message: response.error
});
}
return;
}).catch();
});
};