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("qbank_usage/usage",["exports","core/fragment","core/modal_cancel","core/notification","core/str"],(function(_exports,_fragment,_modal_cancel,_notification,Str){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Usage column selector js.
*
* @module qbank_usage/usage
* @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,_fragment=_interopRequireDefault(_fragment),_modal_cancel=_interopRequireDefault(_modal_cancel),_notification=_interopRequireDefault(_notification),Str=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Str);let modal=null;const usageEvent=async(questionId,contextId,specificVersion)=>{const args={questionid:questionId,specificversion:specificVersion};if(null===modal){try{modal=await _modal_cancel.default.create({title:Str.get_string("usageheader","qbank_usage"),body:_fragment.default.loadFragment("qbank_usage","question_usage",contextId,args),large:!0,show:!0})}catch(e){return void _notification.default.exception(e)}modal.getRoot().on("click","a[href].page-link",(function(e){e.preventDefault();let attr=e.target.getAttribute("href");"#"!==attr&&(args.querystring=attr,modal.setBody(_fragment.default.loadFragment("qbank_usage","question_usage",contextId,args)))})),modal.getRoot().on("change","#question_usage_version_dropdown",(function(e){args.questionid=e.target.value,modal.setBody(_fragment.default.loadFragment("qbank_usage","question_usage",contextId,args))}))}else modal.setBody(_fragment.default.loadFragment("qbank_usage","question_usage",contextId,args)),modal.show()};_exports.init=function(){let specificVersion=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const target=document.querySelector("#categoryquestions");null!==target&&target.addEventListener("click",(e=>{e.target.dataset.target&&e.target.dataset.target.includes("questionusagepreview")&&usageEvent(e.target.dataset.questionid,e.target.dataset.contextid,specificVersion)}))}}));
//# sourceMappingURL=usage.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"usage.min.js","sources":["../src/usage.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 * Usage column selector js.\n *\n * @module qbank_usage/usage\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 Fragment from 'core/fragment';\nimport ModalCancel from 'core/modal_cancel';\nimport Notification from 'core/notification';\nimport * as Str from 'core/str';\n\nlet modal = null;\n\n/**\n * Event listeners for the module.\n *\n * @method clickEvent\n * @param {int} questionId\n * @param {int} contextId\n * @param {boolean} specificVersion Is the view listing specific question versions?\n */\nconst usageEvent = async(questionId, contextId, specificVersion) => {\n const args = {\n questionid: questionId,\n specificversion: specificVersion,\n };\n if (modal === null) {\n try {\n modal = await ModalCancel.create({\n title: Str.get_string('usageheader', 'qbank_usage'),\n body: Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args),\n large: true,\n show: true,\n });\n } catch (e) {\n Notification.exception(e);\n return;\n }\n\n modal.getRoot().on('click', 'a[href].page-link', function(e) {\n e.preventDefault();\n let attr = e.target.getAttribute(\"href\");\n if (attr !== '#') {\n args.querystring = attr;\n modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));\n }\n });\n // Version selection event.\n modal.getRoot().on('change', '#question_usage_version_dropdown', function(e) {\n args.questionid = e.target.value;\n modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));\n });\n } else {\n modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));\n modal.show();\n }\n\n};\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n * @param {boolean} specificVersion Is the view listing specific question versions?\n */\nexport const init = (specificVersion = false) => {\n const target = document.querySelector('#categoryquestions');\n if (target !== null) {\n target.addEventListener('click', (e) => {\n if (e.target.dataset.target && e.target.dataset.target.includes('questionusagepreview')) {\n // Call for the event listener to listed for clicks in any usage count row.\n usageEvent(e.target.dataset.questionid, e.target.dataset.contextid, specificVersion);\n }\n });\n }\n};\n"],"names":["modal","usageEvent","async","questionId","contextId","specificVersion","args","questionid","specificversion","ModalCancel","create","title","Str","get_string","body","Fragment","loadFragment","large","show","e","exception","getRoot","on","preventDefault","attr","target","getAttribute","querystring","setBody","value","document","querySelector","addEventListener","dataset","includes","contextid"],"mappings":";;;;;;;;g4BA6BIA,MAAQ,WAUNC,WAAaC,MAAMC,WAAYC,UAAWC,yBACtCC,KAAO,CACTC,WAAYJ,WACZK,gBAAiBH,oBAEP,OAAVL,MAAgB,KAEZA,YAAcS,sBAAYC,OAAO,CAC7BC,MAAOC,IAAIC,WAAW,cAAe,eACrCC,KAAMC,kBAASC,aAAa,cAAe,iBAAkBZ,UAAWE,MACxEW,OAAO,EACPC,MAAM,IAEZ,MAAOC,qCACQC,UAAUD,GAI3BnB,MAAMqB,UAAUC,GAAG,QAAS,qBAAqB,SAASH,GACtDA,EAAEI,qBACEC,KAAOL,EAAEM,OAAOC,aAAa,QACpB,MAATF,OACAlB,KAAKqB,YAAcH,KACnBxB,MAAM4B,QAAQb,kBAASC,aAAa,cAAe,iBAAkBZ,UAAWE,WAIxFN,MAAMqB,UAAUC,GAAG,SAAU,oCAAoC,SAASH,GACtEb,KAAKC,WAAaY,EAAEM,OAAOI,MAC3B7B,MAAM4B,QAAQb,kBAASC,aAAa,cAAe,iBAAkBZ,UAAWE,eAGpFN,MAAM4B,QAAQb,kBAASC,aAAa,cAAe,iBAAkBZ,UAAWE,OAChFN,MAAMkB,sBAWM,eAACb,8EACXoB,OAASK,SAASC,cAAc,sBACvB,OAAXN,QACAA,OAAOO,iBAAiB,SAAUb,IAC1BA,EAAEM,OAAOQ,QAAQR,QAAUN,EAAEM,OAAOQ,QAAQR,OAAOS,SAAS,yBAE5DjC,WAAWkB,EAAEM,OAAOQ,QAAQ1B,WAAYY,EAAEM,OAAOQ,QAAQE,UAAW9B"}
+94
View File
@@ -0,0 +1,94 @@
// 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/>.
/**
* Usage column selector js.
*
* @module qbank_usage/usage
* @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 Fragment from 'core/fragment';
import ModalCancel from 'core/modal_cancel';
import Notification from 'core/notification';
import * as Str from 'core/str';
let modal = null;
/**
* Event listeners for the module.
*
* @method clickEvent
* @param {int} questionId
* @param {int} contextId
* @param {boolean} specificVersion Is the view listing specific question versions?
*/
const usageEvent = async(questionId, contextId, specificVersion) => {
const args = {
questionid: questionId,
specificversion: specificVersion,
};
if (modal === null) {
try {
modal = await ModalCancel.create({
title: Str.get_string('usageheader', 'qbank_usage'),
body: Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args),
large: true,
show: true,
});
} catch (e) {
Notification.exception(e);
return;
}
modal.getRoot().on('click', 'a[href].page-link', function(e) {
e.preventDefault();
let attr = e.target.getAttribute("href");
if (attr !== '#') {
args.querystring = attr;
modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));
}
});
// Version selection event.
modal.getRoot().on('change', '#question_usage_version_dropdown', function(e) {
args.questionid = e.target.value;
modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));
});
} else {
modal.setBody(Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args));
modal.show();
}
};
/**
* Entrypoint of the js.
*
* @method init
* @param {boolean} specificVersion Is the view listing specific question versions?
*/
export const init = (specificVersion = false) => {
const target = document.querySelector('#categoryquestions');
if (target !== null) {
target.addEventListener('click', (e) => {
if (e.target.dataset.target && e.target.dataset.target.includes('questionusagepreview')) {
// Call for the event listener to listed for clicks in any usage count row.
usageEvent(e.target.dataset.questionid, e.target.dataset.contextid, specificVersion);
}
});
}
};