Sindbad~EG File Manager

Current Path : /var/www/html/encuestas.sumar.com.py/lib/amd/build/moodlenet/
Upload File :
Current File : /var/www/html/encuestas.sumar.com.py/lib/amd/build/moodlenet/send_resource.min.js.map

{"version":3,"file":"send_resource.min.js","sources":["../../src/moodlenet/send_resource.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 * A module to handle Share operations of the MoodleNet.\n *\n * @module     core/moodlenet/send_resource\n * @copyright  2023 Huong Nguyen <huongnv13@gmail.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since      4.2\n */\n\nimport Config from 'core/config';\nimport ModalFactory from 'core/modal_factory';\nimport {alert as displayAlert, addNotification, exception as displayException} from 'core/notification';\nimport {get_string as getString} from 'core/str';\nimport Prefetch from \"core/prefetch\";\nimport * as Templates from 'core/templates';\nimport * as MoodleNetService from 'core/moodlenet/service';\nimport SendActivityModal from 'core/moodlenet/send_activity_modal';\n\nconst TYPE_ACTIVITY = \"activity\";\n\nlet currentModal;\nlet siteSupportUrl;\nlet issuerId;\nlet courseId;\nlet cmId;\nlet shareFormat;\n\n/**\n * Handle send to MoodleNet.\n *\n * @param {int} issuerId The OAuth 2 issuer ID.\n * @param {int} cmId The course module ID.\n * @param {int} shareFormat The share format.\n */\nconst sendToMoodleNet = (issuerId, cmId, shareFormat) => {\n    const $modal = currentModal.getModal();\n    const modal = $modal[0];\n    modal.querySelector('.modal-header').classList.remove('no-border');\n    modal.querySelector('.modal-header').classList.add('no-header-text');\n\n    currentModal.setBody(Templates.render('core/moodlenet/send_activity_modal_packaging', {}));\n    currentModal.hideFooter();\n\n    MoodleNetService.sendActivity(issuerId, cmId, shareFormat).then(async(data) => {\n        const status = data.status;\n        const resourceUrl = data.resourceurl;\n        return responseFromMoodleNet(status, resourceUrl);\n    }).catch(displayException);\n};\n\n/**\n * Handle response from MoodleNet.\n *\n * @param {boolean} status Response status. True if successful.\n * @param {String} resourceUrl Resource URL.\n */\nconst responseFromMoodleNet = (status, resourceUrl = '') => {\n    const $modal = currentModal.getModal();\n    const modal = $modal[0];\n    modal.querySelector('.modal-header').classList.add('no-border');\n    currentModal.setBody(Templates.render('core/moodlenet/send_activity_modal_done', {\n        success: status,\n        sitesupporturl: siteSupportUrl,\n    }));\n\n    if (status) {\n        currentModal.setFooter(Templates.render('core/moodlenet/send_activity_modal_footer_view', {\n            resourceurl: resourceUrl,\n        }));\n        currentModal.showFooter();\n    }\n};\n\n/**\n * Handle authorization with MoodleNet server.\n *\n * @param {int} issuerId The OAuth 2 issuer ID.\n * @return {promise}\n */\nconst handleAuthorization = (issuerId) => {\n    const windowsizewidth = 550;\n    const windowsizeheight = 550;\n\n    // Check if the user is authorized with MoodleNet or not.\n    return MoodleNetService.authorizationCheck(issuerId, courseId).then(async(data) => {\n        if (!data.status) {\n            // Not yet authorized.\n            // Declare moodleNetAuthorize variable, so we can call it later in the callback.\n            window.moodleNetAuthorize = (error, errorDescription) => {\n                // This will be called by the callback after the authorization is successful.\n                if (error == '') {\n                    handleAuthorization(issuerId);\n                } else if (error !== 'access_denied') {\n                    displayAlert(\n                        'Authorization error',\n                        'Error: ' + error + '<br><br>Error description: ' + errorDescription,\n                        'Cancel'\n                    );\n                }\n            };\n            // Open the login url of the OAuth 2 issuer for user to login into MoodleNet and authorize.\n            return window.open(data.loginurl, 'moodlenet_auth',\n                `location=0,status=0,width=${windowsizewidth},height=${windowsizeheight},scrollbars=yes`);\n        } else {\n            // Already authorized.\n            return sendToMoodleNet(issuerId, cmId, shareFormat);\n        }\n    }).catch(displayException);\n};\n\n/**\n * Register events.\n */\nconst registerEventListeners = () => {\n    document.addEventListener('click', e => {\n        const shareAction = e.target.closest('[data-action=\"sendtomoodlenet\"]');\n        const sendAction = e.target.closest('.moodlenet-action-buttons [data-action=\"share\"]');\n        if (shareAction) {\n            e.preventDefault();\n            const type = shareAction.getAttribute('data-type');\n            const shareType = shareAction.getAttribute('data-sharetype');\n            const cmId = Config.contextInstanceId;\n            if (type == TYPE_ACTIVITY) {\n                MoodleNetService.getActivityInformation(cmId).then(async(data) => {\n                    if (data.status) {\n                        siteSupportUrl = data.supportpageurl;\n                        issuerId = data.issuerid;\n                        const modalPromise = ModalFactory.create({\n                            type: SendActivityModal.TYPE,\n                            large: true,\n                            templateContext: {\n                                'activitytype': data.type,\n                                'activityname': data.name,\n                                'sharetype': await getString('moodlenet:sharetype' + shareType, 'moodle'),\n                                'server': data.server,\n                            }\n                        });\n                        return modalPromise.then(modal => {\n                            currentModal = modal;\n                            modal.show();\n                            return modal;\n                        }).catch(displayException);\n                    } else {\n                        return addNotification({\n                            message: data.warnings[0].message,\n                            type: 'error'\n                        });\n                    }\n                }).catch(displayException);\n            }\n        }\n\n        if (sendAction) {\n            e.preventDefault();\n            courseId = Config.courseId;\n            cmId = Config.contextInstanceId;\n            shareFormat = 0;\n            handleAuthorization(issuerId);\n        }\n    });\n};\n\n/**\n * Initialize.\n */\nexport const init = () => {\n    Prefetch.prefetchTemplates([\n        'core/moodlenet/send_activity_modal_base',\n        'core/moodlenet/send_activity_modal_packaging',\n        'core/moodlenet/send_activity_modal_done',\n        'core/moodlenet/send_activity_modal_footer_view',\n    ]);\n    registerEventListeners();\n};\n"],"names":["currentModal","siteSupportUrl","issuerId","courseId","cmId","shareFormat","responseFromMoodleNet","status","resourceUrl","$modal","getModal","modal","querySelector","classList","add","setBody","Templates","render","success","sitesupporturl","setFooter","resourceurl","showFooter","handleAuthorization","MoodleNetService","authorizationCheck","then","async","data","remove","hideFooter","sendActivity","catch","displayException","sendToMoodleNet","window","moodleNetAuthorize","error","errorDescription","open","loginurl","prefetchTemplates","document","addEventListener","e","shareAction","target","closest","sendAction","preventDefault","type","getAttribute","shareType","Config","contextInstanceId","getActivityInformation","supportpageurl","issuerid","ModalFactory","create","SendActivityModal","TYPE","large","templateContext","name","server","show","message","warnings"],"mappings":";;;;;;;;0YAmCIA,aACAC,eACAC,SACAC,SACAC,KACAC,kBA+BEC,sBAAwB,SAACC,YAAQC,mEAAc,SAC3CC,OAAST,aAAaU,WACtBC,MAAQF,OAAO,GACrBE,MAAMC,cAAc,iBAAiBC,UAAUC,IAAI,aACnDd,aAAae,QAAQC,UAAUC,OAAO,0CAA2C,CAC7EC,QAASX,OACTY,eAAgBlB,kBAGhBM,SACAP,aAAaoB,UAAUJ,UAAUC,OAAO,iDAAkD,CACtFI,YAAab,eAEjBR,aAAasB,eAUfC,oBAAuBrB,UAKlBsB,iBAAiBC,mBAAmBvB,SAAUC,UAAUuB,MAAKC,MAAAA,MAC3DC,KAAKrB,OAnDM,EAACL,SAAUE,KAAMC,qBAE/BM,MADSX,aAAaU,WACP,GACrBC,MAAMC,cAAc,iBAAiBC,UAAUgB,OAAO,aACtDlB,MAAMC,cAAc,iBAAiBC,UAAUC,IAAI,kBAEnDd,aAAae,QAAQC,UAAUC,OAAO,+CAAgD,KACtFjB,aAAa8B,aAEbN,iBAAiBO,aAAa7B,SAAUE,KAAMC,aAAaqB,MAAKC,MAAAA,aACtDpB,OAASqB,KAAKrB,OACdC,YAAcoB,KAAKP,mBAClBf,sBAAsBC,OAAQC,gBACtCwB,MAAMC,0BA0DMC,CAAgBhC,SAAUE,KAAMC,cAjBvC8B,OAAOC,mBAAqB,CAACC,MAAOC,oBAEnB,IAATD,MACAd,oBAAoBrB,UACH,kBAAVmC,+BAEH,sBACA,UAAYA,MAAQ,8BAAgCC,iBACpD,WAKLH,OAAOI,KAAKX,KAAKY,SAAU,qDArBlB,uBACC,2BA0BtBR,MAAMC,uCA0DO,uB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