Current Path : /var/www/ljmtc/cbt/message/output/popup/amd/build/ |
Current File : /var/www/ljmtc/cbt/message/output/popup/amd/build/notification_repository.min.js.map |
{"version":3,"sources":["../src/notification_repository.js"],"names":["define","Ajax","Notification","query","args","limit","offset","promise","call","methodname","fail","exception","countUnread","markAllAsRead","markAsRead","id","timeread","notificationid"],"mappings":"AAwBAA,OAAM,yCAAC,CAAC,WAAD,CAAc,mBAAd,CAAD,CAAqC,SAASC,CAAT,CAAeC,CAAf,CAA6B,CA8FpE,MAAO,CACHC,KAAK,CAxFG,QAARA,CAAAA,KAAQ,CAASC,CAAT,CAAe,CACvB,GAA0B,WAAtB,QAAOA,CAAAA,CAAI,CAACC,KAAhB,CAAuC,CACnCD,CAAI,CAACC,KAAL,CAAa,EAChB,CAED,GAA2B,WAAvB,QAAOD,CAAAA,CAAI,CAACE,MAAhB,CAAwC,CACpCF,CAAI,CAACE,MAAL,CAAc,CACjB,CAPsB,GAcnBC,CAAAA,CAAO,CAAGN,CAAI,CAACO,IAAL,CAAU,CALV,CACVC,UAAU,CAAE,uCADF,CAEVL,IAAI,CAAEA,CAFI,CAKU,CAAV,EAAqB,CAArB,CAdS,CAgBvBG,CAAO,CAACG,IAAR,CAAaR,CAAY,CAACS,SAA1B,EAEA,MAAOJ,CAAAA,CACV,CAoEM,CAEHK,WAAW,CA9DG,QAAdA,CAAAA,WAAc,CAASR,CAAT,CAAe,IAMzBG,CAAAA,CAAO,CAAGN,CAAI,CAACO,IAAL,CAAU,CALV,CACVC,UAAU,CAAE,mDADF,CAEVL,IAAI,CAAEA,CAFI,CAKU,CAAV,EAAqB,CAArB,CANe,CAQ7BG,CAAO,CAACG,IAAR,CAAaR,CAAY,CAACS,SAA1B,EAEA,MAAOJ,CAAAA,CACV,CAiDM,CAGHM,aAAa,CA5CG,QAAhBA,CAAAA,aAAgB,CAAST,CAAT,CAAe,IAM3BG,CAAAA,CAAO,CAAGN,CAAI,CAACO,IAAL,CAAU,CALV,CACVC,UAAU,CAAE,6CADF,CAEVL,IAAI,CAAEA,CAFI,CAKU,CAAV,EAAqB,CAArB,CANiB,CAQ/BG,CAAO,CAACG,IAAR,CAAaR,CAAY,CAACS,SAA1B,EAEA,MAAOJ,CAAAA,CACV,CA8BM,CAIHO,UAAU,CAzBG,QAAbA,CAAAA,UAAa,CAASC,CAAT,CAAaC,CAAb,CAAuB,CACpC,GAAIZ,CAAAA,CAAI,CAAG,CACPa,cAAc,CAAEF,CADT,CAAX,CAIA,GAAIC,CAAJ,CAAc,CACVZ,CAAI,CAACY,QAAL,CAAgBA,CACnB,CAPmC,GAchCT,CAAAA,CAAO,CAAGN,CAAI,CAACO,IAAL,CAAU,CALV,CACVC,UAAU,CAAE,qCADF,CAEVL,IAAI,CAAEA,CAFI,CAKU,CAAV,EAAqB,CAArB,CAdsB,CAgBpCG,CAAO,CAACG,IAAR,CAAaR,CAAY,CAACS,SAA1B,EAEA,MAAOJ,CAAAA,CACV,CAEM,CAMV,CApGK,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 * Retrieves notifications from the server.\n *\n * @module message_popup/notification_repository\n * @class notification_repository\n * @package message_popup\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/ajax', 'core/notification'], function(Ajax, Notification) {\n /**\n * Retrieve a list of notifications from the server.\n *\n * @param {object} args The request arguments\n * @return {object} jQuery promise\n */\n var query = function(args) {\n if (typeof args.limit === 'undefined') {\n args.limit = 20;\n }\n\n if (typeof args.offset === 'undefined') {\n args.offset = 0;\n }\n\n var request = {\n methodname: 'message_popup_get_popup_notifications',\n args: args\n };\n\n var promise = Ajax.call([request])[0];\n\n promise.fail(Notification.exception);\n\n return promise;\n };\n\n /**\n * Get the number of unread notifications from the server.\n *\n * @param {object} args The request arguments\n * @return {object} jQuery promise\n */\n var countUnread = function(args) {\n var request = {\n methodname: 'message_popup_get_unread_popup_notification_count',\n args: args\n };\n\n var promise = Ajax.call([request])[0];\n\n promise.fail(Notification.exception);\n\n return promise;\n };\n\n /**\n * Mark all notifications for the given user as read.\n *\n * @param {object} args The request arguments:\n * @return {object} jQuery promise\n */\n var markAllAsRead = function(args) {\n var request = {\n methodname: 'core_message_mark_all_notifications_as_read',\n args: args\n };\n\n var promise = Ajax.call([request])[0];\n\n promise.fail(Notification.exception);\n\n return promise;\n };\n\n /**\n * Mark a specific notification as read.\n *\n * @param {int} id The notification id\n * @param {int} timeread The read timestamp (optional)\n * @return {object} jQuery promise\n */\n var markAsRead = function(id, timeread) {\n var args = {\n notificationid: id,\n };\n\n if (timeread) {\n args.timeread = timeread;\n }\n\n var request = {\n methodname: 'core_message_mark_notification_read',\n args: args\n };\n\n var promise = Ajax.call([request])[0];\n\n promise.fail(Notification.exception);\n\n return promise;\n };\n\n return {\n query: query,\n countUnread: countUnread,\n markAllAsRead: markAllAsRead,\n markAsRead: markAsRead,\n };\n});\n"],"file":"notification_repository.min.js"}