%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/vacivi36/ava/message/amd/build/
Upload File :
Create Path :
Current File : //home2/vacivi36/ava/message/amd/build/message_send_bulk.min.js.map

{"version":3,"file":"message_send_bulk.min.js","sources":["../src/message_send_bulk.js"],"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 * Send bulk message to the given user ids.\n *\n * @module     core_message/message_send_bulk\n * @copyright  2019 Shamim Rezaie <shamim@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {get_string} from 'core/str';\nimport ModalFactory from 'core/modal_factory';\nimport Templates from 'core/templates';\nimport ModalEvents from 'core/modal_events';\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Show the send message popup.\n *\n * @method showModal\n * @param {int[]} users\n * @param {Function} callback A callback to apply after the form is closed.\n * @returns {Promise}\n */\nexport const showModal = (users, callback = null) => {\n    if (!users.length) {\n        // Nothing to do.\n        return Promise.resolve();\n    }\n    let titlePromise = null;\n    if (users.length == 1) {\n        titlePromise = get_string('sendbulkmessagesingle', 'core_message');\n    } else {\n        titlePromise = get_string('sendbulkmessage', 'core_message', users.length);\n    }\n\n    return ModalFactory.create({\n        type: ModalFactory.types.SAVE_CANCEL,\n        body: Templates.render('core_message/send_bulk_message', {}),\n        title: titlePromise,\n    })\n    .then(function(modal) {\n        modal.setSaveButtonText(titlePromise);\n\n        // When the dialog is closed, perform the callback (if provided).\n        modal.getRoot().on(ModalEvents.hidden, function() {\n            if (callback) {\n                callback();\n            }\n            modal.getRoot().remove();\n        });\n\n        modal.getRoot().on(ModalEvents.save, function() {\n            let messageText = modal.getRoot().find('form textarea').val();\n            sendMessage(messageText, users);\n        });\n\n        modal.show();\n\n        return modal;\n    });\n};\n\n/**\n * Send a message to these users.\n *\n * @method sendMessage\n * @param {String} messageText\n * @param {Number[]} users\n * @returns {Promise}\n */\nexport const sendMessage = (messageText, users) => {\n    let messages = [];\n\n    users.forEach(user => {\n        messages.push({\n            touserid: user,\n            text: messageText\n        });\n    });\n\n    return Ajax.call([{\n        methodname: 'core_message_send_instant_messages',\n        args: {messages: messages}\n    }])[0]\n    .then(function(messageIds) {\n        if (messageIds.length == 1) {\n            return get_string('sendbulkmessagesentsingle', 'core_message');\n        } else {\n            return get_string('sendbulkmessagesent', 'core_message', messageIds.length);\n        }\n    })\n    .then(function(msg) {\n        Notification.addNotification({\n            message: msg,\n            type: \"success\"\n        });\n        return true;\n    })\n    .catch(Notification.exception);\n};\n"],"names":["users","callback","length","Promise","resolve","titlePromise","ModalFactory","create","type","types","SAVE_CANCEL","body","Templates","render","title","then","modal","setSaveButtonText","getRoot","on","ModalEvents","hidden","remove","save","messageText","find","val","sendMessage","show","messages","forEach","user","push","touserid","text","Ajax","call","methodname","args","messageIds","msg","addNotification","message","catch","Notification","exception"],"mappings":";;;;;;;+WAqCyB,SAACA,WAAOC,gEAAW,SACnCD,MAAME,cAEAC,QAAQC,cAEfC,aAAe,YAEfA,aADgB,GAAhBL,MAAME,QACS,mBAAW,wBAAyB,iBAEpC,mBAAW,kBAAmB,eAAgBF,MAAME,QAGhEI,uBAAaC,OAAO,CACvBC,KAAMF,uBAAaG,MAAMC,YACzBC,KAAMC,mBAAUC,OAAO,iCAAkC,IACzDC,MAAOT,eAEVU,MAAK,SAASC,cACXA,MAAMC,kBAAkBZ,cAGxBW,MAAME,UAAUC,GAAGC,sBAAYC,QAAQ,WAC/BpB,UACAA,WAEJe,MAAME,UAAUI,YAGpBN,MAAME,UAAUC,GAAGC,sBAAYG,MAAM,eAC7BC,YAAcR,MAAME,UAAUO,KAAK,iBAAiBC,MACxDC,YAAYH,YAAaxB,UAG7BgB,MAAMY,OAECZ,gBAYFW,YAAc,CAACH,YAAaxB,aACjC6B,SAAW,UAEf7B,MAAM8B,SAAQC,OACVF,SAASG,KAAK,CACVC,SAAUF,KACVG,KAAMV,iBAIPW,cAAKC,KAAK,CAAC,CACdC,WAAY,qCACZC,KAAM,CAACT,SAAUA,aACjB,GACHd,MAAK,SAASwB,mBACc,GAArBA,WAAWrC,QACJ,mBAAW,4BAA6B,iBAExC,mBAAW,sBAAuB,eAAgBqC,WAAWrC,WAG3Ea,MAAK,SAASyB,kCACEC,gBAAgB,CACzBC,QAASF,IACThC,KAAM,aAEH,KAEVmC,MAAMC,sBAAaC"}

Zerion Mini Shell 1.0