Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/admin/tool/lp/amd/build/parentcompetency_form.min.js.map

{"version":3,"sources":["../src/parentcompetency_form.js"],"names":["define","$","ajax","Str","Picker","Templates","Notification","ParentCompetencyForm","buttonSelector","inputHiddenSelector","staticElementSelector","frameworkId","pageContextId","registerEvents","prototype","setParent","data","self","competencyId","call","methodname","args","id","done","competency","html","shortname","val","fail","exception","get_string","then","rootframework","on","e","preventDefault","picker","_render","_preRender","context","competencies","_competencies","framework","_getFramework","_frameworkId","frameworks","_frameworks","search","_searchText","singleFramework","_singleFramework","render","display","init","inputSelector"],"mappings":"AAuBAA,OAAM,iCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,UAAxB,CAAoC,0BAApC,CAAgE,gBAAhE,CAAkF,mBAAlF,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAuBC,CAAvB,CAA+BC,CAA/B,CAA0CC,CAA1C,CAAwD,CAUxD,GAAIC,CAAAA,CAAoB,CAAG,SAASC,CAAT,CACSC,CADT,CAESC,CAFT,CAGSC,CAHT,CAISC,CAJT,CAIwB,CAC/C,KAAKJ,cAAL,CAAsBA,CAAtB,CACA,KAAKC,mBAAL,CAA2BA,CAA3B,CACA,KAAKC,qBAAL,CAA6BA,CAA7B,CACA,KAAKC,WAAL,CAAmBA,CAAnB,CACA,KAAKC,aAAL,CAAqBA,CAArB,CAGA,KAAKC,cAAL,EACH,CAbD,CAgBAN,CAAoB,CAACO,SAArB,CAA+BN,cAA/B,CAAgD,IAAhD,CAEAD,CAAoB,CAACO,SAArB,CAA+BL,mBAA/B,CAAqD,IAArD,CAEAF,CAAoB,CAACO,SAArB,CAA+BJ,qBAA/B,CAAuD,IAAvD,CAEAH,CAAoB,CAACO,SAArB,CAA+BH,WAA/B,CAA6C,IAA7C,CAEAJ,CAAoB,CAACO,SAArB,CAA+BF,aAA/B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,CAAWa,CAAI,CAACL,aAAhB,CAA+BK,CAAI,CAACN,WAApC,CAAiD,MAAjD,IAAb,CAGAyB,CAAM,CAACC,OAAP,CAAiB,UAAW,CACxB,GAAIpB,CAAAA,CAAI,CAAG,IAAX,CACA,MAAOA,CAAAA,CAAI,CAACqB,UAAL,GAAkBP,IAAlB,CAAuB,UAAW,CACrC,GAAIQ,CAAAA,CAAO,CAAG,CACVC,YAAY,CAAEvB,CAAI,CAACwB,aADT,CAEVC,SAAS,CAAEzB,CAAI,CAAC0B,aAAL,CAAmB1B,CAAI,CAAC2B,YAAxB,CAFD,CAGVC,UAAU,CAAE5B,CAAI,CAAC6B,WAHP,CAIVC,MAAM,CAAE9B,CAAI,CAAC+B,WAJH,CAKVC,eAAe,CAAEhC,CAAI,CAACiC,gBALZ,CAAd,CAQA,MAAO7C,CAAAA,CAAS,CAAC8C,MAAV,CAAiB,0CAAjB,CAA6DZ,CAA7D,CACV,CAVM,CAWV,CAbD,CAgBAH,CAAM,CAACH,EAAP,CAAU,MAAV,CAAkB,SAASC,CAAT,CAAYlB,CAAZ,CAAkB,CAChCC,CAAI,CAACF,SAAL,CAAeC,CAAf,CACH,CAFD,EAIAoB,CAAM,CAACgB,OAAP,EACH,CA3BD,CA4BH,CAhCD,CAkCA,MAAO,CAWHC,IAAI,CAAE,cAAS7C,CAAT,CACU8C,CADV,CAEU5C,CAFV,CAGUC,CAHV,CAIUC,CAJV,CAIyB,CAE3B,GAAIL,CAAAA,CAAJ,CAAyBC,CAAzB,CACwB8C,CADxB,CAEwB5C,CAFxB,CAGwBC,CAHxB,CAIwBC,CAJxB,CAKH,CAtBE,CAwBV,CAhIK,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 * Handle selecting parent competency in competency form.\n *\n * @module     tool_lp/parentcompetency_form\n * @package    tool_lp\n * @copyright  2015 Issam Taboubi <issam.taboubi@umontreal.ca>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/str', 'tool_lp/competencypicker', 'core/templates', 'core/notification'],\n    function($, ajax, Str, Picker, Templates, Notification) {\n\n    /**\n     * Parent Competency Form object.\n     * @param {String} buttonSelector The parent competency button selector.\n     * @param {String} inputHiddenSelector The hidden input field selector.\n     * @param {String} staticElementSelector The static element displaying the parent competency.\n     * @param {Number} frameworkId The competency framework ID.\n     * @param {Number} pageContextId The page context ID.\n     */\n    var ParentCompetencyForm = function(buttonSelector,\n                                        inputHiddenSelector,\n                                        staticElementSelector,\n                                        frameworkId,\n                                        pageContextId) {\n        this.buttonSelector = buttonSelector;\n        this.inputHiddenSelector = inputHiddenSelector;\n        this.staticElementSelector = staticElementSelector;\n        this.frameworkId = frameworkId;\n        this.pageContextId = pageContextId;\n\n        // Register the events.\n        this.registerEvents();\n    };\n\n    /** @var {String} The parent competency button selector. */\n    ParentCompetencyForm.prototype.buttonSelector = null;\n    /** @var {String} The hidden input field selector. */\n    ParentCompetencyForm.prototype.inputHiddenSelector = null;\n    /** @var {String} The static element displaying the parent competency. */\n    ParentCompetencyForm.prototype.staticElementSelector = null;\n    /** @var {Number} The competency framework ID. */\n    ParentCompetencyForm.prototype.frameworkId = null;\n    /** @var {Number} The page context ID. */\n    ParentCompetencyForm.prototype.pageContextId = null;\n\n    /**\n     * Set the parent competency in the competency form.\n     *\n     * @param {Object} data Data containing selected competency.\n     * @method setParent\n     */\n    ParentCompetencyForm.prototype.setParent = function(data) {\n        var self = this;\n\n        if (data.competencyId !== 0) {\n            ajax.call([\n                {methodname: 'core_competency_read_competency', args: {\n                    id: data.competencyId\n                }}\n            ])[0].done(function(competency) {\n                $(self.staticElementSelector).html(competency.shortname);\n                $(self.inputHiddenSelector).val(competency.id);\n            }).fail(Notification.exception);\n        } else {\n            // Root of competency framework selected.\n            Str.get_string('competencyframeworkroot', 'tool_lp').then(function(rootframework) {\n                $(self.staticElementSelector).html(rootframework);\n                $(self.inputHiddenSelector).val(data.competencyId);\n                return;\n            }).fail(Notification.exception);\n        }\n    };\n\n    /**\n     * Register the events of parent competency button click.\n     *\n     * @method registerEvents\n     */\n    ParentCompetencyForm.prototype.registerEvents = function() {\n        var self = this;\n\n        // Event on edit parent button.\n        $(self.buttonSelector).on('click', function(e) {\n            e.preventDefault();\n\n            var picker = new Picker(self.pageContextId, self.frameworkId, 'self', false);\n\n            // Override the render method to make framework selectable.\n            picker._render = function() {\n                var self = this;\n                return self._preRender().then(function() {\n                    var context = {\n                        competencies: self._competencies,\n                        framework: self._getFramework(self._frameworkId),\n                        frameworks: self._frameworks,\n                        search: self._searchText,\n                        singleFramework: self._singleFramework,\n                    };\n\n                    return Templates.render('tool_lp/competency_picker_competencyform', context);\n                });\n            };\n\n            // On selected competency.\n            picker.on('save', function(e, data) {\n                self.setParent(data);\n            });\n\n            picker.display();\n        });\n    };\n\n    return {\n\n        /**\n         * Main initialisation.\n         * @param {String} buttonSelector The parent competency button selector.\n         * @param {String} inputSelector The hidden input field selector.\n         * @param {String} staticElementSelector The static element displaying the parent competency.\n         * @param {Number} frameworkId The competency framework ID.\n         * @param {Number} pageContextId The page context ID.\n         * @method init\n         */\n        init: function(buttonSelector,\n                        inputSelector,\n                        staticElementSelector,\n                        frameworkId,\n                        pageContextId) {\n            // Create instance.\n            new ParentCompetencyForm(buttonSelector,\n                                    inputSelector,\n                                    staticElementSelector,\n                                    frameworkId,\n                                    pageContextId);\n        }\n    };\n});\n"],"file":"parentcompetency_form.min.js"}