Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/admin/tool/policy/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/admin/tool/policy/amd/build/policyactions.min.js.map

{"version":3,"sources":["../src/policyactions.js"],"names":["define","$","Ajax","Notification","ModalFactory","ModalEvents","PolicyActions","root","registerEvents","prototype","on","e","preventDefault","versionid","data","behalfid","modalTitle","Deferred","modalBody","modal","create","title","body","large","then","getRoot","hidden","destroy","show","catch","exception","promises","call","methodname","args","when","result","policy","resolve","name","content","Error","warnings","message","hide","addNotification","type"],"mappings":"AAuBAA,OAAM,6BAAC,CACH,QADG,CAEH,WAFG,CAGH,mBAHG,CAIH,oBAJG,CAKH,mBALG,CAAD,CAMN,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAgCC,CAAhC,CAA8CC,CAA9C,CAA2D,CAKvD,GAAIC,CAAAA,CAAa,CAAG,SAASC,CAAT,CAAe,CAC/B,KAAKC,cAAL,CAAoBD,CAApB,CACH,CAFD,CAOAD,CAAa,CAACG,SAAd,CAAwBD,cAAxB,CAAyC,SAASD,CAAT,CAAe,CACpDA,CAAI,CAACG,EAAL,CAAQ,OAAR,CAAiB,SAASC,CAAT,CAAY,CACzBA,CAAC,CAACC,cAAF,GADyB,GAGrBC,CAAAA,CAAS,CAAGZ,CAAC,CAAC,IAAD,CAAD,CAAQa,IAAR,CAAa,WAAb,CAHS,CAIrBC,CAAQ,CAAGd,CAAC,CAAC,IAAD,CAAD,CAAQa,IAAR,CAAa,UAAb,CAJU,CAgBrBE,CAAU,CAAGf,CAAC,CAACgB,QAAF,EAhBQ,CAiBrBC,CAAS,CAAGjB,CAAC,CAACgB,QAAF,EAjBS,CAmBrBE,CAAK,CAAGf,CAAY,CAACgB,MAAb,CAAoB,CAC5BC,KAAK,CAAEL,CADqB,CAE5BM,IAAI,CAAEJ,CAFsB,CAG5BK,KAAK,GAHuB,CAApB,EAKXC,IALW,CAKN,SAASL,CAAT,CAAgB,CAElBA,C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AE,OAF0B,CAA7B,CAIV,CAtBD,CAuBH,CAjED,CAmEH,CApED,CAsEA,MAAsD,CASlD,KAAQ,cAASvC,CAAT,CAAe,CACnBA,CAAI,CAAGN,CAAC,CAACM,CAAD,CAAR,CACA,MAAO,IAAID,CAAAA,CAAJ,CAAkBC,CAAlB,CACV,CAZiD,CAczD,CAtGK,CAAN","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 * Policy actions.\n *\n * @module     tool_policy/policyactions\n * @package    tool_policy\n * @copyright  2018 Sara Arjona (sara@moodle.com)\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n    'jquery',\n    'core/ajax',\n    'core/notification',\n    'core/modal_factory',\n    'core/modal_events'],\nfunction($, Ajax, Notification, ModalFactory, ModalEvents) {\n\n    /**\n     * PolicyActions class.\n     */\n    var PolicyActions = function(root) {\n        this.registerEvents(root);\n    };\n\n    /**\n     * Register event listeners.\n     */\n    PolicyActions.prototype.registerEvents = function(root) {\n        root.on(\"click\", function(e) {\n            e.preventDefault();\n\n            var versionid = $(this).data('versionid');\n            var behalfid = $(this).data('behalfid');\n\n            var params = {\n                'versionid': versionid,\n                'behalfid': behalfid\n            };\n\n            var request = {\n                methodname: 'tool_policy_get_policy_version',\n                args: params\n            };\n\n            var modalTitle = $.Deferred();\n            var modalBody = $.Deferred();\n\n            var modal = ModalFactory.create({\n                title: modalTitle,\n                body: modalBody,\n                large: true\n            })\n            .then(function(modal) {\n                // Handle hidden event.\n                modal.getRoot().on(ModalEvents.hidden, function() {\n                    // Destroy when hidden.\n                    modal.destroy();\n                });\n\n                return modal;\n            })\n            .then(function(modal) {\n                modal.show();\n\n                return modal;\n            })\n            .catch(Notification.exception);\n\n            // Make the request now that the modal is configured.\n            var promises = Ajax.call([request]);\n            $.when(promises[0]).then(function(data) {\n                if (data.result.policy) {\n                    modalTitle.resolve(data.result.policy.name);\n                    modalBody.resolve(data.result.policy.content);\n\n                    return data;\n                } else {\n                    throw new Error(data.warnings[0].message);\n                }\n            }).catch(function(message) {\n                modal.then(function(modal) {\n                    modal.hide();\n                    modal.destroy();\n\n                    return modal;\n                })\n                .catch(Notification.exception);\n\n                return Notification.addNotification({\n                    message: message,\n                    type: 'error'\n                });\n            });\n        });\n\n    };\n\n    return /** @alias module:tool_policy/policyactions */ {\n        // Public variables and functions.\n\n        /**\n         * Initialise the actions helper.\n         *\n         * @method init\n         * @return {PolicyActions}\n         */\n        'init': function(root) {\n            root = $(root);\n            return new PolicyActions(root);\n        }\n    };\n});\n"],"file":"policyactions.min.js"}