Your IP : 192.168.165.1


Current Path : C:/Users/Mahmood/Desktop/moodle8/user/amd/build/
Upload File :
Current File : C:/Users/Mahmood/Desktop/moodle8/user/amd/build/participants.min.js.map

{"version":3,"sources":["../src/participants.js"],"names":["define","$","Str","ModalFactory","ModalEvents","Templates","Notification","Ajax","SELECTORS","BULKACTIONSELECT","BULKUSERCHECKBOXES","BULKUSERNOSCHECKBOXES","BULKUSERSELECTEDCHECKBOXES","BULKACTIONFORM","CHECKALLBUTTON","CHECKALLNOSBUTTON","Participants","options","courseId","courseid","noteStateNames","stateHelpIcon","attachEventListeners","prototype","modal","on","e","action","target","val","indexOf","preventDefault","ids","each","index","ele","name","attr","id","replace","push","showSendMessage","fail","exception","showAddNote","prop","length","submit","bind","showallink","data","window","location","users","Deferred","resolve","promise","states","key","value","label","selected","context","stateNames","titlePromise","get_string","when","create","type","types","SAVE_CANCEL","body","render","then","title","setTitle","setSaveButtonText","getRoot","hidden","notification","focus","remove","save","submitAddNote","show","noteText","find","publishState","notes","i","userid","text","publishstate","call","methodname","args","noteIds","msg","addNotification","message","catch","submitSendMessage","messageText","messages","touserid","messageIds"],"mappings":"AAwBAA,OAAM,0BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAkE,gBAAlE,CAAoF,mBAApF,CAAyG,WAAzG,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA4CC,CAA5C,CAAuDC,CAAvD,CAAqEC,CAArE,CAA2E,IAE3EC,CAAAA,CAAS,CAAG,CACZC,gBAAgB,CAAE,eADN,CAEZC,kBAAkB,CAAE,oBAFR,CAGZC,qBAAqB,CAAE,+BAHX,CAIZC,0BAA0B,CAAE,4BAJhB,CAKZC,cAAc,CAAE,mBALJ,CAMZC,cAAc,CAAE,WANJ,CAOZC,iBAAiB,CAAE,cAPP,CAF+D,CAkB3EC,CAAY,CAAG,SAASC,CAAT,CAAkB,CAEjC,KAAKC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,CAAG,KAAK9E,KAAL,CAAWqD,OAAX,GAAqBS,IAArB,CAA0B,eAA1B,EAA2CzD,GAA3C,EAFqC,CAInD0E,CAAQ,CAAG,EAJwC,CAKnDd,CAAC,CAAG,CAL+C,CAOvD,IAAKA,CAAC,CAAG,CAAT,CAAYA,CAAC,CAAGpC,CAAK,CAACP,MAAtB,CAA8B2C,CAAC,EAA/B,CAAmC,CAC/Bc,CAAQ,CAAC/D,IAAT,CAAc,CAACgE,QAAQ,CAAEnD,CAAK,CAACoC,CAAD,CAAhB,CAAqBE,IAAI,CAAEW,CAA3B,CAAd,CACH,CAED,MAAO/F,CAAAA,CAAI,CAACsF,IAAL,CAAU,CAAC,CACdC,UAAU,CAAE,oCADE,CAEdC,IAAI,CAAE,CAACQ,QAAQ,CAAEA,CAAX,CAFQ,CAAD,CAAV,EAGH,CAHG,EAGA9B,IAHA,CAGK,SAASgC,CAAT,CAAqB,CAC7B,GAAyB,CAArB,EAAAA,CAAU,CAAC3D,MAAf,CAA4B,CACxB,MAAO5C,CAAAA,CAAG,CAAC+D,UAAJ,CAAe,2BAAf,CAA4C,cAA5C,CACV,CAFD,IAEO,CACH,MAAO/D,CAAAA,CAAG,CAAC+D,UAAJ,CAAe,qBAAf,CAAsC,cAAtC,CAAsDwC,CAAU,CAAC3D,MAAjE,CACV,CACJ,CATM,EASJ2B,IATI,CASC,SAASwB,CAAT,CAAc,CAClB3F,CAAY,CAAC4F,eAAb,CAA6B,CACzBC,OAAO,CAAEF,CADgB,CAEzB7B,IAAI,CAAE,SAFmB,CAA7B,EAIA,QACH,CAfM,EAeJgC,KAfI,CAeE9F,CAAY,CAACqC,SAff,CAgBV,CA3BD,CA6BA,MAAmD,CAU/C,KAAQ,cAAS1B,CAAT,CAAkB,CACtB,MAAO,IAAID,CAAAA,CAAJ,CAAiBC,CAAjB,CACV,CAZ8C,CActD,CAhTK,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 * Some UI stuff for participants page.\n * This is also used by the report/participants/index.php because it has the same functionality.\n *\n * @module     core_user/participants\n * @package    core_user\n * @copyright  2017 Damyon Wiese\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/templates', 'core/notification', 'core/ajax'],\n        function($, Str, ModalFactory, ModalEvents, Templates, Notification, Ajax) {\n\n    var SELECTORS = {\n        BULKACTIONSELECT: \"#formactionid\",\n        BULKUSERCHECKBOXES: \"input.usercheckbox\",\n        BULKUSERNOSCHECKBOXES: \"input.usercheckbox[value='0']\",\n        BULKUSERSELECTEDCHECKBOXES: \"input.usercheckbox:checked\",\n        BULKACTIONFORM: \"#participantsform\",\n        CHECKALLBUTTON: \"#checkall\",\n        CHECKALLNOSBUTTON: \"#checkallnos\"\n    };\n\n    /**\n     * Constructor\n     *\n     * @param {Object} options Object containing options. Contextid is required.\n     * Each call to templates.render gets it's own instance of this class.\n     */\n    var Participants = function(options) {\n\n        this.courseId = options.courseid;\n        this.noteStateNames = options.noteStateNames;\n        this.stateHelpIcon = options.stateHelpIcon;\n\n        this.attachEventListeners();\n    };\n    // Class variables and functions.\n\n    /**\n     * @var {Modal} modal\n     * @private\n     */\n    Participants.prototype.modal = null;\n\n    /**\n     * @var {int} courseId\n     * @private\n     */\n    Participants.prototype.courseId = -1;\n\n    /**\n     * @var {Object} noteStateNames\n     * @private\n     */\n    Participants.prototype.noteStateNames = {};\n\n    /**\n     * @var {String} stateHelpIcon\n     * @private\n     */\n    Participants.prototype.stateHelpIcon = \"\";\n\n    /**\n     * Private method\n     *\n     * @method attachEventListeners\n     * @private\n     */\n    Participants.prototype.attachEventListeners = function() {\n        $(SELECTORS.BULKACTIONSELECT).on('change', function(e) {\n            var action = $(e.target).val();\n            if (action.indexOf('#') !== -1) {\n                e.preventDefault();\n\n                var ids = [];\n                $(SELECTORS.BULKUSERSELECTEDCHECKBOXES).each(function(index, ele) {\n                    var name = $(ele).attr('name');\n                    var id = name.replace('user', '');\n                    ids.push(id);\n                });\n\n                if (action == '#messageselect') {\n                    this.showSendMessage(ids).fail(Notification.exception);\n                } else if (action == '#addgroupnote') {\n                    this.showAddNote(ids).fail(Notification.exception);\n                }\n                $(SELECTORS.BULKACTIONSELECT + ' option[value=\"\"]').prop('selected', 'selected');\n            } else if (action !== '') {\n                if ($(SELECTORS.BULKUSERSELECTEDCHECKBOXES).length > 0) {\n                    $(SELECTORS.BULKACTIONFORM).submit();\n                } else {\n                    $(SELECTORS.BULKACTIONSELECT + ' option[value=\"\"]').prop('selected', 'selected');\n                }\n            }\n        }.bind(this));\n\n        $(SELECTORS.CHECKALLBUTTON).on('click', function() {\n            var showallink = $(this).data('showallink');\n            if (showallink) {\n                window.location = showallink;\n            }\n        });\n\n        $(SELECTORS.CHECKALLNOSBUTTON).on('click', function() {\n            $(SELECTORS.BULKUSERNOSCHECKBOXES).prop('checked', true);\n        });\n    };\n\n    /**\n     * Show the add note popup\n     *\n     * @method showAddNote\n     * @private\n     * @param {int[]} users\n     * @return {Promise}\n     */\n    Participants.prototype.showAddNote = function(users) {\n\n        if (users.length == 0) {\n            // Nothing to do.\n            return $.Deferred().resolve().promise();\n        }\n\n        var states = [];\n        for (var key in this.noteStateNames) {\n            switch (key) {\n                case 'draft':\n                    states.push({value: 'personal', label: this.noteStateNames[key]});\n                    break;\n                case 'public':\n                    states.push({value: 'course', label: this.noteStateNames[key], selected: 1});\n                    break;\n                case 'site':\n                    states.push({value: key, label: this.noteStateNames[key]});\n                    break;\n            }\n        }\n\n        var context = {stateNames: states, stateHelpIcon: this.stateHelpIcon};\n        var titlePromise = null;\n        if (users.length == 1) {\n            titlePromise = Str.get_string('addbulknotesingle', 'core_notes');\n        } else {\n            titlePromise = Str.get_string('addbulknote', 'core_notes', users.length);\n        }\n\n        return $.when(\n            ModalFactory.create({\n                type: ModalFactory.types.SAVE_CANCEL,\n                body: Templates.render('core_user/add_bulk_note', context)\n            }),\n            titlePromise\n        ).then(function(modal, title) {\n            // Keep a reference to the modal.\n            this.modal = modal;\n            this.modal.setTitle(title);\n            this.modal.setSaveButtonText(title);\n\n            // We want to focus on the action select when the dialog is closed.\n            this.modal.getRoot().on(ModalEvents.hidden, function() {\n                var notification = $('#user-notifications [role=alert]');\n                if (notification.length) {\n                    notification.focus();\n                } else {\n                    $(SELECTORS.BULKACTIONSELECT).focus();\n                }\n                this.modal.getRoot().remove();\n            }.bind(this));\n\n            this.modal.getRoot().on(ModalEvents.save, this.submitAddNote.bind(this, users));\n\n            this.modal.show();\n\n            return this.modal;\n        }.bind(this));\n    };\n\n    /**\n     * Add a note to this list of users.\n     *\n     * @method submitAddNote\n     * @private\n     * @param {int[]} users\n     * @return {Promise}\n     */\n    Participants.prototype.submitAddNote = function(users) {\n        var noteText = this.modal.getRoot().find('form textarea').val();\n        var publishState = this.modal.getRoot().find('form select').val();\n        var notes = [],\n            i = 0;\n\n        for (i = 0; i < users.length; i++) {\n            notes.push({userid: users[i], text: noteText, courseid: this.courseId, publishstate: publishState});\n        }\n\n        return Ajax.call([{\n            methodname: 'core_notes_create_notes',\n            args: {notes: notes}\n        }])[0].then(function(noteIds) {\n            if (noteIds.length == 1) {\n                return Str.get_string('addbulknotedonesingle', 'core_notes');\n            } else {\n                return Str.get_string('addbulknotedone', 'core_notes', noteIds.length);\n            }\n        }).then(function(msg) {\n            Notification.addNotification({\n                message: msg,\n                type: \"success\"\n            });\n            return true;\n        }).catch(Notification.exception);\n    };\n\n    /**\n     * Show the send message popup.\n     *\n     * @method showSendMessage\n     * @private\n     * @param {int[]} users\n     * @return {Promise}\n     */\n    Participants.prototype.showSendMessage = function(users) {\n\n        if (users.length == 0) {\n            // Nothing to do.\n            return $.Deferred().resolve().promise();\n        }\n        var titlePromise = null;\n        if (users.length == 1) {\n            titlePromise = Str.get_string('sendbulkmessagesingle', 'core_message');\n        } else {\n            titlePromise = Str.get_string('sendbulkmessage', 'core_message', users.length);\n        }\n\n        return $.when(\n            ModalFactory.create({\n                type: ModalFactory.types.SAVE_CANCEL,\n                body: Templates.render('core_user/send_bulk_message', {})\n            }),\n            titlePromise\n        ).then(function(modal, title) {\n            // Keep a reference to the modal.\n            this.modal = modal;\n\n            this.modal.setTitle(title);\n            this.modal.setSaveButtonText(title);\n\n            // We want to focus on the action select when the dialog is closed.\n            this.modal.getRoot().on(ModalEvents.hidden, function() {\n                $(SELECTORS.BULKACTIONSELECT).focus();\n                this.modal.getRoot().remove();\n            }.bind(this));\n\n            this.modal.getRoot().on(ModalEvents.save, this.submitSendMessage.bind(this, users));\n\n            this.modal.show();\n\n            return this.modal;\n        }.bind(this));\n    };\n\n    /**\n     * Send a message to these users.\n     *\n     * @method submitSendMessage\n     * @private\n     * @param {int[]} users\n     * @param {Event} e Form submission event.\n     * @return {Promise}\n     */\n    Participants.prototype.submitSendMessage = function(users) {\n\n        var messageText = this.modal.getRoot().find('form textarea').val();\n\n        var messages = [],\n            i = 0;\n\n        for (i = 0; i < users.length; i++) {\n            messages.push({touserid: users[i], text: messageText});\n        }\n\n        return Ajax.call([{\n            methodname: 'core_message_send_instant_messages',\n            args: {messages: messages}\n        }])[0].then(function(messageIds) {\n            if (messageIds.length == 1) {\n                return Str.get_string('sendbulkmessagesentsingle', 'core_message');\n            } else {\n                return Str.get_string('sendbulkmessagesent', 'core_message', messageIds.length);\n            }\n        }).then(function(msg) {\n            Notification.addNotification({\n                message: msg,\n                type: \"success\"\n            });\n            return true;\n        }).catch(Notification.exception);\n    };\n\n    return /** @alias module:core_user/participants */ {\n        // Public variables and functions.\n\n        /**\n         * Initialise the unified user filter.\n         *\n         * @method init\n         * @param {Object} options - List of options.\n         * @return {Participants}\n         */\n        'init': function(options) {\n            return new Participants(options);\n        }\n    };\n});\n"],"file":"participants.min.js"}