first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,11 @@
/**
* Controls the content area of the notification area on the
* notification page.
*
* @module message_popup/notification_area_content_area
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("message_popup/notification_area_content_area",["jquery","core/templates","core/notification","core/custom_interaction_events","message_popup/notification_repository","message_popup/notification_area_events"],(function($,Templates,DebugNotification,CustomEvents,NotificationRepo,NotificationAreaEvents){var SELECTORS={CONTAINER:'[data-region="notification-area"]',CONTENT:'[data-region="content"]',HEADER:'[data-region="header"]',FOOTER:'[data-region="footer"]',TOGGLE_MODE:'[data-action="toggle-mode"]'},TEMPLATES_HEADER="message_popup/notification_area_content_area_header",TEMPLATES_CONTENT="message_popup/notification_area_content_area_content",TEMPLATES_FOOTER="message_popup/notification_area_content_area_footer",ContentArea=function(root,userId){this.root=$(root),this.container=this.root.closest(SELECTORS.CONTAINER),this.userId=userId,this.header=this.root.find(SELECTORS.HEADER),this.content=this.root.find(SELECTORS.CONTENT),this.footer=this.root.find(SELECTORS.FOOTER),this.registerEventListeners()};return ContentArea.prototype.getRoot=function(){return this.root},ContentArea.prototype.getContainer=function(){return this.container},ContentArea.prototype.getUserId=function(){return this.userId},ContentArea.prototype.getHeader=function(){return this.header},ContentArea.prototype.getContent=function(){return this.content},ContentArea.prototype.getFooter=function(){return this.footer},ContentArea.prototype.show=function(){this.getContainer().addClass("show-content-area")},ContentArea.prototype.hide=function(){this.getContainer().removeClass("show-content-area")},ContentArea.prototype.setHeaderHTML=function(html){this.getHeader().empty().html(html)},ContentArea.prototype.setContentHTML=function(html){this.getContent().empty().html(html)},ContentArea.prototype.setFooterHTML=function(html){this.getFooter().empty().html(html)},ContentArea.prototype.showNotification=function(notification){var headerPromise=Templates.render(TEMPLATES_HEADER,notification).done(function(html){this.setHeaderHTML(html)}.bind(this)),contentPromise=Templates.render(TEMPLATES_CONTENT,notification).done(function(html){this.setContentHTML(html)}.bind(this)),footerPromise=Templates.render(TEMPLATES_FOOTER,notification).done(function(html){this.setFooterHTML(html)}.bind(this));return $.when(headerPromise,contentPromise,footerPromise).done(function(){this.show(),this.getContainer().trigger(NotificationAreaEvents.notificationShown,[notification])}.bind(this))},ContentArea.prototype.registerEventListeners=function(){CustomEvents.define(this.getRoot(),[CustomEvents.events.activate]),this.getRoot().on(CustomEvents.events.activate,SELECTORS.VIEW_TOGGLE,function(){this.hide()}.bind(this)),this.getContainer().on(NotificationAreaEvents.showNotification,function(e,notification){this.showNotification(notification)}.bind(this))},ContentArea}));
//# sourceMappingURL=notification_area_content_area.min.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
define("message_popup/notification_area_events",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;return _exports.default={showNotification:"notification-area-events:showNotification",notificationShown:"notification-area-events:notificationShown"},_exports.default}));
//# sourceMappingURL=notification_area_events.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"notification_area_events.min.js","sources":["../src/notification_area_events.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 * Contain the events that can be fired in the notification area on\n * the notifications page.\n *\n * @module message_popup/notification_area_events\n * @copyright 2016 Ryan Wyllie <ryan@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nexport default {\n showNotification: 'notification-area-events:showNotification',\n notificationShown: 'notification-area-events:notificationShown',\n};\n"],"names":["showNotification","notificationShown"],"mappings":"wLAuBe,CACXA,iBAAkB,4CAClBC,kBAAmB"}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
/**
* Retrieves notifications from the server.
*
* @module message_popup/notification_repository
* @copyright 2016 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("message_popup/notification_repository",["core/ajax","core/notification"],(function(Ajax,Notification){return{query:function(args){void 0===args.limit&&(args.limit=20),void 0===args.offset&&(args.offset=0);var request={methodname:"message_popup_get_popup_notifications",args:args},promise=Ajax.call([request])[0];return promise.fail(Notification.exception),promise},countUnread:function(args){var request={methodname:"message_popup_get_unread_popup_notification_count",args:args},promise=Ajax.call([request])[0];return promise.fail(Notification.exception),promise},markAllAsRead:function(args){var request={methodname:"core_message_mark_all_notifications_as_read",args:args},promise=Ajax.call([request])[0];return promise.fail(Notification.exception),promise},markAsRead:function(id,timeread){var args={notificationid:id};timeread&&(args.timeread=timeread);var request={methodname:"core_message_mark_notification_read",args:args},promise=Ajax.call([request])[0];return promise.fail(Notification.exception),promise}}}));
//# sourceMappingURL=notification_repository.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"notification_repository.min.js","sources":["../src/notification_repository.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 * Retrieves notifications from the server.\n *\n * @module message_popup/notification_repository\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"],"names":["define","Ajax","Notification","query","args","limit","offset","request","methodname","promise","call","fail","exception","countUnread","markAllAsRead","markAsRead","id","timeread","notificationid"],"mappings":";;;;;;;AAsBAA,+CAAO,CAAC,YAAa,sBAAsB,SAASC,KAAMC,oBA8F/C,CACHC,MAxFQ,SAASC,WACS,IAAfA,KAAKC,QACZD,KAAKC,MAAQ,SAGU,IAAhBD,KAAKE,SACZF,KAAKE,OAAS,OAGdC,QAAU,CACVC,WAAY,wCACZJ,KAAMA,MAGNK,QAAUR,KAAKS,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKT,aAAaU,WAEnBH,SAuEPI,YA9Dc,SAAST,UACnBG,QAAU,CACVC,WAAY,oDACZJ,KAAMA,MAGNK,QAAUR,KAAKS,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKT,aAAaU,WAEnBH,SAqDPK,cA5CgB,SAASV,UACrBG,QAAU,CACVC,WAAY,8CACZJ,KAAMA,MAGNK,QAAUR,KAAKS,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKT,aAAaU,WAEnBH,SAmCPM,WAzBa,SAASC,GAAIC,cACtBb,KAAO,CACPc,eAAgBF,IAGhBC,WACAb,KAAKa,SAAWA,cAGhBV,QAAU,CACVC,WAAY,sCACZJ,KAAMA,MAGNK,QAAUR,KAAKS,KAAK,CAACH,UAAU,UAEnCE,QAAQE,KAAKT,aAAaU,WAEnBH"}