HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/8.0.30
System: Linux multiplicar 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64
User: root (0)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /var/www/html/formacion.bdp.com.py-bk/lib/amd/build/addblockmodal.min.js.map
{"version":3,"file":"addblockmodal.min.js","sources":["../src/addblockmodal.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 * Show an add block modal instead of doing it on a separate page.\n *\n * @module     core/addblockmodal\n * @copyright  2016 Damyon Wiese <damyon@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalFactory from 'core/modal_factory';\nimport Templates from 'core/templates';\nimport {get_string as getString} from 'core/str';\nimport Ajax from 'core/ajax';\n\nconst SELECTORS = {\n    ADD_BLOCK: '[data-key=\"addblock\"]'\n};\n\nlet addBlockModal = null;\n\n/**\n * Register related event listeners.\n *\n * @method registerListenerEvents\n * @param {String} pageType The type of the page\n * @param {String} pageLayout The layout of the page\n * @param {String} addBlockUrl The add block URL\n * @param {String} subPage The subpage identifier\n */\nconst registerListenerEvents = (pageType, pageLayout, addBlockUrl, subPage) => {\n    document.addEventListener('click', e => {\n\n        if (e.target.closest(SELECTORS.ADD_BLOCK)) {\n            e.preventDefault();\n\n            if (addBlockModal) { // The 'add block' modal has been already created.\n                // Display the 'add block' modal.\n                addBlockModal.show();\n            } else {\n                buildAddBlockModal()\n                .then(modal => {\n                    addBlockModal = modal;\n                    const modalBody = renderBlocks(addBlockUrl, pageType, pageLayout, subPage);\n                    modal.setBody(modalBody);\n                    modal.show();\n\n                    return modalBody;\n                })\n                .catch(() => {\n                    addBlockModal.destroy();\n                    // Unset the addBlockModal in case this is a transient error and it goes away on a relaunch.\n                    addBlockModal = null;\n                });\n            }\n        }\n    });\n};\n\n/**\n * Method that creates the 'add block' modal.\n *\n * @method buildAddBlockModal\n * @returns {Promise} The modal promise (modal's body will be rendered later).\n */\nconst buildAddBlockModal = () => {\n    return ModalFactory.create({\n        type: ModalFactory.types.CANCEL,\n        title: getString('addblock')\n    });\n};\n\n/**\n * Method that renders the list of available blocks.\n *\n * @method renderBlocks\n * @param {String} addBlockUrl The add block URL\n * @param {String} pageType The type of the page\n * @param {String} pageLayout The layout of the page\n * @param {String} subPage The subpage identifier\n * @return {Promise}\n */\nconst renderBlocks = async(addBlockUrl, pageType, pageLayout, subPage) => {\n    // Fetch all addable blocks in the given page.\n    const blocks = await getAddableBlocks(pageType, pageLayout, subPage);\n\n    return Templates.render('core/add_block_body', {\n        blocks: blocks,\n        url: addBlockUrl\n    });\n};\n\n/**\n * Method that fetches all addable blocks in a given page.\n *\n * @method getAddableBlocks\n * @param {String} pageType The type of the page\n * @param {String} pageLayout The layout of the page\n * @param {String} subPage The subpage identifier\n * @return {Promise}\n */\nconst getAddableBlocks = async(pageType, pageLayout, subPage) => {\n    const request = {\n        methodname: 'core_block_fetch_addable_blocks',\n        args: {\n            pagecontextid: M.cfg.contextid,\n            pagetype: pageType,\n            pagelayout: pageLayout,\n            subpage: subPage,\n        },\n    };\n\n    return Ajax.call([request])[0];\n};\n\n/**\n * Set up the actions.\n *\n * @method init\n * @param {String} pageType The type of the page\n * @param {String} pageLayout The layout of the page\n * @param {String} addBlockUrl The add block URL\n * @param {String} subPage The subpage identifier\n */\nexport const init = (pageType, pageLayout, addBlockUrl, subPage = '') => {\n    registerListenerEvents(pageType, pageLayout, addBlockUrl, subPage);\n};\n"],"names":["SELECTORS","addBlockModal","registerListenerEvents","pageType","pageLayout","addBlockUrl","subPage","document","addEventListener","e","target","closest","preventDefault","show","buildAddBlockModal","then","modal","modalBody","renderBlocks","setBody","catch","destroy","ModalFactory","create","type","types","CANCEL","title","getAddableBlocks","blocks","Templates","render","url","request","methodname","args","pagecontextid","M","cfg","contextid","pagetype","pagelayout","subpage","Ajax","call"],"mappings":"ogCA4BMA,oBACS,wBAGXC,cAAgB,KAWdC,uBAAyB,SAACC,SAAUC,WAAYC,YAAaC,SAC/DC,SAASC,iBAAiB,SAAS,SAAAC,GAE3BA,EAAEC,OAAOC,QAAQX,uBACjBS,EAAEG,iBAEEX,cAEAA,cAAcY,OAEdC,qBACCC,MAAK,SAAAC,OACFf,cAAgBe,UACVC,UAAYC,aAAab,YAAaF,SAAUC,WAAYE,gBAClEU,MAAMG,QAAQF,WACdD,MAAMH,OAECI,aAEVG,OAAM,WACHnB,cAAcoB,UAEdpB,cAAgB,aAa9Ba,mBAAqB,kBAChBQ,uBAAaC,OAAO,CACvBC,KAAMF,uBAAaG,MAAMC,OACzBC,OAAO,mBAAU,eAcnBT,8DAAe,iBAAMb,YAAaF,SAAUC,WAAYE,gJAErCsB,iBAAiBzB,SAAUC,WAAYE,uBAAtDuB,8CAECC,mBAAUC,OAAO,sBAAuB,CAC3CF,OAAQA,OACRG,IAAK3B,oIAaPuB,mEAAmB,kBAAMzB,SAAUC,WAAYE,oIAC3C2B,QAAU,CACZC,WAAY,kCACZC,KAAM,CACFC,cAAeC,EAAEC,IAAIC,UACrBC,SAAUrC,SACVsC,WAAYrC,WACZsC,QAASpC,oCAIVqC,cAAKC,KAAK,CAACX,UAAU,uIAYZ,SAAC9B,SAAUC,WAAYC,iBAAaC,+DAAU,GAC9DJ,uBAAuBC,SAAUC,WAAYC,YAAaC"}