Sindbad~EG File Manager
{"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 * as Str from 'core/str';\nimport ModalFactory from 'core/modal_factory';\nimport Notification from 'core/notification';\n\n/**\n * Get the fragment.\n *\n * @method getFragment\n * @param {{questioned: int}} args\n * @param {int} contextId\n * @return {string}\n */\nconst getFragment = (args, contextId) => {\n return Fragment.loadFragment('qbank_usage', 'question_usage', contextId, args);\n};\n\n/**\n * Event listeners for the module.\n *\n * @method clickEvent\n * @param {int} questionId\n * @param {int} contextId\n */\nconst usageEvent = (questionId, contextId) => {\n let args = {\n questionid: questionId\n };\n ModalFactory.create({\n type: ModalFactory.types.CANCEL,\n title: Str.get_string('usageheader', 'qbank_usage'),\n body: getFragment(args, contextId),\n large: true,\n }).then((modal) => {\n modal.show();\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(getFragment(args, contextId));\n }\n });\n return modal;\n }).fail(Notification.exception);\n};\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n * @param {string} questionSelector the question usage identifier.\n * @param {int} contextId the question context id.\n */\nexport const init = (questionSelector, contextId) => {\n let target = document.querySelector(questionSelector);\n let questionId = target.getAttribute('data-questionid');\n target.addEventListener('click', () => {\n // Call for the event listener to listed for clicks in any usage count row.\n usageEvent(questionId, contextId);\n });\n};\n"],"names":["getFragment","args","contextId","Fragment","loadFragment","questionSelector","target","document","querySelector","questionId","getAttribute","addEventListener","questionid","create","type","ModalFactory","types","CANCEL","title","Str","get_string","body","large","then","modal","show","getRoot","on","e","preventDefault","attr","querystring","setBody","fail","Notification","exception","usageEvent"],"mappings":";;;;;;;;o4BAqCMA,YAAc,CAACC,KAAMC,YAChBC,kBAASC,aAAa,cAAe,iBAAkBF,UAAWD,oBAwCzD,CAACI,iBAAkBH,iBAC/BI,OAASC,SAASC,cAAcH,kBAChCI,WAAaH,OAAOI,aAAa,mBACrCJ,OAAOK,iBAAiB,SAAS,KAjClB,EAACF,WAAYP,iBACxBD,KAAO,CACPW,WAAYH,mCAEHI,OAAO,CAChBC,KAAMC,uBAAaC,MAAMC,OACzBC,MAAOC,IAAIC,WAAW,cAAe,eACrCC,KAAMrB,YAAYC,KAAMC,WACxBoB,OAAO,IACRC,MAAMC,QACLA,MAAMC,OACND,MAAME,UAAUC,GAAG,QAAS,qBAAqB,SAASC,GACtDA,EAAEC,qBACEC,KAAOF,EAAEtB,OAAOI,aAAa,QACpB,MAAToB,OACA7B,KAAK8B,YAAcD,KACnBN,MAAMQ,QAAQhC,YAAYC,KAAMC,gBAGjCsB,SACRS,KAAKC,sBAAaC,YAejBC,CAAW3B,WAAYP"}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists