Your IP : 216.73.216.95


Current Path : /var/www/ljmtc/cbt/message/amd/build/
Upload File :
Current File : /var/www/ljmtc/cbt/message/amd/build/preferences_processor_form.min.js.map

{"version":3,"sources":["../src/preferences_processor_form.js"],"names":["define","$","Ajax","Notification","ProcessorForm","element","root","userId","attr","name","find","on","e","preventDefault","save","done","trigger","bind","prototype","startLoading","addClass","stopLoading","removeClass","isLoading","hasClass","Deferred","data","serializeArray","request","methodname","args","userid","formvalues","call","fail","exception","always"],"mappings":"AAwBAA,OAAM,2CAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,mBAAxB,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAgC,CAMpC,GAAIC,CAAAA,CAAa,CAAG,SAASC,CAAT,CAAkB,CAClC,KAAKC,IAAL,CAAYL,CAAC,CAACI,CAAD,CAAb,CACA,KAAKE,MAAL,CAAc,KAAKD,IAAL,CAAUE,IAAV,CAAe,cAAf,CAAd,CACA,KAAKC,IAAL,CAAY,KAAKH,IAAL,CAAUE,IAAV,CAAe,qBAAf,CAAZ,CAEA,KAAKF,IAAL,CAAUI,IAAV,CAAe,MAAf,EAAuBC,EAAvB,CAA0B,QAA1B,CAAoC,SAASC,CAAT,CAAY,CAC5CA,CAAC,CAACC,cAAF,GACA,KAAKC,IAAL,GAAYC,IAAZ,CAAiB,UAAW,CACxBd,CAAC,CAACI,CAAD,CAAD,CAAWW,OAAX,CAAmB,mBAAnB,CACH,CAFD,CAGH,CALmC,CAKlCC,IALkC,CAK7B,IAL6B,CAApC,CAMH,CAXD,CAkBAb,CAAa,CAACc,SAAd,CAAwBC,YAAxB,CAAuC,UAAW,CAC9C,KAAKb,IAAL,CAAUc,QAAV,CAAmB,SAAnB,CACH,CAFD,CASAhB,CAAa,CAACc,SAAd,CAAwBG,WAAxB,CAAsC,UAAW,CAC7C,KAAKf,IAAL,CAAUgB,WAAV,CAAsB,SAAtB,CACH,CAFD,CAUAlB,CAAa,CAACc,SAAd,CAAwBK,SAAxB,CAAoC,UAAW,CAC3C,MAAO,MAAKjB,IAAL,CAAUkB,QAAV,CAAmB,SAAnB,CACV,CAFD,CAUApB,CAAa,CAACc,SAAd,CAAwBJ,IAAxB,CAA+B,UAAW,CACtC,GAAI,KAAKS,SAAL,EAAJ,CAAsB,CAClB,MAAOtB,CAAAA,CAAC,CAACwB,QAAF,EACV,CAED,KAAKN,YAAL,GALsC,GAOlCO,CAAAA,CAAI,CAAG,KAAKpB,IAAL,CAAUI,IAAV,CAAe,MAAf,EAAuBiB,cAAvB,EAP2B,CAQlCC,CAAO,CAAG,CACVC,UAAU,CAAE,4CADF,CAEVC,IAAI,CAAE,CACFC,MAAM,CAAE,KAAKxB,MADX,CAEFE,IAAI,CAAE,KAAKA,IAFT,CAGFuB,UAAU,CAAEN,CAHV,CAFI,CARwB,CAiBtC,MAAOxB,CAAAA,CAAI,CAAC+B,IAAL,CAAU,CAACL,CAAD,CAAV,EAAqB,CAArB,EACFM,IADE,CACG/B,CAAY,CAACgC,SADhB,EAEFC,MAFE,CAEK,UAAW,CACf,KAAKf,WAAL,EACH,CAFO,CAENJ,IAFM,CAED,IAFC,CAFL,CAKV,CAtBD,CAwBA,MAAOb,CAAAA,CACV,CA/EK,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 * Manages the processor form on the message preferences page.\n *\n * @module     core_message/preferences_processor_form\n * @class      preferences_processor_form\n * @package    message\n * @copyright  2016 Ryan Wyllie <ryan@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/notification'],\n        function($, Ajax, Notification) {\n    /**\n     * Constructor for the ProcessorForm.\n     *\n     * @param {object} element jQuery object root element of the preference\n     */\n    var ProcessorForm = function(element) {\n        this.root = $(element);\n        this.userId = this.root.attr('data-user-id');\n        this.name = this.root.attr('data-processor-name');\n\n        this.root.find('form').on('submit', function(e) {\n            e.preventDefault();\n            this.save().done(function() {\n                $(element).trigger('mpp:formsubmitted');\n            });\n        }.bind(this));\n    };\n\n    /**\n     * Flag the processor as loading.\n     *\n     * @method startLoading\n     */\n    ProcessorForm.prototype.startLoading = function() {\n        this.root.addClass('loading');\n    };\n\n    /**\n     * Remove the loading flag for this processor.\n     *\n     * @method stopLoading\n     */\n    ProcessorForm.prototype.stopLoading = function() {\n        this.root.removeClass('loading');\n    };\n\n    /**\n     * Check if this processor is loading.\n     *\n     * @method isLoading\n     * @return {bool}\n     */\n    ProcessorForm.prototype.isLoading = function() {\n        return this.root.hasClass('loading');\n    };\n\n    /**\n     * Persist the processor configuration.\n     *\n     * @method save\n     * @return {object} jQuery promise\n     */\n    ProcessorForm.prototype.save = function() {\n        if (this.isLoading()) {\n            return $.Deferred();\n        }\n\n        this.startLoading();\n\n        var data = this.root.find('form').serializeArray();\n        var request = {\n            methodname: 'core_message_message_processor_config_form',\n            args: {\n                userid: this.userId,\n                name: this.name,\n                formvalues: data,\n            }\n        };\n\n        return Ajax.call([request])[0]\n            .fail(Notification.exception)\n            .always(function() {\n                this.stopLoading();\n            }.bind(this));\n    };\n\n    return ProcessorForm;\n});\n"],"file":"preferences_processor_form.min.js"}