diff --git a/message/amd/src/notification_area_content_area.js b/message/output/popup/amd/src/notification_area_content_area.js similarity index 94% rename from message/amd/src/notification_area_content_area.js rename to message/output/popup/amd/src/notification_area_content_area.js index f5e571de986..d4a0944e517 100644 --- a/message/amd/src/notification_area_content_area.js +++ b/message/output/popup/amd/src/notification_area_content_area.js @@ -17,14 +17,14 @@ * Controls the content area of the notification area on the * notification page. * - * @module core_message/notification_area_content_area + * @module message_popup/notification_area_content_area * @class notification_area_content_area * @package message * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interaction_events', - 'message_popup/notification_repository', 'core_message/notification_area_events'], + 'message_popup/notification_repository', 'message_popup/notification_area_events'], function($, Templates, DebugNotification, CustomEvents, NotificationRepo, NotificationAreaEvents) { var SELECTORS = { @@ -36,9 +36,9 @@ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interactio }; var TEMPLATES = { - HEADER: 'message/notification_area_content_area_header', - CONTENT: 'message/notification_area_content_area_content', - FOOTER: 'message/notification_area_content_area_footer', + HEADER: 'message_popup/notification_area_content_area_header', + CONTENT: 'message_popup/notification_area_content_area_content', + FOOTER: 'message_popup/notification_area_content_area_footer', }; /** diff --git a/message/amd/src/notification_area_control_area.js b/message/output/popup/amd/src/notification_area_control_area.js similarity index 98% rename from message/amd/src/notification_area_control_area.js rename to message/output/popup/amd/src/notification_area_control_area.js index 176d853eac9..a8550b6c3cd 100644 --- a/message/amd/src/notification_area_control_area.js +++ b/message/output/popup/amd/src/notification_area_control_area.js @@ -16,14 +16,14 @@ /** * Controls the notification area on the notification page. * - * @module core_message/notification_area_control_area + * @module message_popup/notification_area_control_area * @class notification_area_control_area * @package message * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define(['jquery', 'core/templates', 'core/notification', 'core/custom_interaction_events', - 'message_popup/notification_repository', 'core_message/notification_area_events'], + 'message_popup/notification_repository', 'message_popup/notification_area_events'], function($, Templates, DebugNotification, CustomEvents, NotificationRepo, NotificationAreaEvents) { var SELECTORS = { diff --git a/message/amd/src/notification_area_events.js b/message/output/popup/amd/src/notification_area_events.js similarity index 95% rename from message/amd/src/notification_area_events.js rename to message/output/popup/amd/src/notification_area_events.js index e3be6157f32..468f0656ff0 100644 --- a/message/amd/src/notification_area_events.js +++ b/message/output/popup/amd/src/notification_area_events.js @@ -17,7 +17,7 @@ * Contain the events that can be fired in the notification area on * the notifications page. * - * @module core/notification_area_events + * @module message_popup/notification_area_events * @class notification_area_events * @package core * @copyright 2016 Ryan Wyllie diff --git a/message/output/popup/amd/src/notification_popover_controller.js b/message/output/popup/amd/src/notification_popover_controller.js index cd25a30603c..7fccdc6faad 100644 --- a/message/output/popup/amd/src/notification_popover_controller.js +++ b/message/output/popup/amd/src/notification_popover_controller.js @@ -26,7 +26,7 @@ */ define(['jquery', 'theme_bootstrapbase/bootstrap', 'core/ajax', 'core/templates', 'core/str', 'core/url', 'core/notification', 'core/custom_interaction_events', 'core/popover_region_controller', - 'message_popup/notification_repository', 'core_message/notification_area_events'], + 'message_popup/notification_repository', 'message_popup/notification_area_events'], function($, Bootstrap, Ajax, Templates, Str, URL, DebugNotification, CustomEvents, PopoverController, NotificationRepo, NotificationAreaEvents) { @@ -236,7 +236,7 @@ define(['jquery', 'theme_bootstrapbase/bootstrap', 'core/ajax', 'core/templates' var offset = this.getOffset() - this.limit; // Update the view more url to contain the offset to allow the notifications // page to load to the correct position in the list of notifications. - notification.viewmoreurl = URL.relativeUrl('/message/notifications.php', { + notification.viewmoreurl = URL.relativeUrl('/message/output/popup/notifications.php', { notificationid: notification.id, offset: offset, }, true); diff --git a/message/notifications.php b/message/output/popup/notifications.php similarity index 86% rename from message/notifications.php rename to message/output/popup/notifications.php index f9ca5751813..2f0bc2581fd 100644 --- a/message/notifications.php +++ b/message/output/popup/notifications.php @@ -17,21 +17,19 @@ /** * View a user's notifications. * - * @package core_message + * @package message_popup * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(__DIR__ . '/../config.php'); -require_once($CFG->dirroot . '/message/lib.php'); -require_once($CFG->dirroot . '/user/lib.php'); +require_once(__DIR__ . '/../../../config.php'); $notificationid = optional_param('notificationid', 0, PARAM_INT); $offset = optional_param('offset', 0, PARAM_INT); $limit = optional_param('limit', 0, PARAM_INT); $userid = $USER->id; -$url = new moodle_url('/message/notifications.php'); +$url = new moodle_url('/message/output/popup/notifications.php'); $url->param('id', $notificationid); $PAGE->set_url($url); @@ -67,6 +65,6 @@ $context = [ echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('notifications', 'message')); -echo $renderer->render_from_template('message/notification_area', $context); +echo $renderer->render_from_template('message_popup/notification_area', $context); echo $OUTPUT->footer(); diff --git a/message/templates/notification_area.mustache b/message/output/popup/templates/notification_area.mustache similarity index 85% rename from message/templates/notification_area.mustache rename to message/output/popup/templates/notification_area.mustache index 015dceb9407..1095ec4baba 100644 --- a/message/templates/notification_area.mustache +++ b/message/output/popup/templates/notification_area.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template message/notification_area + @template message_popup/notification_area This template will render the notification area on the notifications page. @@ -24,15 +24,13 @@ * none Data attributes required for JS: - * data-region="notification-area" - * data-region="control-area" - * data-region="content-area" - * data-region="header" - * data-region="content" - * data-action="toggle-mode" + * All data attributes are required Context variables required for this template: * userid The logged in user id + * offset The offset amound of the notification list + * limit The limit amount for the notification list + * notificationid The specific notification to select Example context (json): { @@ -58,10 +56,10 @@ {{#js}} -require(['jquery', 'core_message/notification_area_control_area', 'core_message/notification_area_content_area'], +require(['jquery', 'message_popup/notification_area_control_area', 'message_popup/notification_area_content_area'], function($, ControlArea, ContentArea) { - var userId = $('[data-region="notification-area"]').attr('data-user-id'); + var userId = {{userid}}; var controlArea = new ControlArea($('[data-region="control-area"]'), userId); {{#offset}} controlArea.setOffset({{.}}); diff --git a/message/templates/notification_area_content_area_content.mustache b/message/output/popup/templates/notification_area_content_area_content.mustache similarity index 94% rename from message/templates/notification_area_content_area_content.mustache rename to message/output/popup/templates/notification_area_content_area_content.mustache index 7a054a68eed..d23db35b778 100644 --- a/message/templates/notification_area_content_area_content.mustache +++ b/message/output/popup/templates/notification_area_content_area_content.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template message/notification_area_content_area_content + @template message_popup/notification_area_content_area_content This template will render the content for the content area in the notification area on the notifications page. diff --git a/message/templates/notification_area_content_area_footer.mustache b/message/output/popup/templates/notification_area_content_area_footer.mustache similarity index 94% rename from message/templates/notification_area_content_area_footer.mustache rename to message/output/popup/templates/notification_area_content_area_footer.mustache index 9ff31a85a37..08ddfe83d38 100644 --- a/message/templates/notification_area_content_area_footer.mustache +++ b/message/output/popup/templates/notification_area_content_area_footer.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template message/notification_area_content_area_footer + @template message_popup/notification_area_content_area_footer This template will render the footer for the content area in the notification area on the notifications page. diff --git a/message/templates/notification_area_content_area_header.mustache b/message/output/popup/templates/notification_area_content_area_header.mustache similarity index 95% rename from message/templates/notification_area_content_area_header.mustache rename to message/output/popup/templates/notification_area_content_area_header.mustache index e156b6bcc1a..6d7047baf5a 100644 --- a/message/templates/notification_area_content_area_header.mustache +++ b/message/output/popup/templates/notification_area_content_area_header.mustache @@ -15,7 +15,7 @@ along with Moodle. If not, see . }} {{! - @template message/notification_area_content_area_header + @template message_popup/notification_area_content_area_header This template will render the header for the content area in the notification area on the notifications page.