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/user_competency_workflow.min.js.map

{"version":3,"sources":["../src/user_competency_workflow.js"],"names":["define","$","Templates","Ajax","Notification","Str","Menubar","EventBase","UserCompetencyWorkflow","prototype","constructor","apply","Object","create","_nodeSelector","_cancelReviewRequest","data","call","methodname","args","userid","competencyid","then","_trigger","bind","catch","cancelReviewRequest","_cancelReviewRequestHandler","e","preventDefault","_findUserCompetencyData","target","_requestReview","requestReview","_requestReviewHandler","_startReview","startReview","_startReviewHandler","_stopReview","stopReview","_stopReviewHandler","enhanceMenubar","selector","enhance","node","parent","parents","length","Error","registerEvents","wrapper","find","click"],"mappings":"AAuBAA,OAAM,oCAAC,CAAC,QAAD,CACC,gBADD,CAEC,WAFD,CAGC,mBAHD,CAIC,UAJD,CAKC,iBALD,CAMC,oBAND,CAAD,CAOE,SAASC,CAAT,CAAYC,CAAZ,CAAuBC,CAAvB,CAA6BC,CAA7B,CAA2CC,CAA3C,CAAgDC,CAAhD,CAAyDC,CAAzD,CAAoE,CAOxE,GAAIC,CAAAA,CAAsB,CAAG,UAAW,CACpCD,CAAS,CAACE,SAAV,CAAoBC,WAApB,CAAgCC,KAAhC,CAAsC,IAAtC,CAA4C,EAA5C,CACH,CAFD,CAGAH,CAAsB,CAACC,SAAvB,CAAmCG,MAAM,CAACC,MAAP,CAAcN,CAAS,CAACE,SAAxB,CAAnC,CAGAD,CAAsB,CAACC,SAAvB,CAAiCK,aAAjC,CAAiD,iCAAjD,CAQAN,CAAsB,CAACC,SAAvB,CAAiCM,oBAAjC,CAAwD,SAASC,CAAT,CAAe,CACnE,GAAIC,CAAAA,CAAI,CAAG,CACPC,UAAU,CAAE,uDADL,CAEPC,IAAI,CAAE,CACFC,MAAM,CAAEJ,CAAI,CAACI,MADX,CAEFC,YAAY,CAAEL,CAAI,CAACK,YAFjB,CAFC,CAAX,CAQ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C,CAAkD,SAASP,CAAT,CAAmB,CACjE,GAAIQ,CAAAA,CAAO,CAAGjD,CAAC,CAACyC,CAAD,CAAf,CAEAQ,CAAO,CAACC,IAAR,CAAa,kCAAb,EAA+CC,KAA/C,CAAqD,KAAKlB,qBAAL,CAA2BV,IAA3B,CAAgC,IAAhC,CAArD,EACA0B,CAAO,CAACC,IAAR,CAAa,yCAAb,EAAsDC,KAAtD,CAA4D,KAAKzB,2BAAL,CAAiCH,IAAjC,CAAsC,IAAtC,CAA5D,EACA0B,CAAO,CAACC,IAAR,CAAa,gCAAb,EAA6CC,KAA7C,CAAmD,KAAKf,mBAAL,CAAyBb,IAAzB,CAA8B,IAA9B,CAAnD,EACA0B,CAAO,CAACC,IAAR,CAAa,+BAAb,EAA4CC,KAA5C,CAAkD,KAAKZ,kBAAL,CAAwBhB,IAAxB,CAA6B,IAA7B,CAAlD,CACH,CAPD,CASA,MAA4DhB,CAAAA,CAC/D,CAxQK,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 * User competency workflow.\n *\n * @module     tool_lp/user_competency_workflow\n * @package    tool_lp\n * @copyright  2015 Frédéric Massart - FMCorz.net\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery',\n        'core/templates',\n        'core/ajax',\n        'core/notification',\n        'core/str',\n        'tool_lp/menubar',\n        'tool_lp/event_base'],\n        function($, Templates, Ajax, Notification, Str, Menubar, EventBase) {\n\n    /**\n     * UserCompetencyWorkflow class.\n     *\n     * @param {String} selector The node containing the buttons to switch mode.\n     */\n    var UserCompetencyWorkflow = function() {\n        EventBase.prototype.constructor.apply(this, []);\n    };\n    UserCompetencyWorkflow.prototype = Object.create(EventBase.prototype);\n\n    /** @type {String} The selector to find the user competency data. */\n    UserCompetencyWorkflow.prototype._nodeSelector = '[data-node=\"user-competency\"]';\n\n    /**\n     * Cancel a review request and refresh the view.\n     *\n     * @param  {Object} data The user competency data.\n     * @method _cancelReviewRequest\n     */\n    UserCompetencyWorkflow.prototype._cancelReviewRequest = function(data) {\n        var call = {\n            methodname: 'core_competency_user_competency_cancel_review_request',\n            args: {\n                userid: data.userid,\n                competencyid: data.competencyid\n            }\n        };\n\n        Ajax.call([call])[0].then(function() {\n            this._trigger('review-request-cancelled', data);\n            this._trigger('status-changed', data);\n        }.bind(this)).catch(function() {\n            this._trigger('error-occured', data);\n        }.bind(this));\n    };\n\n    /**\n     * Cancel a review request an refresh the view.\n     *\n     * @param  {Object} data The user competency data.\n     * @method cancelReviewRequest\n     */\n    UserCompetencyWorkflow.prototype.cancelReviewRequest = function(data) {\n        this._cancelReviewRequest(data);\n    };\n\n    /**\n     * Cancel a review request handler.\n     *\n     * @param  {Event} e The event.\n     * @method _cancelReviewRequestHandler\n     */\n    UserCompetencyWorkflow.prototype._cancelReviewRequestHandler = function(e) {\n        e.preventDefault();\n        var data = this._findUserCompetencyData($(e.target));\n        this.cancelReviewRequest(data);\n    };\n\n    /**\n     * Request a review and refresh the view.\n     *\n     * @param  {Object} data The user competency data.\n     * @method _requestReview\n     */\n    UserCompetencyWorkflow.prototype._requestReview = function(data) {\n        var call = {\n            methodname: 'core_competency_user_competency_request_review',\n            args: {\n                userid: data.userid,\n                competencyid: data.competencyid\n            }\n        };\n\n        Ajax.call([call])[0].then(function() {\n            this._trigger('review-requested', data);\n            this._trigger('status-changed', data);\n        }.bind(this)).catch(function() {\n            this._trigger('error-occured', data);\n        }.bind(this));\n    };\n\n    /**\n     * Request a review.\n     *\n     * @param  {Object} data The user competency data.\n     * @method requestReview\n     */\n    UserCompetencyWorkflow.prototype.requestReview = function(data) {\n        this._requestReview(data);\n    };\n\n    /**\n     * Request a review handler.\n     *\n     * @param  {Event} e The event.\n     * @method _requestReviewHandler\n     */\n    UserCompetencyWorkflow.prototype._requestReviewHandler = function(e) {\n        e.preventDefault();\n        var data = this._findUserCompetencyData($(e.target));\n        this.requestReview(data);\n    };\n\n    /**\n     * Start a review and refresh the view.\n     *\n     * @param  {Object} data The user competency data.\n     * @method _startReview\n     */\n    UserCompetencyWorkflow.prototype._startReview = function(data) {\n        var call = {\n            methodname: 'core_competency_user_competency_start_review',\n            args: {\n                userid: data.userid,\n                competencyid: data.competencyid\n            }\n        };\n        Ajax.call([call])[0].then(function() {\n            this._trigger('review-started', data);\n            this._trigger('status-changed', data);\n        }.bind(this)).catch(function() {\n            this._trigger('error-occured', data);\n        }.bind(this));\n    };\n\n    /**\n     * Start a review.\n     *\n     * @param  {Object} data The user competency data.\n     * @method startReview\n     */\n    UserCompetencyWorkflow.prototype.startReview = function(data) {\n        this._startReview(data);\n    };\n\n    /**\n     * Start a review handler.\n     *\n     * @param  {Event} e The event.\n     * @method _startReviewHandler\n     */\n    UserCompetencyWorkflow.prototype._startReviewHandler = function(e) {\n        e.preventDefault();\n        var data = this._findUserCompetencyData($(e.target));\n        this.startReview(data);\n    };\n\n    /**\n     * Stop a review and refresh the view.\n     *\n     * @param  {Object} data The user competency data.\n     * @method _stopReview\n     */\n    UserCompetencyWorkflow.prototype._stopReview = function(data) {\n        var call = {\n            methodname: 'core_competency_user_competency_stop_review',\n            args: {\n                userid: data.userid,\n                competencyid: data.competencyid\n            }\n        };\n\n        Ajax.call([call])[0].then(function() {\n            this._trigger('review-stopped', data);\n            this._trigger('status-changed', data);\n        }.bind(this)).catch(function() {\n            this._trigger('error-occured', data);\n        }.bind(this));\n    };\n\n    /**\n     * Stop a review.\n     *\n     * @param  {Object} data The user competency data.\n     * @method stopReview\n     */\n    UserCompetencyWorkflow.prototype.stopReview = function(data) {\n        this._stopReview(data);\n    };\n\n    /**\n     * Stop a review handler.\n     *\n     * @param  {Event} e The event.\n     * @method _stopReviewHandler\n     */\n    UserCompetencyWorkflow.prototype._stopReviewHandler = function(e) {\n        e.preventDefault();\n        var data = this._findUserCompetencyData($(e.target));\n        this.stopReview(data);\n    };\n\n    /**\n     * Enhance a menu bar.\n     *\n     * @param  {String} selector Menubar selector.\n     */\n    UserCompetencyWorkflow.prototype.enhanceMenubar = function(selector) {\n        Menubar.enhance(selector, {\n            '[data-action=\"request-review\"]': this._requestReviewHandler.bind(this),\n            '[data-action=\"cancel-review-request\"]': this._cancelReviewRequestHandler.bind(this),\n        });\n    };\n\n    /**\n     * Find the user competency data from a node.\n     *\n     * @param  {Node} node The node to search from.\n     * @return {Object} User competency data.\n     */\n    UserCompetencyWorkflow.prototype._findUserCompetencyData = function(node) {\n        var parent = node.parents(this._nodeSelector),\n            data;\n\n        if (parent.length != 1) {\n            throw new Error('The evidence node was not located.');\n        }\n\n        data = parent.data();\n        if (typeof data === 'undefined' || typeof data.userid === 'undefined' || typeof data.competencyid === 'undefined') {\n            throw new Error('User competency data could not be found.');\n        }\n\n        return data;\n    };\n\n    /**\n     * Enhance a menu bar.\n     *\n     * @param  {String} selector Menubar selector.\n     */\n    UserCompetencyWorkflow.prototype.enhanceMenubar = function(selector) {\n        Menubar.enhance(selector, {\n            '[data-action=\"request-review\"]': this._requestReviewHandler.bind(this),\n            '[data-action=\"cancel-review-request\"]': this._cancelReviewRequestHandler.bind(this),\n            '[data-action=\"start-review\"]': this._startReviewHandler.bind(this),\n            '[data-action=\"stop-review\"]': this._stopReviewHandler.bind(this),\n        });\n    };\n\n    /**\n     * Register the events in the region.\n     *\n     * @param {String} selector The base selector to search nodes in and attach events.\n     */\n    UserCompetencyWorkflow.prototype.registerEvents = function(selector) {\n        var wrapper = $(selector);\n\n        wrapper.find('[data-action=\"request-review\"]').click(this._requestReviewHandler.bind(this));\n        wrapper.find('[data-action=\"cancel-review-request\"]').click(this._cancelReviewRequestHandler.bind(this));\n        wrapper.find('[data-action=\"start-review\"]').click(this._startReviewHandler.bind(this));\n        wrapper.find('[data-action=\"stop-review\"]').click(this._stopReviewHandler.bind(this));\n    };\n\n    return /** @alias module:tool_lp/user_competency_actions */ UserCompetencyWorkflow;\n});\n"],"file":"user_competency_workflow.min.js"}