diff --git a/admin/tool/analytics/amd/build/log_info.min.js.map b/admin/tool/analytics/amd/build/log_info.min.js.map
index 643ee195028..6e21bd92aae 100644
--- a/admin/tool/analytics/amd/build/log_info.min.js.map
+++ b/admin/tool/analytics/amd/build/log_info.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/log_info.js"],"names":["define","$","str","ModalFactory","Notification","loadInfo","id","info","link","get_string","then","langString","bodyInfo","forEach","item","append","create","title","body","html","large","catch","exception"],"mappings":"AAwBAA,OAAM,2BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAD,CAAoE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA6C,CAEnH,MAAoD,CAShDC,QAAQ,CAAE,kBAASC,CAAT,CAAaC,CAAb,CAAmB,CAEzB,GAAIC,CAAAA,CAAI,CAAGP,CAAC,CAAC,wBAAyBK,CAAzB,CAA8B,KAA/B,CAAZ,CACAJ,CAAG,CAACO,UAAJ,CAAe,SAAf,CAA0B,gBAA1B,EAA4CC,IAA5C,CAAiD,SAASC,CAAT,CAAqB,CAElE,GAAIC,CAAAA,CAAQ,CAAGX,CAAC,CAAC,MAAD,CAAhB,CACAM,CAAI,CAACM,OAAL,CAAa,SAASC,CAAT,CAAe,CACxBF,CAAQ,CAACG,MAAT,CAAgB,OAASD,CAAT,CAAgB,OAAhC,CACH,CAFD,EAGAF,CAAQ,CAACG,MAAT,CAAgB,OAAhB,EAEA,MAAOZ,CAAAA,CAAY,CAACa,MAAb,CAAoB,CACvBC,KAAK,CAAEN,CADgB,CAEvBO,IAAI,CAAEN,CAAQ,CAACO,IAAT,EAFiB,CAGvBC,KAAK,GAHkB,CAApB,CAIJZ,CAJI,CAMV,CAdD,EAcGa,KAdH,CAcSjB,CAAY,CAACkB,SAdtB,CAeH,CA3B+C,CA6BvD,CA/BK,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 .\n\n/**\n * Shows a dialogue with info about this logs.\n *\n * @module tool_analytics/log_info\n * @class log_info\n * @package tool_analytics\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {\n\n return /** @alias module:tool_analytics/log_info */ {\n\n /**\n * Prepares a modal info for a log's results.\n *\n * @method loadInfo\n * @param {int} id\n * @param {string[]} info\n */\n loadInfo: function(id, info) {\n\n var link = $('[data-model-log-id=\"' + id + '\"]');\n str.get_string('loginfo', 'tool_analytics').then(function(langString) {\n\n var bodyInfo = $(\"
\");\n\n return ModalFactory.create({\n title: langString,\n body: bodyInfo.html(),\n large: true,\n }, link);\n\n }).catch(Notification.exception);\n }\n };\n});\n"],"file":"log_info.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/log_info.js"],"names":["define","$","str","ModalFactory","Notification","loadInfo","id","info","link","get_string","then","langString","bodyInfo","forEach","item","append","create","title","body","html","large","catch","exception"],"mappings":"AAuBAA,OAAM,2BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAD,CAAoE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA6C,CAEnH,MAAoD,CAShDC,QAAQ,CAAE,kBAASC,CAAT,CAAaC,CAAb,CAAmB,CAEzB,GAAIC,CAAAA,CAAI,CAAGP,CAAC,CAAC,wBAAyBK,CAAzB,CAA8B,KAA/B,CAAZ,CACAJ,CAAG,CAACO,UAAJ,CAAe,SAAf,CAA0B,gBAA1B,EAA4CC,IAA5C,CAAiD,SAASC,CAAT,CAAqB,CAElE,GAAIC,CAAAA,CAAQ,CAAGX,CAAC,CAAC,MAAD,CAAhB,CACAM,CAAI,CAACM,OAAL,CAAa,SAASC,CAAT,CAAe,CACxBF,CAAQ,CAACG,MAAT,CAAgB,OAASD,CAAT,CAAgB,OAAhC,CACH,CAFD,EAGAF,CAAQ,CAACG,MAAT,CAAgB,OAAhB,EAEA,MAAOZ,CAAAA,CAAY,CAACa,MAAb,CAAoB,CACvBC,KAAK,CAAEN,CADgB,CAEvBO,IAAI,CAAEN,CAAQ,CAACO,IAAT,EAFiB,CAGvBC,KAAK,GAHkB,CAApB,CAIJZ,CAJI,CAMV,CAdD,EAcGa,KAdH,CAcSjB,CAAY,CAACkB,SAdtB,CAeH,CA3B+C,CA6BvD,CA/BK,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 .\n\n/**\n * Shows a dialogue with info about this logs.\n *\n * @module tool_analytics/log_info\n * @class log_info\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {\n\n return /** @alias module:tool_analytics/log_info */ {\n\n /**\n * Prepares a modal info for a log's results.\n *\n * @method loadInfo\n * @param {int} id\n * @param {string[]} info\n */\n loadInfo: function(id, info) {\n\n var link = $('[data-model-log-id=\"' + id + '\"]');\n str.get_string('loginfo', 'tool_analytics').then(function(langString) {\n\n var bodyInfo = $(\"
<- This is the target of the selector parameter.\n *
<- This is repeated for each top level menu.\n * Text <- This is the text for the top level menu.\n *
<- This is a list of the entries in this top level menu.\n *
<- This is repeated for each menu entry.\n * Choice 1 <- The anchor for the menu.\n *
\n *
\n *
\n *
\n *\n * @method enhance\n * @param {String} selector - The selector for the outer most menu node.\n * @param {Function} handler - Javascript handler for when a menu item was chosen. If the\n * handler returns true (or does not exist), the\n * menu will look for an anchor with a link to follow.\n * For example, if the menu entry has a \"data-action\" attribute\n * and we want to call a javascript function when that entry is chosen,\n * we could pass a list of handlers like this:\n * { \"[data-action='add']\" : callAddFunction }\n */\n enhance: function(selector, handler) {\n $(selector).each(function(index, element) {\n var menuRoot = $(element);\n // Don't enhance the same menu twice.\n if (menuRoot.data(\"menubarEnhanced\") !== true) {\n (new Menubar(menuRoot, handler));\n menuRoot.data(\"menubarEnhanced\", true);\n }\n });\n },\n\n /**\n * Handy function to close all open menus anywhere on the page.\n * @method closeAll\n */\n closeAll: closeAllSubMenus\n };\n});\n"],"file":"menubar.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/menubar.js"],"names":["define","$","documentClickHandlerRegistered","menuActive","closeAllSubMenus","attr","Menubar","menuRoot","handlers","rootMenus","children","subMenus","subMenuItems","allItems","add","activeItem","isChildOpen","keys","tab","enter","esc","space","left","up","right","down","addAriaAttributes","addEventListeners","prototype","openSubMenu","menu","setOpenDirection","currentThis","document","click","mouseenter","addClass","mouseout","removeClass","e","handleClick","keydown","handleKeyDown","focus","handleFocus","blur","handleBlur","item","stopPropagation","parentUL","parent","is","first","find","not","anchor","clickEvent","Event","target","eventHandled","each","selector","handler","length","callable","proxy","isDefaultPrevented","window","location","href","parentItems","parentsUntil","filter","itemUL","pos","offset","isRTL","body","hasClass","heightmenuRoot","outerHeight","widthmenuRoot","outerWidth","subMenuContainer","css","menuRealWidth","menuRealHeight","margintop","marginright","marginleft","top","scrollTop","height","width","altKey","ctrlKey","keyCode","moveToPrevious","moveToNext","moveUp","moveDown","menuItems","menuNum","menuIndex","index","newItem","childMenu","next","parentMenus","rootItem","last","prev","parentLI","startChr","newItemUL","match","curNdx","titleChr","eq","html","charAt","toLowerCase","enhance","element","data","closeAll"],"mappings":"AAuBAA,OAAM,mBAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,IAGvBC,CAAAA,CAA8B,GAHP,CAMvBC,CAAU,GANa,CAavBC,CAAgB,CAAG,UAAW,CAC9BH,CAAC,CAAC,iCAAD,CAAD,CAAqCI,IAArC,CAA0C,aAA1C,CAAyD,MAAzD,EAEAF,CAAU,GACb,CAjB0B,CAyBvBG,CAAO,CAAG,SAASC,CAAT,CAAmBC,CAAnB,CAA6B,CAEvC,KAAKD,QAAL,CAAgBA,CAAhB,CACA,KAAKC,QAAL,CAAgBA,CAAhB,CACA,KAAKC,SAAL,CAAiB,KAAKF,QAAL,CAAcG,QAAd,CAAuB,IAAvB,CAAjB,CACA,KAAKC,QAAL,CAAgB,KAAKF,SAAL,CAAeC,QAAf,CAAwB,IAAxB,CAAhB,CACA,KAAKE,YAAL,CAAoB,KAAKD,QAAL,CAAcD,QAAd,CAAuB,IAAvB,CAApB,CACA,KAAKG,QAAL,CAAgB,KAAKJ,SAAL,CAAeK,GAAf,CAAmB,KAAKF,YAAxB,CAAhB,CACA,KAAKG,UAAL,CAAkB,IAAlB,CACA,KAAKC,WAAL,IAEA,KAAKC,IAAL,CAAY,CACRC,GAAG,CAAK,CADA,CAERC,KAAK,CAAG,EAFA,CAGRC,GAAG,CAAK,EAHA,CAIRC,KAAK,CAAG,EAJA,CAKRC,IAAI,CAAI,EALA,CAMRC,EAAE,CAAM,EANA,CAORC,KAAK,CAAG,EAPA,CAQRC,IAAI,CAAI,EARA,CAAZ,CAWA,KAAKC,iBAAL,GAEA,KAAKC,iBAAL,EACH,CAlD0B,CAyD3BrB,CAAO,CAACsB,SAAR,CAAkBC,WA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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 .\n\n/**\n * Aria menubar functionality. Enhances a simple nested list structure into a full aria widget.\n * Based on the open ajax example: http://oaa-accessibility.org/example/26/\n *\n * @module tool_lp/menubar\n * @copyright 2015 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'], function($) {\n\n /** @property {boolean} Flag to indicate if we have already registered a click event handler for the document. */\n var documentClickHandlerRegistered = false;\n\n /** @property {boolean} Flag to indicate whether there's an active, open menu. */\n var menuActive = false;\n\n /**\n * Close all open submenus anywhere in the page (there should only ever be one open at a time).\n *\n * @method closeAllSubMenus\n */\n var closeAllSubMenus = function() {\n $('.tool-lp-menu .tool-lp-sub-menu').attr('aria-hidden', 'true');\n // Every menu's closed at this point, so set the menu active flag to false.\n menuActive = false;\n };\n\n /**\n * Constructor\n *\n * @param {$} menuRoot Jquery collection matching the root of the menu.\n * @param {Function[]} handlers, called when a menu item is chosen.\n */\n var Menubar = function(menuRoot, handlers) {\n // Setup private class variables.\n this.menuRoot = menuRoot;\n this.handlers = handlers;\n this.rootMenus = this.menuRoot.children('li');\n this.subMenus = this.rootMenus.children('ul');\n this.subMenuItems = this.subMenus.children('li');\n this.allItems = this.rootMenus.add(this.subMenuItems);\n this.activeItem = null;\n this.isChildOpen = false;\n\n this.keys = {\n tab: 9,\n enter: 13,\n esc: 27,\n space: 32,\n left: 37,\n up: 38,\n right: 39,\n down: 40\n };\n\n this.addAriaAttributes();\n // Add the event listeners.\n this.addEventListeners();\n };\n\n /**\n * Open a submenu, first it closes all other sub-menus and sets the open direction.\n * @method openSubMenu\n * @param {Node} menu\n */\n Menubar.prototype.openSubMenu = function(menu) {\n this.setOpenDirection();\n closeAllSubMenus();\n menu.attr('aria-hidden', 'false');\n // Set menu active flag to true when a menu is opened.\n menuActive = true;\n };\n\n\n /**\n * Bind the event listeners to the DOM\n * @method addEventListeners\n */\n Menubar.prototype.addEventListeners = function() {\n var currentThis = this;\n\n // When clicking outside the menubar.\n if (documentClickHandlerRegistered === false) {\n $(document).click(function() {\n // Check if a menu is opened.\n if (menuActive) {\n // Close menu.\n closeAllSubMenus();\n }\n });\n // Set this flag to true so that we won't need to add a document click handler for the other Menubar instances.\n documentClickHandlerRegistered = true;\n }\n\n // Hovers.\n this.subMenuItems.mouseenter(function() {\n $(this).addClass('menu-hover');\n return true;\n });\n\n this.subMenuItems.mouseout(function() {\n $(this).removeClass('menu-hover');\n return true;\n });\n\n // Mouse listeners.\n this.allItems.click(function(e) {\n return currentThis.handleClick($(this), e);\n });\n\n // Key listeners.\n this.allItems.keydown(function(e) {\n return currentThis.handleKeyDown($(this), e);\n });\n\n this.allItems.focus(function() {\n return currentThis.handleFocus($(this));\n });\n\n this.allItems.blur(function() {\n return currentThis.handleBlur($(this));\n });\n };\n\n /**\n * Process click events for the top menus.\n *\n * @method handleClick\n * @param {Object} item is the jquery object of the item firing the event\n * @param {Event} e is the associated event object\n * @return {boolean} Returns false\n */\n Menubar.prototype.handleClick = function(item, e) {\n e.stopPropagation();\n\n var parentUL = item.parent();\n\n if (parentUL.is('.tool-lp-menu')) {\n // Toggle the child menu open/closed.\n if (item.children('ul').first().attr('aria-hidden') == 'true') {\n this.openSubMenu(item.children('ul').first());\n } else {\n item.children('ul').first().attr('aria-hidden', 'true');\n }\n } else {\n // Remove hover and focus styling.\n this.allItems.removeClass('menu-hover menu-focus');\n\n // Clear the active item.\n this.activeItem = null;\n\n // Close the menu.\n this.menuRoot.find('ul').not('.root-level').attr('aria-hidden', 'true');\n // Follow any link, or call the click handlers.\n var anchor = item.find('a').first();\n var clickEvent = new $.Event('click');\n clickEvent.target = anchor;\n var eventHandled = false;\n if (this.handlers) {\n $.each(this.handlers, function(selector, handler) {\n if (eventHandled) {\n return;\n }\n if (item.find(selector).length > 0) {\n var callable = $.proxy(handler, anchor);\n // False means stop propogatting events.\n eventHandled = (callable(clickEvent) === false) || clickEvent.isDefaultPrevented();\n }\n });\n }\n // If we didn't find a handler, and the HREF is # that probably means that\n // we are handling it from somewhere else. Let's just do nothing in that case.\n if (!eventHandled && anchor.attr('href') !== '#') {\n window.location.href = anchor.attr('href');\n }\n }\n return false;\n };\n\n /*\n * Process focus events for the menu.\n *\n * @method handleFocus\n * @param {Object} item is the jquery object of the item firing the event\n * @return boolean Returns false\n */\n Menubar.prototype.handleFocus = function(item) {\n\n // If activeItem is null, we are getting focus from outside the menu. Store\n // the item that triggered the event.\n if (this.activeItem === null) {\n this.activeItem = item;\n } else if (item[0] != this.activeItem[0]) {\n return true;\n }\n\n // Get the set of jquery objects for all the parent items of the active item.\n var parentItems = this.activeItem.parentsUntil('ul.tool-lp-menu').filter('li');\n\n // Remove focus styling from all other menu items.\n this.allItems.removeClass('menu-focus');\n\n // Add focus styling to the active item.\n this.activeItem.addClass('menu-focus');\n\n // Add focus styling to all parent items.\n parentItems.addClass('menu-focus');\n\n // If the bChildOpen flag has been set, open the active item's child menu (if applicable).\n if (this.isChildOpen === true) {\n\n var itemUL = item.parent();\n\n // If the itemUL is a root-level menu and item is a parent item,\n // show the child menu.\n if (itemUL.is('.tool-lp-menu') && (item.attr('aria-haspopup') == 'true')) {\n this.openSubMenu(item.children('ul').first());\n }\n }\n\n return true;\n };\n\n /*\n * Process blur events for the menu.\n *\n * @method handleBlur\n * @param {Object} item is the jquery object of the item firing the event\n * @return boolean Returns false\n */\n Menubar.prototype.handleBlur = function(item) {\n item.removeClass('menu-focus');\n\n return true;\n };\n\n /*\n * Determine if the menu should open to the left, or the right,\n * based on the screen size and menu position.\n * @method setOpenDirection\n */\n Menubar.prototype.setOpenDirection = function() {\n var pos = this.menuRoot.offset();\n var isRTL = $(document.body).hasClass('dir-rtl');\n var openLeft = true;\n var heightmenuRoot = this.rootMenus.outerHeight();\n var widthmenuRoot = this.rootMenus.outerWidth();\n // Sometimes the menuMinWidth is not enough to figure out if menu exceeds the window width.\n // So we have to calculate the real menu width.\n var subMenuContainer = this.rootMenus.find('ul.tool-lp-sub-menu');\n\n // Reset margins.\n subMenuContainer.css('margin-right', '');\n subMenuContainer.css('margin-left', '');\n subMenuContainer.css('margin-top', '');\n\n subMenuContainer.attr('aria-hidden', false);\n var menuRealWidth = subMenuContainer.outerWidth(),\n menuRealHeight = subMenuContainer.outerHeight();\n\n var margintop = null,\n marginright = null,\n marginleft = null;\n var top = pos.top - $(window).scrollTop();\n // Top is the same for RTL and LTR.\n if (top + menuRealHeight > $(window).height()) {\n margintop = menuRealHeight + heightmenuRoot;\n subMenuContainer.css('margin-top', '-' + margintop + 'px');\n }\n\n if (isRTL) {\n if (pos.left - menuRealWidth < 0) {\n marginright = menuRealWidth - widthmenuRoot;\n subMenuContainer.css('margin-right', '-' + marginright + 'px');\n }\n } else {\n if (pos.left + menuRealWidth > $(window).width()) {\n marginleft = menuRealWidth - widthmenuRoot;\n subMenuContainer.css('margin-left', '-' + marginleft + 'px');\n }\n }\n\n if (openLeft) {\n this.menuRoot.addClass('tool-lp-menu-open-left');\n } else {\n this.menuRoot.removeClass('tool-lp-menu-open-left');\n }\n\n };\n\n /*\n * Process keyDown events for the menu.\n *\n * @method handleKeyDown\n * @param {Object} item is the jquery object of the item firing the event\n * @param {Event} e is the associated event object\n * @return boolean Returns false if consuming the event\n */\n Menubar.prototype.handleKeyDown = function(item, e) {\n\n if (e.altKey || e.ctrlKey) {\n // Modifier key pressed: Do not process.\n return true;\n }\n\n switch (e.keyCode) {\n case this.keys.tab: {\n\n // Hide all menu items and update their aria attributes.\n this.menuRoot.find('ul').attr('aria-hidden', 'true');\n\n // Remove focus styling from all menu items.\n this.allItems.removeClass('menu-focus');\n\n this.activeItem = null;\n\n this.isChildOpen = false;\n\n break;\n }\n case this.keys.esc: {\n var itemUL = item.parent();\n\n if (itemUL.is('.tool-lp-menu')) {\n // Hide the child menu and update the aria attributes.\n item.children('ul').first().attr('aria-hidden', 'true');\n } else {\n\n // Move up one level.\n this.activeItem = itemUL.parent();\n\n // Reset the isChildOpen flag.\n this.isChildOpen = false;\n\n // Set focus on the new item.\n this.activeItem.focus();\n\n // Hide the active menu and update the aria attributes.\n itemUL.attr('aria-hidden', 'true');\n }\n\n e.stopPropagation();\n return false;\n }\n case this.keys.enter:\n case this.keys.space: {\n // Trigger click handler.\n return this.handleClick(item, e);\n }\n\n case this.keys.left: {\n\n this.activeItem = this.moveToPrevious(item);\n\n this.activeItem.focus();\n\n e.stopPropagation();\n return false;\n }\n case this.keys.right: {\n\n this.activeItem = this.moveToNext(item);\n\n this.activeItem.focus();\n\n e.stopPropagation();\n return false;\n }\n case this.keys.up: {\n\n this.activeItem = this.moveUp(item);\n\n this.activeItem.focus();\n\n e.stopPropagation();\n return false;\n }\n case this.keys.down: {\n\n this.activeItem = this.moveDown(item);\n\n this.activeItem.focus();\n\n e.stopPropagation();\n return false;\n }\n }\n\n return true;\n\n };\n\n\n /**\n * Move to the next menu level.\n * This will be either the next root-level menu or the child of a menu parent. If\n * at the root level and the active item is the last in the menu, this function will loop\n * to the first menu item.\n *\n * If the menu is a horizontal menu, the first child element of the newly selected menu will\n * be selected\n *\n * @method moveToNext\n * @param {Object} item is the active menu item\n * @return {Object} Returns the item to move to. Returns item is no move is possible\n */\n Menubar.prototype.moveToNext = function(item) {\n // Item's containing menu.\n var itemUL = item.parent();\n\n // The items in the currently active menu.\n var menuItems = itemUL.children('li');\n\n // The number of items in the active menu.\n var menuNum = menuItems.length;\n // The items index in its menu.\n var menuIndex = menuItems.index(item);\n var newItem = null;\n var childMenu = null;\n\n if (itemUL.is('.tool-lp-menu')) {\n // This is the root level move to next sibling. This will require closing\n // the current child menu and opening the new one.\n\n if (menuIndex < menuNum - 1) {\n // Not the last root menu.\n newItem = item.next();\n } else { // Wrap to first item.\n newItem = menuItems.first();\n }\n\n // Close the current child menu (if applicable).\n if (item.attr('aria-haspopup') == 'true') {\n\n childMenu = item.children('ul').first();\n\n if (childMenu.attr('aria-hidden') == 'false') {\n // Update the child menu's aria-hidden attribute.\n childMenu.attr('aria-hidden', 'true');\n this.isChildOpen = true;\n }\n }\n\n // Remove the focus styling from the current menu.\n item.removeClass('menu-focus');\n\n // Open the new child menu (if applicable).\n if ((newItem.attr('aria-haspopup') === 'true') && (this.isChildOpen === true)) {\n\n childMenu = newItem.children('ul').first();\n\n // Update the child's aria-hidden attribute.\n this.openSubMenu(childMenu);\n }\n } else {\n // This is not the root level. If there is a child menu to be moved into, do that;\n // otherwise, move to the next root-level menu if there is one.\n if (item.attr('aria-haspopup') == 'true') {\n\n childMenu = item.children('ul').first();\n\n newItem = childMenu.children('li').first();\n\n // Show the child menu and update its aria attributes.\n this.openSubMenu(childMenu);\n } else {\n // At deepest level, move to the next root-level menu.\n\n var parentMenus = null;\n var rootItem = null;\n\n // Get list of all parent menus for item, up to the root level.\n parentMenus = item.parentsUntil('ul.tool-lp-menu').filter('ul').not('.tool-lp-menu');\n\n // Hide the current menu and update its aria attributes accordingly.\n parentMenus.attr('aria-hidden', 'true');\n\n // Remove the focus styling from the active menu.\n parentMenus.find('li').removeClass('menu-focus');\n parentMenus.last().parent().removeClass('menu-focus');\n\n // The containing root for the menu.\n rootItem = parentMenus.last().parent();\n\n menuIndex = this.rootMenus.index(rootItem);\n\n // If this is not the last root menu item, move to the next one.\n if (menuIndex < this.rootMenus.length - 1) {\n newItem = rootItem.next();\n } else {\n // Loop.\n newItem = this.rootMenus.first();\n }\n\n // Add the focus styling to the new menu.\n newItem.addClass('menu-focus');\n\n if (newItem.attr('aria-haspopup') == 'true') {\n childMenu = newItem.children('ul').first();\n\n newItem = childMenu.children('li').first();\n\n // Show the child menu and update it's aria attributes.\n this.openSubMenu(childMenu);\n this.isChildOpen = true;\n }\n }\n }\n\n return newItem;\n };\n\n /**\n * Member function to move to the previous menu level.\n * This will be either the previous root-level menu or the child of a menu parent. If\n * at the root level and the active item is the first in the menu, this function will loop\n * to the last menu item.\n *\n * If the menu is a horizontal menu, the first child element of the newly selected menu will\n * be selected\n *\n * @method moveToPrevious\n * @param {Object} item is the active menu item\n * @return {Object} Returns the item to move to. Returns item is no move is possible\n */\n Menubar.prototype.moveToPrevious = function(item) {\n // Item's containing menu.\n var itemUL = item.parent();\n // The items in the currently active menu.\n var menuItems = itemUL.children('li');\n // The items index in its menu.\n var menuIndex = menuItems.index(item);\n var newItem = null;\n var childMenu = null;\n\n if (itemUL.is('.tool-lp-menu')) {\n // This is the root level move to previous sibling. This will require closing\n // the current child menu and opening the new one.\n\n if (menuIndex > 0) {\n // Not the first root menu.\n newItem = item.prev();\n } else {\n // Wrap to last item.\n newItem = menuItems.last();\n }\n\n // Close the current child menu (if applicable).\n if (item.attr('aria-haspopup') == 'true') {\n childMenu = item.children('ul').first();\n\n if (childMenu.attr('aria-hidden') == 'false') {\n // Update the child menu's aria-hidden attribute.\n childMenu.attr('aria-hidden', 'true');\n this.isChildOpen = true;\n }\n }\n\n // Remove the focus styling from the current menu.\n item.removeClass('menu-focus');\n\n // Open the new child menu (if applicable).\n if ((newItem.attr('aria-haspopup') === 'true') && (this.isChildOpen === true)) {\n\n childMenu = newItem.children('ul').first();\n\n // Update the child's aria-hidden attribute.\n this.openSubMenu(childMenu);\n\n }\n } else {\n // This is not the root level. If there is a parent menu that is not the\n // root menu, move up one level; otherwise, move to first item of the previous\n // root menu.\n\n var parentLI = itemUL.parent();\n var parentUL = parentLI.parent();\n\n // If this is a vertical menu or is not the first child menu\n // of the root-level menu, move up one level.\n if (!parentUL.is('.tool-lp-menu')) {\n\n newItem = itemUL.parent();\n\n // Hide the active menu and update aria-hidden.\n itemUL.attr('aria-hidden', 'true');\n\n // Remove the focus highlight from the item.\n item.removeClass('menu-focus');\n\n } else {\n // Move to previous root-level menu.\n\n // Hide the current menu and update the aria attributes accordingly.\n itemUL.attr('aria-hidden', 'true');\n\n // Remove the focus styling from the active menu.\n item.removeClass('menu-focus');\n parentLI.removeClass('menu-focus');\n\n menuIndex = this.rootMenus.index(parentLI);\n\n if (menuIndex > 0) {\n // Move to the previous root-level menu.\n newItem = parentLI.prev();\n } else {\n // Loop to last root-level menu.\n newItem = this.rootMenus.last();\n }\n\n // Add the focus styling to the new menu.\n newItem.addClass('menu-focus');\n\n if (newItem.attr('aria-haspopup') == 'true') {\n childMenu = newItem.children('ul').first();\n\n // Show the child menu and update it's aria attributes.\n this.openSubMenu(childMenu);\n this.isChildOpen = true;\n\n newItem = childMenu.children('li').first();\n }\n }\n }\n\n return newItem;\n };\n\n /**\n * Member function to select the next item in a menu.\n * If the active item is the last in the menu, this function will loop to the\n * first menu item.\n *\n * @method moveDown\n * @param {Object} item is the active menu item\n * @param {String} startChr is the character to attempt to match against the beginning of the\n * menu item titles. If found, focus moves to the next menu item beginning with that character.\n * @return {Object} Returns the item to move to. Returns item is no move is possible\n */\n Menubar.prototype.moveDown = function(item, startChr) {\n // Item's containing menu.\n var itemUL = item.parent();\n // The items in the currently active menu.\n var menuItems = itemUL.children('li').not('.separator');\n // The number of items in the active menu.\n var menuNum = menuItems.length;\n // The items index in its menu.\n var menuIndex = menuItems.index(item);\n var newItem = null;\n var newItemUL = null;\n\n if (itemUL.is('.tool-lp-menu')) {\n // This is the root level menu.\n\n if (item.attr('aria-haspopup') != 'true') {\n // No child menu to move to.\n return item;\n }\n\n // Move to the first item in the child menu.\n newItemUL = item.children('ul').first();\n newItem = newItemUL.children('li').first();\n\n // Make sure the child menu is visible.\n this.openSubMenu(newItemUL);\n\n return newItem;\n }\n\n // If $item is not the last item in its menu, move to the next item. If startChr is specified, move\n // to the next item with a title that begins with that character.\n if (startChr) {\n var match = false;\n var curNdx = menuIndex + 1;\n\n // Check if the active item was the last one on the list.\n if (curNdx == menuNum) {\n curNdx = 0;\n }\n\n // Iterate through the menu items (starting from the current item and wrapping) until a match is found\n // or the loop returns to the current menu item.\n while (curNdx != menuIndex) {\n\n var titleChr = menuItems.eq(curNdx).html().charAt(0);\n\n if (titleChr.toLowerCase() == startChr) {\n match = true;\n break;\n }\n\n curNdx = curNdx + 1;\n\n if (curNdx == menuNum) {\n // Reached the end of the list, start again at the beginning.\n curNdx = 0;\n }\n }\n\n if (match === true) {\n newItem = menuItems.eq(curNdx);\n\n // Remove the focus styling from the current item.\n item.removeClass('menu-focus');\n\n return newItem;\n } else {\n return item;\n }\n } else {\n if (menuIndex < menuNum - 1) {\n newItem = menuItems.eq(menuIndex + 1);\n } else {\n newItem = menuItems.first();\n }\n }\n\n // Remove the focus styling from the current item.\n item.removeClass('menu-focus');\n\n return newItem;\n };\n\n /**\n * Function moveUp() is a member function to select the previous item in a menu.\n * If the active item is the first in the menu, this function will loop to the\n * last menu item.\n *\n * @method moveUp\n * @param {Object} item is the active menu item\n * @return {Object} Returns the item to move to. Returns item is no move is possible\n */\n Menubar.prototype.moveUp = function(item) {\n // Item's containing menu.\n var itemUL = item.parent();\n // The items in the currently active menu.\n var menuItems = itemUL.children('li').not('.separator');\n // The items index in its menu.\n var menuIndex = menuItems.index(item);\n var newItem = null;\n\n if (itemUL.is('.tool-lp-menu')) {\n // This is the root level menu.\n // Nothing to do.\n return item;\n }\n\n // If item is not the first item in its menu, move to the previous item.\n if (menuIndex > 0) {\n newItem = menuItems.eq(menuIndex - 1);\n } else {\n // Loop to top of menu.\n newItem = menuItems.last();\n }\n\n // Remove the focus styling from the current item.\n item.removeClass('menu-focus');\n\n return newItem;\n };\n\n /**\n * Enhance the dom with aria attributes.\n * @method addAriaAttributes\n */\n Menubar.prototype.addAriaAttributes = function() {\n this.menuRoot.attr('role', 'menubar');\n this.rootMenus.attr('role', 'menuitem');\n this.rootMenus.attr('tabindex', '0');\n this.rootMenus.attr('aria-haspopup', 'true');\n this.subMenus.attr('role', 'menu');\n this.subMenus.attr('aria-hidden', 'true');\n this.subMenuItems.attr('role', 'menuitem');\n this.subMenuItems.attr('tabindex', '-1');\n\n // For CSS styling and effects.\n this.menuRoot.addClass('tool-lp-menu');\n this.allItems.addClass('tool-lp-menu-item');\n this.rootMenus.addClass('tool-lp-root-menu');\n this.subMenus.addClass('tool-lp-sub-menu');\n this.subMenuItems.addClass('dropdown-item');\n };\n\n return /** @alias module:tool_lp/menubar */ {\n /**\n * Create a menu bar object for every node matching the selector.\n *\n * The expected DOM structure is shown below.\n *
<- This is the target of the selector parameter.\n *
<- This is repeated for each top level menu.\n * Text <- This is the text for the top level menu.\n *
<- This is a list of the entries in this top level menu.\n *
<- This is repeated for each menu entry.\n * Choice 1 <- The anchor for the menu.\n *
');\n ul.attr('role', 'group');\n Aria.hide(ul);\n\n $.each(nodes, function(index, node) {\n if (typeof node !== 'object') {\n return;\n }\n\n var li = $('');\n var p = $('');\n var id = node.id || node.key + '_tree_item';\n var icon = null;\n var isBranch = (node.expandable || node.haschildren) ? true : false;\n\n p.addClass('tree_item');\n p.attr('id', id);\n p.attr('role', 'treeitem');\n // Negative tab index to allow it to receive focus.\n p.attr('tabindex', '-1');\n\n if (node.requiresajaxloading) {\n p.attr('data-requires-ajax', true);\n p.attr('data-node-id', node.id);\n p.attr('data-node-key', node.key);\n p.attr('data-node-type', node.type);\n }\n\n if (isBranch) {\n li.addClass('collapsed contains_branch');\n p.attr('aria-expanded', false);\n p.addClass('branch');\n }\n\n var eleToAddIcon = null;\n if (node.link) {\n var link = $('');\n\n eleToAddIcon = link;\n link.append('' + node.name + '');\n\n if (node.hidden) {\n link.addClass('dimmed');\n }\n\n p.append(link);\n } else {\n var span = $('');\n\n eleToAddIcon = span;\n span.append('' + node.name + '');\n\n if (node.hidden) {\n span.addClass('dimmed');\n }\n\n p.append(span);\n }\n\n if (node.icon && (!isBranch || node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE)) {\n li.addClass('item_with_icon');\n p.addClass('hasicon');\n\n if (node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE) {\n icon = $('');\n icon.attr('alt', node.icon.alt);\n icon.attr('title', node.icon.title);\n icon.attr('src', Url.imageUrl(node.icon.pix, node.icon.component));\n $.each(node.icon.classes, function(index, className) {\n icon.addClass(className);\n });\n eleToAddIcon.prepend(icon);\n } else {\n if (node.icon.component == 'moodle') {\n node.icon.component = 'core';\n }\n Templates.renderPix(node.icon.pix, node.icon.component, node.icon.title).then(function(html) {\n // Prepend.\n eleToAddIcon.prepend(html);\n return;\n }).catch(Notification.exception);\n }\n }\n\n li.append(p);\n ul.append(li);\n\n if (node.children && node.children.length) {\n buildDOM(p, node.children);\n } else if (isBranch && !node.requiresajaxloading) {\n li.removeClass('contains_branch');\n p.addClass('emptybranch');\n }\n });\n\n rootElement.parent().append(ul);\n var id = rootElement.attr('id') + '_group';\n ul.attr('id', id);\n rootElement.attr('aria-owns', id);\n rootElement.attr('role', 'treeitem');\n }\n\n return {\n render: function(element, nodes) {\n // The first element of the response is the existing node so we start with processing the children.\n if (nodes.children && nodes.children.length) {\n buildDOM(element, nodes.children);\n\n var item = element.children(\"[role='treeitem']\").first();\n var group = element.find('#' + item.attr('aria-owns'));\n\n item.attr('aria-expanded', true);\n Aria.unhide(group);\n } else {\n if (element.parent().hasClass('contains_branch')) {\n element.parent().removeClass('contains_branch');\n element.addClass('emptybranch');\n }\n }\n }\n };\n});\n"],"file":"ajax_response_renderer.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/ajax_response_renderer.js"],"names":["define","$","Templates","Notification","Url","Aria","NODETYPE","ACTIVITY","RESOURCE","buildDOM","rootElement","nodes","ul","attr","hide","each","index","node","li","p","id","key","icon","isBranch","expandable","haschildren","addClass","requiresajaxloading","type","eleToAddIcon","link","title","append","name","hidden","span","alt","imageUrl","pix","component","classes","className","prepend","renderPix","then","html","catch","exception","children","length","removeClass","parent","render","element","item","first","group","find","unhide","hasClass"],"mappings":"mSAuBAA,OAAM,2CAAC,CACH,QADG,CAEH,gBAFG,CAGH,mBA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,CAjBE,CAmBV,CAxJK,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 .\n\n/**\n * Parse the response from the navblock ajax page and render the correct DOM\n * structure for the tree from it.\n *\n * @module block_navigation/ajax_response_renderer\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/notification',\n 'core/url',\n 'core/aria',\n], function(\n $,\n Templates,\n Notification,\n Url,\n Aria\n) {\n\n // Mappings for the different types of nodes coming from the navigation.\n // Copied from lib/navigationlib.php navigation_node constants.\n var NODETYPE = {\n // @type int Activity (course module) = 40.\n ACTIVITY: 40,\n // @type int Resource (course module = 50.\n RESOURCE: 50,\n };\n\n /**\n * Build DOM.\n *\n * @method buildDOM\n * @param {Object} rootElement the root element of DOM.\n * @param {object} nodes jquery object representing the nodes to be build.\n */\n function buildDOM(rootElement, nodes) {\n var ul = $('
');\n ul.attr('role', 'group');\n Aria.hide(ul);\n\n $.each(nodes, function(index, node) {\n if (typeof node !== 'object') {\n return;\n }\n\n var li = $('');\n var p = $('');\n var id = node.id || node.key + '_tree_item';\n var icon = null;\n var isBranch = (node.expandable || node.haschildren) ? true : false;\n\n p.addClass('tree_item');\n p.attr('id', id);\n p.attr('role', 'treeitem');\n // Negative tab index to allow it to receive focus.\n p.attr('tabindex', '-1');\n\n if (node.requiresajaxloading) {\n p.attr('data-requires-ajax', true);\n p.attr('data-node-id', node.id);\n p.attr('data-node-key', node.key);\n p.attr('data-node-type', node.type);\n }\n\n if (isBranch) {\n li.addClass('collapsed contains_branch');\n p.attr('aria-expanded', false);\n p.addClass('branch');\n }\n\n var eleToAddIcon = null;\n if (node.link) {\n var link = $('');\n\n eleToAddIcon = link;\n link.append('' + node.name + '');\n\n if (node.hidden) {\n link.addClass('dimmed');\n }\n\n p.append(link);\n } else {\n var span = $('');\n\n eleToAddIcon = span;\n span.append('' + node.name + '');\n\n if (node.hidden) {\n span.addClass('dimmed');\n }\n\n p.append(span);\n }\n\n if (node.icon && (!isBranch || node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE)) {\n li.addClass('item_with_icon');\n p.addClass('hasicon');\n\n if (node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE) {\n icon = $('');\n icon.attr('alt', node.icon.alt);\n icon.attr('title', node.icon.title);\n icon.attr('src', Url.imageUrl(node.icon.pix, node.icon.component));\n $.each(node.icon.classes, function(index, className) {\n icon.addClass(className);\n });\n eleToAddIcon.prepend(icon);\n } else {\n if (node.icon.component == 'moodle') {\n node.icon.component = 'core';\n }\n Templates.renderPix(node.icon.pix, node.icon.component, node.icon.title).then(function(html) {\n // Prepend.\n eleToAddIcon.prepend(html);\n return;\n }).catch(Notification.exception);\n }\n }\n\n li.append(p);\n ul.append(li);\n\n if (node.children && node.children.length) {\n buildDOM(p, node.children);\n } else if (isBranch && !node.requiresajaxloading) {\n li.removeClass('contains_branch');\n p.addClass('emptybranch');\n }\n });\n\n rootElement.parent().append(ul);\n var id = rootElement.attr('id') + '_group';\n ul.attr('id', id);\n rootElement.attr('aria-owns', id);\n rootElement.attr('role', 'treeitem');\n }\n\n return {\n render: function(element, nodes) {\n // The first element of the response is the existing node so we start with processing the children.\n if (nodes.children && nodes.children.length) {\n buildDOM(element, nodes.children);\n\n var item = element.children(\"[role='treeitem']\").first();\n var group = element.find('#' + item.attr('aria-owns'));\n\n item.attr('aria-expanded', true);\n Aria.unhide(group);\n } else {\n if (element.parent().hasClass('contains_branch')) {\n element.parent().removeClass('contains_branch');\n element.addClass('emptybranch');\n }\n }\n }\n };\n});\n"],"file":"ajax_response_renderer.min.js"}
\ No newline at end of file
diff --git a/blocks/navigation/amd/build/nav_loader.min.js.map b/blocks/navigation/amd/build/nav_loader.min.js.map
index 331c071a0f5..31fc53da1b1 100644
--- a/blocks/navigation/amd/build/nav_loader.min.js.map
+++ b/blocks/navigation/amd/build/nav_loader.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/nav_loader.js"],"names":["define","$","ajax","config","renderer","URL","wwwroot","getBlockInstanceId","element","closest","attr","load","promise","Deferred","data","elementid","id","type","sesskey","instance","dataType","done","nodes","render","resolve"],"mappings":"AAuBAA,OAAM,+BAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,aAAxB,CAAuC,yCAAvC,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA0BC,CAA1B,CAAoC,CAChC,GAAIC,CAAAA,CAAG,CAAGF,CAAM,CAACG,OAAP,CAAiB,4BAA3B,CASA,QAASC,CAAAA,CAAT,CAA4BC,CAA5B,CAAqC,CACjC,MAAOA,CAAAA,CAAO,CAACC,OAAR,CAAgB,cAAhB,EAAgCC,IAAhC,CAAqC,iBAArC,CACV,CAEL,MAAO,CACHC,IAAI,CAAE,cAASH,CAAT,CAAkB,CACpBA,CAAO,CAAGP,CAAC,CAACO,CAAD,CAAX,CADoB,GAEhBI,CAAAA,CAAO,CAAGX,CAAC,CAACY,QAAF,EAFM,CAGhBC,CAAI,CAAG,CACPC,SAAS,CAAEP,CAAO,CAACE,IAAR,CAAa,cAAb,CADJ,CAEPM,EAAE,CAAER,CAAO,CAACE,IAAR,CAAa,eAAb,CAFG,CAGPO,IAAI,CAAET,CAAO,CAACE,IAAR,CAAa,gBAAb,CAHC,CAIPQ,OAAO,CAAEf,CAAM,CAACe,OAJT,CAKPC,QAAQ,CAAEZ,CAAkB,CAACC,CAAD,CALrB,CAHS,CAgBpBP,CAAC,CAACC,IAAF,CAAOG,CAAP,CANe,CACXY,IAAI,CAAE,MADK,CAEXG,QAAQ,CAAE,MAFC,CAGXN,IAAI,CAAEA,CAHK,CAMf,EAAsBO,IAAtB,CAA2B,SAASC,CAAT,CAAgB,CACvClB,CAAQ,CAACmB,MAAT,CAAgBf,CAAhB,CAAyBc,CAAzB,EACAV,CAAO,CAACY,OAAR,EACH,CAHD,EAKA,MAAOZ,CAAAA,CACV,CAvBE,CAyBV,CAxCK,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 .\n\n/**\n * Load the nav tree items via ajax and render the response.\n *\n * @module block_navigation/nav_loader\n * @package core\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_renderer'],\n function($, ajax, config, renderer) {\n var URL = config.wwwroot + '/lib/ajax/getnavbranch.php';\n\n /**\n * Get the block instance id.\n *\n * @function getBlockInstanceId\n * @param {Element} element\n * @returns {String} the instance id\n */\n function getBlockInstanceId(element) {\n return element.closest('[data-block]').attr('data-instanceid');\n }\n\n return {\n load: function(element) {\n element = $(element);\n var promise = $.Deferred();\n var data = {\n elementid: element.attr('data-node-id'),\n id: element.attr('data-node-key'),\n type: element.attr('data-node-type'),\n sesskey: config.sesskey,\n instance: getBlockInstanceId(element)\n };\n var settings = {\n type: 'POST',\n dataType: 'json',\n data: data\n };\n\n $.ajax(URL, settings).done(function(nodes) {\n renderer.render(element, nodes);\n promise.resolve();\n });\n\n return promise;\n }\n };\n});\n"],"file":"nav_loader.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/nav_loader.js"],"names":["define","$","ajax","config","renderer","URL","wwwroot","getBlockInstanceId","element","closest","attr","load","promise","Deferred","data","elementid","id","type","sesskey","instance","dataType","done","nodes","render","resolve"],"mappings":"AAsBAA,OAAM,+BAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,aAAxB,CAAuC,yCAAvC,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA0BC,CAA1B,CAAoC,CAChC,GAAIC,CAAAA,CAAG,CAAGF,CAAM,CAACG,OAAP,CAAiB,4BAA3B,CASA,QAASC,CAAAA,CAAT,CAA4BC,CAA5B,CAAqC,CACjC,MAAOA,CAAAA,CAAO,CAACC,OAAR,CAAgB,cAAhB,EAAgCC,IAAhC,CAAqC,iBAArC,CACV,CAEL,MAAO,CACHC,IAAI,CAAE,cAASH,CAAT,CAAkB,CACpBA,CAAO,CAAGP,CAAC,CAACO,CAAD,CAAX,CADoB,GAEhBI,CAAAA,CAAO,CAAGX,CAAC,CAACY,QAAF,EAFM,CAGhBC,CAAI,CAAG,CACPC,SAAS,CAAEP,CAAO,CAACE,IAAR,CAAa,cAAb,CADJ,CAEPM,EAAE,CAAER,CAAO,CAACE,IAAR,CAAa,eAAb,CAFG,CAGPO,IAAI,CAAET,CAAO,CAACE,IAAR,CAAa,gBAAb,CAHC,CAIPQ,OAAO,CAAEf,CAAM,CAACe,OAJT,CAKPC,QAAQ,CAAEZ,CAAkB,CAACC,CAAD,CALrB,CAHS,CAgBpBP,CAAC,CAACC,IAAF,CAAOG,CAAP,CANe,CACXY,IAAI,CAAE,MADK,CAEXG,QAAQ,CAAE,MAFC,CAGXN,IAAI,CAAEA,CAHK,CAMf,EAAsBO,IAAtB,CAA2B,SAASC,CAAT,CAAgB,CACvClB,CAAQ,CAACmB,MAAT,CAAgBf,CAAhB,CAAyBc,CAAzB,EACAV,CAAO,CAACY,OAAR,EACH,CAHD,EAKA,MAAOZ,CAAAA,CACV,CAvBE,CAyBV,CAxCK,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 .\n\n/**\n * Load the nav tree items via ajax and render the response.\n *\n * @module block_navigation/nav_loader\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_renderer'],\n function($, ajax, config, renderer) {\n var URL = config.wwwroot + '/lib/ajax/getnavbranch.php';\n\n /**\n * Get the block instance id.\n *\n * @function getBlockInstanceId\n * @param {Element} element\n * @returns {String} the instance id\n */\n function getBlockInstanceId(element) {\n return element.closest('[data-block]').attr('data-instanceid');\n }\n\n return {\n load: function(element) {\n element = $(element);\n var promise = $.Deferred();\n var data = {\n elementid: element.attr('data-node-id'),\n id: element.attr('data-node-key'),\n type: element.attr('data-node-type'),\n sesskey: config.sesskey,\n instance: getBlockInstanceId(element)\n };\n var settings = {\n type: 'POST',\n dataType: 'json',\n data: data\n };\n\n $.ajax(URL, settings).done(function(nodes) {\n renderer.render(element, nodes);\n promise.resolve();\n });\n\n return promise;\n }\n };\n});\n"],"file":"nav_loader.min.js"}
\ No newline at end of file
diff --git a/blocks/navigation/amd/build/navblock.min.js.map b/blocks/navigation/amd/build/navblock.min.js.map
index f93c05d4349..cbfc92c3ef3 100644
--- a/blocks/navigation/amd/build/navblock.min.js.map
+++ b/blocks/navigation/amd/build/navblock.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/navblock.js"],"names":["define","$","Tree","init","instanceid","navTree","finishExpandingGroup","item","prototype","call","Y","use","Global","fire","M","core","globalEvents","BLOCK_CONTENT_UPDATED","collapseGroup"],"mappings":"AAuBAA,OAAM,6BAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAC9C,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAqB,CACvB,GAAIC,CAAAA,CAAO,CAAG,GAAIH,CAAAA,CAAJ,CAAS,+BAAT,CAAd,CACAG,CAAO,CAACC,oBAAR,CAA+B,SAASC,CAAT,CAAe,CAC1CL,CAAI,CAACM,SAAL,CAAeF,oBAAf,CAAoCG,IAApC,CAAyC,IAAzC,CAA+CF,CAA/C,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDb,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CAPD,CAQAC,CAAO,CAACa,aAAR,CAAwB,SAASX,CAAT,CAAe,CACnCL,CAAI,CAACM,SAAL,CAAeU,aAAf,CAA6BT,IAA7B,CAAkC,IAAlC,CAAwCF,CAAxC,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDb,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CACJ,CAnBE,CAqBV,CAtBK,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 .\n\n/**\n * Load the navigation tree javascript.\n *\n * @module block_navigation/navblock\n * @package core\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/tree'], function($, Tree) {\n return {\n init: function(instanceid) {\n var navTree = new Tree(\".block_navigation .block_tree\");\n navTree.finishExpandingGroup = function(item) {\n Tree.prototype.finishExpandingGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n navTree.collapseGroup = function(item) {\n Tree.prototype.collapseGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n }\n };\n});\n"],"file":"navblock.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/navblock.js"],"names":["define","$","Tree","init","instanceid","navTree","finishExpandingGroup","item","prototype","call","Y","use","Global","fire","M","core","globalEvents","BLOCK_CONTENT_UPDATED","collapseGroup"],"mappings":"AAsBAA,OAAM,6BAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAC9C,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAqB,CACvB,GAAIC,CAAAA,CAAO,CAAG,GAAIH,CAAAA,CAAJ,CAAS,+BAAT,CAAd,CACAG,CAAO,CAACC,oBAAR,CAA+B,SAASC,CAAT,CAAe,CAC1CL,CAAI,CAACM,SAAL,CAAeF,oBAAf,CAAoCG,IAApC,CAAyC,IAAzC,CAA+CF,CAA/C,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDb,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CAPD,CAQAC,CAAO,CAACa,aAAR,CAAwB,SAASX,CAAT,CAAe,CACnCL,CAAI,CAACM,SAAL,CAAeU,aAAf,CAA6BT,IAA7B,CAAkC,IAAlC,CAAwCF,CAAxC,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDb,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CACJ,CAnBE,CAqBV,CAtBK,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 .\n\n/**\n * Load the navigation tree javascript.\n *\n * @module block_navigation/navblock\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/tree'], function($, Tree) {\n return {\n init: function(instanceid) {\n var navTree = new Tree(\".block_navigation .block_tree\");\n navTree.finishExpandingGroup = function(item) {\n Tree.prototype.finishExpandingGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n navTree.collapseGroup = function(item) {\n Tree.prototype.collapseGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n }\n };\n});\n"],"file":"navblock.min.js"}
\ No newline at end of file
diff --git a/blocks/navigation/amd/build/site_admin_loader.min.js.map b/blocks/navigation/amd/build/site_admin_loader.min.js.map
index c7cd6459f0d..61216fb9cd3 100644
--- a/blocks/navigation/amd/build/site_admin_loader.min.js.map
+++ b/blocks/navigation/amd/build/site_admin_loader.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/site_admin_loader.js"],"names":["define","$","ajax","config","renderer","URL","wwwroot","load","element","promise","Deferred","data","type","sesskey","dataType","done","nodes","render","resolve"],"mappings":"AAuBAA,OAAM,sCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,aAAxB,CAAuC,yCAAvC,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA0BC,CAA1B,CAAoC,IAGpCC,CAAAA,CAAG,CAAGF,CAAM,CAACG,OAAP,CAAiB,kCAHa,CAKxC,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAkB,CACpBA,CAAO,CAAGP,CAAC,CAACO,CAAD,CAAX,CADoB,GAEhBC,CAAAA,CAAO,CAAGR,CAAC,CAACS,QAAF,EAFM,CAGhBC,CAAI,CAAG,CACPC,IAAI,GADG,CAEPC,OAAO,CAAEV,CAAM,CAACU,OAFT,CAHS,CAapBZ,CAAC,CAACC,IAAF,CAAOG,CAAP,CANe,CACXO,IAAI,CAAE,MADK,CAEXE,QAAQ,CAAE,MAFC,CAGXH,IAAI,CAAEA,CAHK,CAMf,EAAsBI,IAAtB,CAA2B,SAASC,CAAT,CAAgB,CACvCZ,CAAQ,CAACa,MAAT,CAAgBT,CAAhB,CAAyBQ,CAAzB,EACAP,CAAO,CAACS,OAAR,EACH,CAHD,EAKA,MAAOT,CAAAA,CACV,CApBE,CAsBV,CA5BK,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 .\n\n/**\n * Load the site admin nav tree via ajax and render the response.\n *\n * @module block_navigation/site_admin_loader\n * @package core\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_renderer'],\n function($, ajax, config, renderer) {\n\n var SITE_ADMIN_NODE_TYPE = 71;\n var URL = config.wwwroot + '/lib/ajax/getsiteadminbranch.php';\n\n return {\n load: function(element) {\n element = $(element);\n var promise = $.Deferred();\n var data = {\n type: SITE_ADMIN_NODE_TYPE,\n sesskey: config.sesskey\n };\n var settings = {\n type: 'POST',\n dataType: 'json',\n data: data\n };\n\n $.ajax(URL, settings).done(function(nodes) {\n renderer.render(element, nodes);\n promise.resolve();\n });\n\n return promise;\n }\n };\n});\n"],"file":"site_admin_loader.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/site_admin_loader.js"],"names":["define","$","ajax","config","renderer","URL","wwwroot","load","element","promise","Deferred","data","type","sesskey","dataType","done","nodes","render","resolve"],"mappings":"AAsBAA,OAAM,sCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,aAAxB,CAAuC,yCAAvC,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA0BC,CAA1B,CAAoC,IAGpCC,CAAAA,CAAG,CAAGF,CAAM,CAACG,OAAP,CAAiB,kCAHa,CAKxC,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAkB,CACpBA,CAAO,CAAGP,CAAC,CAACO,CAAD,CAAX,CADoB,GAEhBC,CAAAA,CAAO,CAAGR,CAAC,CAACS,QAAF,EAFM,CAGhBC,CAAI,CAAG,CACPC,IAAI,GADG,CAEPC,OAAO,CAAEV,CAAM,CAACU,OAFT,CAHS,CAapBZ,CAAC,CAACC,IAAF,CAAOG,CAAP,CANe,CACXO,IAAI,CAAE,MADK,CAEXE,QAAQ,CAAE,MAFC,CAGXH,IAAI,CAAEA,CAHK,CAMf,EAAsBI,IAAtB,CAA2B,SAASC,CAAT,CAAgB,CACvCZ,CAAQ,CAACa,MAAT,CAAgBT,CAAhB,CAAyBQ,CAAzB,EACAP,CAAO,CAACS,OAAR,EACH,CAHD,EAKA,MAAOT,CAAAA,CACV,CApBE,CAsBV,CA5BK,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 .\n\n/**\n * Load the site admin nav tree via ajax and render the response.\n *\n * @module block_navigation/site_admin_loader\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/config', 'block_navigation/ajax_response_renderer'],\n function($, ajax, config, renderer) {\n\n var SITE_ADMIN_NODE_TYPE = 71;\n var URL = config.wwwroot + '/lib/ajax/getsiteadminbranch.php';\n\n return {\n load: function(element) {\n element = $(element);\n var promise = $.Deferred();\n var data = {\n type: SITE_ADMIN_NODE_TYPE,\n sesskey: config.sesskey\n };\n var settings = {\n type: 'POST',\n dataType: 'json',\n data: data\n };\n\n $.ajax(URL, settings).done(function(nodes) {\n renderer.render(element, nodes);\n promise.resolve();\n });\n\n return promise;\n }\n };\n});\n"],"file":"site_admin_loader.min.js"}
\ No newline at end of file
diff --git a/blocks/navigation/amd/src/ajax_response_renderer.js b/blocks/navigation/amd/src/ajax_response_renderer.js
index e92ed463bee..bea1744ca35 100644
--- a/blocks/navigation/amd/src/ajax_response_renderer.js
+++ b/blocks/navigation/amd/src/ajax_response_renderer.js
@@ -18,7 +18,6 @@
* structure for the tree from it.
*
* @module block_navigation/ajax_response_renderer
- * @package core
* @copyright 2015 John Okely
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/navigation/amd/src/nav_loader.js b/blocks/navigation/amd/src/nav_loader.js
index ce5cb997bd9..bd2c6cb2187 100644
--- a/blocks/navigation/amd/src/nav_loader.js
+++ b/blocks/navigation/amd/src/nav_loader.js
@@ -17,7 +17,6 @@
* Load the nav tree items via ajax and render the response.
*
* @module block_navigation/nav_loader
- * @package core
* @copyright 2015 John Okely
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/navigation/amd/src/navblock.js b/blocks/navigation/amd/src/navblock.js
index 40e8678e370..33c1ff3d1ec 100644
--- a/blocks/navigation/amd/src/navblock.js
+++ b/blocks/navigation/amd/src/navblock.js
@@ -17,7 +17,6 @@
* Load the navigation tree javascript.
*
* @module block_navigation/navblock
- * @package core
* @copyright 2015 John Okely
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/navigation/amd/src/site_admin_loader.js b/blocks/navigation/amd/src/site_admin_loader.js
index b203aac0199..91381a58534 100644
--- a/blocks/navigation/amd/src/site_admin_loader.js
+++ b/blocks/navigation/amd/src/site_admin_loader.js
@@ -17,7 +17,6 @@
* Load the site admin nav tree via ajax and render the response.
*
* @module block_navigation/site_admin_loader
- * @package core
* @copyright 2015 John Okely
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/online_users/amd/build/change_user_visibility.min.js.map b/blocks/online_users/amd/build/change_user_visibility.min.js.map
index f8872777068..757879b7f26 100644
--- a/blocks/online_users/amd/build/change_user_visibility.min.js.map
+++ b/blocks/online_users/amd/build/change_user_visibility.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/change_user_visibility.js"],"names":["define","$","Ajax","Str","Notification","SELECTORS","CHANGE_VISIBILITY_LINK","CHANGE_VISIBILITY_ICON","changeVisibility","action","userid","value","call","methodname","args","preferences","then","data","saved","newAction","oppositeAction","changeVisibilityLinkAttr","changeVisibilityIconAttr","catch","exception","getTitle","title","attr","icon","is","M","util","image_url","addClass","getIconClass","removeClass","get_string","init","on","e","preventDefault"],"mappings":"AAwBAA,OAAM,6CAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,UAAxB,CAAoC,mBAApC,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAuBC,CAAvB,CAAqC,IAQrCC,CAAAA,CAAS,CAAG,CACZC,sBAAsB,CAAE,yBADZ,CAEZC,sBAAsB,CAAE,+BAFZ,CARyB,CAqBrCC,CAAgB,CAAG,SAASC,CAAT,CAAiBC,CAAjB,CAAyB,IAExCC,CAAAA,CAAK,CAAa,MAAV,EAAAF,CAAM,CAAa,CAAb,CAAiB,CAFS,CAe5CP,CAAI,CAACU,IAAL,CAAU,CANI,CACVC,UAAU,CAAE,gCADF,CAEVC,IAAI,CAAE,CACFC,WAAW,CATD,CAAC,CACf,KAAQ,mCADO,CAEf,MAASJ,CAFM,CAGf,OAAUD,CAHK,CAAD,CAQR,CAFI,CAMJ,CAAV,EAAqB,CAArB,EAAwBM,IAAxB,CAA6B,SAASC,CAAT,CAAe,CACxC,GAAIA,CAAI,CAACC,KAAT,CAAgB,CACZ,GAAIC,CAAAA,CAAS,CAAGC,CAAc,CAACX,CAAD,CAA9B,CACAY,CAAwB,CAACF,CAAD,CAAxB,CACAG,CAAwB,CAACH,CAAD,CAC3B,CAEJ,CAPD,EAOGI,KAPH,CAOSnB,CAAY,CAACoB,SAPtB,CAQH,CA5CwC,CAsDrCJ,CAAc,CAAG,SAASX,CAAT,CAAiB,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8B,QAC9C,CAnHwC,CA6HrCgB,CAAQ,CAAG,SAAShB,CAAT,CAAiB,CAC5B,MAAON,CAAAA,CAAG,CAACiC,UAAJ,CAAe,iBAAmB3B,CAAlC,CAA0C,oBAA1C,CACV,CA/HwC,CAiIzC,MAAO,CAOH4B,IAAI,CAAE,eAAW,CACbpC,CAAC,CAACI,CAAS,CAACC,sBAAX,CAAD,CAAoCgC,EAApC,CAAuC,OAAvC,CAAgD,SAASC,CAAT,CAAY,CACxDA,CAAC,CAACC,cAAF,GADwD,GAEpD/B,CAAAA,CAAM,CAAIR,CAAC,CAAC,IAAD,CAAD,CAAQ0B,IAAR,CAAa,aAAb,CAF0C,CAGpDjB,CAAM,CAAIT,CAAC,CAAC,IAAD,CAAD,CAAQ0B,IAAR,CAAa,aAAb,CAH0C,CAIxDnB,CAAgB,CAACC,CAAD,CAASC,CAAT,CACnB,CALD,CAMH,CAdE,CAgBV,CAlJK,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 .\n\n/**\n * A javascript module that handles the change of the user's visibility in the\n * online users block.\n *\n * @module block_online_users/change_user_visibility\n * @package block_online_users\n * @copyright 2018 Mihail Geshoski \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/str', 'core/notification'],\n function($, Ajax, Str, Notification) {\n\n /**\n * Selectors.\n *\n * @access private\n * @type {Object}\n */\n var SELECTORS = {\n CHANGE_VISIBILITY_LINK: '#change-user-visibility',\n CHANGE_VISIBILITY_ICON: '#change-user-visibility .icon'\n };\n\n /**\n * Change user visibility in the online users block.\n *\n * @method changeVisibility\n * @param {String} action\n * @param {String} userid\n * @private\n */\n var changeVisibility = function(action, userid) {\n\n var value = action == \"show\" ? 1 : 0;\n var preferences = [{\n 'name': 'block_online_users_uservisibility',\n 'value': value,\n 'userid': userid\n }];\n\n var request = {\n methodname: 'core_user_set_user_preferences',\n args: {\n preferences: preferences\n }\n };\n Ajax.call([request])[0].then(function(data) {\n if (data.saved) {\n var newAction = oppositeAction(action);\n changeVisibilityLinkAttr(newAction);\n changeVisibilityIconAttr(newAction);\n }\n return;\n }).catch(Notification.exception);\n };\n\n /**\n * Get the opposite action.\n *\n * @method oppositeAction\n * @param {String} action\n * @return {String}\n * @private\n */\n var oppositeAction = function(action) {\n return action == 'show' ? 'hide' : 'show';\n };\n\n /**\n * Change the attribute values of the user visibility link in the online users block.\n *\n * @method changeVisibilityLinkAttr\n * @param {String} action\n * @private\n */\n var changeVisibilityLinkAttr = function(action) {\n getTitle(action).then(function(title) {\n $(SELECTORS.CHANGE_VISIBILITY_LINK).attr({\n 'data-action': action,\n 'title': title\n });\n return;\n }).catch(Notification.exception);\n };\n\n /**\n * Change the attribute values of the user visibility icon in the online users block.\n *\n * @method changeVisibilityIconAttr\n * @param {String} action\n * @private\n */\n var changeVisibilityIconAttr = function(action) {\n var icon = $(SELECTORS.CHANGE_VISIBILITY_ICON);\n getTitle(action).then(function(title) {\n // Add the proper title to the icon.\n $(icon).attr({\n 'title': title,\n 'aria-label': title\n });\n // If the icon is an image.\n if (icon.is(\"img\")) {\n $(icon).attr({\n 'src': M.util.image_url('t/' + action),\n 'alt': title\n });\n } else {\n // Add the new icon class and remove the old one.\n $(icon).addClass(getIconClass(action));\n $(icon).removeClass(getIconClass(oppositeAction(action)));\n }\n return;\n }).catch(Notification.exception);\n };\n\n /**\n * Get the proper class for the user visibility icon in the online users block.\n *\n * @method getIconClass\n * @param {String} action\n * @return {String}\n * @private\n */\n var getIconClass = function(action) {\n return action == 'show' ? 'fa-eye-slash' : 'fa-eye';\n };\n\n /**\n * Get the title description of the user visibility link in the online users block.\n *\n * @method getTitle\n * @param {String} action\n * @return {object} jQuery promise\n * @private\n */\n var getTitle = function(action) {\n return Str.get_string('online_status:' + action, 'block_online_users');\n };\n\n return {\n // Public variables and functions.\n /**\n * Initialise change user visibility function.\n *\n * @method init\n */\n init: function() {\n $(SELECTORS.CHANGE_VISIBILITY_LINK).on('click', function(e) {\n e.preventDefault();\n var action = ($(this).attr('data-action'));\n var userid = ($(this).attr('data-userid'));\n changeVisibility(action, userid);\n });\n }\n };\n});\n"],"file":"change_user_visibility.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/change_user_visibility.js"],"names":["define","$","Ajax","Str","Notification","SELECTORS","CHANGE_VISIBILITY_LINK","CHANGE_VISIBILITY_ICON","changeVisibility","action","userid","value","call","methodname","args","preferences","then","data","saved","newAction","oppositeAction","changeVisibilityLinkAttr","changeVisibilityIconAttr","catch","exception","getTitle","title","attr","icon","is","M","util","image_url","addClass","getIconClass","removeClass","get_string","init","on","e","preventDefault"],"mappings":"AAuBAA,OAAM,6CAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,UAAxB,CAAoC,mBAApC,CAAD,CACE,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAuBC,CAAvB,CAAqC,IAQrCC,CAAAA,CAAS,CAAG,CACZC,sBAAsB,CAAE,yBADZ,CAEZC,sBAAsB,CAAE,+BAFZ,CARyB,CAqBrCC,CAAgB,CAAG,SAASC,CAAT,CAAiBC,CAAjB,CAAyB,IAExCC,CAAAA,CAAK,CAAa,MAAV,EAAAF,CAAM,CAAa,CAAb,CAAiB,CAFS,CAe5CP,CAAI,CAACU,IAAL,CAAU,CANI,CACVC,UAAU,CAAE,gCADF,CAEVC,IAAI,CAAE,CACFC,WAAW,CATD,CAAC,CACf,KAAQ,mCADO,CAEf,MAASJ,CAFM,CAGf,OAAUD,CAHK,CAAD,CAQR,CAFI,CAMJ,CAAV,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AAD,CAAD,CAAQK,QAAR,CAAiBC,CAAY,CAACzB,CAAD,CAA7B,EACAR,CAAC,CAAC2B,CAAD,CAAD,CAAQO,WAAR,CAAoBD,CAAY,CAACd,CAAc,CAACX,CAAD,CAAf,CAAhC,CACH,CAEJ,CAlBD,EAkBGc,KAlBH,CAkBSnB,CAAY,CAACoB,SAlBtB,CAmBH,CAvGwC,CAiHrCU,CAAY,CAAG,SAASzB,CAAT,CAAiB,CAChC,MAAiB,MAAV,EAAAA,CAAM,CAAa,cAAb,CAA8B,QAC9C,CAnHwC,CA6HrCgB,CAAQ,CAAG,SAAShB,CAAT,CAAiB,CAC5B,MAAON,CAAAA,CAAG,CAACiC,UAAJ,CAAe,iBAAmB3B,CAAlC,CAA0C,oBAA1C,CACV,CA/HwC,CAiIzC,MAAO,CAOH4B,IAAI,CAAE,eAAW,CACbpC,CAAC,CAACI,CAAS,CAACC,sBAAX,CAAD,CAAoCgC,EAApC,CAAuC,OAAvC,CAAgD,SAASC,CAAT,CAAY,CACxDA,CAAC,CAACC,cAAF,GADwD,GAEpD/B,CAAAA,CAAM,CAAIR,CAAC,CAAC,IAAD,CAAD,CAAQ0B,IAAR,CAAa,aAAb,CAF0C,CAGpDjB,CAAM,CAAIT,CAAC,CAAC,IAAD,CAAD,CAAQ0B,IAAR,CAAa,aAAb,CAH0C,CAIxDnB,CAAgB,CAACC,CAAD,CAASC,CAAT,CACnB,CALD,CAMH,CAdE,CAgBV,CAlJK,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 .\n\n/**\n * A javascript module that handles the change of the user's visibility in the\n * online users block.\n *\n * @module block_online_users/change_user_visibility\n * @copyright 2018 Mihail Geshoski \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/str', 'core/notification'],\n function($, Ajax, Str, Notification) {\n\n /**\n * Selectors.\n *\n * @access private\n * @type {Object}\n */\n var SELECTORS = {\n CHANGE_VISIBILITY_LINK: '#change-user-visibility',\n CHANGE_VISIBILITY_ICON: '#change-user-visibility .icon'\n };\n\n /**\n * Change user visibility in the online users block.\n *\n * @method changeVisibility\n * @param {String} action\n * @param {String} userid\n * @private\n */\n var changeVisibility = function(action, userid) {\n\n var value = action == \"show\" ? 1 : 0;\n var preferences = [{\n 'name': 'block_online_users_uservisibility',\n 'value': value,\n 'userid': userid\n }];\n\n var request = {\n methodname: 'core_user_set_user_preferences',\n args: {\n preferences: preferences\n }\n };\n Ajax.call([request])[0].then(function(data) {\n if (data.saved) {\n var newAction = oppositeAction(action);\n changeVisibilityLinkAttr(newAction);\n changeVisibilityIconAttr(newAction);\n }\n return;\n }).catch(Notification.exception);\n };\n\n /**\n * Get the opposite action.\n *\n * @method oppositeAction\n * @param {String} action\n * @return {String}\n * @private\n */\n var oppositeAction = function(action) {\n return action == 'show' ? 'hide' : 'show';\n };\n\n /**\n * Change the attribute values of the user visibility link in the online users block.\n *\n * @method changeVisibilityLinkAttr\n * @param {String} action\n * @private\n */\n var changeVisibilityLinkAttr = function(action) {\n getTitle(action).then(function(title) {\n $(SELECTORS.CHANGE_VISIBILITY_LINK).attr({\n 'data-action': action,\n 'title': title\n });\n return;\n }).catch(Notification.exception);\n };\n\n /**\n * Change the attribute values of the user visibility icon in the online users block.\n *\n * @method changeVisibilityIconAttr\n * @param {String} action\n * @private\n */\n var changeVisibilityIconAttr = function(action) {\n var icon = $(SELECTORS.CHANGE_VISIBILITY_ICON);\n getTitle(action).then(function(title) {\n // Add the proper title to the icon.\n $(icon).attr({\n 'title': title,\n 'aria-label': title\n });\n // If the icon is an image.\n if (icon.is(\"img\")) {\n $(icon).attr({\n 'src': M.util.image_url('t/' + action),\n 'alt': title\n });\n } else {\n // Add the new icon class and remove the old one.\n $(icon).addClass(getIconClass(action));\n $(icon).removeClass(getIconClass(oppositeAction(action)));\n }\n return;\n }).catch(Notification.exception);\n };\n\n /**\n * Get the proper class for the user visibility icon in the online users block.\n *\n * @method getIconClass\n * @param {String} action\n * @return {String}\n * @private\n */\n var getIconClass = function(action) {\n return action == 'show' ? 'fa-eye-slash' : 'fa-eye';\n };\n\n /**\n * Get the title description of the user visibility link in the online users block.\n *\n * @method getTitle\n * @param {String} action\n * @return {object} jQuery promise\n * @private\n */\n var getTitle = function(action) {\n return Str.get_string('online_status:' + action, 'block_online_users');\n };\n\n return {\n // Public variables and functions.\n /**\n * Initialise change user visibility function.\n *\n * @method init\n */\n init: function() {\n $(SELECTORS.CHANGE_VISIBILITY_LINK).on('click', function(e) {\n e.preventDefault();\n var action = ($(this).attr('data-action'));\n var userid = ($(this).attr('data-userid'));\n changeVisibility(action, userid);\n });\n }\n };\n});\n"],"file":"change_user_visibility.min.js"}
\ No newline at end of file
diff --git a/blocks/online_users/amd/src/change_user_visibility.js b/blocks/online_users/amd/src/change_user_visibility.js
index 4fbed820fdd..253e6ad7856 100644
--- a/blocks/online_users/amd/src/change_user_visibility.js
+++ b/blocks/online_users/amd/src/change_user_visibility.js
@@ -18,7 +18,6 @@
* online users block.
*
* @module block_online_users/change_user_visibility
- * @package block_online_users
* @copyright 2018 Mihail Geshoski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/recentlyaccessedcourses/amd/build/main.min.js.map b/blocks/recentlyaccessedcourses/amd/build/main.min.js.map
index c2da9f58793..b2d60005855 100644
--- a/blocks/recentlyaccessedcourses/amd/build/main.min.js.map
+++ b/blocks/recentlyaccessedcourses/amd/build/main.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/main.js"],"names":["define","$","CustomEvents","Notification","PubSub","PagedContentPagingBar","Templates","CourseEvents","CoursesRepository","Aria","SELECTORS","BLOCK_CONTAINER","CARD_CONTAINER","COURSE_IS_FAVOURITE","CONTENT","EMPTY_MESSAGE","LOADING_PLACEHOLDER","PAGING_BAR","PAGING_BAR_NEXT","PAGING_BAR_PREVIOUS","contentLoaded","allCourses","visibleCoursesId","cardWidth","viewIndex","availableVisibleCards","showEmptyMessage","root","find","removeClass","addClass","showContent","showPagingBar","pagingBar","css","unhide","hidePagingBar","hide","favouriteCourse","courseId","forEach","course","attr","unfavouriteCourse","renderAllCourses","courses","showcoursecategory","data","promises","map","render","when","apply","then","renderedCourses","promise","html","push","catch","exception","loadContent","userid","getLastAccessedCourses","recalculateVisibleCourses","container","availableWidth","parseFloat","numberOfCourses","length","start","outerWidth","Math","floor","overflow","coursesToShow","slice","newVisibleCoursesId","reduce","carry","rootSelector","disablePreviousControlButtons","enablePreviousControlButtons","disableNextControlButtons","enableNextControlButtons","registerEventListeners","resizeTimeout","drawerToggling","subscribe","favourited","unfavorited","recalculationCount","doRecalculation","setTimeout","window","on","events","activate","e","button","target","closest","hasClass","originalEvent","preventDefault","init"],"mappings":"AAwBAA,OAAM,sCACF,CACI,QADJ,CAEI,gCAFJ,CAGI,mBAHJ,CAII,aAJJ,CAKI,+BALJ,CAMI,gBANJ,CAOI,oBAPJ,CAQI,wBARJ,CASI,WATJ,CADE,CAYF,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUE,IAIMC,CAAAA,CAAS,CAAG,CACZC,eAAe,CAAE,2CADL,CAEZC,cAAc,CAAE,6BAFJ,CAGZC,mBAAmB,CAAE,gCAHT,CAIZC,OAAO,CAAE,gCAJG,CAKZC,aAAa,CAAE,iCALH,CAMZC,mBAAmB,CAAE,uCANT,CAOZC,UAAU,CAAE,8BAPA,CAQZC,eAAe,C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5B,CAEDoB,CAAI,CAACuD,aAAL,CAAmBC,cAAnB,EACH,CATD,CAUH,CA1SH,CAuUE,MAAO,CACHC,IAAI,CAtBG,QAAPA,CAAAA,IAAO,CAAS3C,CAAT,CAAiBlC,CAAjB,CAAuB,CAC9BA,CAAI,CAAG1B,CAAC,CAAC0B,CAAD,CAAR,CAEAyD,CAAsB,CAACzD,CAAD,CAAtB,CACAiC,CAAW,CAACC,CAAD,CAAX,CACKR,IADL,CACU,SAASC,CAAT,CAA0B,CAC5BjC,CAAU,CAAGiC,CAAb,CACAlC,CAAa,GAAb,CAEA,GAAIC,CAAU,CAAC+C,MAAf,CAAuB,CACnBrC,CAAW,CAACJ,CAAD,CAAX,CACAoC,CAAyB,CAACpC,CAAD,CAC5B,CAHD,IAGO,CACHD,CAAgB,CAACC,CAAD,CACnB,CAGJ,CAbL,EAcK+B,KAdL,CAcWvD,CAAY,CAACwD,SAdxB,CAeH,CAEM,CAGV,CAhWC,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 .\n\n/**\n * Javascript to initialise the Recently accessed courses block.\n *\n * @module block_recentlyaccessedcourses/main.js\n * @package block_recentlyaccessedcourses\n * @copyright 2018 Victor Deniz \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n [\n 'jquery',\n 'core/custom_interaction_events',\n 'core/notification',\n 'core/pubsub',\n 'core/paged_content_paging_bar',\n 'core/templates',\n 'core_course/events',\n 'core_course/repository',\n 'core/aria',\n ],\n function(\n $,\n CustomEvents,\n Notification,\n PubSub,\n PagedContentPagingBar,\n Templates,\n CourseEvents,\n CoursesRepository,\n Aria\n ) {\n\n // Constants.\n var NUM_COURSES_TOTAL = 10;\n var SELECTORS = {\n BLOCK_CONTAINER: '[data-region=\"recentlyaccessedcourses\"]',\n CARD_CONTAINER: '[data-region=\"card-deck\"]',\n COURSE_IS_FAVOURITE: '[data-region=\"is-favourite\"]',\n CONTENT: '[data-region=\"view-content\"]',\n EMPTY_MESSAGE: '[data-region=\"empty-message\"]',\n LOADING_PLACEHOLDER: '[data-region=\"loading-placeholder\"]',\n PAGING_BAR: '[data-region=\"paging-bar\"]',\n PAGING_BAR_NEXT: '[data-control=\"next\"]',\n PAGING_BAR_PREVIOUS: '[data-control=\"previous\"]'\n };\n // Module variables.\n var contentLoaded = false;\n var allCourses = [];\n var visibleCoursesId = null;\n var cardWidth = null;\n var viewIndex = 0;\n var availableVisibleCards = 1;\n\n /**\n * Show the empty message when no course are found.\n *\n * @param {object} root The root element for the courses view.\n */\n var showEmptyMessage = function(root) {\n root.find(SELECTORS.EMPTY_MESSAGE).removeClass('hidden');\n root.find(SELECTORS.LOADING_PLACEHOLDER).addClass('hidden');\n root.find(SELECTORS.CONTENT).addClass('hidden');\n };\n\n /**\n * Show the empty message when no course are found.\n *\n * @param {object} root The root element for the courses view.\n */\n var showContent = function(root) {\n root.find(SELECTORS.CONTENT).removeClass('hidden');\n root.find(SELECTORS.EMPTY_MESSAGE).addClass('hidden');\n root.find(SELECTORS.LOADING_PLACEHOLDER).addClass('hidden');\n };\n\n /**\n * Show the paging bar.\n *\n * @param {object} root The root element for the courses view.\n */\n var showPagingBar = function(root) {\n var pagingBar = root.find(SELECTORS.PAGING_BAR);\n pagingBar.css('opacity', 1);\n pagingBar.css('visibility', 'visible');\n Aria.unhide(pagingBar);\n };\n\n /**\n * Hide the paging bar.\n *\n * @param {object} root The root element for the courses view.\n */\n var hidePagingBar = function(root) {\n var pagingBar = root.find(SELECTORS.PAGING_BAR);\n pagingBar.css('opacity', 0);\n pagingBar.css('visibility', 'hidden');\n Aria.hide(pagingBar);\n };\n\n /**\n * Show the favourite indicator for the given course (if it's in the list).\n *\n * @param {object} root The root element for the courses view.\n * @param {number} courseId The id of the course to be favourited.\n */\n var favouriteCourse = function(root, courseId) {\n allCourses.forEach(function(course) {\n if (course.attr('data-course-id') == courseId) {\n course.find(SELECTORS.COURSE_IS_FAVOURITE).removeClass('hidden');\n }\n });\n };\n\n /**\n * Hide the favourite indicator for the given course (if it's in the list).\n *\n * @param {object} root The root element for the courses view.\n * @param {number} courseId The id of the course to be unfavourited.\n */\n var unfavouriteCourse = function(root, courseId) {\n allCourses.forEach(function(course) {\n if (course.attr('data-course-id') == courseId) {\n course.find(SELECTORS.COURSE_IS_FAVOURITE).addClass('hidden');\n }\n });\n };\n\n /**\n * Render the a list of courses.\n *\n * @param {array} courses containing array of courses.\n * @return {promise} Resolved with list of rendered courses as jQuery objects.\n */\n var renderAllCourses = function(courses) {\n var showcoursecategory = $(SELECTORS.BLOCK_CONTAINER).data('displaycoursecategory');\n var promises = courses.map(function(course) {\n course.showcoursecategory = showcoursecategory;\n return Templates.render('block_recentlyaccessedcourses/course-card', course);\n });\n\n return $.when.apply(null, promises).then(function() {\n var renderedCourses = [];\n\n promises.forEach(function(promise) {\n promise.then(function(html) {\n renderedCourses.push($(html));\n return;\n })\n .catch(Notification.exception);\n });\n\n return renderedCourses;\n });\n };\n\n /**\n * Fetch user's recently accessed courses and reload the content of the block.\n *\n * @param {int} userid User whose courses will be shown\n * @returns {promise} The updated content for the block.\n */\n var loadContent = function(userid) {\n return CoursesRepository.getLastAccessedCourses(userid, NUM_COURSES_TOTAL)\n .then(function(courses) {\n return renderAllCourses(courses);\n });\n };\n\n /**\n * Recalculate the number of courses that should be visible.\n *\n * @param {object} root The root element for the courses view.\n */\n var recalculateVisibleCourses = function(root) {\n var container = root.find(SELECTORS.CONTENT).find(SELECTORS.CARD_CONTAINER);\n var availableWidth = parseFloat(root.css('width'));\n var numberOfCourses = allCourses.length;\n var start = 0;\n\n if (!cardWidth) {\n container.html(allCourses[0]);\n // Render one card initially to calculate the width of the cards\n // including the margins.\n cardWidth = allCourses[0].outerWidth(true);\n }\n\n availableVisibleCards = Math.floor(availableWidth / cardWidth);\n\n if (viewIndex + availableVisibleCards < numberOfCourses) {\n start = viewIndex;\n } else {\n var overflow = (viewIndex + availableVisibleCards) - numberOfCourses;\n start = viewIndex - overflow;\n start = start >= 0 ? start : 0;\n }\n\n // At least show one card.\n if (availableVisibleCards === 0) {\n availableVisibleCards = 1;\n }\n\n var coursesToShow = allCourses.slice(start, start + availableVisibleCards);\n // Create an id for the list of courses we expect to be displayed.\n var newVisibleCoursesId = coursesToShow.reduce(function(carry, course) {\n return carry + course.attr('data-course-id');\n }, '');\n\n // Centre the courses if we have an overflow of courses.\n if (allCourses.length > coursesToShow.length) {\n container.addClass('justify-content-center');\n container.removeClass('justify-content-start');\n } else {\n container.removeClass('justify-content-center');\n container.addClass('justify-content-start');\n }\n\n // Don't bother updating the DOM unless the visible courses have changed.\n if (visibleCoursesId != newVisibleCoursesId) {\n var pagingBar = root.find(PagedContentPagingBar.rootSelector);\n container.html(coursesToShow);\n visibleCoursesId = newVisibleCoursesId;\n\n if (availableVisibleCards >= allCourses.length) {\n hidePagingBar(root);\n } else {\n showPagingBar(root);\n\n if (viewIndex === 0) {\n PagedContentPagingBar.disablePreviousControlButtons(pagingBar);\n } else {\n PagedContentPagingBar.enablePreviousControlButtons(pagingBar);\n }\n\n if (viewIndex + availableVisibleCards >= allCourses.length) {\n PagedContentPagingBar.disableNextControlButtons(pagingBar);\n } else {\n PagedContentPagingBar.enableNextControlButtons(pagingBar);\n }\n }\n }\n };\n\n /**\n * Register event listeners for the block.\n *\n * @param {object} root The root element for the recentlyaccessedcourses block.\n */\n var registerEventListeners = function(root) {\n var resizeTimeout = null;\n var drawerToggling = false;\n\n PubSub.subscribe(CourseEvents.favourited, function(courseId) {\n favouriteCourse(root, courseId);\n });\n\n PubSub.subscribe(CourseEvents.unfavorited, function(courseId) {\n unfavouriteCourse(root, courseId);\n });\n\n PubSub.subscribe('nav-drawer-toggle-start', function() {\n if (!contentLoaded || !allCourses.length || drawerToggling) {\n // Nothing to recalculate.\n return;\n }\n\n drawerToggling = true;\n var recalculationCount = 0;\n // This function is going to recalculate the number of courses while\n // the nav drawer is opening or closes (up to a maximum of 5 recalcs).\n var doRecalculation = function() {\n setTimeout(function() {\n recalculateVisibleCourses(root);\n recalculationCount++;\n\n if (recalculationCount < 5 && drawerToggling) {\n // If we haven't done too many recalculations and the drawer\n // is still toggling then recurse.\n doRecalculation();\n }\n }, 100);\n };\n\n // Start the recalculations.\n doRecalculation(root);\n });\n\n PubSub.subscribe('nav-drawer-toggle-end', function() {\n drawerToggling = false;\n });\n\n $(window).on('resize', function() {\n if (!contentLoaded || !allCourses.length) {\n // Nothing to reclculate.\n return;\n }\n\n // Resize events fire rapidly so recalculating the visible courses each\n // time can be expensive. Let's debounce them,\n if (!resizeTimeout) {\n resizeTimeout = setTimeout(function() {\n resizeTimeout = null;\n recalculateVisibleCourses(root);\n // The recalculateVisibleCourses function will execute at a rate of 15fps.\n }, 66);\n }\n });\n\n CustomEvents.define(root, [CustomEvents.events.activate]);\n root.on(CustomEvents.events.activate, SELECTORS.PAGING_BAR_NEXT, function(e, data) {\n var button = $(e.target).closest(SELECTORS.PAGING_BAR_NEXT);\n if (!button.hasClass('disabled')) {\n viewIndex = viewIndex + availableVisibleCards;\n recalculateVisibleCourses(root);\n }\n\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.activate, SELECTORS.PAGING_BAR_PREVIOUS, function(e, data) {\n var button = $(e.target).closest(SELECTORS.PAGING_BAR_PREVIOUS);\n if (!button.hasClass('disabled')) {\n viewIndex = viewIndex - availableVisibleCards;\n viewIndex = viewIndex < 0 ? 0 : viewIndex;\n recalculateVisibleCourses(root);\n }\n\n data.originalEvent.preventDefault();\n });\n };\n\n /**\n * Get and show the recent courses into the block.\n *\n * @param {int} userid User from which the courses will be obtained\n * @param {object} root The root element for the recentlyaccessedcourses block.\n */\n var init = function(userid, root) {\n root = $(root);\n\n registerEventListeners(root);\n loadContent(userid)\n .then(function(renderedCourses) {\n allCourses = renderedCourses;\n contentLoaded = true;\n\n if (allCourses.length) {\n showContent(root);\n recalculateVisibleCourses(root);\n } else {\n showEmptyMessage(root);\n }\n\n return;\n })\n .catch(Notification.exception);\n };\n\n return {\n init: init\n };\n });\n"],"file":"main.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/main.js"],"names":["define","$","CustomEvents","Notification","PubSub","PagedContentPagingBar","Templates","CourseEvents","CoursesRepository","Aria","SELECTORS","BLOCK_CONTAINER","CARD_CONTAINER","COURSE_IS_FAVOURITE","CONTENT","EMPTY_MESSAGE","LOADING_PLACEHOLDER","PAGING_BAR","PAGING_BAR_NEXT","PAGING_BAR_PREVIOUS","contentLoaded","allCourses","visibleCoursesId","cardWidth","viewIndex","availableVisibleCards","showEmptyMessage","root","find","removeClass","addClass","showContent","showPagingBar","pagingBar","css","unhide","hidePagingBar","hide","favouriteCourse","courseId","forEach","course","attr","unfavouriteCourse","renderAllCourses","courses","showcoursecategory","data","promises","map","render","when","apply","then","renderedCourses","promise","html","push","catch","exception","loadContent","userid","getLastAccessedCourses","recalculateVisibleCourses","container","availableWidth","parseFloat","numberOfCourses","length","start","outerWidth","Math","floor","overflow","coursesToShow","slice","newVisibleCoursesId","reduce","carry","rootSelector","disablePreviousControlButtons","enablePreviousControlButtons","disableNextControlButtons","enableNextControlButtons","registerEventListeners","resizeTimeout","drawerToggling","subscribe","favourited","unfavorited","recalculationCount","doRecalculation","setTimeout","window","on","events","activate","e","button","target","closest","hasClass","originalEvent","preventDefault","init"],"mappings":"AAuBAA,OAAM,sCACF,CACI,QADJ,CAEI,gCAFJ,CAGI,mBAHJ,CAII,aAJJ,CAKI,+BALJ,CAMI,gBANJ,CAOI,oBAPJ,CAQI,wBARJ,CASI,WATJ,CADE,CAYF,SACIC,CADJ,CA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AAZ,CAAkB,CACnF,GAAImD,CAAAA,CAAM,CAAGjG,CAAC,CAACgG,CAAC,CAACE,MAAH,CAAD,CAAYC,OAAZ,CAAoB1F,CAAS,CAACS,mBAA9B,CAAb,CACA,GAAI,CAAC+E,CAAM,CAACG,QAAP,CAAgB,UAAhB,CAAL,CAAkC,CAC9B7E,CAAS,CAAGA,CAAS,CAAGC,CAAxB,CACAD,CAAS,CAAe,CAAZ,CAAAA,CAAS,CAAO,CAAP,CAAWA,CAAhC,CACAuC,CAAyB,CAACpC,CAAD,CAC5B,CAEDoB,CAAI,CAACuD,aAAL,CAAmBC,cAAnB,EACH,CATD,CAUH,CA1SH,CAuUE,MAAO,CACHC,IAAI,CAtBG,QAAPA,CAAAA,IAAO,CAAS3C,CAAT,CAAiBlC,CAAjB,CAAuB,CAC9BA,CAAI,CAAG1B,CAAC,CAAC0B,CAAD,CAAR,CAEAyD,CAAsB,CAACzD,CAAD,CAAtB,CACAiC,CAAW,CAACC,CAAD,CAAX,CACKR,IADL,CACU,SAASC,CAAT,CAA0B,CAC5BjC,CAAU,CAAGiC,CAAb,CACAlC,CAAa,GAAb,CAEA,GAAIC,CAAU,CAAC+C,MAAf,CAAuB,CACnBrC,CAAW,CAACJ,CAAD,CAAX,CACAoC,CAAyB,CAACpC,CAAD,CAC5B,CAHD,IAGO,CACHD,CAAgB,CAACC,CAAD,CACnB,CAGJ,CAbL,EAcK+B,KAdL,CAcWvD,CAAY,CAACwD,SAdxB,CAeH,CAEM,CAGV,CAhWC,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 .\n\n/**\n * Javascript to initialise the Recently accessed courses block.\n *\n * @module block_recentlyaccessedcourses/main\n * @copyright 2018 Victor Deniz \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n [\n 'jquery',\n 'core/custom_interaction_events',\n 'core/notification',\n 'core/pubsub',\n 'core/paged_content_paging_bar',\n 'core/templates',\n 'core_course/events',\n 'core_course/repository',\n 'core/aria',\n ],\n function(\n $,\n CustomEvents,\n Notification,\n PubSub,\n PagedContentPagingBar,\n Templates,\n CourseEvents,\n CoursesRepository,\n Aria\n ) {\n\n // Constants.\n var NUM_COURSES_TOTAL = 10;\n var SELECTORS = {\n BLOCK_CONTAINER: '[data-region=\"recentlyaccessedcourses\"]',\n CARD_CONTAINER: '[data-region=\"card-deck\"]',\n COURSE_IS_FAVOURITE: '[data-region=\"is-favourite\"]',\n CONTENT: '[data-region=\"view-content\"]',\n EMPTY_MESSAGE: '[data-region=\"empty-message\"]',\n LOADING_PLACEHOLDER: '[data-region=\"loading-placeholder\"]',\n PAGING_BAR: '[data-region=\"paging-bar\"]',\n PAGING_BAR_NEXT: '[data-control=\"next\"]',\n PAGING_BAR_PREVIOUS: '[data-control=\"previous\"]'\n };\n // Module variables.\n var contentLoaded = false;\n var allCourses = [];\n var visibleCoursesId = null;\n var cardWidth = null;\n var viewIndex = 0;\n var availableVisibleCards = 1;\n\n /**\n * Show the empty message when no course are found.\n *\n * @param {object} root The root element for the courses view.\n */\n var showEmptyMessage = function(root) {\n root.find(SELECTORS.EMPTY_MESSAGE).removeClass('hidden');\n root.find(SELECTORS.LOADING_PLACEHOLDER).addClass('hidden');\n root.find(SELECTORS.CONTENT).addClass('hidden');\n };\n\n /**\n * Show the empty message when no course are found.\n *\n * @param {object} root The root element for the courses view.\n */\n var showContent = function(root) {\n root.find(SELECTORS.CONTENT).removeClass('hidden');\n root.find(SELECTORS.EMPTY_MESSAGE).addClass('hidden');\n root.find(SELECTORS.LOADING_PLACEHOLDER).addClass('hidden');\n };\n\n /**\n * Show the paging bar.\n *\n * @param {object} root The root element for the courses view.\n */\n var showPagingBar = function(root) {\n var pagingBar = root.find(SELECTORS.PAGING_BAR);\n pagingBar.css('opacity', 1);\n pagingBar.css('visibility', 'visible');\n Aria.unhide(pagingBar);\n };\n\n /**\n * Hide the paging bar.\n *\n * @param {object} root The root element for the courses view.\n */\n var hidePagingBar = function(root) {\n var pagingBar = root.find(SELECTORS.PAGING_BAR);\n pagingBar.css('opacity', 0);\n pagingBar.css('visibility', 'hidden');\n Aria.hide(pagingBar);\n };\n\n /**\n * Show the favourite indicator for the given course (if it's in the list).\n *\n * @param {object} root The root element for the courses view.\n * @param {number} courseId The id of the course to be favourited.\n */\n var favouriteCourse = function(root, courseId) {\n allCourses.forEach(function(course) {\n if (course.attr('data-course-id') == courseId) {\n course.find(SELECTORS.COURSE_IS_FAVOURITE).removeClass('hidden');\n }\n });\n };\n\n /**\n * Hide the favourite indicator for the given course (if it's in the list).\n *\n * @param {object} root The root element for the courses view.\n * @param {number} courseId The id of the course to be unfavourited.\n */\n var unfavouriteCourse = function(root, courseId) {\n allCourses.forEach(function(course) {\n if (course.attr('data-course-id') == courseId) {\n course.find(SELECTORS.COURSE_IS_FAVOURITE).addClass('hidden');\n }\n });\n };\n\n /**\n * Render the a list of courses.\n *\n * @param {array} courses containing array of courses.\n * @return {promise} Resolved with list of rendered courses as jQuery objects.\n */\n var renderAllCourses = function(courses) {\n var showcoursecategory = $(SELECTORS.BLOCK_CONTAINER).data('displaycoursecategory');\n var promises = courses.map(function(course) {\n course.showcoursecategory = showcoursecategory;\n return Templates.render('block_recentlyaccessedcourses/course-card', course);\n });\n\n return $.when.apply(null, promises).then(function() {\n var renderedCourses = [];\n\n promises.forEach(function(promise) {\n promise.then(function(html) {\n renderedCourses.push($(html));\n return;\n })\n .catch(Notification.exception);\n });\n\n return renderedCourses;\n });\n };\n\n /**\n * Fetch user's recently accessed courses and reload the content of the block.\n *\n * @param {int} userid User whose courses will be shown\n * @returns {promise} The updated content for the block.\n */\n var loadContent = function(userid) {\n return CoursesRepository.getLastAccessedCourses(userid, NUM_COURSES_TOTAL)\n .then(function(courses) {\n return renderAllCourses(courses);\n });\n };\n\n /**\n * Recalculate the number of courses that should be visible.\n *\n * @param {object} root The root element for the courses view.\n */\n var recalculateVisibleCourses = function(root) {\n var container = root.find(SELECTORS.CONTENT).find(SELECTORS.CARD_CONTAINER);\n var availableWidth = parseFloat(root.css('width'));\n var numberOfCourses = allCourses.length;\n var start = 0;\n\n if (!cardWidth) {\n container.html(allCourses[0]);\n // Render one card initially to calculate the width of the cards\n // including the margins.\n cardWidth = allCourses[0].outerWidth(true);\n }\n\n availableVisibleCards = Math.floor(availableWidth / cardWidth);\n\n if (viewIndex + availableVisibleCards < numberOfCourses) {\n start = viewIndex;\n } else {\n var overflow = (viewIndex + availableVisibleCards) - numberOfCourses;\n start = viewIndex - overflow;\n start = start >= 0 ? start : 0;\n }\n\n // At least show one card.\n if (availableVisibleCards === 0) {\n availableVisibleCards = 1;\n }\n\n var coursesToShow = allCourses.slice(start, start + availableVisibleCards);\n // Create an id for the list of courses we expect to be displayed.\n var newVisibleCoursesId = coursesToShow.reduce(function(carry, course) {\n return carry + course.attr('data-course-id');\n }, '');\n\n // Centre the courses if we have an overflow of courses.\n if (allCourses.length > coursesToShow.length) {\n container.addClass('justify-content-center');\n container.removeClass('justify-content-start');\n } else {\n container.removeClass('justify-content-center');\n container.addClass('justify-content-start');\n }\n\n // Don't bother updating the DOM unless the visible courses have changed.\n if (visibleCoursesId != newVisibleCoursesId) {\n var pagingBar = root.find(PagedContentPagingBar.rootSelector);\n container.html(coursesToShow);\n visibleCoursesId = newVisibleCoursesId;\n\n if (availableVisibleCards >= allCourses.length) {\n hidePagingBar(root);\n } else {\n showPagingBar(root);\n\n if (viewIndex === 0) {\n PagedContentPagingBar.disablePreviousControlButtons(pagingBar);\n } else {\n PagedContentPagingBar.enablePreviousControlButtons(pagingBar);\n }\n\n if (viewIndex + availableVisibleCards >= allCourses.length) {\n PagedContentPagingBar.disableNextControlButtons(pagingBar);\n } else {\n PagedContentPagingBar.enableNextControlButtons(pagingBar);\n }\n }\n }\n };\n\n /**\n * Register event listeners for the block.\n *\n * @param {object} root The root element for the recentlyaccessedcourses block.\n */\n var registerEventListeners = function(root) {\n var resizeTimeout = null;\n var drawerToggling = false;\n\n PubSub.subscribe(CourseEvents.favourited, function(courseId) {\n favouriteCourse(root, courseId);\n });\n\n PubSub.subscribe(CourseEvents.unfavorited, function(courseId) {\n unfavouriteCourse(root, courseId);\n });\n\n PubSub.subscribe('nav-drawer-toggle-start', function() {\n if (!contentLoaded || !allCourses.length || drawerToggling) {\n // Nothing to recalculate.\n return;\n }\n\n drawerToggling = true;\n var recalculationCount = 0;\n // This function is going to recalculate the number of courses while\n // the nav drawer is opening or closes (up to a maximum of 5 recalcs).\n var doRecalculation = function() {\n setTimeout(function() {\n recalculateVisibleCourses(root);\n recalculationCount++;\n\n if (recalculationCount < 5 && drawerToggling) {\n // If we haven't done too many recalculations and the drawer\n // is still toggling then recurse.\n doRecalculation();\n }\n }, 100);\n };\n\n // Start the recalculations.\n doRecalculation(root);\n });\n\n PubSub.subscribe('nav-drawer-toggle-end', function() {\n drawerToggling = false;\n });\n\n $(window).on('resize', function() {\n if (!contentLoaded || !allCourses.length) {\n // Nothing to reclculate.\n return;\n }\n\n // Resize events fire rapidly so recalculating the visible courses each\n // time can be expensive. Let's debounce them,\n if (!resizeTimeout) {\n resizeTimeout = setTimeout(function() {\n resizeTimeout = null;\n recalculateVisibleCourses(root);\n // The recalculateVisibleCourses function will execute at a rate of 15fps.\n }, 66);\n }\n });\n\n CustomEvents.define(root, [CustomEvents.events.activate]);\n root.on(CustomEvents.events.activate, SELECTORS.PAGING_BAR_NEXT, function(e, data) {\n var button = $(e.target).closest(SELECTORS.PAGING_BAR_NEXT);\n if (!button.hasClass('disabled')) {\n viewIndex = viewIndex + availableVisibleCards;\n recalculateVisibleCourses(root);\n }\n\n data.originalEvent.preventDefault();\n });\n\n root.on(CustomEvents.events.activate, SELECTORS.PAGING_BAR_PREVIOUS, function(e, data) {\n var button = $(e.target).closest(SELECTORS.PAGING_BAR_PREVIOUS);\n if (!button.hasClass('disabled')) {\n viewIndex = viewIndex - availableVisibleCards;\n viewIndex = viewIndex < 0 ? 0 : viewIndex;\n recalculateVisibleCourses(root);\n }\n\n data.originalEvent.preventDefault();\n });\n };\n\n /**\n * Get and show the recent courses into the block.\n *\n * @param {int} userid User from which the courses will be obtained\n * @param {object} root The root element for the recentlyaccessedcourses block.\n */\n var init = function(userid, root) {\n root = $(root);\n\n registerEventListeners(root);\n loadContent(userid)\n .then(function(renderedCourses) {\n allCourses = renderedCourses;\n contentLoaded = true;\n\n if (allCourses.length) {\n showContent(root);\n recalculateVisibleCourses(root);\n } else {\n showEmptyMessage(root);\n }\n\n return;\n })\n .catch(Notification.exception);\n };\n\n return {\n init: init\n };\n });\n"],"file":"main.min.js"}
\ No newline at end of file
diff --git a/blocks/recentlyaccessedcourses/amd/src/main.js b/blocks/recentlyaccessedcourses/amd/src/main.js
index 423eeb0abe3..7fbf97e312a 100644
--- a/blocks/recentlyaccessedcourses/amd/src/main.js
+++ b/blocks/recentlyaccessedcourses/amd/src/main.js
@@ -16,8 +16,7 @@
/**
* Javascript to initialise the Recently accessed courses block.
*
- * @module block_recentlyaccessedcourses/main.js
- * @package block_recentlyaccessedcourses
+ * @module block_recentlyaccessedcourses/main
* @copyright 2018 Victor Deniz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/recentlyaccesseditems/amd/build/main.min.js.map b/blocks/recentlyaccesseditems/amd/build/main.min.js.map
index 6308a5e272f..0ec27118f46 100644
--- a/blocks/recentlyaccesseditems/amd/build/main.min.js.map
+++ b/blocks/recentlyaccesseditems/amd/build/main.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/main.js"],"names":["define","$","Repository","Templates","Notification","SELECTORS","CARDDECK_CONTAINER","CARDDECK","getRecentItems","limit","renderItems","root","items","length","render","noitemsimgurl","attr","init","itemsContainer","find","itemsContent","itemsPromise","then","pageContentPromise","html","js","replaceNodeContents","catch","exception"],"mappings":"AAyBAA,OAAM,oCACF,CACI,QADJ,CAEI,wCAFJ,CAGI,gBAHJ,CAII,mBAJJ,CADE,CAOF,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKE,IAIMC,CAAAA,CAAS,CAAG,CACZC,kBAAkB,CAAE,8CADR,CAEZC,QAAQ,CAAE,sDAFE,CAJlB,CAgBMC,CAAc,CAAG,SAASC,CAAT,CAAgB,CACjC,MAAOP,CAAAA,CAAU,CAACM,cAAX,CAA0BC,CAA1B,CACV,CAlBH,CA4BMC,CAAW,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAsB,CACpC,GAAmB,CAAf,CAAAA,CAAK,CAACC,MAAV,CAAsB,CAClB,MAAOV,CAAAA,CAAS,CAACW,MAAV,CAAiB,wCAAjB,CAA2D,CAC9DF,KAAK,CAAEA,CADuD,CAA3D,CAGV,CAJD,IAIO,CACH,GAAIG,CAAAA,CAAa,CAAGJ,CAAI,CAACK,IAAL,CAAU,oBAAV,CAApB,CACA,MAAOb,CAAAA,CAAS,CAACW,MAAV,CAAiB,sCAAjB,CAAyD,CAC5DC,aAAa,CAAEA,CAD6C,CAAzD,CAGV,CACJ,CAvCH,CAgEE,MAAO,CACHE,IAAI,CAnBG,QAAPA,CAAAA,IAAO,CAASN,CAAT,CAAe,CACtBA,CAAI,CAAGV,CAAC,CAACU,CAAD,CAAR,CADsB,GAGlBO,CAAAA,CAAc,CAAGP,CAAI,CAACQ,IAAL,CAAUd,CAAS,CAACC,kBAApB,CAHC,CAIlBc,CAAY,CAAGT,CAAI,CAACQ,IAAL,CAAUd,CAAS,CAACE,QAApB,CAJG,CAMlBc,CAAY,CAAGb,CAAc,GANX,CAQtBa,CAAY,CAACC,IAAb,CAAkB,SAASV,CAAT,CAAgB,CAC9B,GAAIW,CAAAA,CAAkB,CAAGb,CAAW,CAACQ,CAAD,CAAiBN,CAAjB,CAApC,CAEAW,CAAkB,CAACD,IAAnB,CAAwB,SAASE,CAAT,CAAeC,CAAf,CAAmB,CACvC,MAAOtB,CAAAA,CAAS,CAACuB,mBAAV,CAA8BN,CAA9B,CAA4CI,CAA5C,CAAkDC,CAAlD,CACV,CAFD,EAEGE,KAFH,CAESvB,CAAY,CAACwB,SAFtB,EAGA,MAAOP,CAAAA,CACV,CAPD,EAOGM,KAPH,CAOSvB,CAAY,CAACwB,SAPtB,CAQH,CAEM,CAGV,CA/EC,CAAN","sourcesContent":["\n// 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 .\n\n/**\n * Javascript to initialise the Recently accessed items block.\n *\n * @module block_recentlyaccesseditems/main\n * @package block_recentlyaccesseditems\n * @copyright 2018 Victor Deniz \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n [\n 'jquery',\n 'block_recentlyaccesseditems/repository',\n 'core/templates',\n 'core/notification'\n ],\n function(\n $,\n Repository,\n Templates,\n Notification\n ) {\n\n var NUM_ITEMS = 9;\n\n var SELECTORS = {\n CARDDECK_CONTAINER: '[data-region=\"recentlyaccesseditems-view\"]',\n CARDDECK: '[data-region=\"recentlyaccesseditems-view-content\"]',\n };\n\n /**\n * Get recent items from backend.\n *\n * @method getRecentItems\n * @param {int} limit Only return this many results\n * @return {array} Items user most recently has accessed\n */\n var getRecentItems = function(limit) {\n return Repository.getRecentItems(limit);\n };\n\n /**\n * Render the block content.\n *\n * @method renderItems\n * @param {object} root The root element for the items view.\n * @param {array} items containing array of returned items.\n * @return {promise} Resolved with HTML and JS strings\n */\n var renderItems = function(root, items) {\n if (items.length > 0) {\n return Templates.render('block_recentlyaccesseditems/view-cards', {\n items: items\n });\n } else {\n var noitemsimgurl = root.attr('data-noitemsimgurl');\n return Templates.render('block_recentlyaccesseditems/no-items', {\n noitemsimgurl: noitemsimgurl\n });\n }\n };\n\n /**\n * Get and show the recent items into the block.\n *\n * @param {object} root The root element for the items block.\n */\n var init = function(root) {\n root = $(root);\n\n var itemsContainer = root.find(SELECTORS.CARDDECK_CONTAINER);\n var itemsContent = root.find(SELECTORS.CARDDECK);\n\n var itemsPromise = getRecentItems(NUM_ITEMS);\n\n itemsPromise.then(function(items) {\n var pageContentPromise = renderItems(itemsContainer, items);\n\n pageContentPromise.then(function(html, js) {\n return Templates.replaceNodeContents(itemsContent, html, js);\n }).catch(Notification.exception);\n return itemsPromise;\n }).catch(Notification.exception);\n };\n\n return {\n init: init\n };\n });"],"file":"main.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/main.js"],"names":["define","$","Repository","Templates","Notification","SELECTORS","CARDDECK_CONTAINER","CARDDECK","getRecentItems","limit","renderItems","root","items","length","render","noitemsimgurl","attr","init","itemsContainer","find","itemsContent","itemsPromise","then","pageContentPromise","html","js","replaceNodeContents","catch","exception"],"mappings":"AAwBAA,OAAM,oCACF,CACI,QADJ,CAEI,wCAFJ,CAGI,gBAHJ,CAII,mBAJJ,CADE,CAOF,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKE,IAIMC,CAAAA,CAAS,CAAG,CACZC,kBAAkB,CAAE,8CADR,CAEZC,QAAQ,CAAE,sDAFE,CAJlB,CAgBMC,CAAc,CAAG,SAASC,CAAT,CAAgB,CACjC,MAAOP,CAAAA,CAAU,CAACM,cAAX,CAA0BC,CAA1B,CACV,CAlBH,CA4BMC,CAAW,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAsB,CACpC,GAAmB,CAAf,CAAAA,CAAK,CAACC,MAAV,CAAsB,CAClB,MAAOV,CAAAA,CAAS,CAACW,MAAV,CAAiB,wCAAjB,CAA2D,CAC9DF,KAAK,CAAEA,CADuD,CAA3D,CAGV,CAJD,IAIO,CACH,GAAIG,CAAAA,CAAa,CAAGJ,CAAI,CAACK,IAAL,CAAU,oBAAV,CAApB,CACA,MAAOb,CAAAA,CAAS,CAACW,MAAV,CAAiB,sCAAjB,CAAyD,CAC5DC,aAAa,CAAEA,CAD6C,CAAzD,CAGV,CACJ,CAvCH,CAgEE,MAAO,CACHE,IAAI,CAnBG,QAAPA,CAAAA,IAAO,CAASN,CAAT,CAAe,CACtBA,CAAI,CAAGV,CAAC,CAACU,CAAD,CAAR,CADsB,GAGlBO,CAAAA,CAAc,CAAGP,CAAI,CAACQ,IAAL,CAAUd,CAAS,CAACC,kBAApB,CAHC,CAIlBc,CAAY,CAAGT,CAAI,CAACQ,IAAL,CAAUd,CAAS,CAACE,QAApB,CAJG,CAMlBc,CAAY,CAAGb,CAAc,GANX,CAQtBa,CAAY,CAACC,IAAb,CAAkB,SAASV,CAAT,CAAgB,CAC9B,GAAIW,CAAAA,CAAkB,CAAGb,CAAW,CAACQ,CAAD,CAAiBN,CAAjB,CAApC,CAEAW,CAAkB,CAACD,IAAnB,CAAwB,SAASE,CAAT,CAAeC,CAAf,CAAmB,CACvC,MAAOtB,CAAAA,CAAS,CAACuB,mBAAV,CAA8BN,CAA9B,CAA4CI,CAA5C,CAAkDC,CAAlD,CACV,CAFD,EAEGE,KAFH,CAESvB,CAAY,CAACwB,SAFtB,EAGA,MAAOP,CAAAA,CACV,CAPD,EAOGM,KAPH,CAOSvB,CAAY,CAACwB,SAPtB,CAQH,CAEM,CAGV,CA/EC,CAAN","sourcesContent":["\n// 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 .\n\n/**\n * Javascript to initialise the Recently accessed items block.\n *\n * @module block_recentlyaccesseditems/main\n * @copyright 2018 Victor Deniz \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n [\n 'jquery',\n 'block_recentlyaccesseditems/repository',\n 'core/templates',\n 'core/notification'\n ],\n function(\n $,\n Repository,\n Templates,\n Notification\n ) {\n\n var NUM_ITEMS = 9;\n\n var SELECTORS = {\n CARDDECK_CONTAINER: '[data-region=\"recentlyaccesseditems-view\"]',\n CARDDECK: '[data-region=\"recentlyaccesseditems-view-content\"]',\n };\n\n /**\n * Get recent items from backend.\n *\n * @method getRecentItems\n * @param {int} limit Only return this many results\n * @return {array} Items user most recently has accessed\n */\n var getRecentItems = function(limit) {\n return Repository.getRecentItems(limit);\n };\n\n /**\n * Render the block content.\n *\n * @method renderItems\n * @param {object} root The root element for the items view.\n * @param {array} items containing array of returned items.\n * @return {promise} Resolved with HTML and JS strings\n */\n var renderItems = function(root, items) {\n if (items.length > 0) {\n return Templates.render('block_recentlyaccesseditems/view-cards', {\n items: items\n });\n } else {\n var noitemsimgurl = root.attr('data-noitemsimgurl');\n return Templates.render('block_recentlyaccesseditems/no-items', {\n noitemsimgurl: noitemsimgurl\n });\n }\n };\n\n /**\n * Get and show the recent items into the block.\n *\n * @param {object} root The root element for the items block.\n */\n var init = function(root) {\n root = $(root);\n\n var itemsContainer = root.find(SELECTORS.CARDDECK_CONTAINER);\n var itemsContent = root.find(SELECTORS.CARDDECK);\n\n var itemsPromise = getRecentItems(NUM_ITEMS);\n\n itemsPromise.then(function(items) {\n var pageContentPromise = renderItems(itemsContainer, items);\n\n pageContentPromise.then(function(html, js) {\n return Templates.replaceNodeContents(itemsContent, html, js);\n }).catch(Notification.exception);\n return itemsPromise;\n }).catch(Notification.exception);\n };\n\n return {\n init: init\n };\n });"],"file":"main.min.js"}
\ No newline at end of file
diff --git a/blocks/recentlyaccesseditems/amd/build/repository.min.js.map b/blocks/recentlyaccesseditems/amd/build/repository.min.js.map
index 2a17bd0b5b1..6037b6471a0 100644
--- a/blocks/recentlyaccesseditems/amd/build/repository.min.js.map
+++ b/blocks/recentlyaccesseditems/amd/build/repository.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/repository.js"],"names":["define","Ajax","getRecentItems","limit","args","call","methodname"],"mappings":"AAuBAA,OAAM,0CAAC,CAAC,WAAD,CAAD,CAAgB,SAASC,CAAT,CAAe,CAoBjC,MAAO,CACHC,cAAc,CAZG,QAAjBA,CAAAA,cAAiB,CAASC,CAAT,CAAgB,CACjC,GAAIC,CAAAA,CAAI,CAAG,EAAX,CACA,GAAqB,WAAjB,QAAOD,CAAAA,CAAX,CAAkC,CAC9BC,CAAI,CAACD,KAAL,CAAaA,CAChB,CAKD,MAAOF,CAAAA,CAAI,CAACI,IAAL,CAAU,CAJH,CACVC,UAAU,CAAE,8CADF,CAEVF,IAAI,CAAEA,CAFI,CAIG,CAAV,EAAqB,CAArB,CACV,CACM,CAGV,CAvBK,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 .\n\n/**\n * A javascript module to handle user ajax actions.\n *\n * @module block_recentlyaccesseditems/repository\n * @package block_recentlyaccesseditems\n * @copyright 2018 Victor Deniz \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/ajax'], function(Ajax) {\n\n /**\n * Get the list of items that the user has most recently accessed.\n *\n * @method getRecentItems\n * @param {int} limit Only return this many results\n * @return {promise} Resolved with an array of items\n */\n var getRecentItems = function(limit) {\n var args = {};\n if (typeof limit !== 'undefined') {\n args.limit = limit;\n }\n var request = {\n methodname: 'block_recentlyaccesseditems_get_recent_items',\n args: args\n };\n return Ajax.call([request])[0];\n };\n return {\n getRecentItems: getRecentItems\n };\n});"],"file":"repository.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/repository.js"],"names":["define","Ajax","getRecentItems","limit","args","call","methodname"],"mappings":"AAsBAA,OAAM,0CAAC,CAAC,WAAD,CAAD,CAAgB,SAASC,CAAT,CAAe,CAoBjC,MAAO,CACHC,cAAc,CAZG,QAAjBA,CAAAA,cAAiB,CAASC,CAAT,CAAgB,CACjC,GAAIC,CAAAA,CAAI,CAAG,EAAX,CACA,GAAqB,WAAjB,QAAOD,CAAAA,CAAX,CAAkC,CAC9BC,CAAI,CAACD,KAAL,CAAaA,CAChB,CAKD,MAAOF,CAAAA,CAAI,CAACI,IAAL,CAAU,CAJH,CACVC,UAAU,CAAE,8CADF,CAEVF,IAAI,CAAEA,CAFI,CAIG,CAAV,EAAqB,CAArB,CACV,CACM,CAGV,CAvBK,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 .\n\n/**\n * A javascript module to handle user ajax actions.\n *\n * @module block_recentlyaccesseditems/repository\n * @copyright 2018 Victor Deniz \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['core/ajax'], function(Ajax) {\n\n /**\n * Get the list of items that the user has most recently accessed.\n *\n * @method getRecentItems\n * @param {int} limit Only return this many results\n * @return {promise} Resolved with an array of items\n */\n var getRecentItems = function(limit) {\n var args = {};\n if (typeof limit !== 'undefined') {\n args.limit = limit;\n }\n var request = {\n methodname: 'block_recentlyaccesseditems_get_recent_items',\n args: args\n };\n return Ajax.call([request])[0];\n };\n return {\n getRecentItems: getRecentItems\n };\n});"],"file":"repository.min.js"}
\ No newline at end of file
diff --git a/blocks/recentlyaccesseditems/amd/src/main.js b/blocks/recentlyaccesseditems/amd/src/main.js
index 5d4fd16e5c3..c217e002ae3 100644
--- a/blocks/recentlyaccesseditems/amd/src/main.js
+++ b/blocks/recentlyaccesseditems/amd/src/main.js
@@ -18,7 +18,6 @@
* Javascript to initialise the Recently accessed items block.
*
* @module block_recentlyaccesseditems/main
- * @package block_recentlyaccesseditems
* @copyright 2018 Victor Deniz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/recentlyaccesseditems/amd/src/repository.js b/blocks/recentlyaccesseditems/amd/src/repository.js
index cd76802a55b..a1d7a122148 100644
--- a/blocks/recentlyaccesseditems/amd/src/repository.js
+++ b/blocks/recentlyaccesseditems/amd/src/repository.js
@@ -17,7 +17,6 @@
* A javascript module to handle user ajax actions.
*
* @module block_recentlyaccesseditems/repository
- * @package block_recentlyaccesseditems
* @copyright 2018 Victor Deniz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/settings/amd/build/settingsblock.min.js.map b/blocks/settings/amd/build/settingsblock.min.js.map
index 1696676c470..716f924fd1d 100644
--- a/blocks/settings/amd/build/settingsblock.min.js.map
+++ b/blocks/settings/amd/build/settingsblock.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/settingsblock.js"],"names":["define","$","Tree","init","instanceid","siteAdminNodeId","adminTree","siteAdminNode","treeRoot","find","siteAdminLink","children","first","replaceWith","html","finishExpandingGroup","item","prototype","call","Y","use","Global","fire","M","core","globalEvents","BLOCK_CONTENT_UPDATED","collapseGroup"],"mappings":"AAuBAA,OAAM,gCAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAC9C,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAqBC,CAArB,CAAsC,CACxC,GAAIC,CAAAA,CAAS,CAAG,GAAIJ,CAAAA,CAAJ,CAAS,6BAAT,CAAhB,CACA,GAAIG,CAAJ,CAAqB,IACbE,CAAAA,CAAa,CAAGD,CAAS,CAACE,QAAV,CAAmBC,IAAnB,CAAwB,IAAMJ,CAA9B,CADH,CAEbK,CAAa,CAAGH,CAAa,CAACI,QAAd,CAAuB,GAAvB,EAA4BC,KAA5B,EAFH,CAGjBF,CAAa,CAACG,WAAd,CAA0B,wBAAwBH,CAAa,CAACI,IAAd,EAAxB,CAA+C,SAAzE,CACH,CACDR,CAAS,CAACS,oBAAV,CAAiC,SAASC,CAAT,CAAe,CAC5Cd,CAAI,CAACe,SAAL,CAAeF,oBAAf,CAAoCG,IAApC,CAAyC,IAAzC,CAA+CF,CAA/C,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDtB,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CAPD,CAQAE,CAAS,CAACqB,aAAV,CAA0B,SAASX,CAAT,CAAe,CACrCd,CAAI,CAACe,SAAL,CAAeU,aAAf,CAA6BT,IAA7B,CAAkC,IAAlC,CAAwCF,CAAxC,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDtB,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CACJ,CAxBE,CA0BV,CA3BK,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 .\n\n/**\n * Load the settings block tree javscript\n *\n * @module block_settings/settingsblock\n * @package core\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/tree'], function($, Tree) {\n return {\n init: function(instanceid, siteAdminNodeId) {\n var adminTree = new Tree(\".block_settings .block_tree\");\n if (siteAdminNodeId) {\n var siteAdminNode = adminTree.treeRoot.find('#' + siteAdminNodeId);\n var siteAdminLink = siteAdminNode.children('a').first();\n siteAdminLink.replaceWith('' + siteAdminLink.html() + '');\n }\n adminTree.finishExpandingGroup = function(item) {\n Tree.prototype.finishExpandingGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n adminTree.collapseGroup = function(item) {\n Tree.prototype.collapseGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n }\n };\n});\n"],"file":"settingsblock.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/settingsblock.js"],"names":["define","$","Tree","init","instanceid","siteAdminNodeId","adminTree","siteAdminNode","treeRoot","find","siteAdminLink","children","first","replaceWith","html","finishExpandingGroup","item","prototype","call","Y","use","Global","fire","M","core","globalEvents","BLOCK_CONTENT_UPDATED","collapseGroup"],"mappings":"AAsBAA,OAAM,gCAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAC9C,MAAO,CACHC,IAAI,CAAE,cAASC,CAAT,CAAqBC,CAArB,CAAsC,CACxC,GAAIC,CAAAA,CAAS,CAAG,GAAIJ,CAAAA,CAAJ,CAAS,6BAAT,CAAhB,CACA,GAAIG,CAAJ,CAAqB,IACbE,CAAAA,CAAa,CAAGD,CAAS,CAACE,QAAV,CAAmBC,IAAnB,CAAwB,IAAMJ,CAA9B,CADH,CAEbK,CAAa,CAAGH,CAAa,CAACI,QAAd,CAAuB,GAAvB,EAA4BC,KAA5B,EAFH,CAGjBF,CAAa,CAACG,WAAd,CAA0B,wBAAwBH,CAAa,CAACI,IAAd,EAAxB,CAA+C,SAAzE,CACH,CACDR,CAAS,CAACS,oBAAV,CAAiC,SAASC,CAAT,CAAe,CAC5Cd,CAAI,CAACe,SAAL,CAAeF,oBAAf,CAAoCG,IAApC,CAAyC,IAAzC,CAA+CF,CAA/C,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDtB,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CAPD,CAQAE,CAAS,CAACqB,aAAV,CAA0B,SAASX,CAAT,CAAe,CACrCd,CAAI,CAACe,SAAL,CAAeU,aAAf,CAA6BT,IAA7B,CAAkC,IAAlC,CAAwCF,CAAxC,EACAG,CAAC,CAACC,GAAF,CAAM,mBAAN,CAA2B,UAAW,CAClCD,CAAC,CAACE,MAAF,CAASC,IAAT,CAAcC,CAAC,CAACC,IAAF,CAAOC,YAAP,CAAoBC,qBAAlC,CAAyD,CACrDtB,UAAU,CAAEA,CADyC,CAAzD,CAGH,CAJD,CAKH,CACJ,CAxBE,CA0BV,CA3BK,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 .\n\n/**\n * Load the settings block tree javscript\n *\n * @module block_settings/settingsblock\n * @copyright 2015 John Okely \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/tree'], function($, Tree) {\n return {\n init: function(instanceid, siteAdminNodeId) {\n var adminTree = new Tree(\".block_settings .block_tree\");\n if (siteAdminNodeId) {\n var siteAdminNode = adminTree.treeRoot.find('#' + siteAdminNodeId);\n var siteAdminLink = siteAdminNode.children('a').first();\n siteAdminLink.replaceWith('' + siteAdminLink.html() + '');\n }\n adminTree.finishExpandingGroup = function(item) {\n Tree.prototype.finishExpandingGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n adminTree.collapseGroup = function(item) {\n Tree.prototype.collapseGroup.call(this, item);\n Y.use('moodle-core-event', function() {\n Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {\n instanceid: instanceid\n });\n });\n };\n }\n };\n});\n"],"file":"settingsblock.min.js"}
\ No newline at end of file
diff --git a/blocks/settings/amd/src/settingsblock.js b/blocks/settings/amd/src/settingsblock.js
index f17553f1822..9625f157ff7 100644
--- a/blocks/settings/amd/src/settingsblock.js
+++ b/blocks/settings/amd/src/settingsblock.js
@@ -17,7 +17,6 @@
* Load the settings block tree javscript
*
* @module block_settings/settingsblock
- * @package core
* @copyright 2015 John Okely
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/starredcourses/amd/build/repository.min.js.map b/blocks/starredcourses/amd/build/repository.min.js.map
index 41d6b41c486..2f04b4f633d 100644
--- a/blocks/starredcourses/amd/build/repository.min.js.map
+++ b/blocks/starredcourses/amd/build/repository.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/repository.js"],"names":["define","$","Ajax","Notification","getStarredCourses","args","promise","call","methodname","fail","exception"],"mappings":"AAsBAA,OAAM,mCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,mBAAxB,CAAD,CAA+C,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAgC,CA2BjF,MAAO,CACHC,iBAAiB,CAfG,QAApBA,CAAAA,iBAAoB,CAASC,CAAT,CAAe,IAO/BC,CAAAA,CAAO,CAAGJ,CAAI,CAACK,IAAL,CAAU,CALV,CACVC,UAAU,CAAE,0CADF,CAEVH,IAAI,CAAEA,CAFI,CAKU,CAAV,EAAqB,CAArB,CAPqB,CASnCC,CAAO,CAACG,IAAR,CAAaN,CAAY,CAACO,SAA1B,EAEA,MAAOJ,CAAAA,CACV,CAEM,CAGV,CA9BK,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 .\n\n/**\n * A javascript module to retrieve user's starred courses.\n *\n * @package block_starredcourses\n * @copyright 2018 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {\n\n /**\n * Retrieve a list of starred courses.\n *\n * Valid args are:\n * int limit number of records to retrieve\n * int offset the offset of records to retrieve\n *\n * @method getStarredCourses\n * @param {object} args The request arguments\n * @return {promise} Resolved with an array of courses\n */\n var getStarredCourses = function(args) {\n\n var request = {\n methodname: 'block_starredcourses_get_starred_courses',\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 getStarredCourses: getStarredCourses\n };\n});"],"file":"repository.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/repository.js"],"names":["define","$","Ajax","Notification","getStarredCourses","args","promise","call","methodname","fail","exception"],"mappings":"AAqBAA,OAAM,mCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,mBAAxB,CAAD,CAA+C,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAgC,CA2BjF,MAAO,CACHC,iBAAiB,CAfG,QAApBA,CAAAA,iBAAoB,CAASC,CAAT,CAAe,IAO/BC,CAAAA,CAAO,CAAGJ,CAAI,CAACK,IAAL,CAAU,CALV,CACVC,UAAU,CAAE,0CADF,CAEVH,IAAI,CAAEA,CAFI,CAKU,CAAV,EAAqB,CAArB,CAPqB,CASnCC,CAAO,CAACG,IAAR,CAAaN,CAAY,CAACO,SAA1B,EAEA,MAAOJ,CAAAA,CACV,CAEM,CAGV,CA9BK,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 .\n\n/**\n * A javascript module to retrieve user's starred courses.\n *\n * @copyright 2018 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {\n\n /**\n * Retrieve a list of starred courses.\n *\n * Valid args are:\n * int limit number of records to retrieve\n * int offset the offset of records to retrieve\n *\n * @method getStarredCourses\n * @param {object} args The request arguments\n * @return {promise} Resolved with an array of courses\n */\n var getStarredCourses = function(args) {\n\n var request = {\n methodname: 'block_starredcourses_get_starred_courses',\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 getStarredCourses: getStarredCourses\n };\n});"],"file":"repository.min.js"}
\ No newline at end of file
diff --git a/blocks/starredcourses/amd/src/repository.js b/blocks/starredcourses/amd/src/repository.js
index 7de121ec335..761dd0a13fe 100644
--- a/blocks/starredcourses/amd/src/repository.js
+++ b/blocks/starredcourses/amd/src/repository.js
@@ -16,7 +16,6 @@
/**
* A javascript module to retrieve user's starred courses.
*
- * @package block_starredcourses
* @copyright 2018 Simey Lameze
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/timeline/amd/build/view.min.js.map b/blocks/timeline/amd/build/view.min.js.map
index 90d9b070a05..3934e19066f 100644
--- a/blocks/timeline/amd/build/view.min.js.map
+++ b/blocks/timeline/amd/build/view.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/view.js"],"names":["define","$","ViewDates","ViewCourses","SELECTORS","TIMELINE_DATES_VIEW","TIMELINE_COURSES_VIEW","init","root","datesViewRoot","find","coursesViewRoot","reset","shown","hasClass"],"mappings":"AAuBAA,OAAM,uBACN,CACI,QADJ,CAEI,2BAFJ,CAGI,6BAHJ,CADM,CAMN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIE,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,8BADT,CAEZC,qBAAqB,CAAE,gCAFX,CAFlB,CA0DE,MAAO,CACHC,IAAI,CA7CG,QAAPA,CAAAA,IAAO,CAASC,CAAT,CAAe,CACtBA,CAAI,CAAGP,CAAC,CAACO,CAAD,CAAR,CADsB,GAElBC,CAAAA,CAAa,CAAGD,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACC,mBAApB,CAFE,CAGlBM,CAAe,CAAGH,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACE,qBAApB,CAHA,CAKtBJ,CAAS,CAACK,IAAV,CAAeE,CAAf,EACAN,CAAW,CAACI,IAAZ,CAAiBI,CAAjB,CACH,CAqCM,CAEHC,KAAK,CA5BG,QAARA,CAAAA,KAAQ,CAASJ,CAAT,CAAe,IACnBC,CAAAA,CAAa,CAAGD,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACC,mBAApB,CADG,CAEnBM,CAAe,CAAGH,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACE,qBAApB,CAFC,CAGvBJ,CAAS,CAACU,KAAV,CAAgBH,CAAhB,EACAN,CAAW,CAACS,KAAZ,CAAkBD,CAAlB,CACH,CAqBM,CAGHE,KAAK,CAdG,QAARA,CAAAA,KAAQ,CAASL,CAAT,CAAe,IACnBC,CAAAA,CAAa,CAAGD,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACC,mBAApB,CADG,CAEnBM,CAAe,CAAGH,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACE,qBAApB,CAFC,CAIvB,GAAIG,CAAa,CAACK,QAAd,CAAuB,QAAvB,CAAJ,CAAsC,CAClCZ,CAAS,CAACW,KAAV,CAAgBJ,CAAhB,CACH,CAFD,IAEO,CACHN,CAAW,CAACU,KAAZ,CAAkBF,CAAlB,CACH,CACJ,CAEM,CAKV,CAzEK,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 .\n\n/**\n * Manage the timeline view for the timeline block.\n *\n * @package block_timeline\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'block_timeline/view_dates',\n 'block_timeline/view_courses',\n],\nfunction(\n $,\n ViewDates,\n ViewCourses\n) {\n\n var SELECTORS = {\n TIMELINE_DATES_VIEW: '[data-region=\"view-dates\"]',\n TIMELINE_COURSES_VIEW: '[data-region=\"view-courses\"]',\n };\n\n /**\n * Intialise the timeline dates and courses views on page load.\n * This function should only be called once per page load because\n * it can cause event listeners to be added to the page.\n *\n * @param {object} root The root element for the timeline view.\n */\n var init = function(root) {\n root = $(root);\n var datesViewRoot = root.find(SELECTORS.TIMELINE_DATES_VIEW);\n var coursesViewRoot = root.find(SELECTORS.TIMELINE_COURSES_VIEW);\n\n ViewDates.init(datesViewRoot);\n ViewCourses.init(coursesViewRoot);\n };\n\n /**\n * Reset the timeline dates and courses views to their original\n * state on first page load.\n *\n * This is called when configuration has changed for the event lists\n * to cause them to reload their data.\n *\n * @param {object} root The root element for the timeline view.\n */\n var reset = function(root) {\n var datesViewRoot = root.find(SELECTORS.TIMELINE_DATES_VIEW);\n var coursesViewRoot = root.find(SELECTORS.TIMELINE_COURSES_VIEW);\n ViewDates.reset(datesViewRoot);\n ViewCourses.reset(coursesViewRoot);\n };\n\n /**\n * Tell the timeline dates or courses view that it has been displayed.\n *\n * This is called each time one of the views is displayed and is used to\n * lazy load the data within it on first load.\n *\n * @param {object} root The root element for the timeline view.\n */\n var shown = function(root) {\n var datesViewRoot = root.find(SELECTORS.TIMELINE_DATES_VIEW);\n var coursesViewRoot = root.find(SELECTORS.TIMELINE_COURSES_VIEW);\n\n if (datesViewRoot.hasClass('active')) {\n ViewDates.shown(datesViewRoot);\n } else {\n ViewCourses.shown(coursesViewRoot);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown,\n };\n});\n"],"file":"view.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/view.js"],"names":["define","$","ViewDates","ViewCourses","SELECTORS","TIMELINE_DATES_VIEW","TIMELINE_COURSES_VIEW","init","root","datesViewRoot","find","coursesViewRoot","reset","shown","hasClass"],"mappings":"AAsBAA,OAAM,uBACN,CACI,QADJ,CAEI,2BAFJ,CAGI,6BAHJ,CADM,CAMN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIE,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,8BADT,CAEZC,qBAAqB,CAAE,gCAFX,CAFlB,CA0DE,MAAO,CACHC,IAAI,CA7CG,QAAPA,CAAAA,IAAO,CAASC,CAAT,CAAe,CACtBA,CAAI,CAAGP,CAAC,CAACO,CAAD,CAAR,CADsB,GAElBC,CAAAA,CAAa,CAAGD,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACC,mBAApB,CAFE,CAGlBM,CAAe,CAAGH,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACE,qBAApB,CAHA,CAKtBJ,CAAS,CAACK,IAAV,CAAeE,CAAf,EACAN,CAAW,CAACI,IAAZ,CAAiBI,CAAjB,CACH,CAqCM,CAEHC,KAAK,CA5BG,QAARA,CAAAA,KAAQ,CAASJ,CAAT,CAAe,IACnBC,CAAAA,CAAa,CAAGD,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACC,mBAApB,CADG,CAEnBM,CAAe,CAAGH,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACE,qBAApB,CAFC,CAGvBJ,CAAS,CAACU,KAAV,CAAgBH,CAAhB,EACAN,CAAW,CAACS,KAAZ,CAAkBD,CAAlB,CACH,CAqBM,CAGHE,KAAK,CAdG,QAARA,CAAAA,KAAQ,CAASL,CAAT,CAAe,IACnBC,CAAAA,CAAa,CAAGD,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACC,mBAApB,CADG,CAEnBM,CAAe,CAAGH,CAAI,CAACE,IAAL,CAAUN,CAAS,CAACE,qBAApB,CAFC,CAIvB,GAAIG,CAAa,CAACK,QAAd,CAAuB,QAAvB,CAAJ,CAAsC,CAClCZ,CAAS,CAACW,KAAV,CAAgBJ,CAAhB,CACH,CAFD,IAEO,CACHN,CAAW,CAACU,KAAZ,CAAkBF,CAAlB,CACH,CACJ,CAEM,CAKV,CAzEK,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 .\n\n/**\n * Manage the timeline view for the timeline block.\n *\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'block_timeline/view_dates',\n 'block_timeline/view_courses',\n],\nfunction(\n $,\n ViewDates,\n ViewCourses\n) {\n\n var SELECTORS = {\n TIMELINE_DATES_VIEW: '[data-region=\"view-dates\"]',\n TIMELINE_COURSES_VIEW: '[data-region=\"view-courses\"]',\n };\n\n /**\n * Intialise the timeline dates and courses views on page load.\n * This function should only be called once per page load because\n * it can cause event listeners to be added to the page.\n *\n * @param {object} root The root element for the timeline view.\n */\n var init = function(root) {\n root = $(root);\n var datesViewRoot = root.find(SELECTORS.TIMELINE_DATES_VIEW);\n var coursesViewRoot = root.find(SELECTORS.TIMELINE_COURSES_VIEW);\n\n ViewDates.init(datesViewRoot);\n ViewCourses.init(coursesViewRoot);\n };\n\n /**\n * Reset the timeline dates and courses views to their original\n * state on first page load.\n *\n * This is called when configuration has changed for the event lists\n * to cause them to reload their data.\n *\n * @param {object} root The root element for the timeline view.\n */\n var reset = function(root) {\n var datesViewRoot = root.find(SELECTORS.TIMELINE_DATES_VIEW);\n var coursesViewRoot = root.find(SELECTORS.TIMELINE_COURSES_VIEW);\n ViewDates.reset(datesViewRoot);\n ViewCourses.reset(coursesViewRoot);\n };\n\n /**\n * Tell the timeline dates or courses view that it has been displayed.\n *\n * This is called each time one of the views is displayed and is used to\n * lazy load the data within it on first load.\n *\n * @param {object} root The root element for the timeline view.\n */\n var shown = function(root) {\n var datesViewRoot = root.find(SELECTORS.TIMELINE_DATES_VIEW);\n var coursesViewRoot = root.find(SELECTORS.TIMELINE_COURSES_VIEW);\n\n if (datesViewRoot.hasClass('active')) {\n ViewDates.shown(datesViewRoot);\n } else {\n ViewCourses.shown(coursesViewRoot);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown,\n };\n});\n"],"file":"view.min.js"}
\ No newline at end of file
diff --git a/blocks/timeline/amd/build/view_courses.min.js.map b/blocks/timeline/amd/build/view_courses.min.js.map
index 58b9369cfcd..dcf3ab3540b 100644
--- a/blocks/timeline/amd/build/view_courses.min.js.map
+++ b/blocks/timeline/amd/build/view_courses.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/view_courses.js"],"names":["define","$","Notification","CustomEvents","Str","Templates","EventList","CourseRepository","EventsRepository","SELECTORS","MORE_COURSES_BUTTON","MORE_COURSES_BUTTON_CONTAINER","NO_COURSES_EMPTY_MESSAGE","COURSES_LIST","COURSE_ITEMS_LOADING_PLACEHOLDER","COURSE_EVENTS_CONTAINER","COURSE_NAME","LOADING_ICON","TEMPLATES","COURSE_ITEMS","COURSE_EVENT_LIMIT","SECONDS_IN_DAY","hideLoadingPlaceholder","root","find","addClass","hideMoreCoursesButton","showMoreCoursesButton","removeClass","enableMoreCoursesButtonLoading","button","prop","render","then","html","append","catch","disableMoreCoursesButtonLoading","remove","showNoCoursesEmptyMessage","renderCourseItemsHTML","container","appendNodeContents","hasLoadedCourses","length","getOffset","parseInt","attr","setOffset","offset","getLimit","getDaysOffset","getDaysLimit","daysLimit","getMidnight","getStartTime","midnight","daysOffset","getEndTime","getEventsForCourseIds","courseIds","startTime","limit","endTime","args","courseids","starttime","endtime","queryByCourses","getEventReloadTime","data","setEventReloadTime","time","hasReloadedEventsSince","loadEventsForCourses","courses","map","course","id","updateDisplayFromCourses","noEventsURL","hasdaysoffset","hasdayslimit","daysoffset","dayslimit","nodayslimit","urls","noevents","loadMoreCourses","getEnrolledCoursesByTimelineClassification","result","startEventLoadingTime","Date","now","nextOffset","nextoffset","eventsPromise","renderPromise","when","eventsByCourse","forEach","courseId","events","courseEventsContainer","eventListRoot","rootSelector","courseGroups","groupedbycourse","filter","group","courseid","pageOnePreload","Deferred","resolve","promise","get_string","fullnamedisplay","string","init","exception","reloadCourseEvents","startReloadTime","courseEventsContainers","get","each","index","courseName","text","eventListContainer","pageDeferred","registerEventListeners","activate","on","e","originalEvent","preventDefault","stopPropagation","shown","hasClass","reset","removeAttr"],"mappings":"AAuBAA,OAAM,+BACN,CACI,QADJ,CAEI,mBAFJ,CAGI,gCAHJ,CAII,UAJJ,CAKI,gBALJ,CAMI,2BANJ,CAOI,wBAPJ,CAQI,2CARJ,CADM,CAWN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASE,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,gCADT,CAEZC,6BAA6B,CAAE,iDAFnB,CAGZC,wBAAwB,CAAE,4CAHd,CAIZC,YAAY,CAAE,gCAJF,CAKZC,gCAAgC,CAAE,oDALtB,CAMZC,uBAAuB,CAAE,2CANb,CAOZC,WAAW,CAAE,+BAPD,CAQZC,YAAY,CAAE,eARF,CAFlB,CAaMC,CAAS,CAAG,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I,CAA+B,CAACd,CAAD,CAElC,CAJL,EAKKa,KALL,CAKW,UAAW,CACdC,CAA+B,CAACd,CAAD,CAClC,CAPL,EASA,GAAI+C,CAAJ,CAAU,CACNA,CAAI,CAACgE,aAAL,CAAmBC,cAAnB,GACAjE,CAAI,CAACgE,aAAL,CAAmBE,eAAnB,EACH,CACDH,CAAC,CAACG,eAAF,EACH,CAhBD,CAiBH,CAlfH,CA8hBMC,CAAK,CAAG,SAASlH,CAAT,CAAe,CACvB,GAAI,CAACA,CAAI,CAACwB,IAAL,CAAU,WAAV,CAAL,CAA6B,CACzB,GAAIJ,CAAgB,CAACpB,CAAD,CAApB,CAA4B,CAGxBiG,CAAkB,CAACjG,CAAD,CACrB,CAJD,IAIO,CAEHiE,CAAe,CAACjE,CAAD,CAClB,CAEDA,CAAI,CAACwB,IAAL,CAAU,WAAV,IACH,CACJ,CA3iBH,CA6iBE,MAAO,CACHuE,IAAI,CAjDG,QAAPA,CAAAA,IAAO,CAAS/F,CAAT,CAAe,CACtBA,CAAI,CAAGtB,CAAC,CAACsB,CAAD,CAAR,CAEAgD,CAAkB,CAAChD,CAAD,CAAOqE,IAAI,CAACC,GAAL,EAAP,CAAlB,CAEA,GAAItE,CAAI,CAACmH,QAAL,CAAc,QAAd,CAAJ,CAA6B,CAEzBlD,CAAe,CAACjE,CAAD,CAAf,CACAA,CAAI,CAACwB,IAAL,CAAU,WAAV,IACH,CAEDmF,CAAsB,CAAC3G,CAAD,CACzB,CAoCM,CAEHoH,KAAK,CA9BG,QAARA,CAAAA,KAAQ,CAASpH,CAAT,CAAe,CACvBA,CAAI,CAACqH,UAAL,CAAgB,WAAhB,EACA,GAAIrH,CAAI,CAACmH,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBD,CAAK,CAAClH,CAAD,CACR,CACJ,CAuBM,CAGHkH,KAAK,CAAEA,CAHJ,CAKV,CAtkBK,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 .\n\n/**\n * Manage the timeline courses view for the timeline block.\n *\n * @package block_timeline\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/str',\n 'core/templates',\n 'block_timeline/event_list',\n 'core_course/repository',\n 'block_timeline/calendar_events_repository'\n],\nfunction(\n $,\n Notification,\n CustomEvents,\n Str,\n Templates,\n EventList,\n CourseRepository,\n EventsRepository\n) {\n\n var SELECTORS = {\n MORE_COURSES_BUTTON: '[data-action=\"more-courses\"]',\n MORE_COURSES_BUTTON_CONTAINER: '[data-region=\"more-courses-button-container\"]',\n NO_COURSES_EMPTY_MESSAGE: '[data-region=\"no-courses-empty-message\"]',\n COURSES_LIST: '[data-region=\"courses-list\"]',\n COURSE_ITEMS_LOADING_PLACEHOLDER: '[data-region=\"course-items-loading-placeholder\"]',\n COURSE_EVENTS_CONTAINER: '[data-region=\"course-events-container\"]',\n COURSE_NAME: '[data-region=\"course-name\"]',\n LOADING_ICON: '.loading-icon'\n };\n\n var TEMPLATES = {\n COURSE_ITEMS: 'block_timeline/course-items',\n LOADING_ICON: 'core/loading'\n };\n\n var COURSE_CLASSIFICATION = 'inprogress';\n var COURSE_SORT = 'fullname asc';\n var COURSE_EVENT_LIMIT = 5;\n var COURSE_LIMIT = 2;\n var SECONDS_IN_DAY = 60 * 60 * 24;\n\n /**\n * Hide the loading placeholder elements.\n *\n * @param {object} root The rool element.\n */\n var hideLoadingPlaceholder = function(root) {\n root.find(SELECTORS.COURSE_ITEMS_LOADING_PLACEHOLDER).addClass('hidden');\n };\n\n /**\n * Hide the \"more courses\" button.\n *\n * @param {object} root The rool element.\n */\n var hideMoreCoursesButton = function(root) {\n root.find(SELECTORS.MORE_COURSES_BUTTON_CONTAINER).addClass('hidden');\n };\n\n /**\n * Show the \"more courses\" button.\n *\n * @param {object} root The rool element.\n */\n var showMoreCoursesButton = function(root) {\n root.find(SELECTORS.MORE_COURSES_BUTTON_CONTAINER).removeClass('hidden');\n };\n\n /**\n * Disable the \"more courses\" button and show the loading spinner.\n *\n * @param {object} root The rool element.\n */\n var enableMoreCoursesButtonLoading = function(root) {\n var button = root.find(SELECTORS.MORE_COURSES_BUTTON);\n button.prop('disabled', true);\n Templates.render(TEMPLATES.LOADING_ICON, {})\n .then(function(html) {\n button.append(html);\n return html;\n })\n .catch(function() {\n // It's not important if this false so just do so silently.\n return false;\n });\n };\n\n /**\n * Enable the \"more courses\" button and remove the loading spinner.\n *\n * @param {object} root The rool element.\n */\n var disableMoreCoursesButtonLoading = function(root) {\n var button = root.find(SELECTORS.MORE_COURSES_BUTTON);\n button.prop('disabled', false);\n button.find(SELECTORS.LOADING_ICON).remove();\n };\n\n /**\n * Display the message for when there are no courses available.\n *\n * @param {object} root The rool element.\n */\n var showNoCoursesEmptyMessage = function(root) {\n root.find(SELECTORS.NO_COURSES_EMPTY_MESSAGE).removeClass('hidden');\n };\n\n /**\n * Render the course items HTML to the page.\n *\n * @param {object} root The rool element.\n * @param {string} html The course items HTML to render.\n */\n var renderCourseItemsHTML = function(root, html) {\n var container = root.find(SELECTORS.COURSES_LIST);\n Templates.appendNodeContents(container, html, '');\n };\n\n /**\n * Check if any courses have been loaded.\n *\n * @param {object} root The rool element.\n * @return {bool}\n */\n var hasLoadedCourses = function(root) {\n return root.find(SELECTORS.COURSE_EVENTS_CONTAINER).length > 0;\n };\n\n /**\n * Return the offset value for fetching courses.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getOffset = function(root) {\n return parseInt(root.attr('data-offset'), 10);\n };\n\n /**\n * Set the offset value for fetching courses.\n *\n * @param {object} root The rool element.\n * @param {Number} offset Offset value.\n */\n var setOffset = function(root, offset) {\n root.attr('data-offset', offset);\n };\n\n /**\n * Return the limit value for fetching courses.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getLimit = function(root) {\n return parseInt(root.attr('data-limit'), 10);\n };\n\n /**\n * Return the days offset value for fetching events.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getDaysOffset = function(root) {\n return parseInt(root.attr('data-days-offset'), 10);\n };\n\n /**\n * Return the days limit value for fetching events. The days\n * limit is optional so undefined will be returned if it isn't\n * set.\n *\n * @param {object} root The rool element.\n * @return {int|undefined}\n */\n var getDaysLimit = function(root) {\n var daysLimit = root.attr('data-days-limit');\n return daysLimit != undefined ? parseInt(daysLimit, 10) : undefined;\n };\n\n /**\n * Return the timestamp for the user's midnight.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getMidnight = function(root) {\n return parseInt(root.attr('data-midnight'), 10);\n };\n\n /**\n * Return the start time for fetching events. This is calculated\n * based on the user's midnight value so that timezones are\n * preserved.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getStartTime = function(root) {\n var midnight = getMidnight(root);\n var daysOffset = getDaysOffset(root);\n return midnight + (daysOffset * SECONDS_IN_DAY);\n };\n\n /**\n * Return the end time for fetching events. This is calculated\n * based on the user's midnight value so that timezones are\n * preserved.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getEndTime = function(root) {\n var midnight = getMidnight(root);\n var daysLimit = getDaysLimit(root);\n return daysLimit != undefined ? midnight + (daysLimit * SECONDS_IN_DAY) : false;\n };\n\n /**\n * Get a list of events for the given course ids. Returns a promise that will\n * be resolved with the events.\n *\n * @param {array} courseIds The list of course ids to fetch events for.\n * @param {Number} startTime Timestamp to fetch events from.\n * @param {Number} limit Limit to the number of events (this applies per course, not total)\n * @param {Number} endTime Timestamp to fetch events to.\n * @return {object} jQuery promise.\n */\n var getEventsForCourseIds = function(courseIds, startTime, limit, endTime) {\n var args = {\n courseids: courseIds,\n starttime: startTime,\n limit: limit\n };\n\n if (endTime) {\n args.endtime = endTime;\n }\n\n return EventsRepository.queryByCourses(args);\n };\n\n /**\n * Get the last time the events were reloaded.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getEventReloadTime = function(root) {\n return root.data('last-event-load-time');\n };\n\n /**\n * Set the last time the events were reloaded.\n *\n * @param {object} root The rool element.\n * @param {Number} time Timestamp in milliseconds.\n */\n var setEventReloadTime = function(root, time) {\n root.data('last-event-load-time', time);\n };\n\n /**\n * Check if events have begun reloading since the given\n * time.\n *\n * @param {object} root The rool element.\n * @param {Number} time Timestamp in milliseconds.\n * @return {bool}\n */\n var hasReloadedEventsSince = function(root, time) {\n return getEventReloadTime(root) > time;\n };\n\n /**\n * Send a request to the server to load the events for the courses.\n *\n * @param {array} courses List of course objects.\n * @param {Number} startTime Timestamp to load events after.\n * @param {int|undefined} endTime Timestamp to load events up until.\n * @return {object} jQuery promise resolved with the events.\n */\n var loadEventsForCourses = function(courses, startTime, endTime) {\n var courseIds = courses.map(function(course) {\n return course.id;\n });\n\n return getEventsForCourseIds(courseIds, startTime, COURSE_EVENT_LIMIT + 1, endTime);\n };\n\n /**\n * Render the courses in the DOM once the server has returned the courses.\n *\n * @param {array} courses List of course objects.\n * @param {object} root The root element\n * @param {Number} midnight The midnight timestamp in the user's timezone.\n * @param {Number} daysOffset Number of days from today to offset the events.\n * @param {Number} daysLimit Number of days from today to limit the events to.\n * @param {string} noEventsURL URL for the image to display for no events.\n * @return {object} jQuery promise resolved after rendering is complete.\n */\n var updateDisplayFromCourses = function(courses, root, midnight, daysOffset, daysLimit, noEventsURL) {\n // Render the courses template.\n return Templates.render(TEMPLATES.COURSE_ITEMS, {\n courses: courses,\n midnight: midnight,\n hasdaysoffset: true,\n hasdayslimit: daysLimit != undefined,\n daysoffset: daysOffset,\n dayslimit: daysLimit,\n nodayslimit: daysLimit == undefined,\n urls: {\n noevents: noEventsURL\n }\n }).then(function(html) {\n hideLoadingPlaceholder(root);\n\n if (html) {\n // Template rendering is complete and we have the HTML so we can\n // add it to the DOM.\n renderCourseItemsHTML(root, html);\n } else {\n if (!hasLoadedCourses(root)) {\n // There were no courses to render so show the empty placeholder\n // message for the user to tell them.\n showNoCoursesEmptyMessage(root);\n }\n }\n\n return html;\n })\n .then(function(html) {\n if (courses.length < COURSE_LIMIT) {\n // We know there aren't any more courses because we got back less\n // than we asked for so hide the button to request more.\n hideMoreCoursesButton(root);\n } else {\n // Make sure the button is visible if there are more courses to load.\n showMoreCoursesButton(root);\n }\n\n return html;\n })\n .catch(function() {\n hideLoadingPlaceholder(root);\n });\n };\n\n /**\n * Find all of the visible course blocks and initialise the event\n * list module to being loading the events for the course block.\n *\n * @param {object} root The root element for the timeline courses view.\n * @return {object} jQuery promise resolved with courses and events.\n */\n var loadMoreCourses = function(root) {\n var offset = getOffset(root);\n var limit = getLimit(root);\n\n // Start loading the next set of courses.\n return CourseRepository.getEnrolledCoursesByTimelineClassification(\n COURSE_CLASSIFICATION,\n limit,\n offset,\n COURSE_SORT\n ).then(function(result) {\n var startEventLoadingTime = Date.now();\n var courses = result.courses;\n var nextOffset = result.nextoffset;\n var daysOffset = getDaysOffset(root);\n var daysLimit = getDaysLimit(root);\n var midnight = getMidnight(root);\n var startTime = getStartTime(root);\n var endTime = getEndTime(root);\n var noEventsURL = root.attr('data-no-events-url');\n // Record the next offset if we want to request more courses.\n setOffset(root, nextOffset);\n // Load the events for these courses.\n var eventsPromise = loadEventsForCourses(courses, startTime, endTime);\n // Render the courses in the DOM.\n var renderPromise = updateDisplayFromCourses(courses, root, midnight, daysOffset, daysLimit, noEventsURL);\n\n return $.when(eventsPromise, renderPromise)\n .then(function(eventsByCourse) {\n if (hasReloadedEventsSince(root, startEventLoadingTime)) {\n // All of the events are being reloaded so ignore our results.\n return eventsByCourse;\n }\n\n // When we've got all of the courses and events we can render the events in the\n // correct course event list.\n courses.forEach(function(course) {\n var courseId = course.id;\n var events = [];\n var containerSelector = '[data-region=\"course-events-container\"][data-course-id=\"' + courseId + '\"]';\n var courseEventsContainer = root.find(containerSelector);\n var eventListRoot = courseEventsContainer.find(EventList.rootSelector);\n var courseGroups = eventsByCourse.groupedbycourse.filter(function(group) {\n return group.courseid == courseId;\n });\n\n if (courseGroups.length) {\n // Get the events for this course.\n events = courseGroups[0].events;\n }\n\n // Create a preloaded page to pass to the event list because we've already\n // loaded the first page of events.\n var pageOnePreload = $.Deferred().resolve({events: events}).promise();\n // Initialise the event list pagination area for this course.\n Str.get_string('ariaeventlistpaginationnavcourses', 'block_timeline', course.fullnamedisplay)\n .then(function(string) {\n EventList.init(eventListRoot, COURSE_EVENT_LIMIT, {'1': pageOnePreload}, string);\n return string;\n })\n .catch(function() {\n // An error is ok, just render with the default string.\n EventList.init(eventListRoot, COURSE_EVENT_LIMIT, {'1': pageOnePreload});\n });\n });\n\n return eventsByCourse;\n });\n }).catch(Notification.exception);\n };\n\n /**\n * Reload the events for all of the visible courses. These events will be loaded\n * in a single request to the server.\n *\n * @param {object} root The root element.\n * @return {object} jQuery promise resolved with courses and events.\n */\n var reloadCourseEvents = function(root) {\n var startReloadTime = Date.now();\n var startTime = getStartTime(root);\n var endTime = getEndTime(root);\n var courseEventsContainers = root.find(SELECTORS.COURSE_EVENTS_CONTAINER);\n var courseIds = courseEventsContainers.map(function() {\n return $(this).attr('data-course-id');\n }).get();\n\n // Record when we started our request.\n setEventReloadTime(root, startReloadTime);\n\n // Load all of the events for the given courses.\n return getEventsForCourseIds(courseIds, startTime, COURSE_EVENT_LIMIT + 1, endTime)\n .then(function(eventsByCourse) {\n if (hasReloadedEventsSince(root, startReloadTime)) {\n // A new reload has begun so ignore our results.\n return eventsByCourse;\n }\n\n courseEventsContainers.each(function(index, container) {\n container = $(container);\n var courseId = container.attr('data-course-id');\n var courseName = container.find(SELECTORS.COURSE_NAME).text();\n var eventListContainer = container.find(EventList.rootSelector);\n var pageDeferred = $.Deferred();\n var events = [];\n var courseGroups = eventsByCourse.groupedbycourse.filter(function(group) {\n return group.courseid == courseId;\n });\n\n if (courseGroups.length) {\n // Get the events just for this course.\n events = courseGroups[0].events;\n }\n\n pageDeferred.resolve({events: events});\n\n // Re-initialise the events list with the preloaded events we just got from\n // the server.\n Str.get_string('ariaeventlistpaginationnavcourses', 'block_timeline', courseName)\n .then(function(string) {\n EventList.init(eventListContainer, COURSE_EVENT_LIMIT, {'1': pageDeferred.promise()}, string);\n return string;\n })\n .catch(function() {\n // Ignore a failure to load the string. Just render with the default string.\n EventList.init(eventListContainer, COURSE_EVENT_LIMIT, {'1': pageDeferred.promise()});\n });\n });\n\n return eventsByCourse;\n }).catch(Notification.exception);\n };\n\n /**\n * Add event listeners to load more courses for the courses view.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var registerEventListeners = function(root) {\n CustomEvents.define(root, [CustomEvents.events.activate]);\n // Show more courses and load their events when the user clicks the \"more courses\"\n // button.\n root.on(CustomEvents.events.activate, SELECTORS.MORE_COURSES_BUTTON, function(e, data) {\n enableMoreCoursesButtonLoading(root);\n loadMoreCourses(root)\n .then(function() {\n disableMoreCoursesButtonLoading(root);\n return;\n })\n .catch(function() {\n disableMoreCoursesButtonLoading(root);\n });\n\n if (data) {\n data.originalEvent.preventDefault();\n data.originalEvent.stopPropagation();\n }\n e.stopPropagation();\n });\n };\n\n /**\n * Initialise the timeline courses view. Begin loading the events\n * if this view is active. Add the relevant event listeners.\n *\n * This function should only be called once per page load because it\n * is adding event listeners to the page.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var init = function(root) {\n root = $(root);\n\n setEventReloadTime(root, Date.now());\n\n if (root.hasClass('active')) {\n // Only load if this is active otherwise it will be lazy loaded later.\n loadMoreCourses(root);\n root.attr('data-seen', true);\n }\n\n registerEventListeners(root);\n };\n\n /**\n * Reset the element back to it's initial state. Begin loading the events again\n * if this view is active.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var reset = function(root) {\n root.removeAttr('data-seen');\n if (root.hasClass('active')) {\n shown(root);\n }\n };\n\n /**\n * If this is the first time this view has been displayed then begin loading\n * the events.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var shown = function(root) {\n if (!root.attr('data-seen')) {\n if (hasLoadedCourses(root)) {\n // This isn't the first time this view is shown so just reload the\n // events for the courses we've already loaded.\n reloadCourseEvents(root);\n } else {\n // We haven't loaded any courses yet so do that now.\n loadMoreCourses(root);\n }\n\n root.attr('data-seen', true);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown\n };\n});\n"],"file":"view_courses.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/view_courses.js"],"names":["define","$","Notification","CustomEvents","Str","Templates","EventList","CourseRepository","EventsRepository","SELECTORS","MORE_COURSES_BUTTON","MORE_COURSES_BUTTON_CONTAINER","NO_COURSES_EMPTY_MESSAGE","COURSES_LIST","COURSE_ITEMS_LOADING_PLACEHOLDER","COURSE_EVENTS_CONTAINER","COURSE_NAME","LOADING_ICON","TEMPLATES","COURSE_ITEMS","COURSE_EVENT_LIMIT","SECONDS_IN_DAY","hideLoadingPlaceholder","root","find","addClass","hideMoreCoursesButton","showMoreCoursesButton","removeClass","enableMoreCoursesButtonLoading","button","prop","render","then","html","append","catch","disableMoreCoursesButtonLoading","remove","showNoCoursesEmptyMessage","renderCourseItemsHTML","container","appendNodeContents","hasLoadedCourses","length","getOffset","parseInt","attr","setOffset","offset","getLimit","getDaysOffset","getDaysLimit","daysLimit","getMidnight","getStartTime","midnight","daysOffset","getEndTime","getEventsForCourseIds","courseIds","startTime","limit","endTime","args","courseids","starttime","endtime","queryByCourses","getEventReloadTime","data","setEventReloadTime","time","hasReloadedEventsSince","loadEventsForCourses","courses","map","course","id","updateDisplayFromCourses","noEventsURL","hasdaysoffset","hasdayslimit","daysoffset","dayslimit","nodayslimit","urls","noevents","loadMoreCourses","getEnrolledCoursesByTimelineClassification","result","startEventLoadingTime","Date","now","nextOffset","nextoffset","eventsPromise","renderPromise","when","eventsByCourse","forEach","courseId","events","courseEventsContainer","eventListRoot","rootSelector","courseGroups","groupedbycourse","filter","group","courseid","pageOnePreload","Deferred","resolve","promise","get_string","fullnamedisplay","string","init","exception","reloadCourseEvents","startReloadTime","courseEventsContainers","get","each","index","courseName","text","eventListContainer","pageDeferred","registerEventListeners","activate","on","e","originalEvent","preventDefault","stopPropagation","shown","hasClass","reset","removeAttr"],"mappings":"AAsBAA,OAAM,+BACN,CACI,QADJ,CAEI,mBAFJ,CAGI,gCAHJ,CAII,UAJJ,CAKI,gBALJ,CAMI,2BANJ,CAOI,wBAPJ,CAQI,2CARJ,CADM,CAWN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASE,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,gCADT,CAEZC,6BAA6B,CAAE,iDAFnB,CAGZC,wBAAwB,CAAE,4CAHd,CAIZC,YAAY,CAAE,gCAJF,CAKZC,gCAAgC,CAAE,oDALtB,CAMZC,uBAAuB,CAAE,2CANb,CAOZC,WAAW,CAAE,+BAPD,CAQZC,YAAY,CAAE,eARF,CAFlB,CAaMC,CAAS,CAAG,CACZC,YAAY,CAAE,6BADF,CAEZF,YAAY,CAAE,cAFF,CAblB,CAoBMG,CAAkB,CAAG,CApB3B,CAsBMC,CAAc,MAtBpB,CA6BMC,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,IAAL,CAAUf,CAAS,CAACK,gCAApB,EAAsDW,QAAtD,CAA+D,QAA/D,CACH,CA/BH,CAsCMC,CAAqB,CAAG,SAASH,CAAT,CAAe,CACvCA,CAAI,CAACC,IAAL,CAAUf,CAAS,CAACE,6BAApB,EAAmDc,QAAnD,CAA4D,QAA5D,CACH,CAxCH,CA+CME,CAAqB,CAAG,SAASJ,CAAT,CAAe,CACvCA,CAA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kB,CAACjG,CAAD,CACrB,CAJD,IAIO,CAEHiE,CAAe,CAACjE,CAAD,CAClB,CAEDA,CAAI,CAACwB,IAAL,CAAU,WAAV,IACH,CACJ,CA3iBH,CA6iBE,MAAO,CACHuE,IAAI,CAjDG,QAAPA,CAAAA,IAAO,CAAS/F,CAAT,CAAe,CACtBA,CAAI,CAAGtB,CAAC,CAACsB,CAAD,CAAR,CAEAgD,CAAkB,CAAChD,CAAD,CAAOqE,IAAI,CAACC,GAAL,EAAP,CAAlB,CAEA,GAAItE,CAAI,CAACmH,QAAL,CAAc,QAAd,CAAJ,CAA6B,CAEzBlD,CAAe,CAACjE,CAAD,CAAf,CACAA,CAAI,CAACwB,IAAL,CAAU,WAAV,IACH,CAEDmF,CAAsB,CAAC3G,CAAD,CACzB,CAoCM,CAEHoH,KAAK,CA9BG,QAARA,CAAAA,KAAQ,CAASpH,CAAT,CAAe,CACvBA,CAAI,CAACqH,UAAL,CAAgB,WAAhB,EACA,GAAIrH,CAAI,CAACmH,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBD,CAAK,CAAClH,CAAD,CACR,CACJ,CAuBM,CAGHkH,KAAK,CAAEA,CAHJ,CAKV,CAtkBK,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 .\n\n/**\n * Manage the timeline courses view for the timeline block.\n *\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/str',\n 'core/templates',\n 'block_timeline/event_list',\n 'core_course/repository',\n 'block_timeline/calendar_events_repository'\n],\nfunction(\n $,\n Notification,\n CustomEvents,\n Str,\n Templates,\n EventList,\n CourseRepository,\n EventsRepository\n) {\n\n var SELECTORS = {\n MORE_COURSES_BUTTON: '[data-action=\"more-courses\"]',\n MORE_COURSES_BUTTON_CONTAINER: '[data-region=\"more-courses-button-container\"]',\n NO_COURSES_EMPTY_MESSAGE: '[data-region=\"no-courses-empty-message\"]',\n COURSES_LIST: '[data-region=\"courses-list\"]',\n COURSE_ITEMS_LOADING_PLACEHOLDER: '[data-region=\"course-items-loading-placeholder\"]',\n COURSE_EVENTS_CONTAINER: '[data-region=\"course-events-container\"]',\n COURSE_NAME: '[data-region=\"course-name\"]',\n LOADING_ICON: '.loading-icon'\n };\n\n var TEMPLATES = {\n COURSE_ITEMS: 'block_timeline/course-items',\n LOADING_ICON: 'core/loading'\n };\n\n var COURSE_CLASSIFICATION = 'inprogress';\n var COURSE_SORT = 'fullname asc';\n var COURSE_EVENT_LIMIT = 5;\n var COURSE_LIMIT = 2;\n var SECONDS_IN_DAY = 60 * 60 * 24;\n\n /**\n * Hide the loading placeholder elements.\n *\n * @param {object} root The rool element.\n */\n var hideLoadingPlaceholder = function(root) {\n root.find(SELECTORS.COURSE_ITEMS_LOADING_PLACEHOLDER).addClass('hidden');\n };\n\n /**\n * Hide the \"more courses\" button.\n *\n * @param {object} root The rool element.\n */\n var hideMoreCoursesButton = function(root) {\n root.find(SELECTORS.MORE_COURSES_BUTTON_CONTAINER).addClass('hidden');\n };\n\n /**\n * Show the \"more courses\" button.\n *\n * @param {object} root The rool element.\n */\n var showMoreCoursesButton = function(root) {\n root.find(SELECTORS.MORE_COURSES_BUTTON_CONTAINER).removeClass('hidden');\n };\n\n /**\n * Disable the \"more courses\" button and show the loading spinner.\n *\n * @param {object} root The rool element.\n */\n var enableMoreCoursesButtonLoading = function(root) {\n var button = root.find(SELECTORS.MORE_COURSES_BUTTON);\n button.prop('disabled', true);\n Templates.render(TEMPLATES.LOADING_ICON, {})\n .then(function(html) {\n button.append(html);\n return html;\n })\n .catch(function() {\n // It's not important if this false so just do so silently.\n return false;\n });\n };\n\n /**\n * Enable the \"more courses\" button and remove the loading spinner.\n *\n * @param {object} root The rool element.\n */\n var disableMoreCoursesButtonLoading = function(root) {\n var button = root.find(SELECTORS.MORE_COURSES_BUTTON);\n button.prop('disabled', false);\n button.find(SELECTORS.LOADING_ICON).remove();\n };\n\n /**\n * Display the message for when there are no courses available.\n *\n * @param {object} root The rool element.\n */\n var showNoCoursesEmptyMessage = function(root) {\n root.find(SELECTORS.NO_COURSES_EMPTY_MESSAGE).removeClass('hidden');\n };\n\n /**\n * Render the course items HTML to the page.\n *\n * @param {object} root The rool element.\n * @param {string} html The course items HTML to render.\n */\n var renderCourseItemsHTML = function(root, html) {\n var container = root.find(SELECTORS.COURSES_LIST);\n Templates.appendNodeContents(container, html, '');\n };\n\n /**\n * Check if any courses have been loaded.\n *\n * @param {object} root The rool element.\n * @return {bool}\n */\n var hasLoadedCourses = function(root) {\n return root.find(SELECTORS.COURSE_EVENTS_CONTAINER).length > 0;\n };\n\n /**\n * Return the offset value for fetching courses.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getOffset = function(root) {\n return parseInt(root.attr('data-offset'), 10);\n };\n\n /**\n * Set the offset value for fetching courses.\n *\n * @param {object} root The rool element.\n * @param {Number} offset Offset value.\n */\n var setOffset = function(root, offset) {\n root.attr('data-offset', offset);\n };\n\n /**\n * Return the limit value for fetching courses.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getLimit = function(root) {\n return parseInt(root.attr('data-limit'), 10);\n };\n\n /**\n * Return the days offset value for fetching events.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getDaysOffset = function(root) {\n return parseInt(root.attr('data-days-offset'), 10);\n };\n\n /**\n * Return the days limit value for fetching events. The days\n * limit is optional so undefined will be returned if it isn't\n * set.\n *\n * @param {object} root The rool element.\n * @return {int|undefined}\n */\n var getDaysLimit = function(root) {\n var daysLimit = root.attr('data-days-limit');\n return daysLimit != undefined ? parseInt(daysLimit, 10) : undefined;\n };\n\n /**\n * Return the timestamp for the user's midnight.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getMidnight = function(root) {\n return parseInt(root.attr('data-midnight'), 10);\n };\n\n /**\n * Return the start time for fetching events. This is calculated\n * based on the user's midnight value so that timezones are\n * preserved.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getStartTime = function(root) {\n var midnight = getMidnight(root);\n var daysOffset = getDaysOffset(root);\n return midnight + (daysOffset * SECONDS_IN_DAY);\n };\n\n /**\n * Return the end time for fetching events. This is calculated\n * based on the user's midnight value so that timezones are\n * preserved.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getEndTime = function(root) {\n var midnight = getMidnight(root);\n var daysLimit = getDaysLimit(root);\n return daysLimit != undefined ? midnight + (daysLimit * SECONDS_IN_DAY) : false;\n };\n\n /**\n * Get a list of events for the given course ids. Returns a promise that will\n * be resolved with the events.\n *\n * @param {array} courseIds The list of course ids to fetch events for.\n * @param {Number} startTime Timestamp to fetch events from.\n * @param {Number} limit Limit to the number of events (this applies per course, not total)\n * @param {Number} endTime Timestamp to fetch events to.\n * @return {object} jQuery promise.\n */\n var getEventsForCourseIds = function(courseIds, startTime, limit, endTime) {\n var args = {\n courseids: courseIds,\n starttime: startTime,\n limit: limit\n };\n\n if (endTime) {\n args.endtime = endTime;\n }\n\n return EventsRepository.queryByCourses(args);\n };\n\n /**\n * Get the last time the events were reloaded.\n *\n * @param {object} root The rool element.\n * @return {Number}\n */\n var getEventReloadTime = function(root) {\n return root.data('last-event-load-time');\n };\n\n /**\n * Set the last time the events were reloaded.\n *\n * @param {object} root The rool element.\n * @param {Number} time Timestamp in milliseconds.\n */\n var setEventReloadTime = function(root, time) {\n root.data('last-event-load-time', time);\n };\n\n /**\n * Check if events have begun reloading since the given\n * time.\n *\n * @param {object} root The rool element.\n * @param {Number} time Timestamp in milliseconds.\n * @return {bool}\n */\n var hasReloadedEventsSince = function(root, time) {\n return getEventReloadTime(root) > time;\n };\n\n /**\n * Send a request to the server to load the events for the courses.\n *\n * @param {array} courses List of course objects.\n * @param {Number} startTime Timestamp to load events after.\n * @param {int|undefined} endTime Timestamp to load events up until.\n * @return {object} jQuery promise resolved with the events.\n */\n var loadEventsForCourses = function(courses, startTime, endTime) {\n var courseIds = courses.map(function(course) {\n return course.id;\n });\n\n return getEventsForCourseIds(courseIds, startTime, COURSE_EVENT_LIMIT + 1, endTime);\n };\n\n /**\n * Render the courses in the DOM once the server has returned the courses.\n *\n * @param {array} courses List of course objects.\n * @param {object} root The root element\n * @param {Number} midnight The midnight timestamp in the user's timezone.\n * @param {Number} daysOffset Number of days from today to offset the events.\n * @param {Number} daysLimit Number of days from today to limit the events to.\n * @param {string} noEventsURL URL for the image to display for no events.\n * @return {object} jQuery promise resolved after rendering is complete.\n */\n var updateDisplayFromCourses = function(courses, root, midnight, daysOffset, daysLimit, noEventsURL) {\n // Render the courses template.\n return Templates.render(TEMPLATES.COURSE_ITEMS, {\n courses: courses,\n midnight: midnight,\n hasdaysoffset: true,\n hasdayslimit: daysLimit != undefined,\n daysoffset: daysOffset,\n dayslimit: daysLimit,\n nodayslimit: daysLimit == undefined,\n urls: {\n noevents: noEventsURL\n }\n }).then(function(html) {\n hideLoadingPlaceholder(root);\n\n if (html) {\n // Template rendering is complete and we have the HTML so we can\n // add it to the DOM.\n renderCourseItemsHTML(root, html);\n } else {\n if (!hasLoadedCourses(root)) {\n // There were no courses to render so show the empty placeholder\n // message for the user to tell them.\n showNoCoursesEmptyMessage(root);\n }\n }\n\n return html;\n })\n .then(function(html) {\n if (courses.length < COURSE_LIMIT) {\n // We know there aren't any more courses because we got back less\n // than we asked for so hide the button to request more.\n hideMoreCoursesButton(root);\n } else {\n // Make sure the button is visible if there are more courses to load.\n showMoreCoursesButton(root);\n }\n\n return html;\n })\n .catch(function() {\n hideLoadingPlaceholder(root);\n });\n };\n\n /**\n * Find all of the visible course blocks and initialise the event\n * list module to being loading the events for the course block.\n *\n * @param {object} root The root element for the timeline courses view.\n * @return {object} jQuery promise resolved with courses and events.\n */\n var loadMoreCourses = function(root) {\n var offset = getOffset(root);\n var limit = getLimit(root);\n\n // Start loading the next set of courses.\n return CourseRepository.getEnrolledCoursesByTimelineClassification(\n COURSE_CLASSIFICATION,\n limit,\n offset,\n COURSE_SORT\n ).then(function(result) {\n var startEventLoadingTime = Date.now();\n var courses = result.courses;\n var nextOffset = result.nextoffset;\n var daysOffset = getDaysOffset(root);\n var daysLimit = getDaysLimit(root);\n var midnight = getMidnight(root);\n var startTime = getStartTime(root);\n var endTime = getEndTime(root);\n var noEventsURL = root.attr('data-no-events-url');\n // Record the next offset if we want to request more courses.\n setOffset(root, nextOffset);\n // Load the events for these courses.\n var eventsPromise = loadEventsForCourses(courses, startTime, endTime);\n // Render the courses in the DOM.\n var renderPromise = updateDisplayFromCourses(courses, root, midnight, daysOffset, daysLimit, noEventsURL);\n\n return $.when(eventsPromise, renderPromise)\n .then(function(eventsByCourse) {\n if (hasReloadedEventsSince(root, startEventLoadingTime)) {\n // All of the events are being reloaded so ignore our results.\n return eventsByCourse;\n }\n\n // When we've got all of the courses and events we can render the events in the\n // correct course event list.\n courses.forEach(function(course) {\n var courseId = course.id;\n var events = [];\n var containerSelector = '[data-region=\"course-events-container\"][data-course-id=\"' + courseId + '\"]';\n var courseEventsContainer = root.find(containerSelector);\n var eventListRoot = courseEventsContainer.find(EventList.rootSelector);\n var courseGroups = eventsByCourse.groupedbycourse.filter(function(group) {\n return group.courseid == courseId;\n });\n\n if (courseGroups.length) {\n // Get the events for this course.\n events = courseGroups[0].events;\n }\n\n // Create a preloaded page to pass to the event list because we've already\n // loaded the first page of events.\n var pageOnePreload = $.Deferred().resolve({events: events}).promise();\n // Initialise the event list pagination area for this course.\n Str.get_string('ariaeventlistpaginationnavcourses', 'block_timeline', course.fullnamedisplay)\n .then(function(string) {\n EventList.init(eventListRoot, COURSE_EVENT_LIMIT, {'1': pageOnePreload}, string);\n return string;\n })\n .catch(function() {\n // An error is ok, just render with the default string.\n EventList.init(eventListRoot, COURSE_EVENT_LIMIT, {'1': pageOnePreload});\n });\n });\n\n return eventsByCourse;\n });\n }).catch(Notification.exception);\n };\n\n /**\n * Reload the events for all of the visible courses. These events will be loaded\n * in a single request to the server.\n *\n * @param {object} root The root element.\n * @return {object} jQuery promise resolved with courses and events.\n */\n var reloadCourseEvents = function(root) {\n var startReloadTime = Date.now();\n var startTime = getStartTime(root);\n var endTime = getEndTime(root);\n var courseEventsContainers = root.find(SELECTORS.COURSE_EVENTS_CONTAINER);\n var courseIds = courseEventsContainers.map(function() {\n return $(this).attr('data-course-id');\n }).get();\n\n // Record when we started our request.\n setEventReloadTime(root, startReloadTime);\n\n // Load all of the events for the given courses.\n return getEventsForCourseIds(courseIds, startTime, COURSE_EVENT_LIMIT + 1, endTime)\n .then(function(eventsByCourse) {\n if (hasReloadedEventsSince(root, startReloadTime)) {\n // A new reload has begun so ignore our results.\n return eventsByCourse;\n }\n\n courseEventsContainers.each(function(index, container) {\n container = $(container);\n var courseId = container.attr('data-course-id');\n var courseName = container.find(SELECTORS.COURSE_NAME).text();\n var eventListContainer = container.find(EventList.rootSelector);\n var pageDeferred = $.Deferred();\n var events = [];\n var courseGroups = eventsByCourse.groupedbycourse.filter(function(group) {\n return group.courseid == courseId;\n });\n\n if (courseGroups.length) {\n // Get the events just for this course.\n events = courseGroups[0].events;\n }\n\n pageDeferred.resolve({events: events});\n\n // Re-initialise the events list with the preloaded events we just got from\n // the server.\n Str.get_string('ariaeventlistpaginationnavcourses', 'block_timeline', courseName)\n .then(function(string) {\n EventList.init(eventListContainer, COURSE_EVENT_LIMIT, {'1': pageDeferred.promise()}, string);\n return string;\n })\n .catch(function() {\n // Ignore a failure to load the string. Just render with the default string.\n EventList.init(eventListContainer, COURSE_EVENT_LIMIT, {'1': pageDeferred.promise()});\n });\n });\n\n return eventsByCourse;\n }).catch(Notification.exception);\n };\n\n /**\n * Add event listeners to load more courses for the courses view.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var registerEventListeners = function(root) {\n CustomEvents.define(root, [CustomEvents.events.activate]);\n // Show more courses and load their events when the user clicks the \"more courses\"\n // button.\n root.on(CustomEvents.events.activate, SELECTORS.MORE_COURSES_BUTTON, function(e, data) {\n enableMoreCoursesButtonLoading(root);\n loadMoreCourses(root)\n .then(function() {\n disableMoreCoursesButtonLoading(root);\n return;\n })\n .catch(function() {\n disableMoreCoursesButtonLoading(root);\n });\n\n if (data) {\n data.originalEvent.preventDefault();\n data.originalEvent.stopPropagation();\n }\n e.stopPropagation();\n });\n };\n\n /**\n * Initialise the timeline courses view. Begin loading the events\n * if this view is active. Add the relevant event listeners.\n *\n * This function should only be called once per page load because it\n * is adding event listeners to the page.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var init = function(root) {\n root = $(root);\n\n setEventReloadTime(root, Date.now());\n\n if (root.hasClass('active')) {\n // Only load if this is active otherwise it will be lazy loaded later.\n loadMoreCourses(root);\n root.attr('data-seen', true);\n }\n\n registerEventListeners(root);\n };\n\n /**\n * Reset the element back to it's initial state. Begin loading the events again\n * if this view is active.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var reset = function(root) {\n root.removeAttr('data-seen');\n if (root.hasClass('active')) {\n shown(root);\n }\n };\n\n /**\n * If this is the first time this view has been displayed then begin loading\n * the events.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var shown = function(root) {\n if (!root.attr('data-seen')) {\n if (hasLoadedCourses(root)) {\n // This isn't the first time this view is shown so just reload the\n // events for the courses we've already loaded.\n reloadCourseEvents(root);\n } else {\n // We haven't loaded any courses yet so do that now.\n loadMoreCourses(root);\n }\n\n root.attr('data-seen', true);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown\n };\n});\n"],"file":"view_courses.min.js"}
\ No newline at end of file
diff --git a/blocks/timeline/amd/build/view_dates.min.js.map b/blocks/timeline/amd/build/view_dates.min.js.map
index 93dcbe3c571..41af10d382b 100644
--- a/blocks/timeline/amd/build/view_dates.min.js.map
+++ b/blocks/timeline/amd/build/view_dates.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/view_dates.js"],"names":["define","$","Str","EventList","PubSub","PagedContentEvents","SELECTORS","EVENT_LIST_CONTAINER","DEFAULT_PAGE_LIMIT","getPagingLimits","root","limitPref","parseInt","data","isDefaultSet","limits","map","value","active","registerEventListeners","namespace","event","SET_ITEMS_PER_PAGE_LIMIT","subscribe","limit","load","eventListContainer","find","attr","Math","random","config","persistentLimitKey","eventNamespace","get_string","then","string","init","catch","hasClass","reset","removeAttr","shown"],"mappings":"AAuBAA,OAAM,6BACN,CACI,QADJ,CAEI,UAFJ,CAGI,2BAHJ,CAII,aAJJ,CAKI,2BALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,oBAAoB,CAAE,wCADV,CAFlB,CAMMC,CAAkB,CAAG,CAAC,CAAD,CAAI,EAAJ,CAAQ,EAAR,CAN3B,CAcMC,CAAe,CAAG,SAASC,CAAT,CAAe,IAC7BC,CAAAA,CAAS,CAAGC,QAAQ,CAACF,CAAI,CAACG,IAAL,CAAU,OAAV,CAAD,CAAqB,EAArB,CADS,CAE7BC,CAAY,GAFiB,CAG7BC,CAAM,CAAGP,CAAkB,CAACQ,GAAnB,CAAuB,SAASC,CAAT,CAAgB,CAChD,GAAIN,CAAS,EAAIM,CAAjB,CAAwB,CACpBH,CAAY,GACf,CAED,MAAO,CACHG,KAAK,CAAEA,CADJ,CAEHC,MAAM,CAAEP,CAAS,EAAIM,CAFlB,CAIV,CATY,CAHoB,CAcjC,GAAI,CAACH,CAAL,CAAmB,CACfC,CAAM,CAAC,CAAD,CAAN,CAAUG,MAAV,GACH,CAED,MAAOH,CAAAA,CACV,CAjCH,CA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CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CA4BM,CAEH2B,KAAK,CAtBG,QAARA,CAAAA,KAAQ,CAAS9B,CAAT,CAAe,CACvBA,CAAI,CAAC+B,UAAL,CAAgB,WAAhB,EACA,GAAI/B,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CAcM,CAGH6B,KAAK,CAVG,QAARA,CAAAA,KAAQ,CAAShC,CAAT,CAAe,CACvB,GAAI,CAACA,CAAI,CAACG,IAAL,CAAU,MAAV,CAAL,CAAwB,CACpBY,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CAEM,CAKV,CArIK,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 .\n\n/**\n * Manage the timeline dates view for the timeline block.\n *\n * @package block_timeline\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/str',\n 'block_timeline/event_list',\n 'core/pubsub',\n 'core/paged_content_events'\n],\nfunction(\n $,\n Str,\n EventList,\n PubSub,\n PagedContentEvents\n) {\n\n var SELECTORS = {\n EVENT_LIST_CONTAINER: '[data-region=\"event-list-container\"]',\n };\n\n var DEFAULT_PAGE_LIMIT = [5, 10, 25];\n\n /**\n * Generate a paged content array of limits taking into account user preferences\n *\n * @param {object} root The root element for the timeline dates view.\n * @return {array} Array of limit objects\n */\n var getPagingLimits = function(root) {\n var limitPref = parseInt(root.data('limit'), 10);\n var isDefaultSet = false;\n var limits = DEFAULT_PAGE_LIMIT.map(function(value) {\n if (limitPref == value) {\n isDefaultSet = true;\n }\n\n return {\n value: value,\n active: limitPref == value\n };\n });\n\n if (!isDefaultSet) {\n limits[0].active = true;\n }\n\n return limits;\n };\n\n /**\n * Setup the listeners for the timeline block\n *\n * @param {string} root view dates container\n * @param {string} namespace The namespace for the paged content\n */\n var registerEventListeners = function(root, namespace) {\n var event = namespace + PagedContentEvents.SET_ITEMS_PER_PAGE_LIMIT;\n PubSub.subscribe(event, function(limit) {\n $(root).data('limit', limit);\n });\n };\n\n /**\n * Initialise the event list and being loading the events.\n *\n * @param {object} root The root element for the timeline dates view.\n */\n var load = function(root) {\n var eventListContainer = root.find(SELECTORS.EVENT_LIST_CONTAINER);\n var namespace = $(eventListContainer).attr('id') + \"user_block_timeline\" + Math.random();\n registerEventListeners(root, namespace);\n\n var limits = getPagingLimits(root);\n var config = {\n persistentLimitKey: \"block_timeline_user_limit_preference\",\n eventNamespace: namespace\n };\n Str.get_string('ariaeventlistpaginationnavdates', 'block_timeline')\n .then(function(string) {\n EventList.init(eventListContainer, limits, {}, string, config);\n return string;\n })\n .catch(function() {\n // Ignore if we can't load the string. Still init the event list.\n EventList.init(eventListContainer, limits, {}, \"\", config);\n });\n };\n\n /**\n * Initialise the timeline dates view. Begin loading the events\n * if this view is active.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var init = function(root) {\n root = $(root);\n if (root.hasClass('active')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n /**\n * Reset the view back to it's initial state. If this view is active then\n * beging loading the events.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var reset = function(root) {\n root.removeAttr('data-seen');\n if (root.hasClass('active')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n /**\n * Load the events if this is the first time the view is displayed.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var shown = function(root) {\n if (!root.data('seen')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown\n };\n});\n"],"file":"view_dates.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/view_dates.js"],"names":["define","$","Str","EventList","PubSub","PagedContentEvents","SELECTORS","EVENT_LIST_CONTAINER","DEFAULT_PAGE_LIMIT","getPagingLimits","root","limitPref","parseInt","data","isDefaultSet","limits","map","value","active","registerEventListeners","namespace","event","SET_ITEMS_PER_PAGE_LIMIT","subscribe","limit","load","eventListContainer","find","attr","Math","random","config","persistentLimitKey","eventNamespace","get_string","then","string","init","catch","hasClass","reset","removeAttr","shown"],"mappings":"AAsBAA,OAAM,6BACN,CACI,QADJ,CAEI,UAFJ,CAGI,2BAHJ,CAII,aAJJ,CAKI,2BALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,oBAAoB,CAAE,wCADV,CAFlB,CAMMC,CAAkB,CAAG,CAAC,CAAD,CAAI,EAAJ,CAAQ,EAAR,CAN3B,CAcMC,CAAe,CAAG,SAASC,CAAT,CAAe,IAC7BC,CAAAA,CAAS,CAAGC,QAAQ,CAACF,CAAI,CAACG,IAAL,CAAU,OAAV,CAAD,CAAqB,EAArB,CADS,CAE7BC,CAAY,GAFiB,CAG7BC,CAAM,CAAGP,CAAkB,CAACQ,GAAnB,CAAuB,SAASC,CAAT,CAAgB,CAChD,GAAIN,CAAS,EAAIM,CAAjB,CAAwB,CACpBH,CAAY,GACf,CAED,MAAO,CACHG,KAAK,CAAEA,CADJ,CAEHC,MAAM,CAAEP,CAAS,EAAIM,CAFlB,CAIV,CATY,CAHoB,CAcjC,GAAI,CAACH,CAAL,CAAmB,CACfC,CA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AAT,CAAe,CACtBA,CAAI,CAAGT,CAAC,CAACS,CAAD,CAAR,CACA,GAAIA,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CA4BM,CAEH2B,KAAK,CAtBG,QAARA,CAAAA,KAAQ,CAAS9B,CAAT,CAAe,CACvBA,CAAI,CAAC+B,UAAL,CAAgB,WAAhB,EACA,GAAI/B,CAAI,CAAC6B,QAAL,CAAc,QAAd,CAAJ,CAA6B,CACzBd,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CAcM,CAGH6B,KAAK,CAVG,QAARA,CAAAA,KAAQ,CAAShC,CAAT,CAAe,CACvB,GAAI,CAACA,CAAI,CAACG,IAAL,CAAU,MAAV,CAAL,CAAwB,CACpBY,CAAI,CAACf,CAAD,CAAJ,CACAA,CAAI,CAACG,IAAL,CAAU,MAAV,IACH,CACJ,CAEM,CAKV,CArIK,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 .\n\n/**\n * Manage the timeline dates view for the timeline block.\n *\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/str',\n 'block_timeline/event_list',\n 'core/pubsub',\n 'core/paged_content_events'\n],\nfunction(\n $,\n Str,\n EventList,\n PubSub,\n PagedContentEvents\n) {\n\n var SELECTORS = {\n EVENT_LIST_CONTAINER: '[data-region=\"event-list-container\"]',\n };\n\n var DEFAULT_PAGE_LIMIT = [5, 10, 25];\n\n /**\n * Generate a paged content array of limits taking into account user preferences\n *\n * @param {object} root The root element for the timeline dates view.\n * @return {array} Array of limit objects\n */\n var getPagingLimits = function(root) {\n var limitPref = parseInt(root.data('limit'), 10);\n var isDefaultSet = false;\n var limits = DEFAULT_PAGE_LIMIT.map(function(value) {\n if (limitPref == value) {\n isDefaultSet = true;\n }\n\n return {\n value: value,\n active: limitPref == value\n };\n });\n\n if (!isDefaultSet) {\n limits[0].active = true;\n }\n\n return limits;\n };\n\n /**\n * Setup the listeners for the timeline block\n *\n * @param {string} root view dates container\n * @param {string} namespace The namespace for the paged content\n */\n var registerEventListeners = function(root, namespace) {\n var event = namespace + PagedContentEvents.SET_ITEMS_PER_PAGE_LIMIT;\n PubSub.subscribe(event, function(limit) {\n $(root).data('limit', limit);\n });\n };\n\n /**\n * Initialise the event list and being loading the events.\n *\n * @param {object} root The root element for the timeline dates view.\n */\n var load = function(root) {\n var eventListContainer = root.find(SELECTORS.EVENT_LIST_CONTAINER);\n var namespace = $(eventListContainer).attr('id') + \"user_block_timeline\" + Math.random();\n registerEventListeners(root, namespace);\n\n var limits = getPagingLimits(root);\n var config = {\n persistentLimitKey: \"block_timeline_user_limit_preference\",\n eventNamespace: namespace\n };\n Str.get_string('ariaeventlistpaginationnavdates', 'block_timeline')\n .then(function(string) {\n EventList.init(eventListContainer, limits, {}, string, config);\n return string;\n })\n .catch(function() {\n // Ignore if we can't load the string. Still init the event list.\n EventList.init(eventListContainer, limits, {}, \"\", config);\n });\n };\n\n /**\n * Initialise the timeline dates view. Begin loading the events\n * if this view is active.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var init = function(root) {\n root = $(root);\n if (root.hasClass('active')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n /**\n * Reset the view back to it's initial state. If this view is active then\n * beging loading the events.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var reset = function(root) {\n root.removeAttr('data-seen');\n if (root.hasClass('active')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n /**\n * Load the events if this is the first time the view is displayed.\n *\n * @param {object} root The root element for the timeline courses view.\n */\n var shown = function(root) {\n if (!root.data('seen')) {\n load(root);\n root.data('seen', true);\n }\n };\n\n return {\n init: init,\n reset: reset,\n shown: shown\n };\n});\n"],"file":"view_dates.min.js"}
\ No newline at end of file
diff --git a/blocks/timeline/amd/build/view_nav.min.js.map b/blocks/timeline/amd/build/view_nav.min.js.map
index 2b6c8424f93..1ccedd50ff2 100644
--- a/blocks/timeline/amd/build/view_nav.min.js.map
+++ b/blocks/timeline/amd/build/view_nav.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/view_nav.js"],"names":["define","$","CustomEvents","View","Ajax","Notification","SELECTORS","TIMELINE_DAY_FILTER","TIMELINE_DAY_FILTER_OPTION","TIMELINE_VIEW_SELECTOR","DATA_DAYS_OFFSET","DATA_DAYS_LIMIT","updateUserPreferences","type","value","call","methodname","args","preferences","fail","exception","registerTimelineDaySelector","root","timelineViewRoot","timelineDaySelectorContainer","find","events","activate","on","e","data","filtername","currentTarget","option","target","closest","attr","daysOffset","daysLimit","elementsWithDaysOffset","removeAttr","reset","originalEvent","preventDefault","registerViewSelector","viewSelector","shown","removeClass","init"],"mappings":"AAuBAA,OAAM,2BACN,CACI,QADJ,CAEI,gCAFJ,CAGI,qBAHJ,CAII,WAJJ,CAKI,mBALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,8BADT,CAEZC,0BAA0B,CAAE,aAFhB,CAGZC,sBAAsB,CAAE,iCAHZ,CAIZC,gBAAgB,CAAE,oBAJN,CAKZC,eAAe,CAAE,mBALL,CAFlB,CAgBMC,CAAqB,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAs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,CAEM,CAGV,CA5IK,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 .\n\n/**\n * Manage the timeline view navigation for the timeline block.\n *\n * @package block_timeline\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/custom_interaction_events',\n 'block_timeline/view',\n 'core/ajax',\n 'core/notification'\n],\nfunction(\n $,\n CustomEvents,\n View,\n Ajax,\n Notification\n) {\n\n var SELECTORS = {\n TIMELINE_DAY_FILTER: '[data-region=\"day-filter\"]',\n TIMELINE_DAY_FILTER_OPTION: '[data-from]',\n TIMELINE_VIEW_SELECTOR: '[data-region=\"view-selector\"]',\n DATA_DAYS_OFFSET: '[data-days-offset]',\n DATA_DAYS_LIMIT: '[data-days-limit]',\n };\n\n /**\n * Generic handler to persist user preferences\n *\n * @param {string} type The name of the attribute you're updating\n * @param {string} value The value of the attribute you're updating\n */\n var updateUserPreferences = function(type, value) {\n var request = {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [\n {\n type: type,\n value: value\n }\n ]\n }\n };\n\n Ajax.call([request])[0]\n .fail(Notification.exception);\n };\n\n /**\n * Event listener for the day selector (\"Next 7 days\", \"Next 30 days\", etc).\n *\n * @param {object} root The root element for the timeline block\n * @param {object} timelineViewRoot The root element for the timeline view\n */\n var registerTimelineDaySelector = function(root, timelineViewRoot) {\n var timelineDaySelectorContainer = root.find(SELECTORS.TIMELINE_DAY_FILTER);\n\n CustomEvents.define(timelineDaySelectorContainer, [CustomEvents.events.activate]);\n timelineDaySelectorContainer.on(\n CustomEvents.events.activate,\n SELECTORS.TIMELINE_DAY_FILTER_OPTION,\n function(e, data) {\n // Update the user preference\n var filtername = $(e.currentTarget).data('filtername');\n var type = 'block_timeline_user_filter_preference';\n updateUserPreferences(type, filtername);\n\n var option = $(e.target).closest(SELECTORS.TIMELINE_DAY_FILTER_OPTION);\n\n if (option.attr('aria-current') == 'true') {\n // If it's already active then we don't need to do anything.\n return;\n }\n\n var daysOffset = option.attr('data-from');\n var daysLimit = option.attr('data-to');\n var elementsWithDaysOffset = root.find(SELECTORS.DATA_DAYS_OFFSET);\n\n elementsWithDaysOffset.attr('data-days-offset', daysOffset);\n\n if (daysLimit != undefined) {\n elementsWithDaysOffset.attr('data-days-limit', daysLimit);\n } else {\n elementsWithDaysOffset.removeAttr('data-days-limit');\n }\n\n // Reset the views to reinitialise the event lists now that we've\n // updated the day limits.\n View.reset(timelineViewRoot);\n\n data.originalEvent.preventDefault();\n }\n );\n };\n\n /**\n * Event listener for the \"sort\" button in the timeline navigation that allows for\n * changing between the timeline dates and courses views.\n *\n * On a view change we tell the timeline view module that the view has been shown\n * so that it can handle how to display the appropriate view.\n *\n * @param {object} root The root element for the timeline block\n * @param {object} timelineViewRoot The root element for the timeline view\n */\n var registerViewSelector = function(root, timelineViewRoot) {\n var viewSelector = root.find(SELECTORS.TIMELINE_VIEW_SELECTOR);\n\n // Listen for when the user changes tab so that we can show the first set of courses\n // and load their events when they request the sort by courses view for the first time.\n viewSelector.on('shown shown.bs.tab', function(e) {\n View.shown(timelineViewRoot);\n $(e.target).removeClass('active');\n });\n\n\n // Event selector for user_sort\n CustomEvents.define(viewSelector, [CustomEvents.events.activate]);\n viewSelector.on(CustomEvents.events.activate, \"[data-toggle='tab']\", function(e) {\n var filtername = $(e.currentTarget).data('filtername');\n var type = 'block_timeline_user_sort_preference';\n updateUserPreferences(type, filtername);\n });\n };\n\n /**\n * Initialise the timeline view navigation by adding event listeners to\n * the navigation elements.\n *\n * @param {object} root The root element for the timeline block\n * @param {object} timelineViewRoot The root element for the timeline view\n */\n var init = function(root, timelineViewRoot) {\n root = $(root);\n registerTimelineDaySelector(root, timelineViewRoot);\n registerViewSelector(root, timelineViewRoot);\n };\n\n return {\n init: init\n };\n});\n"],"file":"view_nav.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/view_nav.js"],"names":["define","$","CustomEvents","View","Ajax","Notification","SELECTORS","TIMELINE_DAY_FILTER","TIMELINE_DAY_FILTER_OPTION","TIMELINE_VIEW_SELECTOR","DATA_DAYS_OFFSET","DATA_DAYS_LIMIT","updateUserPreferences","type","value","call","methodname","args","preferences","fail","exception","registerTimelineDaySelector","root","timelineViewRoot","timelineDaySelectorContainer","find","events","activate","on","e","data","filtername","currentTarget","option","target","closest","attr","daysOffset","daysLimit","elementsWithDaysOffset","removeAttr","reset","originalEvent","preventDefault","registerViewSelector","viewSelector","shown","removeClass","init"],"mappings":"AAsBAA,OAAM,2BACN,CACI,QADJ,CAEI,gCAFJ,CAGI,qBAHJ,CAII,WAJJ,CAKI,mBALJ,CADM,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAS,CAAG,CACZC,mBAAmB,CAAE,8BADT,CAEZC,0BAA0B,CAAE,aAFhB,CAGZC,sBAAsB,CAAE,iCAHZ,CAIZC,gBAAgB,CAAE,oBAJN,CAKZC,eAAe,CAAE,mBALL,CAFlB,CAgBMC,CAAqB,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAsB,CAa9CV,CAAI,CAACW,IAAL,CAAU,CAZI,CACVC,UAAU,CAAE,mCADF,CAEVC,IAAI,CAAE,CACFC,WAAW,CAAE,CACT,CACIL,IAAI,CAAEA,CADV,CAEIC,KAAK,CAAEA,CAFX,CADS,CADX,CAFI,CAYJ,CAAV,EAAqB,CAArB,EACKK,IADL,CACUd,CAAY,CAACe,SADvB,CAEH,CA/BH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,cAAnB,EACH,CAjCL,CAmCH,CA9EH,CA0FMC,CAAoB,CAAG,SAAStB,CAAT,CAAeC,CAAf,CAAiC,CACxD,GAAIsB,CAAAA,CAAY,CAAGvB,CAAI,CAACG,IAAL,CAAUnB,CAAS,CAACG,sBAApB,CAAnB,CAIAoC,CAAY,CAACjB,EAAb,CAAgB,oBAAhB,CAAsC,SAASC,CAAT,CAAY,CAC9C1B,CAAI,CAAC2C,KAAL,CAAWvB,CAAX,EACAtB,CAAC,CAAC4B,CAAC,CAACK,MAAH,CAAD,CAAYa,WAAZ,CAAwB,QAAxB,CACH,CAHD,EAOA7C,CAAY,CAACF,MAAb,CAAoB6C,CAApB,CAAkC,CAAC3C,CAAY,CAACwB,MAAb,CAAoBC,QAArB,CAAlC,EACAkB,CAAY,CAACjB,EAAb,CAAgB1B,CAAY,CAACwB,MAAb,CAAoBC,QAApC,CAA8C,qBAA9C,CAAqE,SAASE,CAAT,CAAY,IACzEE,CAAAA,CAAU,CAAG9B,CAAC,CAAC4B,CAAC,CAACG,aAAH,CAAD,CAAmBF,IAAnB,CAAwB,YAAxB,CAD4D,CAG7ElB,CAAqB,CADV,qCACU,CAAOmB,CAAP,CACxB,CAJD,CAKH,CA5GH,CA2HE,MAAO,CACHiB,IAAI,CAPG,QAAPA,CAAAA,IAAO,CAAS1B,CAAT,CAAeC,CAAf,CAAiC,CACxCD,CAAI,CAAGrB,CAAC,CAACqB,CAAD,CAAR,CACAD,CAA2B,CAACC,CAAD,CAAOC,CAAP,CAA3B,CACAqB,CAAoB,CAACtB,CAAD,CAAOC,CAAP,CACvB,CAEM,CAGV,CA5IK,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 .\n\n/**\n * Manage the timeline view navigation for the timeline block.\n *\n * @copyright 2018 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(\n[\n 'jquery',\n 'core/custom_interaction_events',\n 'block_timeline/view',\n 'core/ajax',\n 'core/notification'\n],\nfunction(\n $,\n CustomEvents,\n View,\n Ajax,\n Notification\n) {\n\n var SELECTORS = {\n TIMELINE_DAY_FILTER: '[data-region=\"day-filter\"]',\n TIMELINE_DAY_FILTER_OPTION: '[data-from]',\n TIMELINE_VIEW_SELECTOR: '[data-region=\"view-selector\"]',\n DATA_DAYS_OFFSET: '[data-days-offset]',\n DATA_DAYS_LIMIT: '[data-days-limit]',\n };\n\n /**\n * Generic handler to persist user preferences\n *\n * @param {string} type The name of the attribute you're updating\n * @param {string} value The value of the attribute you're updating\n */\n var updateUserPreferences = function(type, value) {\n var request = {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [\n {\n type: type,\n value: value\n }\n ]\n }\n };\n\n Ajax.call([request])[0]\n .fail(Notification.exception);\n };\n\n /**\n * Event listener for the day selector (\"Next 7 days\", \"Next 30 days\", etc).\n *\n * @param {object} root The root element for the timeline block\n * @param {object} timelineViewRoot The root element for the timeline view\n */\n var registerTimelineDaySelector = function(root, timelineViewRoot) {\n var timelineDaySelectorContainer = root.find(SELECTORS.TIMELINE_DAY_FILTER);\n\n CustomEvents.define(timelineDaySelectorContainer, [CustomEvents.events.activate]);\n timelineDaySelectorContainer.on(\n CustomEvents.events.activate,\n SELECTORS.TIMELINE_DAY_FILTER_OPTION,\n function(e, data) {\n // Update the user preference\n var filtername = $(e.currentTarget).data('filtername');\n var type = 'block_timeline_user_filter_preference';\n updateUserPreferences(type, filtername);\n\n var option = $(e.target).closest(SELECTORS.TIMELINE_DAY_FILTER_OPTION);\n\n if (option.attr('aria-current') == 'true') {\n // If it's already active then we don't need to do anything.\n return;\n }\n\n var daysOffset = option.attr('data-from');\n var daysLimit = option.attr('data-to');\n var elementsWithDaysOffset = root.find(SELECTORS.DATA_DAYS_OFFSET);\n\n elementsWithDaysOffset.attr('data-days-offset', daysOffset);\n\n if (daysLimit != undefined) {\n elementsWithDaysOffset.attr('data-days-limit', daysLimit);\n } else {\n elementsWithDaysOffset.removeAttr('data-days-limit');\n }\n\n // Reset the views to reinitialise the event lists now that we've\n // updated the day limits.\n View.reset(timelineViewRoot);\n\n data.originalEvent.preventDefault();\n }\n );\n };\n\n /**\n * Event listener for the \"sort\" button in the timeline navigation that allows for\n * changing between the timeline dates and courses views.\n *\n * On a view change we tell the timeline view module that the view has been shown\n * so that it can handle how to display the appropriate view.\n *\n * @param {object} root The root element for the timeline block\n * @param {object} timelineViewRoot The root element for the timeline view\n */\n var registerViewSelector = function(root, timelineViewRoot) {\n var viewSelector = root.find(SELECTORS.TIMELINE_VIEW_SELECTOR);\n\n // Listen for when the user changes tab so that we can show the first set of courses\n // and load their events when they request the sort by courses view for the first time.\n viewSelector.on('shown shown.bs.tab', function(e) {\n View.shown(timelineViewRoot);\n $(e.target).removeClass('active');\n });\n\n\n // Event selector for user_sort\n CustomEvents.define(viewSelector, [CustomEvents.events.activate]);\n viewSelector.on(CustomEvents.events.activate, \"[data-toggle='tab']\", function(e) {\n var filtername = $(e.currentTarget).data('filtername');\n var type = 'block_timeline_user_sort_preference';\n updateUserPreferences(type, filtername);\n });\n };\n\n /**\n * Initialise the timeline view navigation by adding event listeners to\n * the navigation elements.\n *\n * @param {object} root The root element for the timeline block\n * @param {object} timelineViewRoot The root element for the timeline view\n */\n var init = function(root, timelineViewRoot) {\n root = $(root);\n registerTimelineDaySelector(root, timelineViewRoot);\n registerViewSelector(root, timelineViewRoot);\n };\n\n return {\n init: init\n };\n});\n"],"file":"view_nav.min.js"}
\ No newline at end of file
diff --git a/blocks/timeline/amd/src/view.js b/blocks/timeline/amd/src/view.js
index 89430a77fe5..20d3a241939 100644
--- a/blocks/timeline/amd/src/view.js
+++ b/blocks/timeline/amd/src/view.js
@@ -16,7 +16,6 @@
/**
* Manage the timeline view for the timeline block.
*
- * @package block_timeline
* @copyright 2018 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/timeline/amd/src/view_courses.js b/blocks/timeline/amd/src/view_courses.js
index 4749c920351..a31f49665de 100644
--- a/blocks/timeline/amd/src/view_courses.js
+++ b/blocks/timeline/amd/src/view_courses.js
@@ -16,7 +16,6 @@
/**
* Manage the timeline courses view for the timeline block.
*
- * @package block_timeline
* @copyright 2018 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/timeline/amd/src/view_dates.js b/blocks/timeline/amd/src/view_dates.js
index f411c47ff7c..a46bd0f18ec 100644
--- a/blocks/timeline/amd/src/view_dates.js
+++ b/blocks/timeline/amd/src/view_dates.js
@@ -16,7 +16,6 @@
/**
* Manage the timeline dates view for the timeline block.
*
- * @package block_timeline
* @copyright 2018 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/blocks/timeline/amd/src/view_nav.js b/blocks/timeline/amd/src/view_nav.js
index 596c75b669e..180ff9dba3b 100644
--- a/blocks/timeline/amd/src/view_nav.js
+++ b/blocks/timeline/amd/src/view_nav.js
@@ -16,7 +16,6 @@
/**
* Manage the timeline view navigation for the timeline block.
*
- * @package block_timeline
* @copyright 2018 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/build/calendar.min.js.map b/calendar/amd/build/calendar.min.js.map
index aa84975f2fb..322452e0f99 100644
--- a/calendar/amd/build/calendar.min.js.map
+++ b/calendar/amd/build/calendar.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/calendar.js"],"names":["define","$","Ajax","Str","Templates","Notification","CustomEvents","ModalEvents","ModalFactory","ModalEventForm","SummaryModal","CalendarRepository","CalendarEvents","CalendarViewManager","CalendarCrud","CalendarSelectors","SELECTORS","ROOT","DAY","NEW_EVENT_BUTTON","DAY_CONTENT","LOADING_ICON","VIEW_DAY_LINK","CALENDAR_MONTH_WRAPPER","TODAY","handleMoveEvent","e","eventId","originElement","destinationElement","originTimestamp","destinationTimestamp","attr","render","then","html","js","find","addClass","appendNodeContents","updateEventStartDay","trigger","eventMoved","always","destinationLoadingElement","removeClass","replaceNode","originLoadingElement","fail","exception","registerCalendarEventListeners","root","eventFormModalPromise","body","on","created","reloadCurrentMonth","deleted","updated","editActionEvent","url","window","location","assign","moveEvent","registerEditListeners","registerEventListeners","dayLink","target","year","data","month","day","courseId","categoryId","refreshDayContent","preventDefault","history","pushState","elements","courseSelector","selectElement","val","eventFormPromise","registerEventFormModal","contextId","is","startTime","modal","wrapper","closest","setCourseId","setCategoryId","setContextId","setStartTime","show","init"],"mappings":"AA2BAA,OAAM,0BAAC,CACK,QADL,CAEK,WAFL,CAGK,UAHL,CAIK,gBAJL,CAKK,mBALL,CAMK,gCANL,CAOK,mBAPL,CAQK,oBARL,CASK,gCATL,CAUK,6BAVL,CAWK,0BAXL,CAYK,sBAZL,CAaK,4BAbL,CAcK,oBAdL,CAeK,yBAfL,CAAD,CAiBE,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYIC,CAZJ,CAaIC,CAbJ,CAcIC,CAdJ,CAeIC,CAfJ,CAgBE,IAEFC,CAAAA,CAAS,CAAG,CACZC,IAAI,CAAE,0BADM,CAEZC,GAAG,CAAE,qBAFO,CAGZC,gBAAgB,CAAE,kCAHN,CAIZC,WAAW,CAAE,6BAJD,CAKZC,YAAY,CAAE,eALF,CAMZC,aAAa,CAAE,+BANH,CAOZC,sBAAsB,CAAE,k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CAACnB,IAAR,CAAa,UAAb,CAAlB,EAEA,GAAII,CAAAA,CAAU,CAAGe,CAAO,CAACnB,IAAR,CAAa,YAAb,CAAjB,CACA,GAA0B,WAAtB,QAAOI,CAAAA,CAAX,CAAuC,CACnCc,CAAK,CAACI,aAAN,CAAoBlB,CAApB,CACH,CAEDc,CAAK,CAACK,YAAN,CAAmBJ,CAAO,CAACnB,IAAR,CAAa,WAAb,CAAnB,EACAkB,CAAK,CAACM,YAAN,CAAmBP,CAAnB,EACAC,CAAK,CAACO,IAAN,EAEH,CAbD,EAcC/C,IAdD,CAcM3C,CAAY,CAAC4C,SAdnB,EAgBAvB,CAAC,CAACkD,cAAF,EACH,CACJ,CAxBD,CAyBH,CACJ,CA7KK,CA+KN,MAAO,CACHoB,IAAI,CAAE,cAAS7C,CAAT,CAAe,CACjBA,CAAI,CAAGlD,CAAC,CAACkD,CAAD,CAAR,CACAtC,CAAmB,CAACmF,IAApB,CAAyB7C,CAAzB,EACAe,CAAsB,CAACf,CAAD,CACzB,CALE,CAOV,CAvNK,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 .\n\n/**\n * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module core_calendar/calendar\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/str',\n 'core/templates',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal_events',\n 'core/modal_factory',\n 'core_calendar/modal_event_form',\n 'core_calendar/summary_modal',\n 'core_calendar/repository',\n 'core_calendar/events',\n 'core_calendar/view_manager',\n 'core_calendar/crud',\n 'core_calendar/selectors',\n ],\n function(\n $,\n Ajax,\n Str,\n Templates,\n Notification,\n CustomEvents,\n ModalEvents,\n ModalFactory,\n ModalEventForm,\n SummaryModal,\n CalendarRepository,\n CalendarEvents,\n CalendarViewManager,\n CalendarCrud,\n CalendarSelectors\n ) {\n\n var SELECTORS = {\n ROOT: \"[data-region='calendar']\",\n DAY: \"[data-region='day']\",\n NEW_EVENT_BUTTON: \"[data-action='new-event-button']\",\n DAY_CONTENT: \"[data-region='day-content']\",\n LOADING_ICON: '.loading-icon',\n VIEW_DAY_LINK: \"[data-action='view-day-link']\",\n CALENDAR_MONTH_WRAPPER: \".calendarwrapper\",\n TODAY: '.today',\n };\n\n /**\n * Handler for the drag and drop move event. Provides a loading indicator\n * while the request is sent to the server to update the event start date.\n *\n * Triggers a eventMoved calendar javascript event if the event was successfully\n * updated.\n *\n * @param {event} e The calendar move event\n * @param {int} eventId The event id being moved\n * @param {object|null} originElement The jQuery element for where the event is moving from\n * @param {object} destinationElement The jQuery element for where the event is moving to\n */\n var handleMoveEvent = function(e, eventId, originElement, destinationElement) {\n var originTimestamp = null;\n var destinationTimestamp = destinationElement.attr('data-day-timestamp');\n\n if (originElement) {\n originTimestamp = originElement.attr('data-day-timestamp');\n }\n\n // If the event has actually changed day.\n if (!originElement || originTimestamp != destinationTimestamp) {\n Templates.render('core/loading', {})\n .then(function(html, js) {\n // First we show some loading icons in each of the days being affected.\n destinationElement.find(SELECTORS.DAY_CONTENT).addClass('hidden');\n Templates.appendNodeContents(destinationElement, html, js);\n\n if (originElement) {\n originElement.find(SELECTORS.DAY_CONTENT).addClass('hidden');\n Templates.appendNodeContents(originElement, html, js);\n }\n return;\n })\n .then(function() {\n // Send a request to the server to make the change.\n return CalendarRepository.updateEventStartDay(eventId, destinationTimestamp);\n })\n .then(function() {\n // If the update was successful then broadcast an event letting the calendar\n // know that an event has been moved.\n $('body').trigger(CalendarEvents.eventMoved, [eventId, originElement, destinationElement]);\n return;\n })\n .always(function() {\n // Always remove the loading icons regardless of whether the update\n // request was successful or not.\n var destinationLoadingElement = destinationElement.find(SELECTORS.LOADING_ICON);\n destinationElement.find(SELECTORS.DAY_CONTENT).removeClass('hidden');\n Templates.replaceNode(destinationLoadingElement, '', '');\n\n if (originElement) {\n var originLoadingElement = originElement.find(SELECTORS.LOADING_ICON);\n originElement.find(SELECTORS.DAY_CONTENT).removeClass('hidden');\n Templates.replaceNode(originLoadingElement, '', '');\n }\n return;\n })\n .fail(Notification.exception);\n }\n };\n\n /**\n * Listen to and handle any calendar events fired by the calendar UI.\n *\n * @method registerCalendarEventListeners\n * @param {object} root The calendar root element\n * @param {object} eventFormModalPromise A promise reolved with the event form modal\n */\n var registerCalendarEventListeners = function(root, eventFormModalPromise) {\n var body = $('body');\n\n body.on(CalendarEvents.created, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n body.on(CalendarEvents.deleted, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n body.on(CalendarEvents.updated, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n body.on(CalendarEvents.editActionEvent, function(e, url) {\n // Action events needs to be edit directly on the course module.\n window.location.assign(url);\n });\n // Handle the event fired by the drag and drop code.\n body.on(CalendarEvents.moveEvent, handleMoveEvent);\n // When an event is successfully moved we should updated the UI.\n body.on(CalendarEvents.eventMoved, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n\n CalendarCrud.registerEditListeners(root, eventFormModalPromise);\n };\n\n /**\n * Register event listeners for the module.\n *\n * @param {object} root The calendar root element\n */\n var registerEventListeners = function(root) {\n // Listen the click on the day link to render the day view.\n root.on('click', SELECTORS.VIEW_DAY_LINK, function(e) {\n var dayLink = $(e.target);\n var year = dayLink.data('year'),\n month = dayLink.data('month'),\n day = dayLink.data('day'),\n courseId = dayLink.data('courseid'),\n categoryId = dayLink.data('categoryid');\n CalendarViewManager.refreshDayContent(root, year, month, day, courseId, categoryId, root,\n 'core_calendar/calendar_day').then(function() {\n e.preventDefault();\n var url = '?view=day&time=' + dayLink.data('timestamp');\n return window.history.pushState({}, '', url);\n }).fail(Notification.exception);\n });\n\n root.on('change', CalendarSelectors.elements.courseSelector, function() {\n var selectElement = $(this);\n var courseId = selectElement.val();\n CalendarViewManager.reloadCurrentMonth(root, courseId, null)\n .then(function() {\n // We need to get the selector again because the content has changed.\n return root.find(CalendarSelectors.elements.courseSelector).val(courseId);\n })\n .fail(Notification.exception);\n });\n\n var eventFormPromise = CalendarCrud.registerEventFormModal(root),\n contextId = $(SELECTORS.CALENDAR_MONTH_WRAPPER).data('context-id');\n registerCalendarEventListeners(root, eventFormPromise);\n\n if (contextId) {\n // Bind click events to calendar days.\n root.on('click', SELECTORS.DAY, function (e) {\n\n var target = $(e.target);\n\n if (!target.is(SELECTORS.VIEW_DAY_LINK)) {\n var startTime = $(this).attr('data-new-event-timestamp');\n eventFormPromise.then(function (modal) {\n var wrapper = target.closest(CalendarSelectors.wrapper);\n modal.setCourseId(wrapper.data('courseid'));\n\n var categoryId = wrapper.data('categoryid');\n if (typeof categoryId !== 'undefined') {\n modal.setCategoryId(categoryId);\n }\n\n modal.setContextId(wrapper.data('contextId'));\n modal.setStartTime(startTime);\n modal.show();\n return;\n })\n .fail(Notification.exception);\n\n e.preventDefault();\n }\n });\n }\n };\n\n return {\n init: function(root) {\n root = $(root);\n CalendarViewManager.init(root);\n registerEventListeners(root);\n }\n };\n});\n"],"file":"calendar.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/calendar.js"],"names":["define","$","Ajax","Str","Templates","Notification","CustomEvents","ModalEvents","ModalFactory","ModalEventForm","SummaryModal","CalendarRepository","CalendarEvents","CalendarViewManager","CalendarCrud","CalendarSelectors","SELECTORS","ROOT","DAY","NEW_EVENT_BUTTON","DAY_CONTENT","LOADING_ICON","VIEW_DAY_LINK","CALENDAR_MONTH_WRAPPER","TODAY","handleMoveEvent","e","eventId","originElement","destinationElement","originTimestamp","destinationTimestamp","attr","render","then","html","js","find","addClass","appendNodeContents","updateEventStartDay","trigger","eventMoved","always","destinationLoadingElement","removeClass","replaceNode","originLoadingElement","fail","exception","registerCalendarEventListeners","root","eventFormModalPromise","body","on","created","reloadCurrentMonth","deleted","updated","editActionEvent","url","window","location","assign","moveEvent","registerEditListeners","registerEventListeners","dayLink","target","year","data","month","day","courseId","categoryId","refreshDayContent","preventDefault","history","pushState","elements","courseSelector","selectElement","val","eventFormPromise","registerEventFormModal","contextId","is","startTime","modal","wrapper","closest","setCourseId","setCategoryId","setContextId","setStartTime","show","init"],"mappings":"AA0BAA,OAAM,0BAAC,CACK,QADL,CAEK,WAFL,CAGK,UAHL,CAIK,gBAJL,CAKK,mBALL,CAMK,gCANL,CAOK,mBAPL,CAQK,oBARL,CASK,gCATL,CAUK,6BAVL,CAWK,0BAXL,CAYK,sBAZL,CAaK,4BAbL,CAcK,oBAdL,CAeK,yBAfL,CAAD,CAiBE,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYIC,CAZJ,CAaIC,CAbJ,CAcIC,CAdJ,CAeIC,CAfJ,CAgBE,IAEFC,CAAAA,CAAS,CAAG,CACZC,IAAI,CAAE,0BADM,CAEZC,GAAG,CAAE,qBAFO,CAGZC,gBAAgB,CAAE,kCAHN,CAIZC,WAAW,CAAE,6BAJD,CAKZC,YAAY,CAAE,eALF,CAMZC,aAAa,CAAE,+BANH,CAOZC,sBAAsB,CAAE,kBAPZ,CAQZC,KAAK,CAAE,QARK,CAFV,CAyBFC,CAAe,CAAG,SAASC,CAAT,CAAYC,CAAZ,CAAqBC,CAArB,CAAoCC,CAApC,C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,WAAtB,QAAOI,CAAAA,CAAX,CAAuC,CACnCc,CAAK,CAACI,aAAN,CAAoBlB,CAApB,CACH,CAEDc,CAAK,CAACK,YAAN,CAAmBJ,CAAO,CAACnB,IAAR,CAAa,WAAb,CAAnB,EACAkB,CAAK,CAACM,YAAN,CAAmBP,CAAnB,EACAC,CAAK,CAACO,IAAN,EAEH,CAbD,EAcC/C,IAdD,CAcM3C,CAAY,CAAC4C,SAdnB,EAgBAvB,CAAC,CAACkD,cAAF,EACH,CACJ,CAxBD,CAyBH,CACJ,CA7KK,CA+KN,MAAO,CACHoB,IAAI,CAAE,cAAS7C,CAAT,CAAe,CACjBA,CAAI,CAAGlD,CAAC,CAACkD,CAAD,CAAR,CACAtC,CAAmB,CAACmF,IAApB,CAAyB7C,CAAzB,EACAe,CAAsB,CAACf,CAAD,CACzB,CALE,CAOV,CAvNK,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 .\n\n/**\n * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module core_calendar/calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/str',\n 'core/templates',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal_events',\n 'core/modal_factory',\n 'core_calendar/modal_event_form',\n 'core_calendar/summary_modal',\n 'core_calendar/repository',\n 'core_calendar/events',\n 'core_calendar/view_manager',\n 'core_calendar/crud',\n 'core_calendar/selectors',\n ],\n function(\n $,\n Ajax,\n Str,\n Templates,\n Notification,\n CustomEvents,\n ModalEvents,\n ModalFactory,\n ModalEventForm,\n SummaryModal,\n CalendarRepository,\n CalendarEvents,\n CalendarViewManager,\n CalendarCrud,\n CalendarSelectors\n ) {\n\n var SELECTORS = {\n ROOT: \"[data-region='calendar']\",\n DAY: \"[data-region='day']\",\n NEW_EVENT_BUTTON: \"[data-action='new-event-button']\",\n DAY_CONTENT: \"[data-region='day-content']\",\n LOADING_ICON: '.loading-icon',\n VIEW_DAY_LINK: \"[data-action='view-day-link']\",\n CALENDAR_MONTH_WRAPPER: \".calendarwrapper\",\n TODAY: '.today',\n };\n\n /**\n * Handler for the drag and drop move event. Provides a loading indicator\n * while the request is sent to the server to update the event start date.\n *\n * Triggers a eventMoved calendar javascript event if the event was successfully\n * updated.\n *\n * @param {event} e The calendar move event\n * @param {int} eventId The event id being moved\n * @param {object|null} originElement The jQuery element for where the event is moving from\n * @param {object} destinationElement The jQuery element for where the event is moving to\n */\n var handleMoveEvent = function(e, eventId, originElement, destinationElement) {\n var originTimestamp = null;\n var destinationTimestamp = destinationElement.attr('data-day-timestamp');\n\n if (originElement) {\n originTimestamp = originElement.attr('data-day-timestamp');\n }\n\n // If the event has actually changed day.\n if (!originElement || originTimestamp != destinationTimestamp) {\n Templates.render('core/loading', {})\n .then(function(html, js) {\n // First we show some loading icons in each of the days being affected.\n destinationElement.find(SELECTORS.DAY_CONTENT).addClass('hidden');\n Templates.appendNodeContents(destinationElement, html, js);\n\n if (originElement) {\n originElement.find(SELECTORS.DAY_CONTENT).addClass('hidden');\n Templates.appendNodeContents(originElement, html, js);\n }\n return;\n })\n .then(function() {\n // Send a request to the server to make the change.\n return CalendarRepository.updateEventStartDay(eventId, destinationTimestamp);\n })\n .then(function() {\n // If the update was successful then broadcast an event letting the calendar\n // know that an event has been moved.\n $('body').trigger(CalendarEvents.eventMoved, [eventId, originElement, destinationElement]);\n return;\n })\n .always(function() {\n // Always remove the loading icons regardless of whether the update\n // request was successful or not.\n var destinationLoadingElement = destinationElement.find(SELECTORS.LOADING_ICON);\n destinationElement.find(SELECTORS.DAY_CONTENT).removeClass('hidden');\n Templates.replaceNode(destinationLoadingElement, '', '');\n\n if (originElement) {\n var originLoadingElement = originElement.find(SELECTORS.LOADING_ICON);\n originElement.find(SELECTORS.DAY_CONTENT).removeClass('hidden');\n Templates.replaceNode(originLoadingElement, '', '');\n }\n return;\n })\n .fail(Notification.exception);\n }\n };\n\n /**\n * Listen to and handle any calendar events fired by the calendar UI.\n *\n * @method registerCalendarEventListeners\n * @param {object} root The calendar root element\n * @param {object} eventFormModalPromise A promise reolved with the event form modal\n */\n var registerCalendarEventListeners = function(root, eventFormModalPromise) {\n var body = $('body');\n\n body.on(CalendarEvents.created, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n body.on(CalendarEvents.deleted, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n body.on(CalendarEvents.updated, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n body.on(CalendarEvents.editActionEvent, function(e, url) {\n // Action events needs to be edit directly on the course module.\n window.location.assign(url);\n });\n // Handle the event fired by the drag and drop code.\n body.on(CalendarEvents.moveEvent, handleMoveEvent);\n // When an event is successfully moved we should updated the UI.\n body.on(CalendarEvents.eventMoved, function() {\n CalendarViewManager.reloadCurrentMonth(root);\n });\n\n CalendarCrud.registerEditListeners(root, eventFormModalPromise);\n };\n\n /**\n * Register event listeners for the module.\n *\n * @param {object} root The calendar root element\n */\n var registerEventListeners = function(root) {\n // Listen the click on the day link to render the day view.\n root.on('click', SELECTORS.VIEW_DAY_LINK, function(e) {\n var dayLink = $(e.target);\n var year = dayLink.data('year'),\n month = dayLink.data('month'),\n day = dayLink.data('day'),\n courseId = dayLink.data('courseid'),\n categoryId = dayLink.data('categoryid');\n CalendarViewManager.refreshDayContent(root, year, month, day, courseId, categoryId, root,\n 'core_calendar/calendar_day').then(function() {\n e.preventDefault();\n var url = '?view=day&time=' + dayLink.data('timestamp');\n return window.history.pushState({}, '', url);\n }).fail(Notification.exception);\n });\n\n root.on('change', CalendarSelectors.elements.courseSelector, function() {\n var selectElement = $(this);\n var courseId = selectElement.val();\n CalendarViewManager.reloadCurrentMonth(root, courseId, null)\n .then(function() {\n // We need to get the selector again because the content has changed.\n return root.find(CalendarSelectors.elements.courseSelector).val(courseId);\n })\n .fail(Notification.exception);\n });\n\n var eventFormPromise = CalendarCrud.registerEventFormModal(root),\n contextId = $(SELECTORS.CALENDAR_MONTH_WRAPPER).data('context-id');\n registerCalendarEventListeners(root, eventFormPromise);\n\n if (contextId) {\n // Bind click events to calendar days.\n root.on('click', SELECTORS.DAY, function (e) {\n\n var target = $(e.target);\n\n if (!target.is(SELECTORS.VIEW_DAY_LINK)) {\n var startTime = $(this).attr('data-new-event-timestamp');\n eventFormPromise.then(function (modal) {\n var wrapper = target.closest(CalendarSelectors.wrapper);\n modal.setCourseId(wrapper.data('courseid'));\n\n var categoryId = wrapper.data('categoryid');\n if (typeof categoryId !== 'undefined') {\n modal.setCategoryId(categoryId);\n }\n\n modal.setContextId(wrapper.data('contextId'));\n modal.setStartTime(startTime);\n modal.show();\n return;\n })\n .fail(Notification.exception);\n\n e.preventDefault();\n }\n });\n }\n };\n\n return {\n init: function(root) {\n root = $(root);\n CalendarViewManager.init(root);\n registerEventListeners(root);\n }\n };\n});\n"],"file":"calendar.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/calendar_filter.min.js.map b/calendar/amd/build/calendar_filter.min.js.map
index 5fd11036430..1962b1a27e3 100644
--- a/calendar/amd/build/calendar_filter.min.js.map
+++ b/calendar/amd/build/calendar_filter.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/calendar_filter.js"],"names":["define","$","CalendarSelectors","CalendarEvents","Str","Templates","registerEventListeners","root","on","eventFilterItem","e","target","currentTarget","toggleFilter","preventDefault","viewUpdated","filters","find","each","i","filter","data","getFilterData","fireFilterChangedEvent","hidden","M","util","js_pending","get_string","eventtype","then","nameStr","name","icon","key","component","context","render","html","js","replaceNode","js_complete","trigger","filterChanged","type","init"],"mappings":"AAuBAA,OAAM,iCAAC,CACH,QADG,CAEH,yBAFG,CAGH,sBAHG,CAIH,UAJG,CAKH,gBALG,CAAD,CAON,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBN,CAAiB,CAACO,eAAnC,CAAoD,SAASC,CAAT,CAAY,CAC5D,GAAIC,CAAAA,CAAM,CAAGV,CAAC,CAACS,CAAC,CAACE,aAAH,CAAd,CAEAC,CAAY,CAACF,CAAD,CAAZ,CAEAD,CAAC,CAACI,cAAF,EACH,CAND,EAQAb,CAAC,CAAC,MAAD,CAAD,CAAUO,EAAV,CAAaL,CAAc,CAACY,WAA5B,CAAyC,UAAW,CAChD,GAAIC,CAAAA,CAAO,CAAGT,CAAI,CAACU,IAAL,CAAUf,CAAiB,CAACO,eAA5B,CAAd,CAEAO,CAAO,CAACE,IAAR,CAAa,SAASC,CAAT,CAAYC,CAAZ,CAAoB,CAC7BA,CAAM,CAAGnB,CAAC,CAACmB,CAAD,CAAV,CACA,GAAIA,CAAM,CAACC,IAAP,CAAY,kBAAZ,CAAJ,CAAqC,CACjC,GAAIA,CAAAA,CAAI,CAAGC,CAAa,CAACF,CAAD,CAAxB,CACAG,CAAsB,CAACF,CAAD,CACzB,CACJ,CAND,CAOH,CAVD,CAWH,CAtBH,CAwBMR,CAAY,CAAG,SAASF,CAAT,CAAiB,CAChC,GAAIU,CAAAA,CAAI,CAAGC,CAAa,CAACX,CAAD,CAAxB,CAGAU,CAAI,CAACG,MAAL,CAAc,CAACH,CAAI,CAACG,MAApB,CAEAC,CAAC,CAACC,IAAF,CAAOC,UAAP,CAAkB,4CAAlB,E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,CAFL,CAIV,CA9EH,CAgFE,MAAO,CACHwB,IAAI,CAAE,cAAStC,CAAT,CAAe,CACjBA,CAAI,CAAGN,CAAC,CAACM,CAAD,CAAR,CAEAD,CAAsB,CAACC,CAAD,CACzB,CALE,CAOV,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 .\n\n/**\n * This module is responsible for the calendar filter.\n *\n * @module core_calendar/calendar_filter\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core/str',\n 'core/templates',\n],\nfunction(\n $,\n CalendarSelectors,\n CalendarEvents,\n Str,\n Templates\n) {\n\n var registerEventListeners = function(root) {\n root.on('click', CalendarSelectors.eventFilterItem, function(e) {\n var target = $(e.currentTarget);\n\n toggleFilter(target);\n\n e.preventDefault();\n });\n\n $('body').on(CalendarEvents.viewUpdated, function() {\n var filters = root.find(CalendarSelectors.eventFilterItem);\n\n filters.each(function(i, filter) {\n filter = $(filter);\n if (filter.data('eventtype-hidden')) {\n var data = getFilterData(filter);\n fireFilterChangedEvent(data);\n }\n });\n });\n };\n\n var toggleFilter = function(target) {\n var data = getFilterData(target);\n\n // Toggle the hidden. We need to render the template before we change the value.\n data.hidden = !data.hidden;\n\n M.util.js_pending(\"core_calendar/calendar_filter:toggleFilter\");\n return Str.get_string('eventtype' + data.eventtype, 'calendar')\n .then(function(nameStr) {\n data.name = nameStr;\n data.icon = true;\n data.key = 'i/' + data.eventtype + 'event';\n data.component = 'core';\n\n return data;\n })\n .then(function(context) {\n return Templates.render('core_calendar/event_filter_key', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(target, html, js);\n })\n .then(function() {\n fireFilterChangedEvent(data);\n M.util.js_complete(\"core_calendar/calendar_filter:toggleFilter\");\n return;\n });\n };\n\n /**\n * Fire the filterChanged event for the specified data.\n *\n * @param {object} data The data to include\n */\n var fireFilterChangedEvent = function(data) {\n M.util.js_pending(\"month-mini-filterChanged\");\n $('body').trigger(CalendarEvents.filterChanged, {\n type: data.eventtype,\n hidden: data.hidden,\n });\n M.util.js_complete(\"month-mini-filterChanged\");\n };\n\n /**\n * Get the filter data for the specified target.\n *\n * @param {jQuery} target The target node\n * @return {Object}\n */\n var getFilterData = function(target) {\n return {\n eventtype: target.data('eventtype'),\n hidden: target.data('eventtype-hidden'),\n };\n };\n\n return {\n init: function(root) {\n root = $(root);\n\n registerEventListeners(root);\n }\n };\n});\n"],"file":"calendar_filter.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/calendar_filter.js"],"names":["define","$","CalendarSelectors","CalendarEvents","Str","Templates","registerEventListeners","root","on","eventFilterItem","e","target","currentTarget","toggleFilter","preventDefault","viewUpdated","filters","find","each","i","filter","data","getFilterData","fireFilterChangedEvent","hidden","M","util","js_pending","get_string","eventtype","then","nameStr","name","icon","key","component","context","render","html","js","replaceNode","js_complete","trigger","filterChanged","type","init"],"mappings":"AAsBAA,OAAM,iCAAC,CACH,QADG,CAEH,yBAFG,CAGH,sBAHG,CAIH,UAJG,CAKH,gBALG,CAAD,CAON,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEMC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBN,CAAiB,CAACO,eAAnC,CAAoD,SAASC,CAAT,CAAY,CAC5D,GAAIC,CAAAA,CAAM,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M,EAYNN,IAZM,CAYD,SAASQ,CAAT,CAAeC,CAAf,CAAmB,CACrB,MAAOlC,CAAAA,CAAS,CAACmC,WAAV,CAAsB7B,CAAtB,CAA8B2B,CAA9B,CAAoCC,CAApC,CACV,CAdM,EAeNT,IAfM,CAeD,UAAW,CACbP,CAAsB,CAACF,CAAD,CAAtB,CACAI,CAAC,CAACC,IAAF,CAAOe,WAAP,CAAmB,4CAAnB,CAEH,CAnBM,CAoBV,CAnDH,CA0DMlB,CAAsB,CAAG,SAASF,CAAT,CAAe,CACxCI,CAAC,CAACC,IAAF,CAAOC,UAAP,CAAkB,0BAAlB,EACA1B,CAAC,CAAC,MAAD,CAAD,CAAUyC,OAAV,CAAkBvC,CAAc,CAACwC,aAAjC,CAAgD,CAC5CC,IAAI,CAAEvB,CAAI,CAACQ,SADiC,CAE5CL,MAAM,CAAEH,CAAI,CAACG,MAF+B,CAAhD,EAIAC,CAAC,CAACC,IAAF,CAAOe,WAAP,CAAmB,0BAAnB,CACH,CAjEH,CAyEMnB,CAAa,CAAG,SAASX,CAAT,CAAiB,CACjC,MAAO,CACHkB,SAAS,CAAElB,CAAM,CAACU,IAAP,CAAY,WAAZ,CADR,CAEHG,MAAM,CAAEb,CAAM,CAACU,IAAP,CAAY,kBAAZ,CAFL,CAIV,CA9EH,CAgFE,MAAO,CACHwB,IAAI,CAAE,cAAStC,CAAT,CAAe,CACjBA,CAAI,CAAGN,CAAC,CAACM,CAAD,CAAR,CAEAD,CAAsB,CAACC,CAAD,CACzB,CALE,CAOV,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 .\n\n/**\n * This module is responsible for the calendar filter.\n *\n * @module core_calendar/calendar_filter\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core/str',\n 'core/templates',\n],\nfunction(\n $,\n CalendarSelectors,\n CalendarEvents,\n Str,\n Templates\n) {\n\n var registerEventListeners = function(root) {\n root.on('click', CalendarSelectors.eventFilterItem, function(e) {\n var target = $(e.currentTarget);\n\n toggleFilter(target);\n\n e.preventDefault();\n });\n\n $('body').on(CalendarEvents.viewUpdated, function() {\n var filters = root.find(CalendarSelectors.eventFilterItem);\n\n filters.each(function(i, filter) {\n filter = $(filter);\n if (filter.data('eventtype-hidden')) {\n var data = getFilterData(filter);\n fireFilterChangedEvent(data);\n }\n });\n });\n };\n\n var toggleFilter = function(target) {\n var data = getFilterData(target);\n\n // Toggle the hidden. We need to render the template before we change the value.\n data.hidden = !data.hidden;\n\n M.util.js_pending(\"core_calendar/calendar_filter:toggleFilter\");\n return Str.get_string('eventtype' + data.eventtype, 'calendar')\n .then(function(nameStr) {\n data.name = nameStr;\n data.icon = true;\n data.key = 'i/' + data.eventtype + 'event';\n data.component = 'core';\n\n return data;\n })\n .then(function(context) {\n return Templates.render('core_calendar/event_filter_key', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(target, html, js);\n })\n .then(function() {\n fireFilterChangedEvent(data);\n M.util.js_complete(\"core_calendar/calendar_filter:toggleFilter\");\n return;\n });\n };\n\n /**\n * Fire the filterChanged event for the specified data.\n *\n * @param {object} data The data to include\n */\n var fireFilterChangedEvent = function(data) {\n M.util.js_pending(\"month-mini-filterChanged\");\n $('body').trigger(CalendarEvents.filterChanged, {\n type: data.eventtype,\n hidden: data.hidden,\n });\n M.util.js_complete(\"month-mini-filterChanged\");\n };\n\n /**\n * Get the filter data for the specified target.\n *\n * @param {jQuery} target The target node\n * @return {Object}\n */\n var getFilterData = function(target) {\n return {\n eventtype: target.data('eventtype'),\n hidden: target.data('eventtype-hidden'),\n };\n };\n\n return {\n init: function(root) {\n root = $(root);\n\n registerEventListeners(root);\n }\n };\n});\n"],"file":"calendar_filter.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/calendar_mini.min.js.map b/calendar/amd/build/calendar_mini.min.js.map
index 8fd42939090..979529eb1b7 100644
--- a/calendar/amd/build/calendar_mini.min.js.map
+++ b/calendar/amd/build/calendar_mini.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/calendar_mini.js"],"names":["define","$","CalendarSelectors","CalendarEvents","CalendarViewManager","registerCalendarEventListeners","root","body","namespace","attr","on","created","reloadMonth","deleted","updated","eventMoved","e","data","is","reloadCurrentMonth","off","registerEventListeners","filterChanged","daysWithEvent","find","eventType","type","toggleClass","hidden","elements","courseSelector","selectElement","courseId","val","init","loadOnInit"],"mappings":"AA2BAA,OAAM,+BAAC,CACH,QADG,CAEH,yBAFG,CAGH,sBAHG,CAIH,4BAJG,CAAD,CAMN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKE,IAQMC,CAAAA,CAA8B,CAAG,SAASC,CAAT,CAAe,IAC5CC,CAAAA,CAAI,CAAGN,CAAC,CAAC,MAAD,CADoC,CAE5CO,CAAS,CAAG,IAAMF,CAAI,CAACG,IAAL,CAAU,IAAV,CAF0B,CAIhDF,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACQ,OAAf,CAAyBH,CAAjC,CAA4CF,CAA5C,CAAkDM,CAAlD,EACAL,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACU,OAAf,CAAyBL,CAAjC,CAA4CF,CAA5C,CAAkDM,CAAlD,EACAL,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACW,OAAf,CAAyBN,CAAjC,CAA4CF,CAA5C,CAAkDM,CAAlD,EACAL,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACY,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UAAW,CACrF,GAAIxB,CAAI,CAACY,EAAL,CAAQ,UAAR,CAAJ,CAAyB,IACjBa,CAAAA,CAAa,CAAG9B,CAAC,CAAC,IAAD,CADA,CAEjB+B,CAAQ,CAAGD,CAAa,CAACE,GAAd,EAFM,CAKrB7B,CAAmB,CAACe,kBAApB,CAAuCb,CAAvC,CAA6C0B,CAA7C,CAFiB,IAEjB,CACH,CAND,IAMO,CACH/B,CAAC,CAAC,MAAD,CAAD,CAAUmB,GAAV,CAAc,SAAWZ,CAAzB,CACH,CACJ,CAVD,CAYH,CA5DH,CA8DE,MAAO,CACH0B,IAAI,CAAE,cAAS5B,CAAT,CAAe6B,CAAf,CAA2B,CAC7B7B,CAAI,CAAGL,CAAC,CAACK,CAAD,CAAR,CAEAF,CAAmB,CAAC8B,IAApB,CAAyB5B,CAAzB,EACAe,CAAsB,CAACf,CAAD,CAAtB,CACAD,CAA8B,CAACC,CAAD,CAA9B,CAEA,GAAI6B,CAAJ,CAAgB,CAGZ/B,CAAmB,CAACe,kBAApB,CAAuCb,CAAvC,CACH,CAEJ,CAdE,CAgBV,CAzFK,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 .\n\n/**\n * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module core_calendar/calendar_mini\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core_calendar/view_manager',\n],\nfunction(\n $,\n CalendarSelectors,\n CalendarEvents,\n CalendarViewManager\n) {\n\n /**\n * Listen to and handle any calendar events fired by the calendar UI.\n *\n * @method registerCalendarEventListeners\n * @param {object} root The calendar root element\n */\n var registerCalendarEventListeners = function(root) {\n var body = $('body');\n var namespace = '.' + root.attr('id');\n\n body.on(CalendarEvents.created + namespace, root, reloadMonth);\n body.on(CalendarEvents.deleted + namespace, root, reloadMonth);\n body.on(CalendarEvents.updated + namespace, root, reloadMonth);\n body.on(CalendarEvents.eventMoved + namespace, root, reloadMonth);\n };\n\n /**\n * Reload the month view in this month.\n *\n * @param {EventFacade} e\n */\n var reloadMonth = function(e) {\n var root = e.data;\n var body = $('body');\n var namespace = '.' + root.attr('id');\n\n if (root.is(':visible')) {\n CalendarViewManager.reloadCurrentMonth(root);\n } else {\n // The root has been removed.\n // Remove all events in the namespace.\n body.off(CalendarEvents.created + namespace);\n body.off(CalendarEvents.deleted + namespace);\n body.off(CalendarEvents.updated + namespace);\n body.off(CalendarEvents.eventMoved + namespace);\n }\n };\n\n var registerEventListeners = function(root) {\n $('body').on(CalendarEvents.filterChanged, function(e, data) {\n var daysWithEvent = root.find(CalendarSelectors.eventType[data.type]);\n\n daysWithEvent.toggleClass('calendar_event_' + data.type, !data.hidden);\n });\n\n var namespace = '.' + root.attr('id');\n $('body').on('change' + namespace, CalendarSelectors.elements.courseSelector, function() {\n if (root.is(':visible')) {\n var selectElement = $(this);\n var courseId = selectElement.val();\n var categoryId = null;\n\n CalendarViewManager.reloadCurrentMonth(root, courseId, categoryId);\n } else {\n $('body').off('change' + namespace);\n }\n });\n\n };\n\n return {\n init: function(root, loadOnInit) {\n root = $(root);\n\n CalendarViewManager.init(root);\n registerEventListeners(root);\n registerCalendarEventListeners(root);\n\n if (loadOnInit) {\n // The calendar hasn't yet loaded it's events so we\n // should load them as soon as we've initialised.\n CalendarViewManager.reloadCurrentMonth(root);\n }\n\n }\n };\n});\n"],"file":"calendar_mini.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/calendar_mini.js"],"names":["define","$","CalendarSelectors","CalendarEvents","CalendarViewManager","registerCalendarEventListeners","root","body","namespace","attr","on","created","reloadMonth","deleted","updated","eventMoved","e","data","is","reloadCurrentMonth","off","registerEventListeners","filterChanged","daysWithEvent","find","eventType","type","toggleClass","hidden","elements","courseSelector","selectElement","courseId","val","init","loadOnInit"],"mappings":"AA0BAA,OAAM,+BAAC,CACH,QADG,CAEH,yBAFG,CAGH,sBAHG,CAIH,4BAJG,CAAD,CAMN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKE,IAQMC,CAAAA,CAA8B,CAAG,SAASC,CAAT,CAAe,IAC5CC,CAAAA,CAAI,CAAGN,CAAC,CAAC,MAAD,CADoC,CAE5CO,CAAS,CAAG,IAAMF,CAAI,CAACG,IAAL,CAAU,IAAV,CAF0B,CAIhDF,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACQ,OAAf,CAAyBH,CAAjC,CAA4CF,CAA5C,CAAkDM,CAAlD,EACAL,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACU,OAAf,CAAyBL,CAAjC,CAA4CF,CAA5C,CAAkDM,CAAlD,EACAL,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACW,OAAf,CAAyBN,CAAjC,CAA4CF,CAA5C,CAAkDM,CAAlD,EACAL,CAAI,CAACG,EAAL,CAAQP,CAAc,CAACY,UAAf,CAA4BP,CAApC,CAA+CF,CAA/C,CAAqDM,CAArD,CACH,CAhBH,CAuBMA,CAAW,CAAG,SAASI,CAAT,CAAY,IACtBV,CAAAA,CAAI,CAAGU,CAAC,CAACC,IADa,CAEtBV,CAAI,CAAGN,CAAC,CAAC,MAAD,CAFc,CAGtBO,CAAS,CAAG,IAAMF,CAAI,CAACG,IAAL,CAAU,IAAV,CAHI,CAK1B,GAAIH,CAAI,CAACY,EAAL,CAAQ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UmB,GAAV,CAAc,SAAWZ,CAAzB,CACH,CACJ,CAVD,CAYH,CA5DH,CA8DE,MAAO,CACH0B,IAAI,CAAE,cAAS5B,CAAT,CAAe6B,CAAf,CAA2B,CAC7B7B,CAAI,CAAGL,CAAC,CAACK,CAAD,CAAR,CAEAF,CAAmB,CAAC8B,IAApB,CAAyB5B,CAAzB,EACAe,CAAsB,CAACf,CAAD,CAAtB,CACAD,CAA8B,CAACC,CAAD,CAA9B,CAEA,GAAI6B,CAAJ,CAAgB,CAGZ/B,CAAmB,CAACe,kBAApB,CAAuCb,CAAvC,CACH,CAEJ,CAdE,CAgBV,CAzFK,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 .\n\n/**\n * This module is the highest level module for the calendar. It is\n * responsible for initialising all of the components required for\n * the calendar to run. It also coordinates the interaction between\n * components by listening for and responding to different events\n * triggered within the calendar UI.\n *\n * @module core_calendar/calendar_mini\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core_calendar/view_manager',\n],\nfunction(\n $,\n CalendarSelectors,\n CalendarEvents,\n CalendarViewManager\n) {\n\n /**\n * Listen to and handle any calendar events fired by the calendar UI.\n *\n * @method registerCalendarEventListeners\n * @param {object} root The calendar root element\n */\n var registerCalendarEventListeners = function(root) {\n var body = $('body');\n var namespace = '.' + root.attr('id');\n\n body.on(CalendarEvents.created + namespace, root, reloadMonth);\n body.on(CalendarEvents.deleted + namespace, root, reloadMonth);\n body.on(CalendarEvents.updated + namespace, root, reloadMonth);\n body.on(CalendarEvents.eventMoved + namespace, root, reloadMonth);\n };\n\n /**\n * Reload the month view in this month.\n *\n * @param {EventFacade} e\n */\n var reloadMonth = function(e) {\n var root = e.data;\n var body = $('body');\n var namespace = '.' + root.attr('id');\n\n if (root.is(':visible')) {\n CalendarViewManager.reloadCurrentMonth(root);\n } else {\n // The root has been removed.\n // Remove all events in the namespace.\n body.off(CalendarEvents.created + namespace);\n body.off(CalendarEvents.deleted + namespace);\n body.off(CalendarEvents.updated + namespace);\n body.off(CalendarEvents.eventMoved + namespace);\n }\n };\n\n var registerEventListeners = function(root) {\n $('body').on(CalendarEvents.filterChanged, function(e, data) {\n var daysWithEvent = root.find(CalendarSelectors.eventType[data.type]);\n\n daysWithEvent.toggleClass('calendar_event_' + data.type, !data.hidden);\n });\n\n var namespace = '.' + root.attr('id');\n $('body').on('change' + namespace, CalendarSelectors.elements.courseSelector, function() {\n if (root.is(':visible')) {\n var selectElement = $(this);\n var courseId = selectElement.val();\n var categoryId = null;\n\n CalendarViewManager.reloadCurrentMonth(root, courseId, categoryId);\n } else {\n $('body').off('change' + namespace);\n }\n });\n\n };\n\n return {\n init: function(root, loadOnInit) {\n root = $(root);\n\n CalendarViewManager.init(root);\n registerEventListeners(root);\n registerCalendarEventListeners(root);\n\n if (loadOnInit) {\n // The calendar hasn't yet loaded it's events so we\n // should load them as soon as we've initialised.\n CalendarViewManager.reloadCurrentMonth(root);\n }\n\n }\n };\n});\n"],"file":"calendar_mini.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/calendar_threemonth.min.js.map b/calendar/amd/build/calendar_threemonth.min.js.map
index 04406fee766..eb186bdbfac 100644
--- a/calendar/amd/build/calendar_threemonth.min.js.map
+++ b/calendar/amd/build/calendar_threemonth.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/calendar_threemonth.js"],"names":["define","$","Notification","CalendarSelectors","CalendarEvents","Templates","CalendarViewManager","registerCalendarEventListeners","root","body","on","monthChanged","dayChanged","join","e","year","month","courseId","categoryId","queue","next","processRequest","then","fail","exception","newCurrentMonth","find","newParent","closest","calendarPeriods","allMonths","previousMonth","nextMonth","placeHolder","attr","placeHolderContainer","hide","append","requestYear","requestMonth","oldMonth","is","insertBefore","data","insertAfter","Deferred","resolve","refreshMonthContent","slideUpPromise","slideDownPromise","slideUp","remove","slideDown","when","links","miniDayLink","target","day","text","calendarRoot","calendarMain","refreshDayContent","preventDefault","window","history","pushState","init"],"mappings":"AAwBAA,OAAM,qCAAC,CACH,QADG,CAEH,mBAFG,CAGH,yBAHG,CAIH,sBAJG,CAKH,gBALG,CAMH,4BANG,CAAD,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOE,CAQE,GAAIC,CAAAA,CAA8B,CAAG,SAASC,CAAT,CAAe,CAChD,GAAIC,CAAAA,CAAI,CAAGR,CAAC,CAAC,MAAD,CAAZ,CACAQ,CAAI,CAACC,EAAL,CAAQ,CAACN,CAAc,CAACO,YAAhB,CAA8BP,CAAc,CAACQ,UAA7C,EAAyDC,IAAzD,CAA8D,GAA9D,CAAR,CAA4E,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAyBC,CAAzB,CAAmCC,CAAnC,CAA+C,CAGvHV,CAAI,CAACW,KAAL,CAAW,SAASC,CAAT,CAAe,CACtB,MAAOC,CAAAA,CAAc,CAACP,CAAD,CAAIC,CAAJ,CAAUC,CAAV,CAAiBC,CAAjB,CAA2BC,CAA3B,CAAd,CACNI,IADM,CACD,UAAW,CACb,MAAOF,CAAAA,CAAI,EACd,CAHM,EAING,IAJM,CAIDrB,CAAY,CAACsB,SAJZ,CAMV,CAPD,CAQH,CAXD,EAaA,GAAIH,CAAAA,CAAc,CAAG,SAASP,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAyBC,CAAzB,CAAmCC,CAAnC,CAA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jB,CAPyC,CAQtDgB,CAAY,CAAG1D,CAAC,CAAC,MAAD,CAAD,CAAUyB,IAAV,CAAevB,CAAiB,CAACyD,YAAjC,CARuC,CAS1DtD,CAAmB,CAACuD,iBAApB,CAAsCF,CAAtC,CAAoD5C,CAApD,CAA0DC,CAA1D,CAAiEyC,CAAjE,CAAsExC,CAAtE,CAAgFC,CAAhF,CACIyC,CADJ,CACkB,4BADlB,EAEA7C,CAAC,CAACgD,cAAF,GACAC,MAAM,CAACC,OAAP,CAAeC,SAAf,CAAyB,EAAzB,CAA6B,EAA7B,CAAiC,WAAjC,CACP,CAbD,CAcH,CA1FD,CA4FA,MAAO,CACHC,IAAI,CAAE,cAAS1D,CAAT,CAAe,CACjBA,CAAI,CAAGP,CAAC,CAACO,CAAD,CAAR,CAEAD,CAA8B,CAACC,CAAD,CACjC,CALE,CAOV,CA1HK,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 .\n\n/**\n * This module handles display of multiple mini calendars in a view, and\n * movement through them.\n *\n * @module core_calendar/calendar_threemonth\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/notification',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core/templates',\n 'core_calendar/view_manager',\n],\nfunction(\n $,\n Notification,\n CalendarSelectors,\n CalendarEvents,\n Templates,\n CalendarViewManager\n) {\n\n /**\n * Listen to and handle any calendar events fired by the calendar UI.\n *\n * @method registerCalendarEventListeners\n * @param {object} root The calendar root element\n */\n var registerCalendarEventListeners = function(root) {\n var body = $('body');\n body.on([CalendarEvents.monthChanged, CalendarEvents.dayChanged].join(' '), function(e, year, month, courseId, categoryId) {\n // We have to use a queue here because the calling code is decoupled from these listeners.\n // It's possible for the event to be called multiple times before one call is fully resolved.\n root.queue(function(next) {\n return processRequest(e, year, month, courseId, categoryId)\n .then(function() {\n return next();\n })\n .fail(Notification.exception)\n ;\n });\n });\n\n var processRequest = function(e, year, month, courseId, categoryId) {\n var newCurrentMonth = root.find('[data-year=\"' + year + '\"][data-month=\"' + month + '\"]');\n var newParent = newCurrentMonth.closest(CalendarSelectors.calendarPeriods.month);\n var allMonths = root.find(CalendarSelectors.calendarPeriods.month);\n\n var previousMonth = $(allMonths[0]);\n var nextMonth = $(allMonths[2]);\n\n var placeHolder = $('');\n placeHolder.attr('data-template', 'core_calendar/threemonth_month');\n placeHolder.attr('data-includenavigation', false);\n placeHolder.attr('data-mini', true);\n var placeHolderContainer = $('
');\n placeHolderContainer.hide();\n placeHolderContainer.append(placeHolder);\n\n var requestYear;\n var requestMonth;\n var oldMonth;\n\n if (newParent.is(previousMonth)) {\n // Fetch the new previous month.\n placeHolderContainer.insertBefore(previousMonth);\n\n requestYear = previousMonth.data('previousYear');\n requestMonth = previousMonth.data('previousMonth');\n oldMonth = nextMonth;\n } else if (newParent.is(nextMonth)) {\n // Fetch the new next month.\n placeHolderContainer.insertAfter(nextMonth);\n requestYear = nextMonth.data('nextYear');\n requestMonth = nextMonth.data('nextMonth');\n oldMonth = previousMonth;\n } else {\n return $.Deferred().resolve();\n }\n\n return CalendarViewManager.refreshMonthContent(\n placeHolder,\n requestYear,\n requestMonth,\n courseId,\n categoryId,\n placeHolder\n )\n .then(function() {\n var slideUpPromise = $.Deferred();\n var slideDownPromise = $.Deferred();\n oldMonth.slideUp('fast', function() {\n $(this).remove();\n slideUpPromise.resolve();\n });\n placeHolderContainer.slideDown('fast', function() {\n slideDownPromise.resolve();\n });\n\n return $.when(slideUpPromise, slideDownPromise);\n });\n };\n\n // Listen for a click on the day link in the three month block to load the day view.\n root.on('click', CalendarSelectors.links.miniDayLink, function(e) {\n\n var miniDayLink = $(e.target);\n var year = miniDayLink.data('year'),\n month = miniDayLink.data('month'),\n day = miniDayLink.text(),\n courseId = miniDayLink.data('courseid'),\n categoryId = miniDayLink.data('categoryid'),\n calendarRoot = $('body').find(CalendarSelectors.calendarMain);\n CalendarViewManager.refreshDayContent(calendarRoot, year, month, day, courseId, categoryId,\n calendarRoot, 'core_calendar/calendar_day');\n e.preventDefault();\n window.history.pushState({}, '', '?view=day');\n });\n };\n\n return {\n init: function(root) {\n root = $(root);\n\n registerCalendarEventListeners(root);\n }\n };\n});\n"],"file":"calendar_threemonth.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/calendar_threemonth.js"],"names":["define","$","Notification","CalendarSelectors","CalendarEvents","Templates","CalendarViewManager","registerCalendarEventListeners","root","body","on","monthChanged","dayChanged","join","e","year","month","courseId","categoryId","queue","next","processRequest","then","fail","exception","newCurrentMonth","find","newParent","closest","calendarPeriods","allMonths","previousMonth","nextMonth","placeHolder","attr","placeHolderContainer","hide","append","requestYear","requestMonth","oldMonth","is","insertBefore","data","insertAfter","Deferred","resolve","refreshMonthContent","slideUpPromise","slideDownPromise","slideUp","remove","slideDown","when","links","miniDayLink","target","day","text","calendarRoot","calendarMain","refreshDayContent","preventDefault","window","history","pushState","init"],"mappings":"AAuBAA,OAAM,qCAAC,CACH,QADG,CAEH,mBAFG,CAGH,yBAHG,CAIH,sBAJG,CAKH,gBALG,CAMH,4BANG,CAAD,CAQN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOE,CAQE,GAAIC,CAAAA,CAA8B,CAAG,SAASC,CAAT,CAAe,CAChD,GAAIC,CAAAA,CAAI,CAAGR,CAAC,CAAC,MAAD,CAAZ,CACAQ,CAAI,CAACC,EAAL,CAAQ,CAACN,CAA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CAACoD,IAAF,CAAOL,CAAP,CAAuBC,CAAvB,CACV,CApBM,CAqBV,CA1DD,CA6DAzC,CAAI,CAACE,EAAL,CAAQ,OAAR,CAAiBP,CAAiB,CAACmD,KAAlB,CAAwBC,WAAzC,CAAsD,SAASzC,CAAT,CAAY,IAEtDyC,CAAAA,CAAW,CAAGtD,CAAC,CAACa,CAAC,CAAC0C,MAAH,CAFuC,CAGtDzC,CAAI,CAAGwC,CAAW,CAACZ,IAAZ,CAAiB,MAAjB,CAH+C,CAItD3B,CAAK,CAAGuC,CAAW,CAACZ,IAAZ,CAAiB,OAAjB,CAJ8C,CAKtDc,CAAG,CAAGF,CAAW,CAACG,IAAZ,EALgD,CAMtDzC,CAAQ,CAAGsC,CAAW,CAACZ,IAAZ,CAAiB,UAAjB,CAN2C,CAOtDzB,CAAU,CAAGqC,CAAW,CAACZ,IAAZ,CAAiB,YAAjB,CAPyC,CAQtDgB,CAAY,CAAG1D,CAAC,CAAC,MAAD,CAAD,CAAUyB,IAAV,CAAevB,CAAiB,CAACyD,YAAjC,CARuC,CAS1DtD,CAAmB,CAACuD,iBAApB,CAAsCF,CAAtC,CAAoD5C,CAApD,CAA0DC,CAA1D,CAAiEyC,CAAjE,CAAsExC,CAAtE,CAAgFC,CAAhF,CACIyC,CADJ,CACkB,4BADlB,EAEA7C,CAAC,CAACgD,cAAF,GACAC,MAAM,CAACC,OAAP,CAAeC,SAAf,CAAyB,EAAzB,CAA6B,EAA7B,CAAiC,WAAjC,CACP,CAbD,CAcH,CA1FD,CA4FA,MAAO,CACHC,IAAI,CAAE,cAAS1D,CAAT,CAAe,CACjBA,CAAI,CAAGP,CAAC,CAACO,CAAD,CAAR,CAEAD,CAA8B,CAACC,CAAD,CACjC,CALE,CAOV,CA1HK,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 .\n\n/**\n * This module handles display of multiple mini calendars in a view, and\n * movement through them.\n *\n * @module core_calendar/calendar_threemonth\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/notification',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core/templates',\n 'core_calendar/view_manager',\n],\nfunction(\n $,\n Notification,\n CalendarSelectors,\n CalendarEvents,\n Templates,\n CalendarViewManager\n) {\n\n /**\n * Listen to and handle any calendar events fired by the calendar UI.\n *\n * @method registerCalendarEventListeners\n * @param {object} root The calendar root element\n */\n var registerCalendarEventListeners = function(root) {\n var body = $('body');\n body.on([CalendarEvents.monthChanged, CalendarEvents.dayChanged].join(' '), function(e, year, month, courseId, categoryId) {\n // We have to use a queue here because the calling code is decoupled from these listeners.\n // It's possible for the event to be called multiple times before one call is fully resolved.\n root.queue(function(next) {\n return processRequest(e, year, month, courseId, categoryId)\n .then(function() {\n return next();\n })\n .fail(Notification.exception)\n ;\n });\n });\n\n var processRequest = function(e, year, month, courseId, categoryId) {\n var newCurrentMonth = root.find('[data-year=\"' + year + '\"][data-month=\"' + month + '\"]');\n var newParent = newCurrentMonth.closest(CalendarSelectors.calendarPeriods.month);\n var allMonths = root.find(CalendarSelectors.calendarPeriods.month);\n\n var previousMonth = $(allMonths[0]);\n var nextMonth = $(allMonths[2]);\n\n var placeHolder = $('');\n placeHolder.attr('data-template', 'core_calendar/threemonth_month');\n placeHolder.attr('data-includenavigation', false);\n placeHolder.attr('data-mini', true);\n var placeHolderContainer = $('
');\n placeHolderContainer.hide();\n placeHolderContainer.append(placeHolder);\n\n var requestYear;\n var requestMonth;\n var oldMonth;\n\n if (newParent.is(previousMonth)) {\n // Fetch the new previous month.\n placeHolderContainer.insertBefore(previousMonth);\n\n requestYear = previousMonth.data('previousYear');\n requestMonth = previousMonth.data('previousMonth');\n oldMonth = nextMonth;\n } else if (newParent.is(nextMonth)) {\n // Fetch the new next month.\n placeHolderContainer.insertAfter(nextMonth);\n requestYear = nextMonth.data('nextYear');\n requestMonth = nextMonth.data('nextMonth');\n oldMonth = previousMonth;\n } else {\n return $.Deferred().resolve();\n }\n\n return CalendarViewManager.refreshMonthContent(\n placeHolder,\n requestYear,\n requestMonth,\n courseId,\n categoryId,\n placeHolder\n )\n .then(function() {\n var slideUpPromise = $.Deferred();\n var slideDownPromise = $.Deferred();\n oldMonth.slideUp('fast', function() {\n $(this).remove();\n slideUpPromise.resolve();\n });\n placeHolderContainer.slideDown('fast', function() {\n slideDownPromise.resolve();\n });\n\n return $.when(slideUpPromise, slideDownPromise);\n });\n };\n\n // Listen for a click on the day link in the three month block to load the day view.\n root.on('click', CalendarSelectors.links.miniDayLink, function(e) {\n\n var miniDayLink = $(e.target);\n var year = miniDayLink.data('year'),\n month = miniDayLink.data('month'),\n day = miniDayLink.text(),\n courseId = miniDayLink.data('courseid'),\n categoryId = miniDayLink.data('categoryid'),\n calendarRoot = $('body').find(CalendarSelectors.calendarMain);\n CalendarViewManager.refreshDayContent(calendarRoot, year, month, day, courseId, categoryId,\n calendarRoot, 'core_calendar/calendar_day');\n e.preventDefault();\n window.history.pushState({}, '', '?view=day');\n });\n };\n\n return {\n init: function(root) {\n root = $(root);\n\n registerCalendarEventListeners(root);\n }\n };\n});\n"],"file":"calendar_threemonth.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/calendar_view.min.js.map b/calendar/amd/build/calendar_view.min.js.map
index 59a4e6efde2..be62156ed8a 100644
--- a/calendar/amd/build/calendar_view.min.js.map
+++ b/calendar/amd/build/calendar_view.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/calendar_view.js"],"names":["define","$","Str","Notification","CalendarSelectors","CalendarEvents","CalendarViewManager","CalendarRepository","ModalFactory","ModalEventForm","ModalEvents","CalendarCrud","registerEventListeners","root","type","body","registerRemove","reloadFunction","charAt","toUpperCase","slice","on","created","deleted","updated","courseSelector","selectElement","courseId","val","then","find","window","history","pushState","fail","exception","filterChanged","e","data","daysWithEvent","eventType","hidden","addClass","removeClass","eventFormPromise","registerEventFormModal","registerEditListeners","init"],"mappings":"AAuBAA,OAAM,+BAAC,CACC,QADD,CAEC,UAFD,CAGC,mBAHD,CAIC,yBAJD,CAKC,sBALD,CAMC,4BAND,CAOC,0BAPD,CAQC,oBARD,CASC,gCATD,CAUC,mBAVD,CAWC,oBAXD,CAAD,CAaF,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,CAEE,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAqB,CAC9C,GAAIC,CAAAA,CAAI,CAAGd,CAAC,CAAC,MAAD,CAAZ,CAEAU,CAAY,CAACK,cAAb,CAA4BH,CAA5B,EAEA,GAAII,CAAAA,CAAc,CAAG,gBAAkBH,CAAI,CAACI,MAAL,CAAY,CAAZ,EAAeC,WAAf,EAAlB,CAAiDL,CAAI,CAACM,KAAL,CAAW,CAAX,CAAtE,CAEAL,CAAI,CAACM,EAAL,CAAQhB,CAAc,CAACiB,OAAvB,CAAgC,UAAW,CACvChB,CAAmB,CAACW,CAAD,CAAnB,CAAoCJ,CAApC,CACH,CAFD,EAGAE,CAAI,CAACM,EAAL,CAAQhB,CAAc,CAACkB,OAAvB,CAAgC,UAAW,CACvCjB,CAAmB,CAACW,CAAD,CAAnB,CAAoCJ,CAApC,CACH,CAFD,EAGAE,CAAI,CAACM,EAAL,CAAQhB,CAAc,CAACmB,OAAvB,CAAgC,UAAW,CACvClB,CAAmB,CAACW,C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,CAAC,CAACY,CAAD,CAAR,CAEAP,CAAmB,CAACyC,IAApB,CAAyBlC,CAAzB,CAA+BC,CAA/B,EACAF,CAAsB,CAACC,CAAD,CAAOC,CAAP,CACzB,CANE,CAQV,CAjFC,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 .\n\n/**\n * This module is responsible for handle calendar day and upcoming view.\n *\n * @module core_calendar/calendar\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core_calendar/view_manager',\n 'core_calendar/repository',\n 'core/modal_factory',\n 'core_calendar/modal_event_form',\n 'core/modal_events',\n 'core_calendar/crud'\n ],\n function(\n $,\n Str,\n Notification,\n CalendarSelectors,\n CalendarEvents,\n CalendarViewManager,\n CalendarRepository,\n ModalFactory,\n ModalEventForm,\n ModalEvents,\n CalendarCrud\n ) {\n\n var registerEventListeners = function(root, type) {\n var body = $('body');\n\n CalendarCrud.registerRemove(root);\n\n var reloadFunction = 'reloadCurrent' + type.charAt(0).toUpperCase() + type.slice(1);\n\n body.on(CalendarEvents.created, function() {\n CalendarViewManager[reloadFunction](root);\n });\n body.on(CalendarEvents.deleted, function() {\n CalendarViewManager[reloadFunction](root);\n });\n body.on(CalendarEvents.updated, function() {\n CalendarViewManager[reloadFunction](root);\n });\n\n root.on('change', CalendarSelectors.courseSelector, function() {\n var selectElement = $(this);\n var courseId = selectElement.val();\n CalendarViewManager[reloadFunction](root, courseId, null)\n .then(function() {\n // We need to get the selector again because the content has changed.\n return root.find(CalendarSelectors.courseSelector).val(courseId);\n })\n .then(function() {\n window.history.pushState({}, '', '?view=upcoming&course=' + courseId);\n\n return;\n })\n .fail(Notification.exception);\n });\n\n body.on(CalendarEvents.filterChanged, function(e, data) {\n var daysWithEvent = root.find(CalendarSelectors.eventType[data.type]);\n if (data.hidden == true) {\n daysWithEvent.addClass('hidden');\n } else {\n daysWithEvent.removeClass('hidden');\n }\n });\n\n var eventFormPromise = CalendarCrud.registerEventFormModal(root);\n CalendarCrud.registerEditListeners(root, eventFormPromise);\n };\n\n return {\n init: function(root, type) {\n root = $(root);\n\n CalendarViewManager.init(root, type);\n registerEventListeners(root, type);\n }\n };\n });\n"],"file":"calendar_view.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/calendar_view.js"],"names":["define","$","Str","Notification","CalendarSelectors","CalendarEvents","CalendarViewManager","CalendarRepository","ModalFactory","ModalEventForm","ModalEvents","CalendarCrud","registerEventListeners","root","type","body","registerRemove","reloadFunction","charAt","toUpperCase","slice","on","created","deleted","updated","courseSelector","selectElement","courseId","val","then","find","window","history","pushState","fail","exception","filterChanged","e","data","daysWithEvent","eventType","hidden","addClass","removeClass","eventFormPromise","registerEventFormModal","registerEditListeners","init"],"mappings":"AAsBAA,OAAM,+BAAC,CACC,QADD,CAEC,UAFD,CAGC,mBAHD,CAIC,yBAJD,CAKC,sBALD,CAMC,4BAND,CAOC,0BAPD,CAQC,oBARD,CASC,gCATD,CAUC,mBAVD,CAWC,oBAXD,CAAD,CAaF,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,CAEE,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAeC,CAAf,CAAqB,CAC9C,GAAIC,CAA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+B,aAAvB,CAAsC,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CACpD,GAAIC,CAAAA,CAAa,CAAG1B,CAAI,CAACiB,IAAL,CAAU1B,CAAiB,CAACoC,SAAlB,CAA4BF,CAAI,CAACxB,IAAjC,CAAV,CAApB,CACA,GAAI,IAAAwB,CAAI,CAACG,MAAT,CAAyB,CACrBF,CAAa,CAACG,QAAd,CAAuB,QAAvB,CACH,CAFD,IAEO,CACHH,CAAa,CAACI,WAAd,CAA0B,QAA1B,CACH,CACJ,CAPD,EASA,GAAIC,CAAAA,CAAgB,CAAGjC,CAAY,CAACkC,sBAAb,CAAoChC,CAApC,CAAvB,CACAF,CAAY,CAACmC,qBAAb,CAAmCjC,CAAnC,CAAyC+B,CAAzC,CACH,CA5CD,CA8CA,MAAO,CACHG,IAAI,CAAE,cAASlC,CAAT,CAAeC,CAAf,CAAqB,CACvBD,CAAI,CAAGZ,CAAC,CAACY,CAAD,CAAR,CAEAP,CAAmB,CAACyC,IAApB,CAAyBlC,CAAzB,CAA+BC,CAA/B,EACAF,CAAsB,CAACC,CAAD,CAAOC,CAAP,CACzB,CANE,CAQV,CAjFC,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 .\n\n/**\n * This module is responsible for handle calendar day and upcoming view.\n *\n * @module core_calendar/calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core_calendar/selectors',\n 'core_calendar/events',\n 'core_calendar/view_manager',\n 'core_calendar/repository',\n 'core/modal_factory',\n 'core_calendar/modal_event_form',\n 'core/modal_events',\n 'core_calendar/crud'\n ],\n function(\n $,\n Str,\n Notification,\n CalendarSelectors,\n CalendarEvents,\n CalendarViewManager,\n CalendarRepository,\n ModalFactory,\n ModalEventForm,\n ModalEvents,\n CalendarCrud\n ) {\n\n var registerEventListeners = function(root, type) {\n var body = $('body');\n\n CalendarCrud.registerRemove(root);\n\n var reloadFunction = 'reloadCurrent' + type.charAt(0).toUpperCase() + type.slice(1);\n\n body.on(CalendarEvents.created, function() {\n CalendarViewManager[reloadFunction](root);\n });\n body.on(CalendarEvents.deleted, function() {\n CalendarViewManager[reloadFunction](root);\n });\n body.on(CalendarEvents.updated, function() {\n CalendarViewManager[reloadFunction](root);\n });\n\n root.on('change', CalendarSelectors.courseSelector, function() {\n var selectElement = $(this);\n var courseId = selectElement.val();\n CalendarViewManager[reloadFunction](root, courseId, null)\n .then(function() {\n // We need to get the selector again because the content has changed.\n return root.find(CalendarSelectors.courseSelector).val(courseId);\n })\n .then(function() {\n window.history.pushState({}, '', '?view=upcoming&course=' + courseId);\n\n return;\n })\n .fail(Notification.exception);\n });\n\n body.on(CalendarEvents.filterChanged, function(e, data) {\n var daysWithEvent = root.find(CalendarSelectors.eventType[data.type]);\n if (data.hidden == true) {\n daysWithEvent.addClass('hidden');\n } else {\n daysWithEvent.removeClass('hidden');\n }\n });\n\n var eventFormPromise = CalendarCrud.registerEventFormModal(root);\n CalendarCrud.registerEditListeners(root, eventFormPromise);\n };\n\n return {\n init: function(root, type) {\n root = $(root);\n\n CalendarViewManager.init(root, type);\n registerEventListeners(root, type);\n }\n };\n });\n"],"file":"calendar_view.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/crud.min.js.map b/calendar/amd/build/crud.min.js.map
index ff9457017cd..e9c3d90b0b8 100644
--- a/calendar/amd/build/crud.min.js.map
+++ b/calendar/amd/build/crud.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/crud.js"],"names":["define","$","Str","Notification","CustomEvents","Modal","ModalRegistry","ModalFactory","ModalEvents","ModalEventForm","CalendarRepository","CalendarEvents","ModalDelete","CalendarSelectors","Pending","confirmDeletion","eventId","eventTitle","eventCount","pendingPromise","deleteStrings","key","component","parseInt","deletePromise","isRepeatedEvent","push","param","name","count","create","type","TYPE","types","SAVE_CANCEL","stringsPromise","get_strings","finalPromise","when","then","strings","deleteModal","setRemoveOnClose","setTitle","setBody","setSaveButtonText","show","getRoot","on","save","deleteEvent","trigger","deleted","resolve","catch","exception","deleteAll","modal","registerRemove","root","actions","remove","e","eventSource","closest","eventItem","data","preventDefault","registerEditListeners","eventFormModalPromise","editEvent","calendarWrapper","find","wrapper","setEventId","setContextId","stopImmediatePropagation","registerEventFormModal","eventFormPromise","large","categoryId","setCategoryId","today","firstDay","day","length","setStartTime","setCourseId","fail","edit","target","currentTarget","eventWrapper"],"mappings":"AAuBAA,OAAM,sBAAC,CACH,QADG,CAEH,UAFG,CAGH,mBAHG,CAIH,gCAJG,CAKH,YALG,CAMH,qBANG,CAOH,oBAPG,CAQH,mBARG,CASH,gCATG,CAUH,0BAVG,CAWH,sBAXG,CAYH,4BAZG,CAaH,yBAbG,CAcH,cAdG,CAAD,CAgBN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYIC,CAZJ,CAaIC,CAbJ,CAcIC,CAdJ,CAeE,CAUE,QAASC,CAAAA,CAAT,CAAyBC,CAAzB,CAAkCC,CAAlC,CAA8CC,CAA9C,CAA0D,IAClDC,CAAAA,CAAc,CAAG,GAAIL,CAAAA,CAAJ,CAAY,oCAAZ,CADiC,CAElDM,CAAa,CAAG,CAChB,CACIC,GAAG,CAAE,aADT,CAEIC,SAAS,CAAE,UAFf,CADgB,CAFkC,CAStDJ,CAAU,CAAGK,Q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AY,CACzDA,CAAC,CAACK,cAAF,GACA,GAAIuB,CAAAA,CAAM,CAAGzF,CAAC,CAAC6D,CAAC,CAAC6B,aAAH,CAAd,CACIpB,CAAe,CAAGmB,CAAM,CAAC1B,OAAP,CAAenD,CAAiB,CAAC4D,OAAjC,CADtB,CAEImB,CAAY,CAAGF,CAAM,CAAC1B,OAAP,CAAenD,CAAiB,CAACoD,SAAjC,CAFnB,CAIAa,CAAgB,CAACvC,IAAjB,CAAsB,SAASkB,CAAT,CAAgB,CAGlCA,CAAK,CAACiB,UAAN,CAAiBkB,CAAY,CAAC1B,IAAb,CAAkB,SAAlB,CAAjB,EAEAT,CAAK,CAACkB,YAAN,CAAmBJ,CAAe,CAACL,IAAhB,CAAqB,WAArB,CAAnB,EACAT,CAAK,CAACX,IAAN,GAEAgB,CAAC,CAACc,wBAAF,EAEH,CAVD,EAUGY,IAVH,CAUQrF,CAAY,CAACoD,SAVrB,CAWH,CAjBD,EAoBA,MAAOuB,CAAAA,CACV,CAmDM,CAKV,CAvPK,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 .\n\n/**\n * A module to handle CRUD operations within the UI.\n *\n * @module core_calendar/crud\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_registry',\n 'core/modal_factory',\n 'core/modal_events',\n 'core_calendar/modal_event_form',\n 'core_calendar/repository',\n 'core_calendar/events',\n 'core_calendar/modal_delete',\n 'core_calendar/selectors',\n 'core/pending',\n],\nfunction(\n $,\n Str,\n Notification,\n CustomEvents,\n Modal,\n ModalRegistry,\n ModalFactory,\n ModalEvents,\n ModalEventForm,\n CalendarRepository,\n CalendarEvents,\n ModalDelete,\n CalendarSelectors,\n Pending\n) {\n\n /**\n * Prepares the action for the summary modal's delete action.\n *\n * @param {Number} eventId The ID of the event.\n * @param {string} eventTitle The event title.\n * @param {Number} eventCount The number of events in the series.\n * @return {Promise}\n */\n function confirmDeletion(eventId, eventTitle, eventCount) {\n var pendingPromise = new Pending('core_calendar/crud:confirmDeletion');\n var deleteStrings = [\n {\n key: 'deleteevent',\n component: 'calendar'\n },\n ];\n\n eventCount = parseInt(eventCount, 10);\n var deletePromise;\n var isRepeatedEvent = eventCount > 1;\n if (isRepeatedEvent) {\n deleteStrings.push({\n key: 'confirmeventseriesdelete',\n component: 'calendar',\n param: {\n name: eventTitle,\n count: eventCount,\n },\n });\n\n deletePromise = ModalFactory.create(\n {\n type: ModalDelete.TYPE\n }\n );\n } else {\n deleteStrings.push({\n key: 'confirmeventdelete',\n component: 'calendar',\n param: eventTitle\n });\n\n\n deletePromise = ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n });\n }\n\n var stringsPromise = Str.get_strings(deleteStrings);\n\n var finalPromise = $.when(stringsPromise, deletePromise)\n .then(function(strings, deleteModal) {\n deleteModal.setRemoveOnClose(true);\n deleteModal.setTitle(strings[0]);\n deleteModal.setBody(strings[1]);\n if (!isRepeatedEvent) {\n deleteModal.setSaveButtonText(strings[0]);\n }\n\n deleteModal.show();\n\n deleteModal.getRoot().on(ModalEvents.save, function() {\n var pendingPromise = new Pending('calendar/crud:initModal:deletedevent');\n CalendarRepository.deleteEvent(eventId, false)\n .then(function() {\n $('body').trigger(CalendarEvents.deleted, [eventId, false]);\n return;\n })\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n });\n\n deleteModal.getRoot().on(CalendarEvents.deleteAll, function() {\n var pendingPromise = new Pending('calendar/crud:initModal:deletedallevent');\n CalendarRepository.deleteEvent(eventId, true)\n .then(function() {\n $('body').trigger(CalendarEvents.deleted, [eventId, true]);\n return;\n })\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n });\n\n return deleteModal;\n })\n .then(function(modal) {\n pendingPromise.resolve();\n\n return modal;\n })\n .catch(Notification.exception);\n\n return finalPromise;\n }\n\n /**\n * Create the event form modal for creating new events and\n * editing existing events.\n *\n * @method registerEventFormModal\n * @param {object} root The calendar root element\n * @return {object} The create modal promise\n */\n var registerEventFormModal = function(root) {\n var eventFormPromise = ModalFactory.create({\n type: ModalEventForm.TYPE,\n large: true\n });\n\n // Bind click event on the new event button.\n root.on('click', CalendarSelectors.actions.create, function(e) {\n eventFormPromise.then(function(modal) {\n var wrapper = root.find(CalendarSelectors.wrapper);\n\n var categoryId = wrapper.data('categoryid');\n if (typeof categoryId !== 'undefined') {\n modal.setCategoryId(categoryId);\n }\n\n // Attempt to find the cell for today.\n // If it can't be found, then use the start time of the first day on the calendar.\n var today = root.find(CalendarSelectors.today);\n var firstDay = root.find(CalendarSelectors.day);\n if (!today.length && firstDay.length) {\n modal.setStartTime(firstDay.data('newEventTimestamp'));\n }\n\n modal.setContextId(wrapper.data('contextId'));\n modal.setCourseId(wrapper.data('courseid'));\n modal.show();\n return;\n })\n .fail(Notification.exception);\n\n e.preventDefault();\n });\n\n root.on('click', CalendarSelectors.actions.edit, function(e) {\n e.preventDefault();\n var target = $(e.currentTarget),\n calendarWrapper = target.closest(CalendarSelectors.wrapper),\n eventWrapper = target.closest(CalendarSelectors.eventItem);\n\n eventFormPromise.then(function(modal) {\n // When something within the calendar tells us the user wants\n // to edit an event then show the event form modal.\n modal.setEventId(eventWrapper.data('eventId'));\n\n modal.setContextId(calendarWrapper.data('contextId'));\n modal.show();\n\n e.stopImmediatePropagation();\n return;\n }).fail(Notification.exception);\n });\n\n\n return eventFormPromise;\n };\n /**\n * Register the listeners required to remove the event.\n *\n * @param {jQuery} root\n */\n function registerRemove(root) {\n root.on('click', CalendarSelectors.actions.remove, function(e) {\n // Fetch the event title, count, and pass them into the new dialogue.\n var eventSource = $(this).closest(CalendarSelectors.eventItem);\n var eventId = eventSource.data('eventId'),\n eventTitle = eventSource.data('eventTitle'),\n eventCount = eventSource.data('eventCount');\n confirmDeletion(eventId, eventTitle, eventCount);\n\n e.preventDefault();\n });\n }\n\n /**\n * Register the listeners required to edit the event.\n *\n * @param {jQuery} root\n * @param {Promise} eventFormModalPromise\n * @returns {Promise}\n */\n function registerEditListeners(root, eventFormModalPromise) {\n var pendingPromise = new Pending('core_calendar/crud:registerEditListeners');\n\n return eventFormModalPromise\n .then(function(modal) {\n // When something within the calendar tells us the user wants\n // to edit an event then show the event form modal.\n $('body').on(CalendarEvents.editEvent, function(e, eventId) {\n var calendarWrapper = root.find(CalendarSelectors.wrapper);\n modal.setEventId(eventId);\n modal.setContextId(calendarWrapper.data('contextId'));\n modal.show();\n\n e.stopImmediatePropagation();\n });\n return modal;\n })\n .then(function(modal) {\n pendingPromise.resolve();\n\n return modal;\n })\n .catch(Notification.exception);\n }\n\n return {\n registerRemove: registerRemove,\n registerEditListeners: registerEditListeners,\n registerEventFormModal: registerEventFormModal\n };\n});\n"],"file":"crud.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/crud.js"],"names":["define","$","Str","Notification","CustomEvents","Modal","ModalRegistry","ModalFactory","ModalEvents","ModalEventForm","CalendarRepository","CalendarEvents","ModalDelete","CalendarSelectors","Pending","confirmDeletion","eventId","eventTitle","eventCount","pendingPromise","deleteStrings","key","component","parseInt","deletePromise","isRepeatedEvent","push","param","name","count","create","type","TYPE","types","SAVE_CANCEL","stringsPromise","get_strings","finalPromise","when","then","strings","deleteModal","setRemoveOnClose","setTitle","setBody","setSaveButtonText","show","getRoot","on","save","deleteEvent","trigger","deleted","resolve","catch","exception","deleteAll","modal","registerRemove","root","actions","remove","e","eventSource","closest","eventItem","data","preventDefault","registerEditListeners","eventFormModalPromise","editEvent","calendarWrapper","find","wrapper","setEventId","setContextId","stopImmediatePropagation","registerEventFormModal","eventFormPromise","large","categoryId","setCategoryId","today","firstDay","day","length","setStartTime","setCourseId","fail","edit","target","currentTarget","eventWrapper"],"mappings":"AAsBAA,OAAM,sBAAC,CACH,QADG,CAEH,UAFG,CAGH,mBAHG,CAIH,gCAJG,CAKH,YALG,CAMH,qBANG,CAOH,oBAPG,CAQH,mBARG,CASH,gCATG,CAUH,0BAVG,CAWH,sBAXG,CAYH,4BAZG,CAaH,yBAbG,CAcH,cAdG,CAAD,CAgBN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYIC,CAZJ,CAaIC,CAbJ,CAcIC,CAdJ,CAeE,CAUE,QAASC,CAAAA,CAAT,CAAyBC,CAAzB,CAAkCC,CAAlC,CAA8CC,CAA9C,CAA0D,IAClDC,CAAAA,CAAc,CAAG,GAAIL,CAAAA,CAAJ,CAAY,oCAAZ,CADiC,CAElDM,CAAa,CAAG,CAChB,CACIC,GAAG,CAAE,aADT,CAEIC,SAAS,CAAE,UAFf,CADgB,CAFkC,CAStDJ,CAAU,CAAGK,QAAQ,CAACL,CAAD,CAAa,EAAb,CAArB,CATsD,GAUlDM,CAAAA,CAVkD,CAWlDC,CAAe,CAAgB,CAAb,CAAAP,CAXgC,CAYtD,GAAIO,CAAJ,CAAqB,CACjBL,CAAa,CAACM,IAAd,CAAmB,CACfL,GAAG,CAAE,0BADU,CAEfC,SAAS,CAAE,UAFI,CAGfK,KAAK,CAAE,CACHC,IAAI,CAAEX,CADH,CAEHY,KAAK,CAAEX,CAFJ,CAHQ,CAAnB,EASAM,CAAa,CAAGjB,CAAY,CAACuB,MAAb,CACZ,CACIC,IAAI,CAAEnB,CAAW,CAACoB,IADtB,CADY,CAKn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EAT,CAAK,CAACkB,YAAN,CAAmBJ,CAAe,CAACL,IAAhB,CAAqB,WAArB,CAAnB,EACAT,CAAK,CAACX,IAAN,GAEAgB,CAAC,CAACc,wBAAF,EAEH,CAVD,EAUGY,IAVH,CAUQrF,CAAY,CAACoD,SAVrB,CAWH,CAjBD,EAoBA,MAAOuB,CAAAA,CACV,CAmDM,CAKV,CAvPK,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 .\n\n/**\n * A module to handle CRUD operations within the UI.\n *\n * @module core_calendar/crud\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_registry',\n 'core/modal_factory',\n 'core/modal_events',\n 'core_calendar/modal_event_form',\n 'core_calendar/repository',\n 'core_calendar/events',\n 'core_calendar/modal_delete',\n 'core_calendar/selectors',\n 'core/pending',\n],\nfunction(\n $,\n Str,\n Notification,\n CustomEvents,\n Modal,\n ModalRegistry,\n ModalFactory,\n ModalEvents,\n ModalEventForm,\n CalendarRepository,\n CalendarEvents,\n ModalDelete,\n CalendarSelectors,\n Pending\n) {\n\n /**\n * Prepares the action for the summary modal's delete action.\n *\n * @param {Number} eventId The ID of the event.\n * @param {string} eventTitle The event title.\n * @param {Number} eventCount The number of events in the series.\n * @return {Promise}\n */\n function confirmDeletion(eventId, eventTitle, eventCount) {\n var pendingPromise = new Pending('core_calendar/crud:confirmDeletion');\n var deleteStrings = [\n {\n key: 'deleteevent',\n component: 'calendar'\n },\n ];\n\n eventCount = parseInt(eventCount, 10);\n var deletePromise;\n var isRepeatedEvent = eventCount > 1;\n if (isRepeatedEvent) {\n deleteStrings.push({\n key: 'confirmeventseriesdelete',\n component: 'calendar',\n param: {\n name: eventTitle,\n count: eventCount,\n },\n });\n\n deletePromise = ModalFactory.create(\n {\n type: ModalDelete.TYPE\n }\n );\n } else {\n deleteStrings.push({\n key: 'confirmeventdelete',\n component: 'calendar',\n param: eventTitle\n });\n\n\n deletePromise = ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n });\n }\n\n var stringsPromise = Str.get_strings(deleteStrings);\n\n var finalPromise = $.when(stringsPromise, deletePromise)\n .then(function(strings, deleteModal) {\n deleteModal.setRemoveOnClose(true);\n deleteModal.setTitle(strings[0]);\n deleteModal.setBody(strings[1]);\n if (!isRepeatedEvent) {\n deleteModal.setSaveButtonText(strings[0]);\n }\n\n deleteModal.show();\n\n deleteModal.getRoot().on(ModalEvents.save, function() {\n var pendingPromise = new Pending('calendar/crud:initModal:deletedevent');\n CalendarRepository.deleteEvent(eventId, false)\n .then(function() {\n $('body').trigger(CalendarEvents.deleted, [eventId, false]);\n return;\n })\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n });\n\n deleteModal.getRoot().on(CalendarEvents.deleteAll, function() {\n var pendingPromise = new Pending('calendar/crud:initModal:deletedallevent');\n CalendarRepository.deleteEvent(eventId, true)\n .then(function() {\n $('body').trigger(CalendarEvents.deleted, [eventId, true]);\n return;\n })\n .then(pendingPromise.resolve)\n .catch(Notification.exception);\n });\n\n return deleteModal;\n })\n .then(function(modal) {\n pendingPromise.resolve();\n\n return modal;\n })\n .catch(Notification.exception);\n\n return finalPromise;\n }\n\n /**\n * Create the event form modal for creating new events and\n * editing existing events.\n *\n * @method registerEventFormModal\n * @param {object} root The calendar root element\n * @return {object} The create modal promise\n */\n var registerEventFormModal = function(root) {\n var eventFormPromise = ModalFactory.create({\n type: ModalEventForm.TYPE,\n large: true\n });\n\n // Bind click event on the new event button.\n root.on('click', CalendarSelectors.actions.create, function(e) {\n eventFormPromise.then(function(modal) {\n var wrapper = root.find(CalendarSelectors.wrapper);\n\n var categoryId = wrapper.data('categoryid');\n if (typeof categoryId !== 'undefined') {\n modal.setCategoryId(categoryId);\n }\n\n // Attempt to find the cell for today.\n // If it can't be found, then use the start time of the first day on the calendar.\n var today = root.find(CalendarSelectors.today);\n var firstDay = root.find(CalendarSelectors.day);\n if (!today.length && firstDay.length) {\n modal.setStartTime(firstDay.data('newEventTimestamp'));\n }\n\n modal.setContextId(wrapper.data('contextId'));\n modal.setCourseId(wrapper.data('courseid'));\n modal.show();\n return;\n })\n .fail(Notification.exception);\n\n e.preventDefault();\n });\n\n root.on('click', CalendarSelectors.actions.edit, function(e) {\n e.preventDefault();\n var target = $(e.currentTarget),\n calendarWrapper = target.closest(CalendarSelectors.wrapper),\n eventWrapper = target.closest(CalendarSelectors.eventItem);\n\n eventFormPromise.then(function(modal) {\n // When something within the calendar tells us the user wants\n // to edit an event then show the event form modal.\n modal.setEventId(eventWrapper.data('eventId'));\n\n modal.setContextId(calendarWrapper.data('contextId'));\n modal.show();\n\n e.stopImmediatePropagation();\n return;\n }).fail(Notification.exception);\n });\n\n\n return eventFormPromise;\n };\n /**\n * Register the listeners required to remove the event.\n *\n * @param {jQuery} root\n */\n function registerRemove(root) {\n root.on('click', CalendarSelectors.actions.remove, function(e) {\n // Fetch the event title, count, and pass them into the new dialogue.\n var eventSource = $(this).closest(CalendarSelectors.eventItem);\n var eventId = eventSource.data('eventId'),\n eventTitle = eventSource.data('eventTitle'),\n eventCount = eventSource.data('eventCount');\n confirmDeletion(eventId, eventTitle, eventCount);\n\n e.preventDefault();\n });\n }\n\n /**\n * Register the listeners required to edit the event.\n *\n * @param {jQuery} root\n * @param {Promise} eventFormModalPromise\n * @returns {Promise}\n */\n function registerEditListeners(root, eventFormModalPromise) {\n var pendingPromise = new Pending('core_calendar/crud:registerEditListeners');\n\n return eventFormModalPromise\n .then(function(modal) {\n // When something within the calendar tells us the user wants\n // to edit an event then show the event form modal.\n $('body').on(CalendarEvents.editEvent, function(e, eventId) {\n var calendarWrapper = root.find(CalendarSelectors.wrapper);\n modal.setEventId(eventId);\n modal.setContextId(calendarWrapper.data('contextId'));\n modal.show();\n\n e.stopImmediatePropagation();\n });\n return modal;\n })\n .then(function(modal) {\n pendingPromise.resolve();\n\n return modal;\n })\n .catch(Notification.exception);\n }\n\n return {\n registerRemove: registerRemove,\n registerEditListeners: registerEditListeners,\n registerEventFormModal: registerEventFormModal\n };\n});\n"],"file":"crud.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/drag_drop_data_store.min.js.map b/calendar/amd/build/drag_drop_data_store.min.js.map
index 82ff858c249..9a339242cbb 100644
--- a/calendar/amd/build/drag_drop_data_store.min.js.map
+++ b/calendar/amd/build/drag_drop_data_store.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/drag_drop_data_store.js"],"names":["define","eventId","durationDays","minTimestart","maxTimestart","minError","maxError","setEventId","id","getEventId","hasEventId","setDurationDays","days","getDurationDays","setMinTimestart","timestamp","getMinTimestart","hasMinTimestart","setMaxTimestart","getMaxTimestart","hasMaxTimestart","setMinError","message","getMinError","setMaxError","getMaxError","clearAll"],"mappings":"AA2BAA,OAAM,sCAAC,EAAD,CAAK,UAAW,IAEdC,CAAAA,CAAO,CAAG,IAFI,CAIdC,CAAY,CAAG,IAJD,CAMdC,CAAY,CAAG,IAND,CAQdC,CAAY,CAAG,IARD,CAUdC,CAAQ,CAAG,IAVG,CAYdC,CAAQ,CAAG,IAZG,CAmBdC,CAAU,CAAG,SAASC,CAAT,CAAa,CAC1BP,CAAO,CAAGO,CACb,CArBiB,CA4BdC,CAAU,CAAG,UAAW,CACxB,MAAOR,CAAAA,CACV,CA9BiB,CAqCdS,CAAU,CAAG,UAAW,CACxB,MAAmB,KAAZ,GAAAT,CACV,CAvCiB,CA8CdU,CAAe,CAAG,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XA,CAAAA,QAAW,EAAW,CACtBnB,CAAU,CAAC,IAAD,CAAV,CACAI,CAAe,CAAC,IAAD,CAAf,CACAG,CAAe,CAAC,IAAD,CAAf,CACAI,CAAe,CAAC,IAAD,CAAf,CACAG,CAAW,CAAC,IAAD,CAAX,CACAG,CAAW,CAAC,IAAD,CACd,CAEM,CAkBV,CArLK,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 .\n\n/**\n * A javascript module to store calendar drag and drop data.\n *\n * This module is unfortunately required because of the limitations\n * of the HTML5 drag and drop API and it's ability to provide data\n * between the different stages of the drag/drop lifecycle.\n *\n * @module core_calendar/drag_drop_data_store\n * @package core_calendar\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n /* @var {int|null} eventId The id of the event being dragged */\n var eventId = null;\n /* @var {int|null} durationDays How many days the event spans */\n var durationDays = null;\n /* @var {int|null} minTimestart The earliest valid timestart */\n var minTimestart = null;\n /* @var {int|null} maxTimestart The latest valid tiemstart */\n var maxTimestart = null;\n /* @var {string|null} minError Error message for min timestamp violation */\n var minError = null;\n /* @var {string|null} maxError Error message for max timestamp violation */\n var maxError = null;\n\n /**\n * Store the id of the event being dragged.\n *\n * @param {int} id The event id\n */\n var setEventId = function(id) {\n eventId = id;\n };\n\n /**\n * Get the stored event id.\n *\n * @return {int|null}\n */\n var getEventId = function() {\n return eventId;\n };\n\n /**\n * Check if the store has an event id.\n *\n * @return {bool}\n */\n var hasEventId = function() {\n return eventId !== null;\n };\n\n /**\n * Store the duration (in days) of the event being dragged.\n *\n * @param {int} days Number of days the event spans\n */\n var setDurationDays = function(days) {\n durationDays = days;\n };\n\n /**\n * Get the stored number of days.\n *\n * @return {int|null}\n */\n var getDurationDays = function() {\n return durationDays;\n };\n\n /**\n * Store the minimum timestart valid for an event being dragged.\n *\n * @param {int} timestamp The unix timstamp\n */\n var setMinTimestart = function(timestamp) {\n minTimestart = timestamp;\n };\n\n /**\n * Get the minimum valid timestart.\n *\n * @return {int|null}\n */\n var getMinTimestart = function() {\n return minTimestart;\n };\n\n /**\n * Check if a minimum timestamp is set.\n *\n * @return {bool}\n */\n var hasMinTimestart = function() {\n return minTimestart !== null;\n };\n\n /**\n * Store the maximum timestart valid for an event being dragged.\n *\n * @param {int} timestamp The unix timstamp\n */\n var setMaxTimestart = function(timestamp) {\n maxTimestart = timestamp;\n };\n\n /**\n * Get the maximum valid timestart.\n *\n * @return {int|null}\n */\n var getMaxTimestart = function() {\n return maxTimestart;\n };\n\n /**\n * Check if a maximum timestamp is set.\n *\n * @return {bool}\n */\n var hasMaxTimestart = function() {\n return maxTimestart !== null;\n };\n\n /**\n * Store the error string to display if trying to drag an event\n * earlier than the minimum allowed date.\n *\n * @param {string} message The error message\n */\n var setMinError = function(message) {\n minError = message;\n };\n\n /**\n * Get the error message for a minimum time start violation.\n *\n * @return {string|null}\n */\n var getMinError = function() {\n return minError;\n };\n\n /**\n * Store the error string to display if trying to drag an event\n * later than the maximum allowed date.\n *\n * @param {string} message The error message\n */\n var setMaxError = function(message) {\n maxError = message;\n };\n\n /**\n * Get the error message for a maximum time start violation.\n *\n * @return {string|null}\n */\n var getMaxError = function() {\n return maxError;\n };\n\n /**\n * Reset all of the stored values.\n */\n var clearAll = function() {\n setEventId(null);\n setDurationDays(null);\n setMinTimestart(null);\n setMaxTimestart(null);\n setMinError(null);\n setMaxError(null);\n };\n\n return {\n setEventId: setEventId,\n getEventId: getEventId,\n hasEventId: hasEventId,\n setDurationDays: setDurationDays,\n getDurationDays: getDurationDays,\n setMinTimestart: setMinTimestart,\n getMinTimestart: getMinTimestart,\n hasMinTimestart: hasMinTimestart,\n setMaxTimestart: setMaxTimestart,\n getMaxTimestart: getMaxTimestart,\n hasMaxTimestart: hasMaxTimestart,\n setMinError: setMinError,\n getMinError: getMinError,\n setMaxError: setMaxError,\n getMaxError: getMaxError,\n clearAll: clearAll\n };\n});\n"],"file":"drag_drop_data_store.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/drag_drop_data_store.js"],"names":["define","eventId","durationDays","minTimestart","maxTimestart","minError","maxError","setEventId","id","getEventId","hasEventId","setDurationDays","days","getDurationDays","setMinTimestart","timestamp","getMinTimestart","hasMinTimestart","setMaxTimestart","getMaxTimestart","hasMaxTimestart","setMinError","message","getMinError","setMaxError","getMaxError","clearAll"],"mappings":"AA0BAA,OAAM,sCAAC,EAAD,CAAK,UAAW,IAEdC,CAAAA,CAAO,CAAG,IAFI,CAIdC,CAAY,CAAG,IAJD,CAMdC,CAAY,CAAG,IAND,CAQdC,CAAY,CAAG,IARD,CAUdC,CAAQ,CAAG,IAVG,CAYdC,CAAQ,CAAG,IAZG,CAmBdC,CAAU,CAAG,SAASC,CAAT,CAAa,CAC1BP,CAAO,CAAGO,CACb,CArBiB,CA4BdC,CAAU,CAAG,UAAW,CACxB,MAAOR,CAAAA,CACV,CA9BiB,CAqCdS,CAAU,CAAG,UAAW,CACxB,MAAmB,KAAZ,GAAAT,CACV,CAvCiB,CA8CdU,CAAe,CAAG,SAASC,CAAT,CAAe,CACjCV,CAAY,CAAGU,CAClB,CAhDiB,CAuDdC,CAAe,CAAG,UAAW,CAC7B,MAAOX,CAAAA,CACV,CAzDiB,CAgEdY,CAAe,CAAG,SAASC,CAAT,CAAoB,CACtCZ,CAAY,CAAGY,CAClB,CAlEiB,CAyEdC,CAAe,CAAG,UAAW,CAC7B,MAAOb,CAAAA,CACV,CA3EiB,CAkFdc,CAAe,CAAG,UAAW,CAC7B,MAAwB,KAAjB,GAAAd,CACV,CApFiB,CA2Fde,CAAe,CAAG,SAASH,CAAT,CAAoB,CACtCX,CAAY,CAAGW,CAClB,CA7FiB,CAoGdI,CAAe,CAAG,UAAW,CAC7B,MAAOf,CAAAA,CACV,CAtGiB,CA6GdgB,CAAe,CAAG,UAAW,CAC7B,MAAwB,KAAjB,GAAAhB,CACV,CA/GiB,CAuHdiB,CAAW,CAAG,SAASC,CAAT,CAAkB,CAChCjB,CAAQ,CAAGiB,CACd,CAzHiB,CAgIdC,CAAW,CAAG,UAAW,CACzB,MAAOlB,CAAAA,CACV,CAlIiB,CA0IdmB,CAAW,CAAG,SAASF,CAAT,CAAkB,CAChChB,CAAQ,CAAGgB,CACd,CA5IiB,CAmJdG,CAAW,CAAG,UAAW,CACzB,MAAOnB,CAAAA,CACV,CArJiB,CAmKlB,MAAO,CACHC,UAAU,CAAEA,CADT,CAEHE,UAAU,CAAEA,CAFT,CAGHC,UAAU,CAAEA,CAHT,CAIHC,eAAe,CAAEA,CAJd,CAKHE,eAAe,CAAEA,CALd,CAMHC,eAAe,CAAEA,CANd,CAOHE,eAAe,CAAEA,CAPd,CAQHC,eAAe,CAAEA,CARd,CASHC,eAAe,CAAEA,CATd,CAUHC,eAAe,CAAEA,CAVd,CAWHC,eAAe,CAAEA,CAXd,CAYHC,WAAW,CAAEA,CAZV,CAaHE,WAAW,CAAEA,CAbV,CAcHC,WAAW,CAAEA,CAdV,CAeHC,WAAW,CAAEA,CAfV,CAgBHC,QAAQ,CAzBG,QAAXA,CAAAA,QAAW,EAAW,CACtBnB,CAAU,CAAC,IAAD,CAAV,CACAI,CAAe,CAAC,IAAD,CAAf,CACAG,CAAe,CAAC,IAAD,CAAf,CACAI,CAAe,CAAC,IAAD,CAAf,CACAG,CAAW,CAAC,IAAD,CAAX,CACAG,CAAW,CAAC,IAAD,CACd,CAEM,CAkBV,CArLK,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 .\n\n/**\n * A javascript module to store calendar drag and drop data.\n *\n * This module is unfortunately required because of the limitations\n * of the HTML5 drag and drop API and it's ability to provide data\n * between the different stages of the drag/drop lifecycle.\n *\n * @module core_calendar/drag_drop_data_store\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n /* @var {int|null} eventId The id of the event being dragged */\n var eventId = null;\n /* @var {int|null} durationDays How many days the event spans */\n var durationDays = null;\n /* @var {int|null} minTimestart The earliest valid timestart */\n var minTimestart = null;\n /* @var {int|null} maxTimestart The latest valid tiemstart */\n var maxTimestart = null;\n /* @var {string|null} minError Error message for min timestamp violation */\n var minError = null;\n /* @var {string|null} maxError Error message for max timestamp violation */\n var maxError = null;\n\n /**\n * Store the id of the event being dragged.\n *\n * @param {int} id The event id\n */\n var setEventId = function(id) {\n eventId = id;\n };\n\n /**\n * Get the stored event id.\n *\n * @return {int|null}\n */\n var getEventId = function() {\n return eventId;\n };\n\n /**\n * Check if the store has an event id.\n *\n * @return {bool}\n */\n var hasEventId = function() {\n return eventId !== null;\n };\n\n /**\n * Store the duration (in days) of the event being dragged.\n *\n * @param {int} days Number of days the event spans\n */\n var setDurationDays = function(days) {\n durationDays = days;\n };\n\n /**\n * Get the stored number of days.\n *\n * @return {int|null}\n */\n var getDurationDays = function() {\n return durationDays;\n };\n\n /**\n * Store the minimum timestart valid for an event being dragged.\n *\n * @param {int} timestamp The unix timstamp\n */\n var setMinTimestart = function(timestamp) {\n minTimestart = timestamp;\n };\n\n /**\n * Get the minimum valid timestart.\n *\n * @return {int|null}\n */\n var getMinTimestart = function() {\n return minTimestart;\n };\n\n /**\n * Check if a minimum timestamp is set.\n *\n * @return {bool}\n */\n var hasMinTimestart = function() {\n return minTimestart !== null;\n };\n\n /**\n * Store the maximum timestart valid for an event being dragged.\n *\n * @param {int} timestamp The unix timstamp\n */\n var setMaxTimestart = function(timestamp) {\n maxTimestart = timestamp;\n };\n\n /**\n * Get the maximum valid timestart.\n *\n * @return {int|null}\n */\n var getMaxTimestart = function() {\n return maxTimestart;\n };\n\n /**\n * Check if a maximum timestamp is set.\n *\n * @return {bool}\n */\n var hasMaxTimestart = function() {\n return maxTimestart !== null;\n };\n\n /**\n * Store the error string to display if trying to drag an event\n * earlier than the minimum allowed date.\n *\n * @param {string} message The error message\n */\n var setMinError = function(message) {\n minError = message;\n };\n\n /**\n * Get the error message for a minimum time start violation.\n *\n * @return {string|null}\n */\n var getMinError = function() {\n return minError;\n };\n\n /**\n * Store the error string to display if trying to drag an event\n * later than the maximum allowed date.\n *\n * @param {string} message The error message\n */\n var setMaxError = function(message) {\n maxError = message;\n };\n\n /**\n * Get the error message for a maximum time start violation.\n *\n * @return {string|null}\n */\n var getMaxError = function() {\n return maxError;\n };\n\n /**\n * Reset all of the stored values.\n */\n var clearAll = function() {\n setEventId(null);\n setDurationDays(null);\n setMinTimestart(null);\n setMaxTimestart(null);\n setMinError(null);\n setMaxError(null);\n };\n\n return {\n setEventId: setEventId,\n getEventId: getEventId,\n hasEventId: hasEventId,\n setDurationDays: setDurationDays,\n getDurationDays: getDurationDays,\n setMinTimestart: setMinTimestart,\n getMinTimestart: getMinTimestart,\n hasMinTimestart: hasMinTimestart,\n setMaxTimestart: setMaxTimestart,\n getMaxTimestart: getMaxTimestart,\n hasMaxTimestart: hasMaxTimestart,\n setMinError: setMinError,\n getMinError: getMinError,\n setMaxError: setMaxError,\n getMaxError: getMaxError,\n clearAll: clearAll\n };\n});\n"],"file":"drag_drop_data_store.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/event_form.min.js.map b/calendar/amd/build/event_form.min.js.map
index 32d3877390e..cc0bda06ac3 100644
--- a/calendar/amd/build/event_form.min.js.map
+++ b/calendar/amd/build/event_form.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/event_form.js"],"names":["define","$","CalendarRepository","SELECTORS","EVENT_GROUP_COURSE_ID","EVENT_GROUP_ID","SELECT_OPTION","addCourseGroupSelectListeners","formElement","courseGroupSelect","find","loadGroupSelectOptions","groups","groupSelect","groupSelectOptions","courseGroups","remove","prop","each","id","group","append","attr","text","name","on","courseId","val","getCourseGroupsData","then","catch","Notification","exception","init","formId"],"mappings":"AAuBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,0BAAX,CAAD,CAAyC,SAASC,CAAT,CAAYC,CAAZ,CAAgC,IAEvEC,CAAAA,CAAS,CAAG,CACZC,qBAAqB,CAAE,0BADX,CAEZC,cAAc,CAAE,oBAFJ,CAGZC,aAAa,CAAE,QAHH,CAF2D,CAgBvEC,CAA6B,CAAG,SAASC,CAAT,CAAsB,IAClDC,CAAAA,CAAiB,CAAGD,CAAW,CAACE,IAAZ,CAAiBP,CAAS,CAACC,qBAA3B,CAD8B,CAGlDO,CAAsB,CAAG,SAASC,CAAT,CAAiB,CAC1C,GAAIC,CAAAA,CAAW,CAAGL,CAAW,CAACE,IAAZ,CAAiBP,CAAS,CAACE,cAA3B,CAAlB,CACIS,CAAkB,CAAGD,CAAW,CAACH,IAAZ,CAAiBP,CAAS,CAACG,aAA3B,CADzB,CAEIS,CAAY,CAAGd,CAAC,CAACW,CAAD,CAFpB,CAKAE,CAAkB,CAACE,MAAnB,GACAH,CAAW,CAACI,IAAZ,CAAiB,UAAjB,KACAF,CAAY,CAACG,IAAb,CAAkB,SAASC,CAAT,CAAaC,CAAb,CAAoB,CAClCnB,CAAC,CAACY,CAAD,CAAD,CAAeQ,MAAf,CAAsBpB,CAAC,CAAC,mBAAD,CAAD,CAAuBqB,IAAvB,CAA4B,OAA5B,CAAqCF,CAAK,CAACD,EAA3C,EAA+CI,IAA/C,CAAoDH,CAAK,CAACI,IAA1D,CAAtB,CACH,CAFD,CAGH,CAdqD,CAiBtDf,CAAiB,CAACgB,EAAlB,CAAqB,QAArB,CAA+B,UAAW,CACtC,GAAIC,CAAAA,CAAQ,CAAGlB,CAAW,CAACE,IAAZ,CAAiBP,CAAS,CAACC,qBAA3B,EAAkDuB,GAAlD,EAAf,CACAzB,CAAkB,CAAC0B,mBAAnB,CAAuCF,CAAvC,EACKG,IADL,CACU,SAASjB,CAAT,CAAiB,CACnB,MAAOD,CAAAA,CAAsB,CAACC,CAAD,CAChC,CAHL,EAIKkB,KAJL,CAIWC,YAAY,CAACC,SAJxB,CAKH,CAPD,CAQH,CAzC0E,CAsD3E,MAAO,CACHC,IAAI,CANG,QAAPA,CAAAA,IAAO,CAASC,CAAT,CAAiB,CACxB,GAAI1B,CAAAA,CAAW,CAAGP,CAAC,CAAC,IAAMiC,CAAP,CAAnB,CACA3B,CAA6B,CAACC,CAAD,CAChC,CAEM,CAGV,CAzDK,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 .\n\n/**\n * A javascript module to enhance the event form.\n *\n * @module core_calendar/event_form\n * @package core_calendar\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core_calendar/repository'], function($, CalendarRepository) {\n\n var SELECTORS = {\n EVENT_GROUP_COURSE_ID: '[name=\"groupcourseid\"]',\n EVENT_GROUP_ID: '[name=\"groupid\"]',\n SELECT_OPTION: 'option'\n };\n\n /**\n * Listen for when the user changes the group course when configuring\n * a group event and filter the options in the group select to only\n * show the groups available within the course the user has selected.\n *\n * @method addCourseGroupSelectListeners\n * @param {object} formElement The root form element\n */\n var addCourseGroupSelectListeners = function(formElement) {\n var courseGroupSelect = formElement.find(SELECTORS.EVENT_GROUP_COURSE_ID);\n\n var loadGroupSelectOptions = function(groups) {\n var groupSelect = formElement.find(SELECTORS.EVENT_GROUP_ID),\n groupSelectOptions = groupSelect.find(SELECTORS.SELECT_OPTION),\n courseGroups = $(groups);\n\n // Let's clear all options first.\n groupSelectOptions.remove();\n groupSelect.prop(\"disabled\", false);\n courseGroups.each(function(id, group) {\n $(groupSelect).append($(\"\").attr(\"value\", group.id).text(group.name));\n });\n };\n\n // If the user choose a course in the selector do a WS request to get groups.\n courseGroupSelect.on('change', function() {\n var courseId = formElement.find(SELECTORS.EVENT_GROUP_COURSE_ID).val();\n CalendarRepository.getCourseGroupsData(courseId)\n .then(function(groups) {\n return loadGroupSelectOptions(groups);\n })\n .catch(Notification.exception);\n });\n };\n\n /**\n * Initialise all of the form enhancements.\n *\n * @method init\n * @param {string} formId The value of the form's id attribute\n */\n var init = function(formId) {\n var formElement = $('#' + formId);\n addCourseGroupSelectListeners(formElement);\n };\n\n return {\n init: init,\n };\n});\n"],"file":"event_form.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/event_form.js"],"names":["define","$","CalendarRepository","SELECTORS","EVENT_GROUP_COURSE_ID","EVENT_GROUP_ID","SELECT_OPTION","addCourseGroupSelectListeners","formElement","courseGroupSelect","find","loadGroupSelectOptions","groups","groupSelect","groupSelectOptions","courseGroups","remove","prop","each","id","group","append","attr","text","name","on","courseId","val","getCourseGroupsData","then","catch","Notification","exception","init","formId"],"mappings":"AAsBAA,OAAM,4BAAC,CAAC,QAAD,CAAW,0BAAX,CAAD,CAAyC,SAASC,CAAT,CAAYC,CAAZ,CAAgC,IAEvEC,CAAAA,CAAS,CAAG,CACZC,qBAAqB,CAAE,0BADX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1B,CAAAA,CAAW,CAAGP,CAAC,CAAC,IAAMiC,CAAP,CAAnB,CACA3B,CAA6B,CAACC,CAAD,CAChC,CAEM,CAGV,CAzDK,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 .\n\n/**\n * A javascript module to enhance the event form.\n *\n * @module core_calendar/event_form\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core_calendar/repository'], function($, CalendarRepository) {\n\n var SELECTORS = {\n EVENT_GROUP_COURSE_ID: '[name=\"groupcourseid\"]',\n EVENT_GROUP_ID: '[name=\"groupid\"]',\n SELECT_OPTION: 'option'\n };\n\n /**\n * Listen for when the user changes the group course when configuring\n * a group event and filter the options in the group select to only\n * show the groups available within the course the user has selected.\n *\n * @method addCourseGroupSelectListeners\n * @param {object} formElement The root form element\n */\n var addCourseGroupSelectListeners = function(formElement) {\n var courseGroupSelect = formElement.find(SELECTORS.EVENT_GROUP_COURSE_ID);\n\n var loadGroupSelectOptions = function(groups) {\n var groupSelect = formElement.find(SELECTORS.EVENT_GROUP_ID),\n groupSelectOptions = groupSelect.find(SELECTORS.SELECT_OPTION),\n courseGroups = $(groups);\n\n // Let's clear all options first.\n groupSelectOptions.remove();\n groupSelect.prop(\"disabled\", false);\n courseGroups.each(function(id, group) {\n $(groupSelect).append($(\"\").attr(\"value\", group.id).text(group.name));\n });\n };\n\n // If the user choose a course in the selector do a WS request to get groups.\n courseGroupSelect.on('change', function() {\n var courseId = formElement.find(SELECTORS.EVENT_GROUP_COURSE_ID).val();\n CalendarRepository.getCourseGroupsData(courseId)\n .then(function(groups) {\n return loadGroupSelectOptions(groups);\n })\n .catch(Notification.exception);\n });\n };\n\n /**\n * Initialise all of the form enhancements.\n *\n * @method init\n * @param {string} formId The value of the form's id attribute\n */\n var init = function(formId) {\n var formElement = $('#' + formId);\n addCourseGroupSelectListeners(formElement);\n };\n\n return {\n init: init,\n };\n});\n"],"file":"event_form.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/events.min.js.map b/calendar/amd/build/events.min.js.map
index e3efce1d56f..bf94bc57696 100644
--- a/calendar/amd/build/events.min.js.map
+++ b/calendar/amd/build/events.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/events.js"],"names":["define","created","deleted","deleteAll","updated","editEvent","editActionEvent","eventMoved","dayChanged","monthChanged","moveEvent","filterChanged","viewUpdated"],"mappings":"AAwBAA,OAAM,wBAAC,EAAD,CAAK,UAAW,CAClB,MAAO,CACHC,OAAO,CAAE,yBADN,CAEHC,OAAO,CAAE,yBAFN,CAGHC,SAAS,CAAE,4BAHR,CAIHC,OAAO,CAAE,yBAJN,CAKHC,SAAS,CAAE,4BALR,CAMHC,eAAe,CAAE,mCANd,CAOHC,UAAU,CAAE,6BAPT,CAQHC,UAAU,CAAE,6BART,CASHC,YAAY,CAAE,+BATX,CAUHC,SAAS,CAAE,4BAVR,CAWHC,aAAa,CAAE,gCAXZ,CAYHC,WAAW,CAAE,8BAZV,CAcV,CAfK,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 .\n\n/**\n * Contain the events the calendar component can fire.\n *\n * @module core_calendar/events\n * @class calendar_events\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n created: 'calendar-events:created',\n deleted: 'calendar-events:deleted',\n deleteAll: 'calendar-events:delete_all',\n updated: 'calendar-events:updated',\n editEvent: 'calendar-events:edit_event',\n editActionEvent: 'calendar-events:edit_action_event',\n eventMoved: 'calendar-events:event_moved',\n dayChanged: 'calendar-events:day_changed',\n monthChanged: 'calendar-events:month_changed',\n moveEvent: 'calendar-events:move_event',\n filterChanged: 'calendar-events:filter_changed',\n viewUpdated: 'calendar-events:view_updated',\n };\n});\n"],"file":"events.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/events.js"],"names":["define","created","deleted","deleteAll","updated","editEvent","editActionEvent","eventMoved","dayChanged","monthChanged","moveEvent","filterChanged","viewUpdated"],"mappings":"AAuBAA,OAAM,wBAAC,EAAD,CAAK,UAAW,CAClB,MAAO,CACHC,OAAO,CAAE,yBADN,CAEHC,OAAO,CAAE,yBAFN,CAGHC,SAAS,CAAE,4BAHR,CAIHC,OAAO,CAAE,yBAJN,CAKHC,SAAS,CAAE,4BALR,CAMHC,eAAe,CAAE,mCANd,CAOHC,UAAU,CAAE,6BAPT,CAQHC,UAAU,CAAE,6BART,CASHC,YAAY,CAAE,+BATX,CAUHC,SAAS,CAAE,4BAVR,CAWHC,aAAa,CAAE,gCAXZ,CAYHC,WAAW,CAAE,8BAZV,CAcV,CAfK,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 .\n\n/**\n * Contain the events the calendar component can fire.\n *\n * @module core_calendar/events\n * @class calendar_events\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n created: 'calendar-events:created',\n deleted: 'calendar-events:deleted',\n deleteAll: 'calendar-events:delete_all',\n updated: 'calendar-events:updated',\n editEvent: 'calendar-events:edit_event',\n editActionEvent: 'calendar-events:edit_action_event',\n eventMoved: 'calendar-events:event_moved',\n dayChanged: 'calendar-events:day_changed',\n monthChanged: 'calendar-events:month_changed',\n moveEvent: 'calendar-events:move_event',\n filterChanged: 'calendar-events:filter_changed',\n viewUpdated: 'calendar-events:view_updated',\n };\n});\n"],"file":"events.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/modal_delete.min.js.map b/calendar/amd/build/modal_delete.min.js.map
index 090c326af6b..fd5b24cdfec 100644
--- a/calendar/amd/build/modal_delete.min.js.map
+++ b/calendar/amd/build/modal_delete.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/modal_delete.js"],"names":["define","$","Notification","CustomEvents","Modal","ModalEvents","ModalRegistry","CalendarEvents","registered","SELECTORS","DELETE_ONE_BUTTON","DELETE_ALL_BUTTON","CANCEL_BUTTON","ModalDelete","root","call","setRemoveOnClose","TYPE","prototype","Object","create","constructor","registerEventListeners","getModal","on","events","activate","e","data","saveEvent","Event","save","getRoot","trigger","isDefaultPrevented","hide","originalEvent","preventDefault","bind","deleteAll","cancelEvent","cancel","register"],"mappings":"AAwBAA,OAAM,8BAAC,CACH,QADG,CAEH,mBAFG,CAGH,gCAHG,CAIH,YAJG,CAKH,mBALG,CAMH,qBANG,CAOH,sBAPG,CAAD,CASN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQE,IAEMC,CAAAA,CAAU,GAFh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CAAQvB,CAAc,CAACgC,SAAvB,CAAhB,CACA,KAAKP,OAAL,GAAeC,OAAf,CAAuBJ,CAAvB,CAAkC,IAAlC,EAEA,GAAI,CAACA,CAAS,CAACK,kBAAV,EAAL,CAAqC,CACjC,KAAKC,IAAL,GACAP,CAAI,CAACQ,aAAL,CAAmBC,cAAnB,EACH,CACJ,CAR6E,CAQ5EC,IAR4E,CAQvE,IARuE,CAA9E,EAUA,KAAKf,QAAL,GAAgBC,EAAhB,CAAmBrB,CAAY,CAACsB,MAAb,CAAoBC,QAAvC,CAAiDjB,CAAS,CAACG,aAA3D,CAA0E,SAASe,CAAT,CAAYC,CAAZ,CAAkB,CACxF,GAAIY,CAAAA,CAAW,CAAGvC,CAAC,CAAC6B,KAAF,CAAQzB,CAAW,CAACoC,MAApB,CAAlB,CACA,KAAKT,OAAL,GAAeC,OAAf,CAAuBO,CAAvB,CAAoC,IAApC,EAEA,GAAI,CAACA,CAAW,CAACN,kBAAZ,EAAL,CAAuC,CACnC,KAAKC,IAAL,GACAP,CAAI,CAACQ,aAAL,CAAmBC,cAAnB,EACH,CACJ,CARyE,CAQxEC,IARwE,CAQnE,IARmE,CAA1E,CASH,CAjCD,CAqCA,GAAI,CAAC9B,CAAL,CAAiB,CACbF,CAAa,CAACoC,QAAd,CAAuB7B,CAAW,CAACI,IAAnC,CAAyCJ,CAAzC,CAAsD,6BAAtD,EACAL,CAAU,GACb,CAED,MAAOK,CAAAA,CACV,CAzFK,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 .\n\n/**\n * Contain the logic for the save/cancel modal.\n *\n * @module core_calendar/modal_delete\n * @class modal_delete\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_events',\n 'core/modal_registry',\n 'core_calendar/events',\n],\nfunction(\n $,\n Notification,\n CustomEvents,\n Modal,\n ModalEvents,\n ModalRegistry,\n CalendarEvents\n) {\n\n var registered = false;\n var SELECTORS = {\n DELETE_ONE_BUTTON: '[data-action=\"deleteone\"]',\n DELETE_ALL_BUTTON: '[data-action=\"deleteall\"]',\n CANCEL_BUTTON: '[data-action=\"cancel\"]',\n };\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n var ModalDelete = function(root) {\n Modal.call(this, root);\n\n this.setRemoveOnClose(true);\n };\n\n ModalDelete.TYPE = 'core_calendar-modal_delete';\n ModalDelete.prototype = Object.create(Modal.prototype);\n ModalDelete.prototype.constructor = ModalDelete;\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n ModalDelete.prototype.registerEventListeners = function() {\n // Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ONE_BUTTON, function(e, data) {\n var saveEvent = $.Event(ModalEvents.save);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ALL_BUTTON, function(e, data) {\n var saveEvent = $.Event(CalendarEvents.deleteAll);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, function(e, data) {\n var cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n };\n\n // Automatically register with the modal registry the first time this module is imported so that you can create modals\n // of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalDelete.TYPE, ModalDelete, 'calendar/event_delete_modal');\n registered = true;\n }\n\n return ModalDelete;\n});\n"],"file":"modal_delete.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/modal_delete.js"],"names":["define","$","Notification","CustomEvents","Modal","ModalEvents","ModalRegistry","CalendarEvents","registered","SELECTORS","DELETE_ONE_BUTTON","DELETE_ALL_BUTTON","CANCEL_BUTTON","ModalDelete","root","call","setRemoveOnClose","TYPE","prototype","Object","create","constructor","registerEventListeners","getModal","on","events","activate","e","data","saveEvent","Event","save","getRoot","trigger","isDefaultPrevented","hide","originalEvent","preventDefault","bind","deleteAll","cancelEvent","cancel","register"],"mappings":"AAuBAA,OAAM,8BAAC,CACH,QADG,CAEH,mBAFG,CAGH,gCAHG,CAIH,YAJG,CAKH,mBALG,CAMH,qBANG,CAOH,sBAPG,CAAD,CASN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQE,IAEMC,CAAAA,CAAU,GAFhB,CAGMC,CAAS,CAAG,CACZC,iBAAiB,CAAE,6BADP,CAEZC,iBAAiB,CAAE,6BAFP,CAGZC,aAAa,CAAE,0BAHH,CAHlB,CAcMC,CAAW,CAAG,SAASC,CAAT,CAAe,CAC7BV,CAAK,CAACW,IAAN,CAAW,IAAX,CAAiBD,CAAjB,EAEA,KAAKE,gBAAL,IACH,CAlBH,CAoBEH,CAAW,CAACI,IAAZ,CAAmB,4BAAnB,CACAJ,CAAW,CAACK,SAAZ,CAAwBC,MAAM,CAACC,MAAP,CAAchB,CAAK,CAACc,SAApB,CAAxB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ACG,aAA3D,CAA0E,SAASe,CAAT,CAAYC,CAAZ,CAAkB,CACxF,GAAIY,CAAAA,CAAW,CAAGvC,CAAC,CAAC6B,KAAF,CAAQzB,CAAW,CAACoC,MAApB,CAAlB,CACA,KAAKT,OAAL,GAAeC,OAAf,CAAuBO,CAAvB,CAAoC,IAApC,EAEA,GAAI,CAACA,CAAW,CAACN,kBAAZ,EAAL,CAAuC,CACnC,KAAKC,IAAL,GACAP,CAAI,CAACQ,aAAL,CAAmBC,cAAnB,EACH,CACJ,CARyE,CAQxEC,IARwE,CAQnE,IARmE,CAA1E,CASH,CAjCD,CAqCA,GAAI,CAAC9B,CAAL,CAAiB,CACbF,CAAa,CAACoC,QAAd,CAAuB7B,CAAW,CAACI,IAAnC,CAAyCJ,CAAzC,CAAsD,6BAAtD,EACAL,CAAU,GACb,CAED,MAAOK,CAAAA,CACV,CAzFK,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 .\n\n/**\n * Contain the logic for the save/cancel modal.\n *\n * @module core_calendar/modal_delete\n * @class modal_delete\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_events',\n 'core/modal_registry',\n 'core_calendar/events',\n],\nfunction(\n $,\n Notification,\n CustomEvents,\n Modal,\n ModalEvents,\n ModalRegistry,\n CalendarEvents\n) {\n\n var registered = false;\n var SELECTORS = {\n DELETE_ONE_BUTTON: '[data-action=\"deleteone\"]',\n DELETE_ALL_BUTTON: '[data-action=\"deleteall\"]',\n CANCEL_BUTTON: '[data-action=\"cancel\"]',\n };\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n var ModalDelete = function(root) {\n Modal.call(this, root);\n\n this.setRemoveOnClose(true);\n };\n\n ModalDelete.TYPE = 'core_calendar-modal_delete';\n ModalDelete.prototype = Object.create(Modal.prototype);\n ModalDelete.prototype.constructor = ModalDelete;\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n ModalDelete.prototype.registerEventListeners = function() {\n // Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ONE_BUTTON, function(e, data) {\n var saveEvent = $.Event(ModalEvents.save);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.DELETE_ALL_BUTTON, function(e, data) {\n var saveEvent = $.Event(CalendarEvents.deleteAll);\n this.getRoot().trigger(saveEvent, this);\n\n if (!saveEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n\n this.getModal().on(CustomEvents.events.activate, SELECTORS.CANCEL_BUTTON, function(e, data) {\n var cancelEvent = $.Event(ModalEvents.cancel);\n this.getRoot().trigger(cancelEvent, this);\n\n if (!cancelEvent.isDefaultPrevented()) {\n this.hide();\n data.originalEvent.preventDefault();\n }\n }.bind(this));\n };\n\n // Automatically register with the modal registry the first time this module is imported so that you can create modals\n // of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalDelete.TYPE, ModalDelete, 'calendar/event_delete_modal');\n registered = true;\n }\n\n return ModalDelete;\n});\n"],"file":"modal_delete.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/modal_event_form.min.js.map b/calendar/amd/build/modal_event_form.min.js.map
index 6962097c568..b5f1e4cc651 100644
--- a/calendar/amd/build/modal_event_form.min.js.map
+++ b/calendar/amd/build/modal_event_form.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/modal_event_form.js"],"names":["define","$","Event","Str","Notification","Templates","CustomEvents","Modal","ModalRegistry","Fragment","CalendarEvents","Repository","registered","SELECTORS","SAVE_BUTTON","LOADING_ICON_CONTAINER","ModalEventForm","root","call","eventId","startTime","courseId","categoryId","contextId","reloadingBody","reloadingTitle","saveButton","getFooter","find","TYPE","prototype","Object","create","constructor","setContextId","id","getContextId","setCourseId","getCourseId","setCategoryId","getCategoryId","hasCourseId","hasCategoryId","setEventId","getEventId","hasEventId","setStartTime","time","getStartTime","hasStartTime","getForm","getBody","disableButtons","prop","enableButtons","reloadTitleContent","titlePromise","get_string","then","string","setTitle","bind","always","fail","exception","reloadBodyContent","formData","bodyPromise","args","eventid","starttime","courseid","categoryid","formdata","loadFragment","setBody","reloadAllContent","when","show","hide","getFormData","serialize","save","invalid","loadingContainer","length","first","focus","removeClass","submitCreateUpdateForm","response","validationerror","isExisting","trigger","updated","event","created","addClass","registerEventListeners","getModal","on","events","activate","e","data","submit","originalEvent","preventDefault","stopPropagation","notifyFormSubmitAjax","register"],"mappings":"AAwBAA,OAAM,kCAAC,CACK,QADL,CAEK,YAFL,CAGK,UAHL,CAIK,mBAJL,CAKK,gBALL,CAMK,gCANL,CAOK,YAPL,CAQK,qBARL,CASK,eATL,CAUK,sBAVL,CAWK,0BAXL,CAAD,CAaE,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,IAEFC,CAAAA,CAAU,GAFR,CAGFC,CAAS,CAAG,CACZC,WAAW,CAAE,wBADD,CAEZC,sBAAsB,CAAE,0CAFZ,CAHV,CAaFC,CAAc,CAAG,SAASC,CAAT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AKA,KAAKiF,QAAL,GAAgBC,EAAhB,CAAmB9F,CAAY,CAAC+F,MAAb,CAAoBC,QAAvC,CAAiDzF,CAAS,CAACC,WAA3D,CAAwE,SAASyF,CAAT,CAAYC,CAAZ,CAAkB,CACtF,KAAKtD,OAAL,GAAeuD,MAAf,GACAD,CAAI,CAACE,aAAL,CAAmBC,cAAnB,GACAJ,CAAC,CAACK,eAAF,EACH,CAJuE,CAItE/C,IAJsE,CAIjE,IAJiE,CAAxE,EAQA,KAAKsC,QAAL,GAAgBC,EAAhB,CAAmB,QAAnB,CAA6B,SAASG,CAAT,CAAY,CACrCrG,CAAK,CAAC2G,oBAAN,CAA2B,KAAK3D,OAAL,GAAe,CAAf,CAA3B,EAEA,KAAKgC,IAAL,GAIAqB,CAAC,CAACI,cAAF,GACAJ,CAAC,CAACK,eAAF,EACH,CAT4B,CAS3B/C,IAT2B,CAStB,IATsB,CAA7B,CAUH,CAzBD,CA6BA,GAAI,CAACjD,CAAL,CAAiB,CACbJ,CAAa,CAACsG,QAAd,CAAuB9F,CAAc,CAACa,IAAtC,CAA4Cb,CAA5C,CAA4D,2BAA5D,EACAJ,CAAU,GACb,CAED,MAAOI,CAAAA,CACV,CA/dK,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 .\n\n/**\n * Contain the logic for the quick add or update event modal.\n *\n * @module calendar/modal_quick_add_event\n * @class modal_quick_add_event\n * @package core\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/event',\n 'core/str',\n 'core/notification',\n 'core/templates',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_registry',\n 'core/fragment',\n 'core_calendar/events',\n 'core_calendar/repository'\n ],\n function(\n $,\n Event,\n Str,\n Notification,\n Templates,\n CustomEvents,\n Modal,\n ModalRegistry,\n Fragment,\n CalendarEvents,\n Repository\n ) {\n\n var registered = false;\n var SELECTORS = {\n SAVE_BUTTON: '[data-action=\"save\"]',\n LOADING_ICON_CONTAINER: '[data-region=\"loading-icon-container\"]',\n };\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n var ModalEventForm = function(root) {\n Modal.call(this, root);\n this.eventId = null;\n this.startTime = null;\n this.courseId = null;\n this.categoryId = null;\n this.contextId = null;\n this.reloadingBody = false;\n this.reloadingTitle = false;\n this.saveButton = this.getFooter().find(SELECTORS.SAVE_BUTTON);\n };\n\n ModalEventForm.TYPE = 'core_calendar-modal_event_form';\n ModalEventForm.prototype = Object.create(Modal.prototype);\n ModalEventForm.prototype.constructor = ModalEventForm;\n\n /**\n * Set the context id to the given value.\n *\n * @method setContextId\n * @param {Number} id The event id\n */\n ModalEventForm.prototype.setContextId = function(id) {\n this.contextId = id;\n };\n\n /**\n * Retrieve the current context id, if any.\n *\n * @method getContextId\n * @return {Number|null} The event id\n */\n ModalEventForm.prototype.getContextId = function() {\n return this.contextId;\n };\n\n /**\n * Set the course id to the given value.\n *\n * @method setCourseId\n * @param {int} id The event id\n */\n ModalEventForm.prototype.setCourseId = function(id) {\n this.courseId = id;\n };\n\n /**\n * Retrieve the current course id, if any.\n *\n * @method getCourseId\n * @return {int|null} The event id\n */\n ModalEventForm.prototype.getCourseId = function() {\n return this.courseId;\n };\n\n /**\n * Set the category id to the given value.\n *\n * @method setCategoryId\n * @param {int} id The event id\n */\n ModalEventForm.prototype.setCategoryId = function(id) {\n this.categoryId = id;\n };\n\n /**\n * Retrieve the current category id, if any.\n *\n * @method getCategoryId\n * @return {int|null} The event id\n */\n ModalEventForm.prototype.getCategoryId = function() {\n return this.categoryId;\n };\n\n /**\n * Check if the modal has an course id.\n *\n * @method hasCourseId\n * @return {bool}\n */\n ModalEventForm.prototype.hasCourseId = function() {\n return this.courseId !== null;\n };\n\n /**\n * Check if the modal has an category id.\n *\n * @method hasCategoryId\n * @return {bool}\n */\n ModalEventForm.prototype.hasCategoryId = function() {\n return this.categoryId !== null;\n };\n\n /**\n * Set the event id to the given value.\n *\n * @method setEventId\n * @param {int} id The event id\n */\n ModalEventForm.prototype.setEventId = function(id) {\n this.eventId = id;\n };\n\n /**\n * Retrieve the current event id, if any.\n *\n * @method getEventId\n * @return {int|null} The event id\n */\n ModalEventForm.prototype.getEventId = function() {\n return this.eventId;\n };\n\n /**\n * Check if the modal has an event id.\n *\n * @method hasEventId\n * @return {bool}\n */\n ModalEventForm.prototype.hasEventId = function() {\n return this.eventId !== null;\n };\n\n /**\n * Set the start time to the given value.\n *\n * @method setStartTime\n * @param {int} time The start time\n */\n ModalEventForm.prototype.setStartTime = function(time) {\n this.startTime = time;\n };\n\n /**\n * Retrieve the current start time, if any.\n *\n * @method getStartTime\n * @return {int|null} The start time\n */\n ModalEventForm.prototype.getStartTime = function() {\n return this.startTime;\n };\n\n /**\n * Check if the modal has start time.\n *\n * @method hasStartTime\n * @return {bool}\n */\n ModalEventForm.prototype.hasStartTime = function() {\n return this.startTime !== null;\n };\n\n /**\n * Get the form element from the modal.\n *\n * @method getForm\n * @return {object}\n */\n ModalEventForm.prototype.getForm = function() {\n return this.getBody().find('form');\n };\n\n /**\n * Disable the buttons in the footer.\n *\n * @method disableButtons\n */\n ModalEventForm.prototype.disableButtons = function() {\n this.saveButton.prop('disabled', true);\n };\n\n /**\n * Enable the buttons in the footer.\n *\n * @method enableButtons\n */\n ModalEventForm.prototype.enableButtons = function() {\n this.saveButton.prop('disabled', false);\n };\n\n /**\n * Reload the title for the modal to the appropriate value\n * depending on whether we are creating a new event or\n * editing an existing event.\n *\n * @method reloadTitleContent\n * @return {object} A promise resolved with the new title text\n */\n ModalEventForm.prototype.reloadTitleContent = function() {\n if (this.reloadingTitle) {\n return this.titlePromise;\n }\n\n this.reloadingTitle = true;\n\n if (this.hasEventId()) {\n this.titlePromise = Str.get_string('editevent', 'calendar');\n } else {\n this.titlePromise = Str.get_string('newevent', 'calendar');\n }\n\n this.titlePromise.then(function(string) {\n this.setTitle(string);\n return string;\n }.bind(this))\n .always(function() {\n this.reloadingTitle = false;\n return;\n }.bind(this))\n .fail(Notification.exception);\n\n return this.titlePromise;\n };\n\n /**\n * Send a request to the server to get the event_form in a fragment\n * and render the result in the body of the modal.\n *\n * If serialised form data is provided then it will be sent in the\n * request to the server to have the form rendered with the data. This\n * is used when the form had a server side error and we need the server\n * to re-render it for us to display the error to the user.\n *\n * @method reloadBodyContent\n * @param {string} formData The serialised form data\n * @return {object} A promise resolved with the fragment html and js from\n */\n ModalEventForm.prototype.reloadBodyContent = function(formData) {\n if (this.reloadingBody) {\n return this.bodyPromise;\n }\n\n this.reloadingBody = true;\n this.disableButtons();\n\n var args = {};\n\n if (this.hasEventId()) {\n args.eventid = this.getEventId();\n }\n\n if (this.hasStartTime()) {\n args.starttime = this.getStartTime();\n }\n\n if (this.hasCourseId()) {\n args.courseid = this.getCourseId();\n }\n\n if (this.hasCategoryId()) {\n args.categoryid = this.getCategoryId();\n }\n\n if (typeof formData !== 'undefined') {\n args.formdata = formData;\n }\n\n this.bodyPromise = Fragment.loadFragment('calendar', 'event_form', this.getContextId(), args);\n\n this.setBody(this.bodyPromise);\n\n this.bodyPromise.then(function() {\n this.enableButtons();\n return;\n }.bind(this))\n .fail(Notification.exception)\n .always(function() {\n this.reloadingBody = false;\n return;\n }.bind(this))\n .fail(Notification.exception);\n\n return this.bodyPromise;\n };\n\n /**\n * Reload both the title and body content.\n *\n * @method reloadAllContent\n * @return {object} promise\n */\n ModalEventForm.prototype.reloadAllContent = function() {\n return $.when(this.reloadTitleContent(), this.reloadBodyContent());\n };\n\n /**\n * Kick off a reload the modal content before showing it. This\n * is to allow us to re-use the same modal for creating and\n * editing different events within the page.\n *\n * We do the reload when showing the modal rather than hiding it\n * to save a request to the server if the user closes the modal\n * and never re-opens it.\n *\n * @method show\n */\n ModalEventForm.prototype.show = function() {\n this.reloadAllContent();\n Modal.prototype.show.call(this);\n };\n\n /**\n * Clear the event id from the modal when it's closed so\n * that it is loaded fresh next time it's displayed.\n *\n * The event id will be set by the calling code if it wants\n * to edit a specific event.\n *\n * @method hide\n */\n ModalEventForm.prototype.hide = function() {\n Modal.prototype.hide.call(this);\n this.setEventId(null);\n this.setStartTime(null);\n this.setCourseId(null);\n this.setCategoryId(null);\n };\n\n /**\n * Get the serialised form data.\n *\n * @method getFormData\n * @return {string} serialised form data\n */\n ModalEventForm.prototype.getFormData = function() {\n return this.getForm().serialize();\n };\n\n /**\n * Send the form data to the server to create or update\n * an event.\n *\n * If there is a server side validation error then we re-request the\n * rendered form (with the data) from the server in order to get the\n * server side errors to display.\n *\n * On success the modal is hidden and the page is reloaded so that the\n * new event will display.\n *\n * @method save\n * @return {object} A promise\n */\n ModalEventForm.prototype.save = function() {\n var invalid,\n loadingContainer = this.saveButton.find(SELECTORS.LOADING_ICON_CONTAINER);\n\n // Now the change events have run, see if there are any \"invalid\" form fields.\n invalid = this.getForm().find('[aria-invalid=\"true\"]');\n\n // If we found invalid fields, focus on the first one and do not submit via ajax.\n if (invalid.length) {\n invalid.first().focus();\n return;\n }\n\n loadingContainer.removeClass('hidden');\n this.disableButtons();\n\n var formData = this.getFormData();\n // Send the form data to the server for processing.\n return Repository.submitCreateUpdateForm(formData)\n .then(function(response) {\n if (response.validationerror) {\n // If there was a server side validation error then\n // we need to re-request the rendered form from the server\n // in order to display the error for the user.\n this.reloadBodyContent(formData);\n return;\n } else {\n // Check whether this was a new event or not.\n // The hide function unsets the form data so grab this before the hide.\n var isExisting = this.hasEventId();\n\n // No problemo! Our work here is done.\n this.hide();\n\n // Trigger the appropriate calendar event so that the view can be updated.\n if (isExisting) {\n $('body').trigger(CalendarEvents.updated, [response.event]);\n } else {\n $('body').trigger(CalendarEvents.created, [response.event]);\n }\n }\n\n return;\n }.bind(this))\n .always(function() {\n // Regardless of success or error we should always stop\n // the loading icon and re-enable the buttons.\n loadingContainer.addClass('hidden');\n this.enableButtons();\n\n return;\n }.bind(this))\n .fail(Notification.exception);\n };\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n ModalEventForm.prototype.registerEventListeners = function() {\n // Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n // When the user clicks the save button we trigger the form submission. We need to\n // trigger an actual submission because there is some JS code in the form that is\n // listening for this event and doing some stuff (e.g. saving draft areas etc).\n this.getModal().on(CustomEvents.events.activate, SELECTORS.SAVE_BUTTON, function(e, data) {\n this.getForm().submit();\n data.originalEvent.preventDefault();\n e.stopPropagation();\n }.bind(this));\n\n // Catch the submit event before it is actually processed by the browser and\n // prevent the submission. We'll take it from here.\n this.getModal().on('submit', function(e) {\n Event.notifyFormSubmitAjax(this.getForm()[0]);\n\n this.save();\n\n // Stop the form from actually submitting and prevent it's\n // propagation because we have already handled the event.\n e.preventDefault();\n e.stopPropagation();\n }.bind(this));\n };\n\n // Automatically register with the modal registry the first time this module is imported so that you can create modals\n // of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalEventForm.TYPE, ModalEventForm, 'calendar/modal_event_form');\n registered = true;\n }\n\n return ModalEventForm;\n});\n"],"file":"modal_event_form.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/modal_event_form.js"],"names":["define","$","Event","Str","Notification","Templates","CustomEvents","Modal","ModalRegistry","Fragment","CalendarEvents","Repository","registered","SELECTORS","SAVE_BUTTON","LOADING_ICON_CONTAINER","ModalEventForm","root","call","eventId","startTime","courseId","categoryId","contextId","reloadingBody","reloadingTitle","saveButton","getFooter","find","TYPE","prototype","Object","create","constructor","setContextId","id","getContextId","setCourseId","getCourseId","setCategoryId","getCategoryId","hasCourseId","hasCategoryId","setEventId","getEventId","hasEventId","setStartTime","time","getStartTime","hasStartTime","getForm","getBody","disableButtons","prop","enableButtons","reloadTitleContent","titlePromise","get_string","then","string","setTitle","bind","always","fail","exception","reloadBodyContent","formData","bodyPromise","args","eventid","starttime","courseid","categoryid","formdata","loadFragment","setBody","reloadAllContent","when","show","hide","getFormData","serialize","save","invalid","loadingContainer","length","first","focus","removeClass","submitCreateUpdateForm","response","validationerror","isExisting","trigger","updated","event","created","addClass","registerEventListeners","getModal","on","events","activate","e","data","submit","originalEvent","preventDefault","stopPropagation","notifyFormSubmitAjax","register"],"mappings":"AAsBAA,OAAM,kCAAC,CACK,QADL,CAEK,YAFL,CAGK,UAHL,CAIK,mBAJL,CAKK,gBALL,CAMK,gCANL,CAOK,YAPL,CAQK,qBARL,CASK,eATL,CAUK,sBAVL,CAWK,0BAXL,CAAD,CAaE,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,IAEFC,CAAAA,CAAU,GAFR,CAGFC,CAAS,CAAG,CACZC,WAAW,CAAE,wBADD,CAEZC,sBAAsB,CAAE,0CAFZ,CAHV,CAaFC,CAAc,CAAG,SAASC,CAAT,CAAe,CAChCV,CAAK,CAACW,IAAN,CAAW,IAAX,CAAiBD,CAAjB,EACA,KAAKE,OAAL,CAAe,IAAf,CACA,KAAKC,SAAL,CAAiB,IAAjB,CACA,KAAKC,QAAL,CAAgB,IAAhB,CACA,KAAKC,UAAL,CAAkB,IAAlB,CACA,KAAKC,SAAL,CAAiB,IAAjB,CACA,KAAKC,aAAL,IACA,KAAKC,cAAL,IACA,KAAKC,UAAL,CAAkB,KAAKC,SAAL,GAAiBC,IAAjB,CAAsBf,CAAS,CAACC,WAAhC,CACrB,CAvBK,CAyBNE,CAAc,CAACa,IAAf,CAAsB,gCAAtB,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AC2G,oBAAN,CAA2B,KAAK3D,OAAL,GAAe,CAAf,CAA3B,EAEA,KAAKgC,IAAL,GAIAqB,CAAC,CAACI,cAAF,GACAJ,CAAC,CAACK,eAAF,EACH,CAT4B,CAS3B/C,IAT2B,CAStB,IATsB,CAA7B,CAUH,CAzBD,CA6BA,GAAI,CAACjD,CAAL,CAAiB,CACbJ,CAAa,CAACsG,QAAd,CAAuB9F,CAAc,CAACa,IAAtC,CAA4Cb,CAA5C,CAA4D,2BAA5D,EACAJ,CAAU,GACb,CAED,MAAOI,CAAAA,CACV,CA/dK,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 .\n\n/**\n * Contain the logic for the quick add or update event modal.\n *\n * @module core_calendar/modal_quick_add_event\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/event',\n 'core/str',\n 'core/notification',\n 'core/templates',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_registry',\n 'core/fragment',\n 'core_calendar/events',\n 'core_calendar/repository'\n ],\n function(\n $,\n Event,\n Str,\n Notification,\n Templates,\n CustomEvents,\n Modal,\n ModalRegistry,\n Fragment,\n CalendarEvents,\n Repository\n ) {\n\n var registered = false;\n var SELECTORS = {\n SAVE_BUTTON: '[data-action=\"save\"]',\n LOADING_ICON_CONTAINER: '[data-region=\"loading-icon-container\"]',\n };\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n var ModalEventForm = function(root) {\n Modal.call(this, root);\n this.eventId = null;\n this.startTime = null;\n this.courseId = null;\n this.categoryId = null;\n this.contextId = null;\n this.reloadingBody = false;\n this.reloadingTitle = false;\n this.saveButton = this.getFooter().find(SELECTORS.SAVE_BUTTON);\n };\n\n ModalEventForm.TYPE = 'core_calendar-modal_event_form';\n ModalEventForm.prototype = Object.create(Modal.prototype);\n ModalEventForm.prototype.constructor = ModalEventForm;\n\n /**\n * Set the context id to the given value.\n *\n * @method setContextId\n * @param {Number} id The event id\n */\n ModalEventForm.prototype.setContextId = function(id) {\n this.contextId = id;\n };\n\n /**\n * Retrieve the current context id, if any.\n *\n * @method getContextId\n * @return {Number|null} The event id\n */\n ModalEventForm.prototype.getContextId = function() {\n return this.contextId;\n };\n\n /**\n * Set the course id to the given value.\n *\n * @method setCourseId\n * @param {int} id The event id\n */\n ModalEventForm.prototype.setCourseId = function(id) {\n this.courseId = id;\n };\n\n /**\n * Retrieve the current course id, if any.\n *\n * @method getCourseId\n * @return {int|null} The event id\n */\n ModalEventForm.prototype.getCourseId = function() {\n return this.courseId;\n };\n\n /**\n * Set the category id to the given value.\n *\n * @method setCategoryId\n * @param {int} id The event id\n */\n ModalEventForm.prototype.setCategoryId = function(id) {\n this.categoryId = id;\n };\n\n /**\n * Retrieve the current category id, if any.\n *\n * @method getCategoryId\n * @return {int|null} The event id\n */\n ModalEventForm.prototype.getCategoryId = function() {\n return this.categoryId;\n };\n\n /**\n * Check if the modal has an course id.\n *\n * @method hasCourseId\n * @return {bool}\n */\n ModalEventForm.prototype.hasCourseId = function() {\n return this.courseId !== null;\n };\n\n /**\n * Check if the modal has an category id.\n *\n * @method hasCategoryId\n * @return {bool}\n */\n ModalEventForm.prototype.hasCategoryId = function() {\n return this.categoryId !== null;\n };\n\n /**\n * Set the event id to the given value.\n *\n * @method setEventId\n * @param {int} id The event id\n */\n ModalEventForm.prototype.setEventId = function(id) {\n this.eventId = id;\n };\n\n /**\n * Retrieve the current event id, if any.\n *\n * @method getEventId\n * @return {int|null} The event id\n */\n ModalEventForm.prototype.getEventId = function() {\n return this.eventId;\n };\n\n /**\n * Check if the modal has an event id.\n *\n * @method hasEventId\n * @return {bool}\n */\n ModalEventForm.prototype.hasEventId = function() {\n return this.eventId !== null;\n };\n\n /**\n * Set the start time to the given value.\n *\n * @method setStartTime\n * @param {int} time The start time\n */\n ModalEventForm.prototype.setStartTime = function(time) {\n this.startTime = time;\n };\n\n /**\n * Retrieve the current start time, if any.\n *\n * @method getStartTime\n * @return {int|null} The start time\n */\n ModalEventForm.prototype.getStartTime = function() {\n return this.startTime;\n };\n\n /**\n * Check if the modal has start time.\n *\n * @method hasStartTime\n * @return {bool}\n */\n ModalEventForm.prototype.hasStartTime = function() {\n return this.startTime !== null;\n };\n\n /**\n * Get the form element from the modal.\n *\n * @method getForm\n * @return {object}\n */\n ModalEventForm.prototype.getForm = function() {\n return this.getBody().find('form');\n };\n\n /**\n * Disable the buttons in the footer.\n *\n * @method disableButtons\n */\n ModalEventForm.prototype.disableButtons = function() {\n this.saveButton.prop('disabled', true);\n };\n\n /**\n * Enable the buttons in the footer.\n *\n * @method enableButtons\n */\n ModalEventForm.prototype.enableButtons = function() {\n this.saveButton.prop('disabled', false);\n };\n\n /**\n * Reload the title for the modal to the appropriate value\n * depending on whether we are creating a new event or\n * editing an existing event.\n *\n * @method reloadTitleContent\n * @return {object} A promise resolved with the new title text\n */\n ModalEventForm.prototype.reloadTitleContent = function() {\n if (this.reloadingTitle) {\n return this.titlePromise;\n }\n\n this.reloadingTitle = true;\n\n if (this.hasEventId()) {\n this.titlePromise = Str.get_string('editevent', 'calendar');\n } else {\n this.titlePromise = Str.get_string('newevent', 'calendar');\n }\n\n this.titlePromise.then(function(string) {\n this.setTitle(string);\n return string;\n }.bind(this))\n .always(function() {\n this.reloadingTitle = false;\n return;\n }.bind(this))\n .fail(Notification.exception);\n\n return this.titlePromise;\n };\n\n /**\n * Send a request to the server to get the event_form in a fragment\n * and render the result in the body of the modal.\n *\n * If serialised form data is provided then it will be sent in the\n * request to the server to have the form rendered with the data. This\n * is used when the form had a server side error and we need the server\n * to re-render it for us to display the error to the user.\n *\n * @method reloadBodyContent\n * @param {string} formData The serialised form data\n * @return {object} A promise resolved with the fragment html and js from\n */\n ModalEventForm.prototype.reloadBodyContent = function(formData) {\n if (this.reloadingBody) {\n return this.bodyPromise;\n }\n\n this.reloadingBody = true;\n this.disableButtons();\n\n var args = {};\n\n if (this.hasEventId()) {\n args.eventid = this.getEventId();\n }\n\n if (this.hasStartTime()) {\n args.starttime = this.getStartTime();\n }\n\n if (this.hasCourseId()) {\n args.courseid = this.getCourseId();\n }\n\n if (this.hasCategoryId()) {\n args.categoryid = this.getCategoryId();\n }\n\n if (typeof formData !== 'undefined') {\n args.formdata = formData;\n }\n\n this.bodyPromise = Fragment.loadFragment('calendar', 'event_form', this.getContextId(), args);\n\n this.setBody(this.bodyPromise);\n\n this.bodyPromise.then(function() {\n this.enableButtons();\n return;\n }.bind(this))\n .fail(Notification.exception)\n .always(function() {\n this.reloadingBody = false;\n return;\n }.bind(this))\n .fail(Notification.exception);\n\n return this.bodyPromise;\n };\n\n /**\n * Reload both the title and body content.\n *\n * @method reloadAllContent\n * @return {object} promise\n */\n ModalEventForm.prototype.reloadAllContent = function() {\n return $.when(this.reloadTitleContent(), this.reloadBodyContent());\n };\n\n /**\n * Kick off a reload the modal content before showing it. This\n * is to allow us to re-use the same modal for creating and\n * editing different events within the page.\n *\n * We do the reload when showing the modal rather than hiding it\n * to save a request to the server if the user closes the modal\n * and never re-opens it.\n *\n * @method show\n */\n ModalEventForm.prototype.show = function() {\n this.reloadAllContent();\n Modal.prototype.show.call(this);\n };\n\n /**\n * Clear the event id from the modal when it's closed so\n * that it is loaded fresh next time it's displayed.\n *\n * The event id will be set by the calling code if it wants\n * to edit a specific event.\n *\n * @method hide\n */\n ModalEventForm.prototype.hide = function() {\n Modal.prototype.hide.call(this);\n this.setEventId(null);\n this.setStartTime(null);\n this.setCourseId(null);\n this.setCategoryId(null);\n };\n\n /**\n * Get the serialised form data.\n *\n * @method getFormData\n * @return {string} serialised form data\n */\n ModalEventForm.prototype.getFormData = function() {\n return this.getForm().serialize();\n };\n\n /**\n * Send the form data to the server to create or update\n * an event.\n *\n * If there is a server side validation error then we re-request the\n * rendered form (with the data) from the server in order to get the\n * server side errors to display.\n *\n * On success the modal is hidden and the page is reloaded so that the\n * new event will display.\n *\n * @method save\n * @return {object} A promise\n */\n ModalEventForm.prototype.save = function() {\n var invalid,\n loadingContainer = this.saveButton.find(SELECTORS.LOADING_ICON_CONTAINER);\n\n // Now the change events have run, see if there are any \"invalid\" form fields.\n invalid = this.getForm().find('[aria-invalid=\"true\"]');\n\n // If we found invalid fields, focus on the first one and do not submit via ajax.\n if (invalid.length) {\n invalid.first().focus();\n return;\n }\n\n loadingContainer.removeClass('hidden');\n this.disableButtons();\n\n var formData = this.getFormData();\n // Send the form data to the server for processing.\n return Repository.submitCreateUpdateForm(formData)\n .then(function(response) {\n if (response.validationerror) {\n // If there was a server side validation error then\n // we need to re-request the rendered form from the server\n // in order to display the error for the user.\n this.reloadBodyContent(formData);\n return;\n } else {\n // Check whether this was a new event or not.\n // The hide function unsets the form data so grab this before the hide.\n var isExisting = this.hasEventId();\n\n // No problemo! Our work here is done.\n this.hide();\n\n // Trigger the appropriate calendar event so that the view can be updated.\n if (isExisting) {\n $('body').trigger(CalendarEvents.updated, [response.event]);\n } else {\n $('body').trigger(CalendarEvents.created, [response.event]);\n }\n }\n\n return;\n }.bind(this))\n .always(function() {\n // Regardless of success or error we should always stop\n // the loading icon and re-enable the buttons.\n loadingContainer.addClass('hidden');\n this.enableButtons();\n\n return;\n }.bind(this))\n .fail(Notification.exception);\n };\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n ModalEventForm.prototype.registerEventListeners = function() {\n // Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n // When the user clicks the save button we trigger the form submission. We need to\n // trigger an actual submission because there is some JS code in the form that is\n // listening for this event and doing some stuff (e.g. saving draft areas etc).\n this.getModal().on(CustomEvents.events.activate, SELECTORS.SAVE_BUTTON, function(e, data) {\n this.getForm().submit();\n data.originalEvent.preventDefault();\n e.stopPropagation();\n }.bind(this));\n\n // Catch the submit event before it is actually processed by the browser and\n // prevent the submission. We'll take it from here.\n this.getModal().on('submit', function(e) {\n Event.notifyFormSubmitAjax(this.getForm()[0]);\n\n this.save();\n\n // Stop the form from actually submitting and prevent it's\n // propagation because we have already handled the event.\n e.preventDefault();\n e.stopPropagation();\n }.bind(this));\n };\n\n // Automatically register with the modal registry the first time this module is imported so that you can create modals\n // of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalEventForm.TYPE, ModalEventForm, 'calendar/modal_event_form');\n registered = true;\n }\n\n return ModalEventForm;\n});\n"],"file":"modal_event_form.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/month_navigation_drag_drop.min.js.map b/calendar/amd/build/month_navigation_drag_drop.min.js.map
index cf519936329..54ea3a7c28a 100644
--- a/calendar/amd/build/month_navigation_drag_drop.min.js.map
+++ b/calendar/amd/build/month_navigation_drag_drop.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/month_navigation_drag_drop.js"],"names":["define","$","DataStore","SELECTORS","DRAGGABLE","DROP_ZONE","HOVER_CLASS","TARGET_CLASS","registered","hoverTimer","root","updateHoverState","target","hovered","addClass","removeClass","addDropZoneIndicator","find","removeDropZoneIndicator","getTargetFromEvent","e","closest","length","dragstartHandler","eventElement","dragoverHandler","hasEventId","preventDefault","setTimeout","click","dragleaveHandler","clearTimeout","dropHandler","init","rootElement","document","addEventListener"],"mappings":"AA6BAA,OAAM,4CAAC,CACK,QADL,CAEK,oCAFL,CAAD,CAIE,SACIC,CADJ,CAEIC,CAFJ,CAGE,IAEFC,CAAAA,CAAS,CAAG,CACZC,SAAS,CAAE,kDADC,CAEZC,SAAS,CAAE,+BAFC,CAFV,CAMFC,CAAW,CAAG,uBANZ,CAOFC,CAAY,CAAG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C,KACAG,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,CAAqClB,CAArC,KACAV,CAAU,GACb,CAIDE,CAAI,CAAGT,CAAC,CAACiC,CAAD,CAAR,CAGA,GAAIhC,CAAS,CAACwB,UAAV,EAAJ,CAA4B,CACxBV,CAAoB,EACvB,CACJ,CA7BE,CA+BV,CA9MK,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 .\n\n/**\n * A javascript module to handle calendar drag and drop in the calendar\n * month view navigation.\n *\n * This code is run each time the calendar month view is re-rendered. We\n * only register the event handlers once per page load so that the in place\n * DOM updates that happen on month change don't continue to register handlers.\n *\n * @module core_calendar/month_navigation_drag_drop\n * @class month_navigation_drag_drop\n * @package core_calendar\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core_calendar/drag_drop_data_store',\n ],\n function(\n $,\n DataStore\n ) {\n\n var SELECTORS = {\n DRAGGABLE: '[draggable=\"true\"][data-region=\"event-item\"]',\n DROP_ZONE: '[data-drop-zone=\"nav-link\"]',\n };\n var HOVER_CLASS = 'bg-primary text-white';\n var TARGET_CLASS = 'drop-target';\n var HOVER_TIME = 1000; // 1 second hover to change month.\n\n // We store some static variables at the module level because this\n // module is called each time the calendar month view is reloaded but\n // we want some actions to only occur ones.\n\n /* @var {bool} registered If the event listeners have been added */\n var registered = false;\n /* @var {int} hoverTimer The timeout id of any timeout waiting for hover */\n var hoverTimer = null;\n /* @var {object} root The root nav element we're operating on */\n var root = null;\n\n /**\n * Add or remove the appropriate styling to indicate whether\n * the drop target is being hovered over.\n *\n * @param {object} target The target drop zone element\n * @param {bool} hovered If the element is hovered over ot not\n */\n var updateHoverState = function(target, hovered) {\n if (hovered) {\n target.addClass(HOVER_CLASS);\n } else {\n target.removeClass(HOVER_CLASS);\n }\n };\n\n /**\n * Add some styling to the UI to indicate that the nav links\n * are an acceptable drop target.\n */\n var addDropZoneIndicator = function() {\n root.find(SELECTORS.DROP_ZONE).addClass(TARGET_CLASS);\n };\n\n /**\n * Remove the styling from the nav links.\n */\n var removeDropZoneIndicator = function() {\n root.find(SELECTORS.DROP_ZONE).removeClass(TARGET_CLASS);\n };\n\n /**\n * Get the drop zone target from the event, if one is found.\n *\n * @param {event} e Javascript event\n * @return {object|null}\n */\n var getTargetFromEvent = function(e) {\n var target = $(e.target).closest(SELECTORS.DROP_ZONE);\n return (target.length) ? target : null;\n };\n\n /**\n * This will add a visual indicator to the calendar UI to\n * indicate which nav link is a valid drop zone.\n */\n var dragstartHandler = function(e) {\n // Make sure the drag event is for a calendar event.\n var eventElement = $(e.target).closest(SELECTORS.DRAGGABLE);\n\n if (eventElement.length) {\n addDropZoneIndicator();\n }\n };\n\n /**\n * Update the hover state of the target nav element when\n * the user is dragging an event over it.\n *\n * This will add a visual indicator to the calendar UI to\n * indicate which nav link is being hovered.\n *\n * @param {event} e The dragover event\n */\n var dragoverHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n e.preventDefault();\n var target = getTargetFromEvent(e);\n\n if (!target) {\n return;\n }\n\n // If we're not draggin a calendar event then\n // ignore it.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n if (!hoverTimer) {\n hoverTimer = setTimeout(function() {\n target.click();\n hoverTimer = null;\n }, HOVER_TIME);\n }\n\n updateHoverState(target, true);\n removeDropZoneIndicator();\n };\n\n /**\n * Update the hover state of the target nav element that was\n * previously dragged over but has is no longer a drag target.\n *\n * This will remove the visual indicator from the calendar UI\n * that was added by the dragoverHandler.\n *\n * @param {event} e The dragstart event\n */\n var dragleaveHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n var target = getTargetFromEvent(e);\n\n if (!target) {\n return;\n }\n\n if (hoverTimer) {\n clearTimeout(hoverTimer);\n hoverTimer = null;\n }\n\n updateHoverState(target, false);\n addDropZoneIndicator();\n e.preventDefault();\n };\n\n /**\n * Remove the visual indicator from the calendar UI that was\n * added by the dragoverHandler.\n *\n * @param {event} e The drop event\n */\n var dropHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n removeDropZoneIndicator();\n var target = getTargetFromEvent(e);\n\n if (!target) {\n return;\n }\n\n updateHoverState(target, false);\n e.preventDefault();\n };\n\n return {\n /**\n * Initialise the event handlers for the drag events.\n *\n * @param {object} rootElement The element containing calendar nav links\n */\n init: function(rootElement) {\n // Only register the handlers once on the first load.\n if (!registered) {\n // These handlers are only added the first time the module\n // is loaded because we don't want to have a new listener\n // added each time the \"init\" function is called otherwise we'll\n // end up with lots of stale handlers.\n document.addEventListener('dragstart', dragstartHandler, false);\n document.addEventListener('dragover', dragoverHandler, false);\n document.addEventListener('dragleave', dragleaveHandler, false);\n document.addEventListener('drop', dropHandler, false);\n document.addEventListener('dragend', removeDropZoneIndicator, false);\n registered = true;\n }\n\n // Update the module variable to operate on the given\n // root element.\n root = $(rootElement);\n\n // If we're currently dragging then add the indicators.\n if (DataStore.hasEventId()) {\n addDropZoneIndicator();\n }\n },\n };\n});\n"],"file":"month_navigation_drag_drop.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/month_navigation_drag_drop.js"],"names":["define","$","DataStore","SELECTORS","DRAGGABLE","DROP_ZONE","HOVER_CLASS","TARGET_CLASS","registered","hoverTimer","root","updateHoverState","target","hovered","addClass","removeClass","addDropZoneIndicator","find","removeDropZoneIndicator","getTargetFromEvent","e","closest","length","dragstartHandler","eventElement","dragoverHandler","hasEventId","preventDefault","setTimeout","click","dragleaveHandler","clearTimeout","dropHandler","init","rootElement","document","addEventListener"],"mappings":"AA4BAA,OAAM,4CAAC,CACK,QADL,CAEK,oCAFL,CAAD,CAIE,SACIC,CADJ,CAEIC,CAFJ,CAGE,IAEFC,CAAAA,CAAS,CAAG,CACZC,SAAS,CAAE,kDADC,CAEZC,SAAS,CAAE,+BAFC,CAFV,CAMFC,CAAW,CAAG,uBANZ,CAOFC,CAAY,CAAG,aAPb,CAeFC,CAAU,GAfR,CAiBFC,CAAU,CAAG,IAjBX,CAmBFC,CAAI,CAAG,IAnBL,CA4BFC,CAAgB,CAAG,SAASC,CAAT,CAAiBC,CAAjB,CAA0B,CAC7C,GAAIA,CAAJ,CAAa,CACTD,CAAM,CAACE,QAAP,CAAgBR,CAAhB,CACH,CAFD,IAEO,CACHM,CAAM,CAACG,WAAP,CAAmBT,CAAnB,CACH,CACJ,CAlCK,CAwCFU,CAAoB,CAAG,UAAW,CAClCN,CAAI,CAACO,IAAL,CAAUd,CAAS,CAACE,SAApB,EAA+BS,QAA/B,CAAwCP,CAAxC,CACH,CA1CK,CA+CFW,CAAuB,CAAG,UAAW,CACrCR,CAAI,CAACO,IAAL,CAAUd,CAAS,CAACE,SAApB,EAA+BU,WAA/B,CAA2CR,CAA3C,CACH,CAjDK,CAyDFY,CAAkB,CAAG,SAASC,CAAT,CAAY,CACjC,GAAIR,CAAAA,CAAM,CAAGX,CAAC,CAACmB,CAAC,CAACR,MAAH,CAAD,CAAYS,OAAZ,CAAoBlB,CAAS,CAACE,SAA9B,CAAb,CACA,MAAQO,CAAAA,CAAM,CAACU,MAAR,CAAkBV,CAAlB,CAA2B,IACrC,CA5DK,CAkEFW,CAAgB,CAAG,SAASH,CAAT,CAAY,CAE/B,GAAII,CAAAA,CAAY,CAAGvB,CAAC,CAACmB,CAAC,CAACR,MAAH,CAAD,CAAYS,OAAZ,CAAoBlB,CAAS,CAACC,SAA9B,CAAnB,CAEA,GAAIoB,CA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HM,IAAI,CAAE,cAASC,CAAT,CAAsB,CAExB,GAAI,CAAC1B,CAAL,CAAiB,CAKb2B,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,CAAuCb,CAAvC,KACAY,QAAQ,CAACC,gBAAT,CAA0B,UAA1B,CAAsCX,CAAtC,KACAU,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,CAAuCN,CAAvC,KACAK,QAAQ,CAACC,gBAAT,CAA0B,MAA1B,CAAkCJ,CAAlC,KACAG,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,CAAqClB,CAArC,KACAV,CAAU,GACb,CAIDE,CAAI,CAAGT,CAAC,CAACiC,CAAD,CAAR,CAGA,GAAIhC,CAAS,CAACwB,UAAV,EAAJ,CAA4B,CACxBV,CAAoB,EACvB,CACJ,CA7BE,CA+BV,CA9MK,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 .\n\n/**\n * A javascript module to handle calendar drag and drop in the calendar\n * month view navigation.\n *\n * This code is run each time the calendar month view is re-rendered. We\n * only register the event handlers once per page load so that the in place\n * DOM updates that happen on month change don't continue to register handlers.\n *\n * @module core_calendar/month_navigation_drag_drop\n * @class month_navigation_drag_drop\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core_calendar/drag_drop_data_store',\n ],\n function(\n $,\n DataStore\n ) {\n\n var SELECTORS = {\n DRAGGABLE: '[draggable=\"true\"][data-region=\"event-item\"]',\n DROP_ZONE: '[data-drop-zone=\"nav-link\"]',\n };\n var HOVER_CLASS = 'bg-primary text-white';\n var TARGET_CLASS = 'drop-target';\n var HOVER_TIME = 1000; // 1 second hover to change month.\n\n // We store some static variables at the module level because this\n // module is called each time the calendar month view is reloaded but\n // we want some actions to only occur ones.\n\n /* @var {bool} registered If the event listeners have been added */\n var registered = false;\n /* @var {int} hoverTimer The timeout id of any timeout waiting for hover */\n var hoverTimer = null;\n /* @var {object} root The root nav element we're operating on */\n var root = null;\n\n /**\n * Add or remove the appropriate styling to indicate whether\n * the drop target is being hovered over.\n *\n * @param {object} target The target drop zone element\n * @param {bool} hovered If the element is hovered over ot not\n */\n var updateHoverState = function(target, hovered) {\n if (hovered) {\n target.addClass(HOVER_CLASS);\n } else {\n target.removeClass(HOVER_CLASS);\n }\n };\n\n /**\n * Add some styling to the UI to indicate that the nav links\n * are an acceptable drop target.\n */\n var addDropZoneIndicator = function() {\n root.find(SELECTORS.DROP_ZONE).addClass(TARGET_CLASS);\n };\n\n /**\n * Remove the styling from the nav links.\n */\n var removeDropZoneIndicator = function() {\n root.find(SELECTORS.DROP_ZONE).removeClass(TARGET_CLASS);\n };\n\n /**\n * Get the drop zone target from the event, if one is found.\n *\n * @param {event} e Javascript event\n * @return {object|null}\n */\n var getTargetFromEvent = function(e) {\n var target = $(e.target).closest(SELECTORS.DROP_ZONE);\n return (target.length) ? target : null;\n };\n\n /**\n * This will add a visual indicator to the calendar UI to\n * indicate which nav link is a valid drop zone.\n */\n var dragstartHandler = function(e) {\n // Make sure the drag event is for a calendar event.\n var eventElement = $(e.target).closest(SELECTORS.DRAGGABLE);\n\n if (eventElement.length) {\n addDropZoneIndicator();\n }\n };\n\n /**\n * Update the hover state of the target nav element when\n * the user is dragging an event over it.\n *\n * This will add a visual indicator to the calendar UI to\n * indicate which nav link is being hovered.\n *\n * @param {event} e The dragover event\n */\n var dragoverHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n e.preventDefault();\n var target = getTargetFromEvent(e);\n\n if (!target) {\n return;\n }\n\n // If we're not draggin a calendar event then\n // ignore it.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n if (!hoverTimer) {\n hoverTimer = setTimeout(function() {\n target.click();\n hoverTimer = null;\n }, HOVER_TIME);\n }\n\n updateHoverState(target, true);\n removeDropZoneIndicator();\n };\n\n /**\n * Update the hover state of the target nav element that was\n * previously dragged over but has is no longer a drag target.\n *\n * This will remove the visual indicator from the calendar UI\n * that was added by the dragoverHandler.\n *\n * @param {event} e The dragstart event\n */\n var dragleaveHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n var target = getTargetFromEvent(e);\n\n if (!target) {\n return;\n }\n\n if (hoverTimer) {\n clearTimeout(hoverTimer);\n hoverTimer = null;\n }\n\n updateHoverState(target, false);\n addDropZoneIndicator();\n e.preventDefault();\n };\n\n /**\n * Remove the visual indicator from the calendar UI that was\n * added by the dragoverHandler.\n *\n * @param {event} e The drop event\n */\n var dropHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n removeDropZoneIndicator();\n var target = getTargetFromEvent(e);\n\n if (!target) {\n return;\n }\n\n updateHoverState(target, false);\n e.preventDefault();\n };\n\n return {\n /**\n * Initialise the event handlers for the drag events.\n *\n * @param {object} rootElement The element containing calendar nav links\n */\n init: function(rootElement) {\n // Only register the handlers once on the first load.\n if (!registered) {\n // These handlers are only added the first time the module\n // is loaded because we don't want to have a new listener\n // added each time the \"init\" function is called otherwise we'll\n // end up with lots of stale handlers.\n document.addEventListener('dragstart', dragstartHandler, false);\n document.addEventListener('dragover', dragoverHandler, false);\n document.addEventListener('dragleave', dragleaveHandler, false);\n document.addEventListener('drop', dropHandler, false);\n document.addEventListener('dragend', removeDropZoneIndicator, false);\n registered = true;\n }\n\n // Update the module variable to operate on the given\n // root element.\n root = $(rootElement);\n\n // If we're currently dragging then add the indicators.\n if (DataStore.hasEventId()) {\n addDropZoneIndicator();\n }\n },\n };\n});\n"],"file":"month_navigation_drag_drop.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/month_view_drag_drop.min.js.map b/calendar/amd/build/month_view_drag_drop.min.js.map
index a0053f93ee2..65f3f5d8a5a 100644
--- a/calendar/amd/build/month_view_drag_drop.min.js.map
+++ b/calendar/amd/build/month_view_drag_drop.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/month_view_drag_drop.js"],"names":["define","$","Notification","Str","CalendarEvents","DataStore","SELECTORS","ROOT","DRAGGABLE","DROP_ZONE","WEEK","INVALID_DROP_ZONE_CLASS","INVALID_HOVER_CLASS","VALID_HOVER_CLASS","ALL_CLASSES","registered","getDropZoneFromEvent","e","dropZone","target","closest","length","isValidDropZone","dropTimestamp","attr","minTimestart","getMinTimestart","maxTimestart","getMaxTimestart","getDropZoneError","getMinError","getMaxError","clearAllDropZonesState","find","each","index","removeClass","updateHoverState","hovered","count","getDurationDays","valid","addClass","nextDropZone","next","nextWeek","children","first","updateAllDropZonesState","dragstartHandler","draggableElement","eventElement","eventId","minError","maxError","eventsSelector","duration","setEventId","setDurationDays","setMinTimestart","setMaxTimestart","setMinError","setMaxError","dataTransfer","effectAllowed","dropEffect","setData","dragoverHandler","hasEventId","preventDefault","dragleaveHandler","dropHandler","clearAll","getEventId","eventElementSelector","origin","trigger","moveEvent","message","get_string","then","string","exception","name","dragendHandler","calendarMonthChangedHandler","init","document","addEventListener","on","monthChanged"],"mappings":"AAyBAA,OAAM,sCAAC,CACK,QADL,CAEK,mBAFL,CAGK,UAHL,CAIK,sBAJL,CAKK,oCALL,CAAD,CAOE,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAME,IAEFC,CAAAA,CAAS,CAAG,CACZC,IAAI,CAAE,0BADM,CAEZC,SAAS,CAAE,kDAFC,CAGZC,SAAS,CAAE,qCAHC,CAIZC,IAAI,CAAE,mCAJM,CAFV,CAQFC,CAAuB,C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5B/E,CAAS,CAACmE,QAAV,GACAxC,CAAsB,EACzB,CA/UK,CAsVFqD,CAA2B,CAAG,UAAW,CACzCrC,CAAuB,EAC1B,CAxVK,CA0VN,MAAO,CAIHsC,IAAI,CAAE,eAAW,CACb,GAAI,CAACvE,CAAL,CAAiB,CAKbwE,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,CAAuCvC,CAAvC,KACAsC,QAAQ,CAACC,gBAAT,CAA0B,UAA1B,CAAsCrB,CAAtC,KACAoB,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,CAAuClB,CAAvC,KACAiB,QAAQ,CAACC,gBAAT,CAA0B,MAA1B,CAAkCjB,CAAlC,KACAgB,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,CAAqCJ,CAArC,KACAnF,CAAC,CAAC,MAAD,CAAD,CAAUwF,EAAV,CAAarF,CAAc,CAACsF,YAA5B,CAA0CL,CAA1C,EACAtE,CAAU,GACb,CACJ,CAlBE,CAoBV,CA3XK,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 .\n\n/**\n * A javascript module to handle calendar drag and drop in the calendar\n * month view.\n *\n * @module core_calendar/month_view_drag_drop\n * @class month_view_drag_drop\n * @package core_calendar\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/notification',\n 'core/str',\n 'core_calendar/events',\n 'core_calendar/drag_drop_data_store'\n ],\n function(\n $,\n Notification,\n Str,\n CalendarEvents,\n DataStore\n ) {\n\n var SELECTORS = {\n ROOT: \"[data-region='calendar']\",\n DRAGGABLE: '[draggable=\"true\"][data-region=\"event-item\"]',\n DROP_ZONE: '[data-drop-zone=\"month-view-day\"]',\n WEEK: '[data-region=\"month-view-week\"]',\n };\n var INVALID_DROP_ZONE_CLASS = 'bg-faded';\n var INVALID_HOVER_CLASS = 'bg-danger text-white';\n var VALID_HOVER_CLASS = 'bg-primary text-white';\n var ALL_CLASSES = INVALID_DROP_ZONE_CLASS + ' ' + INVALID_HOVER_CLASS + ' ' + VALID_HOVER_CLASS;\n /* @var {bool} registered If the event listeners have been added */\n var registered = false;\n\n /**\n * Get the correct drop zone element from the given javascript\n * event.\n *\n * @param {event} e The javascript event\n * @return {object|null}\n */\n var getDropZoneFromEvent = function(e) {\n var dropZone = $(e.target).closest(SELECTORS.DROP_ZONE);\n return (dropZone.length) ? dropZone : null;\n };\n\n /**\n * Determine if the given dropzone element is within the acceptable\n * time range.\n *\n * The drop zone timestamp is midnight on that day so we should check\n * that the event's acceptable timestart value\n *\n * @param {object} dropZone The drop zone day from the calendar\n * @return {bool}\n */\n var isValidDropZone = function(dropZone) {\n var dropTimestamp = dropZone.attr('data-day-timestamp');\n var minTimestart = DataStore.getMinTimestart();\n var maxTimestart = DataStore.getMaxTimestart();\n\n if (minTimestart && minTimestart > dropTimestamp) {\n return false;\n }\n\n if (maxTimestart && maxTimestart < dropTimestamp) {\n return false;\n }\n\n return true;\n };\n\n /**\n * Get the error string to display for a given drop zone element\n * if it is invalid.\n *\n * @param {object} dropZone The drop zone day from the calendar\n * @return {string}\n */\n var getDropZoneError = function(dropZone) {\n var dropTimestamp = dropZone.attr('data-day-timestamp');\n var minTimestart = DataStore.getMinTimestart();\n var maxTimestart = DataStore.getMaxTimestart();\n\n if (minTimestart && minTimestart > dropTimestamp) {\n return DataStore.getMinError();\n }\n\n if (maxTimestart && maxTimestart < dropTimestamp) {\n return DataStore.getMaxError();\n }\n\n return null;\n };\n\n /**\n * Remove all of the styling from each of the drop zones in the calendar.\n */\n var clearAllDropZonesState = function() {\n $(SELECTORS.ROOT).find(SELECTORS.DROP_ZONE).each(function(index, dropZone) {\n dropZone = $(dropZone);\n dropZone.removeClass(ALL_CLASSES);\n });\n };\n\n /**\n * Update the hover state for the event in the calendar to reflect\n * which days the event will be moved to.\n *\n * If the drop zone is not being hovered then it will apply some\n * styling to reflect whether the drop zone is a valid or invalid\n * drop place for the current dragging event.\n *\n * This funciton supports events spanning multiple days and will\n * recurse to highlight (or remove highlight) each of the days\n * that the event will be moved to.\n *\n * For example: An event with a duration of 3 days will have\n * 3 days highlighted when it's dragged elsewhere in the calendar.\n * The current drag target and the 2 days following it (including\n * wrapping to the next week if necessary).\n *\n * @param {string|object} target The drag target element\n * @param {bool} hovered If the target is hovered or not\n * @param {int} count How many days to highlight (default to duration)\n */\n var updateHoverState = function(dropZone, hovered, count) {\n if (typeof count === 'undefined') {\n // This is how many days we need to highlight.\n count = DataStore.getDurationDays();\n }\n\n var valid = isValidDropZone(dropZone);\n dropZone.removeClass(ALL_CLASSES);\n\n if (hovered) {\n\n if (valid) {\n dropZone.addClass(VALID_HOVER_CLASS);\n } else {\n dropZone.addClass(INVALID_HOVER_CLASS);\n }\n } else {\n dropZone.removeClass(VALID_HOVER_CLASS + ' ' + INVALID_HOVER_CLASS);\n\n if (!valid) {\n dropZone.addClass(INVALID_DROP_ZONE_CLASS);\n }\n }\n\n count--;\n\n // If we've still got days to highlight then we should\n // find the next day.\n if (count > 0) {\n var nextDropZone = dropZone.next();\n\n // If there are no more days in this week then we\n // need to move down to the next week in the calendar.\n if (!nextDropZone.length) {\n var nextWeek = dropZone.closest(SELECTORS.WEEK).next();\n\n if (nextWeek.length) {\n nextDropZone = nextWeek.children(SELECTORS.DROP_ZONE).first();\n }\n }\n\n // If we found another day then let's recursively\n // update it's hover state.\n if (nextDropZone.length) {\n updateHoverState(nextDropZone, hovered, count);\n }\n }\n };\n\n /**\n * Find all of the calendar event drop zones in the calendar and update the display\n * for the user to indicate which zones are valid and invalid.\n */\n var updateAllDropZonesState = function() {\n $(SELECTORS.ROOT).find(SELECTORS.DROP_ZONE).each(function(index, dropZone) {\n dropZone = $(dropZone);\n\n if (!isValidDropZone(dropZone)) {\n updateHoverState(dropZone, false);\n }\n });\n };\n\n\n /**\n * Set up the module level variables to track which event is being\n * dragged and how many days it spans.\n *\n * @param {event} e The dragstart event\n */\n var dragstartHandler = function(e) {\n var target = $(e.target);\n var draggableElement = target.closest(SELECTORS.DRAGGABLE);\n\n if (!draggableElement.length) {\n return;\n }\n\n var eventElement = draggableElement.find('[data-event-id]');\n var eventId = eventElement.attr('data-event-id');\n var minTimestart = draggableElement.attr('data-min-day-timestamp');\n var maxTimestart = draggableElement.attr('data-max-day-timestamp');\n var minError = draggableElement.attr('data-min-day-error');\n var maxError = draggableElement.attr('data-max-day-error');\n var eventsSelector = SELECTORS.ROOT + ' [data-event-id=\"' + eventId + '\"]';\n var duration = $(eventsSelector).length;\n\n DataStore.setEventId(eventId);\n DataStore.setDurationDays(duration);\n\n if (minTimestart) {\n DataStore.setMinTimestart(minTimestart);\n }\n\n if (maxTimestart) {\n DataStore.setMaxTimestart(maxTimestart);\n }\n\n if (minError) {\n DataStore.setMinError(minError);\n }\n\n if (maxError) {\n DataStore.setMaxError(maxError);\n }\n\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.dropEffect = \"move\";\n // Firefox requires a value to be set here or the drag won't\n // work and the dragover handler won't fire.\n e.dataTransfer.setData('text/plain', eventId);\n e.dropEffect = \"move\";\n\n updateAllDropZonesState();\n };\n\n /**\n * Update the hover state of the target day element when\n * the user is dragging an event over it.\n *\n * This will add a visual indicator to the calendar UI to\n * indicate which day(s) the event will be moved to.\n *\n * @param {event} e The dragstart event\n */\n var dragoverHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n e.preventDefault();\n\n var dropZone = getDropZoneFromEvent(e);\n\n if (!dropZone) {\n return;\n }\n\n updateHoverState(dropZone, true);\n };\n\n /**\n * Update the hover state of the target day element that was\n * previously dragged over but has is no longer a drag target.\n *\n * This will remove the visual indicator from the calendar UI\n * that was added by the dragoverHandler.\n *\n * @param {event} e The dragstart event\n */\n var dragleaveHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n var dropZone = getDropZoneFromEvent(e);\n\n if (!dropZone) {\n return;\n }\n\n updateHoverState(dropZone, false);\n e.preventDefault();\n };\n\n /**\n * Determines the event element, origin day, and destination day\n * once the user drops the calendar event. These three bits of data\n * are provided as the payload to the \"moveEvent\" calendar javascript\n * event that is fired.\n *\n * This will remove the visual indicator from the calendar UI\n * that was added by the dragoverHandler.\n *\n * @param {event} e The dragstart event\n */\n var dropHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n var dropZone = getDropZoneFromEvent(e);\n\n if (!dropZone) {\n DataStore.clearAll();\n clearAllDropZonesState();\n return;\n }\n\n if (isValidDropZone(dropZone)) {\n var eventId = DataStore.getEventId();\n var eventElementSelector = SELECTORS.ROOT + ' [data-event-id=\"' + eventId + '\"]';\n var eventElement = $(eventElementSelector);\n var origin = null;\n\n if (eventElement.length) {\n origin = eventElement.closest(SELECTORS.DROP_ZONE);\n }\n\n $('body').trigger(CalendarEvents.moveEvent, [eventId, origin, dropZone]);\n } else {\n // If the drop zone is not valid then there is not need for us to\n // try to process it. Instead we can just show an error to the user.\n var message = getDropZoneError(dropZone);\n Str.get_string('errorinvaliddate', 'calendar').then(function(string) {\n Notification.exception({\n name: string,\n message: message || string\n });\n });\n }\n\n DataStore.clearAll();\n clearAllDropZonesState();\n\n e.preventDefault();\n };\n\n /**\n * Clear the data store and remove the drag indicators from the UI\n * when the drag event has finished.\n */\n var dragendHandler = function() {\n DataStore.clearAll();\n clearAllDropZonesState();\n };\n\n /**\n * Re-render the drop zones in the new month to highlight\n * which areas are or aren't acceptable to drop the calendar\n * event.\n */\n var calendarMonthChangedHandler = function() {\n updateAllDropZonesState();\n };\n\n return {\n /**\n * Initialise the event handlers for the drag events.\n */\n init: function() {\n if (!registered) {\n // These handlers are only added the first time the module\n // is loaded because we don't want to have a new listener\n // added each time the \"init\" function is called otherwise we'll\n // end up with lots of stale handlers.\n document.addEventListener('dragstart', dragstartHandler, false);\n document.addEventListener('dragover', dragoverHandler, false);\n document.addEventListener('dragleave', dragleaveHandler, false);\n document.addEventListener('drop', dropHandler, false);\n document.addEventListener('dragend', dragendHandler, false);\n $('body').on(CalendarEvents.monthChanged, calendarMonthChangedHandler);\n registered = true;\n }\n },\n };\n});\n"],"file":"month_view_drag_drop.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/month_view_drag_drop.js"],"names":["define","$","Notification","Str","CalendarEvents","DataStore","SELECTORS","ROOT","DRAGGABLE","DROP_ZONE","WEEK","INVALID_DROP_ZONE_CLASS","INVALID_HOVER_CLASS","VALID_HOVER_CLASS","ALL_CLASSES","registered","getDropZoneFromEvent","e","dropZone","target","closest","length","isValidDropZone","dropTimestamp","attr","minTimestart","getMinTimestart","maxTimestart","getMaxTimestart","getDropZoneError","getMinError","getMaxError","clearAllDropZonesState","find","each","index","removeClass","updateHoverState","hovered","count","getDurationDays","valid","addClass","nextDropZone","next","nextWeek","children","first","updateAllDropZonesState","dragstartHandler","draggableElement","eventElement","eventId","minError","maxError","eventsSelector","duration","setEventId","setDurationDays","setMinTimestart","setMaxTimestart","setMinError","setMaxError","dataTransfer","effectAllowed","dropEffect","setData","dragoverHandler","hasEventId","preventDefault","dragleaveHandler","dropHandler","clearAll","getEventId","eventElementSelector","origin","trigger","moveEvent","message","get_string","then","string","exception","name","dragendHandler","calendarMonthChangedHandler","init","document","addEventListener","on","monthChanged"],"mappings":"AAwBAA,OAAM,sCAAC,CACK,QADL,CAEK,mBAFL,CAGK,UAHL,CAIK,sBAJL,CAKK,oCALL,CAAD,CAOE,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CA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OAAO,CAAEA,CAAO,EAAIG,CAFD,CAAvB,CAIH,CALD,CAMH,CAED5E,CAAS,CAACmE,QAAV,GACAxC,CAAsB,GAEtBf,CAAC,CAACoD,cAAF,EACH,CAtUK,CA4UFe,CAAc,CAAG,UAAW,CAC5B/E,CAAS,CAACmE,QAAV,GACAxC,CAAsB,EACzB,CA/UK,CAsVFqD,CAA2B,CAAG,UAAW,CACzCrC,CAAuB,EAC1B,CAxVK,CA0VN,MAAO,CAIHsC,IAAI,CAAE,eAAW,CACb,GAAI,CAACvE,CAAL,CAAiB,CAKbwE,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,CAAuCvC,CAAvC,KACAsC,QAAQ,CAACC,gBAAT,CAA0B,UAA1B,CAAsCrB,CAAtC,KACAoB,QAAQ,CAACC,gBAAT,CAA0B,WAA1B,CAAuClB,CAAvC,KACAiB,QAAQ,CAACC,gBAAT,CAA0B,MAA1B,CAAkCjB,CAAlC,KACAgB,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,CAAqCJ,CAArC,KACAnF,CAAC,CAAC,MAAD,CAAD,CAAUwF,EAAV,CAAarF,CAAc,CAACsF,YAA5B,CAA0CL,CAA1C,EACAtE,CAAU,GACb,CACJ,CAlBE,CAoBV,CA3XK,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 .\n\n/**\n * A javascript module to handle calendar drag and drop in the calendar\n * month view.\n *\n * @module core_calendar/month_view_drag_drop\n * @class month_view_drag_drop\n * @copyright 2017 Ryan Wyllie \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/notification',\n 'core/str',\n 'core_calendar/events',\n 'core_calendar/drag_drop_data_store'\n ],\n function(\n $,\n Notification,\n Str,\n CalendarEvents,\n DataStore\n ) {\n\n var SELECTORS = {\n ROOT: \"[data-region='calendar']\",\n DRAGGABLE: '[draggable=\"true\"][data-region=\"event-item\"]',\n DROP_ZONE: '[data-drop-zone=\"month-view-day\"]',\n WEEK: '[data-region=\"month-view-week\"]',\n };\n var INVALID_DROP_ZONE_CLASS = 'bg-faded';\n var INVALID_HOVER_CLASS = 'bg-danger text-white';\n var VALID_HOVER_CLASS = 'bg-primary text-white';\n var ALL_CLASSES = INVALID_DROP_ZONE_CLASS + ' ' + INVALID_HOVER_CLASS + ' ' + VALID_HOVER_CLASS;\n /* @var {bool} registered If the event listeners have been added */\n var registered = false;\n\n /**\n * Get the correct drop zone element from the given javascript\n * event.\n *\n * @param {event} e The javascript event\n * @return {object|null}\n */\n var getDropZoneFromEvent = function(e) {\n var dropZone = $(e.target).closest(SELECTORS.DROP_ZONE);\n return (dropZone.length) ? dropZone : null;\n };\n\n /**\n * Determine if the given dropzone element is within the acceptable\n * time range.\n *\n * The drop zone timestamp is midnight on that day so we should check\n * that the event's acceptable timestart value\n *\n * @param {object} dropZone The drop zone day from the calendar\n * @return {bool}\n */\n var isValidDropZone = function(dropZone) {\n var dropTimestamp = dropZone.attr('data-day-timestamp');\n var minTimestart = DataStore.getMinTimestart();\n var maxTimestart = DataStore.getMaxTimestart();\n\n if (minTimestart && minTimestart > dropTimestamp) {\n return false;\n }\n\n if (maxTimestart && maxTimestart < dropTimestamp) {\n return false;\n }\n\n return true;\n };\n\n /**\n * Get the error string to display for a given drop zone element\n * if it is invalid.\n *\n * @param {object} dropZone The drop zone day from the calendar\n * @return {string}\n */\n var getDropZoneError = function(dropZone) {\n var dropTimestamp = dropZone.attr('data-day-timestamp');\n var minTimestart = DataStore.getMinTimestart();\n var maxTimestart = DataStore.getMaxTimestart();\n\n if (minTimestart && minTimestart > dropTimestamp) {\n return DataStore.getMinError();\n }\n\n if (maxTimestart && maxTimestart < dropTimestamp) {\n return DataStore.getMaxError();\n }\n\n return null;\n };\n\n /**\n * Remove all of the styling from each of the drop zones in the calendar.\n */\n var clearAllDropZonesState = function() {\n $(SELECTORS.ROOT).find(SELECTORS.DROP_ZONE).each(function(index, dropZone) {\n dropZone = $(dropZone);\n dropZone.removeClass(ALL_CLASSES);\n });\n };\n\n /**\n * Update the hover state for the event in the calendar to reflect\n * which days the event will be moved to.\n *\n * If the drop zone is not being hovered then it will apply some\n * styling to reflect whether the drop zone is a valid or invalid\n * drop place for the current dragging event.\n *\n * This funciton supports events spanning multiple days and will\n * recurse to highlight (or remove highlight) each of the days\n * that the event will be moved to.\n *\n * For example: An event with a duration of 3 days will have\n * 3 days highlighted when it's dragged elsewhere in the calendar.\n * The current drag target and the 2 days following it (including\n * wrapping to the next week if necessary).\n *\n * @param {string|object} target The drag target element\n * @param {bool} hovered If the target is hovered or not\n * @param {int} count How many days to highlight (default to duration)\n */\n var updateHoverState = function(dropZone, hovered, count) {\n if (typeof count === 'undefined') {\n // This is how many days we need to highlight.\n count = DataStore.getDurationDays();\n }\n\n var valid = isValidDropZone(dropZone);\n dropZone.removeClass(ALL_CLASSES);\n\n if (hovered) {\n\n if (valid) {\n dropZone.addClass(VALID_HOVER_CLASS);\n } else {\n dropZone.addClass(INVALID_HOVER_CLASS);\n }\n } else {\n dropZone.removeClass(VALID_HOVER_CLASS + ' ' + INVALID_HOVER_CLASS);\n\n if (!valid) {\n dropZone.addClass(INVALID_DROP_ZONE_CLASS);\n }\n }\n\n count--;\n\n // If we've still got days to highlight then we should\n // find the next day.\n if (count > 0) {\n var nextDropZone = dropZone.next();\n\n // If there are no more days in this week then we\n // need to move down to the next week in the calendar.\n if (!nextDropZone.length) {\n var nextWeek = dropZone.closest(SELECTORS.WEEK).next();\n\n if (nextWeek.length) {\n nextDropZone = nextWeek.children(SELECTORS.DROP_ZONE).first();\n }\n }\n\n // If we found another day then let's recursively\n // update it's hover state.\n if (nextDropZone.length) {\n updateHoverState(nextDropZone, hovered, count);\n }\n }\n };\n\n /**\n * Find all of the calendar event drop zones in the calendar and update the display\n * for the user to indicate which zones are valid and invalid.\n */\n var updateAllDropZonesState = function() {\n $(SELECTORS.ROOT).find(SELECTORS.DROP_ZONE).each(function(index, dropZone) {\n dropZone = $(dropZone);\n\n if (!isValidDropZone(dropZone)) {\n updateHoverState(dropZone, false);\n }\n });\n };\n\n\n /**\n * Set up the module level variables to track which event is being\n * dragged and how many days it spans.\n *\n * @param {event} e The dragstart event\n */\n var dragstartHandler = function(e) {\n var target = $(e.target);\n var draggableElement = target.closest(SELECTORS.DRAGGABLE);\n\n if (!draggableElement.length) {\n return;\n }\n\n var eventElement = draggableElement.find('[data-event-id]');\n var eventId = eventElement.attr('data-event-id');\n var minTimestart = draggableElement.attr('data-min-day-timestamp');\n var maxTimestart = draggableElement.attr('data-max-day-timestamp');\n var minError = draggableElement.attr('data-min-day-error');\n var maxError = draggableElement.attr('data-max-day-error');\n var eventsSelector = SELECTORS.ROOT + ' [data-event-id=\"' + eventId + '\"]';\n var duration = $(eventsSelector).length;\n\n DataStore.setEventId(eventId);\n DataStore.setDurationDays(duration);\n\n if (minTimestart) {\n DataStore.setMinTimestart(minTimestart);\n }\n\n if (maxTimestart) {\n DataStore.setMaxTimestart(maxTimestart);\n }\n\n if (minError) {\n DataStore.setMinError(minError);\n }\n\n if (maxError) {\n DataStore.setMaxError(maxError);\n }\n\n e.dataTransfer.effectAllowed = \"move\";\n e.dataTransfer.dropEffect = \"move\";\n // Firefox requires a value to be set here or the drag won't\n // work and the dragover handler won't fire.\n e.dataTransfer.setData('text/plain', eventId);\n e.dropEffect = \"move\";\n\n updateAllDropZonesState();\n };\n\n /**\n * Update the hover state of the target day element when\n * the user is dragging an event over it.\n *\n * This will add a visual indicator to the calendar UI to\n * indicate which day(s) the event will be moved to.\n *\n * @param {event} e The dragstart event\n */\n var dragoverHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n e.preventDefault();\n\n var dropZone = getDropZoneFromEvent(e);\n\n if (!dropZone) {\n return;\n }\n\n updateHoverState(dropZone, true);\n };\n\n /**\n * Update the hover state of the target day element that was\n * previously dragged over but has is no longer a drag target.\n *\n * This will remove the visual indicator from the calendar UI\n * that was added by the dragoverHandler.\n *\n * @param {event} e The dragstart event\n */\n var dragleaveHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n var dropZone = getDropZoneFromEvent(e);\n\n if (!dropZone) {\n return;\n }\n\n updateHoverState(dropZone, false);\n e.preventDefault();\n };\n\n /**\n * Determines the event element, origin day, and destination day\n * once the user drops the calendar event. These three bits of data\n * are provided as the payload to the \"moveEvent\" calendar javascript\n * event that is fired.\n *\n * This will remove the visual indicator from the calendar UI\n * that was added by the dragoverHandler.\n *\n * @param {event} e The dragstart event\n */\n var dropHandler = function(e) {\n // Ignore dragging of non calendar events.\n if (!DataStore.hasEventId()) {\n return;\n }\n\n var dropZone = getDropZoneFromEvent(e);\n\n if (!dropZone) {\n DataStore.clearAll();\n clearAllDropZonesState();\n return;\n }\n\n if (isValidDropZone(dropZone)) {\n var eventId = DataStore.getEventId();\n var eventElementSelector = SELECTORS.ROOT + ' [data-event-id=\"' + eventId + '\"]';\n var eventElement = $(eventElementSelector);\n var origin = null;\n\n if (eventElement.length) {\n origin = eventElement.closest(SELECTORS.DROP_ZONE);\n }\n\n $('body').trigger(CalendarEvents.moveEvent, [eventId, origin, dropZone]);\n } else {\n // If the drop zone is not valid then there is not need for us to\n // try to process it. Instead we can just show an error to the user.\n var message = getDropZoneError(dropZone);\n Str.get_string('errorinvaliddate', 'calendar').then(function(string) {\n Notification.exception({\n name: string,\n message: message || string\n });\n });\n }\n\n DataStore.clearAll();\n clearAllDropZonesState();\n\n e.preventDefault();\n };\n\n /**\n * Clear the data store and remove the drag indicators from the UI\n * when the drag event has finished.\n */\n var dragendHandler = function() {\n DataStore.clearAll();\n clearAllDropZonesState();\n };\n\n /**\n * Re-render the drop zones in the new month to highlight\n * which areas are or aren't acceptable to drop the calendar\n * event.\n */\n var calendarMonthChangedHandler = function() {\n updateAllDropZonesState();\n };\n\n return {\n /**\n * Initialise the event handlers for the drag events.\n */\n init: function() {\n if (!registered) {\n // These handlers are only added the first time the module\n // is loaded because we don't want to have a new listener\n // added each time the \"init\" function is called otherwise we'll\n // end up with lots of stale handlers.\n document.addEventListener('dragstart', dragstartHandler, false);\n document.addEventListener('dragover', dragoverHandler, false);\n document.addEventListener('dragleave', dragleaveHandler, false);\n document.addEventListener('drop', dropHandler, false);\n document.addEventListener('dragend', dragendHandler, false);\n $('body').on(CalendarEvents.monthChanged, calendarMonthChangedHandler);\n registered = true;\n }\n },\n };\n});\n"],"file":"month_view_drag_drop.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/repository.min.js.map b/calendar/amd/build/repository.min.js.map
index 1cace37b8a2..8792399bd7d 100644
--- a/calendar/amd/build/repository.min.js.map
+++ b/calendar/amd/build/repository.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/repository.js"],"names":["deleteEvent","eventId","deleteSeries","Ajax","call","methodname","args","events","eventid","repeat","getEventById","submitCreateUpdateForm","formData","formdata","getCalendarMonthData","year","month","courseId","categoryId","includeNavigation","mini","day","courseid","categoryid","includenavigation","getCalendarDayData","updateEventStartDay","dayTimestamp","daytimestamp","getCalendarUpcomingData","getCourseGroupsData"],"mappings":"sTAwBA,uDAUO,GAAMA,CAAAA,CAAW,CAAG,SAACC,CAAD,CAAmC,IAAzBC,CAAAA,CAAyB,2DAW1D,MAAOC,WAAKC,IAAL,CAAU,CAVD,CACZC,UAAU,CAAE,sCADA,CAEZC,IAAI,CAAE,CACFC,MAAM,CAAE,CAAC,CACLC,OAAO,CAAEP,CADJ,CAELQ,MAAM,CAAEP,CAFH,CAAD,CADN,CAFM,CAUC,CAAV,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,CAFM,CAWC,CAAV,EAAqB,CAArB,CACV,CAbM,C,uBAwBA,GAAMQ,CAAAA,CAAmB,CAAG,SAACzB,CAAD,CAAU0B,CAAV,CAA2B,CAS1D,MAAOxB,WAAKC,IAAL,CAAU,CARD,CACZC,UAAU,CAAE,sCADA,CAEZC,IAAI,CAAE,CACFE,OAAO,CAAEP,CADP,CAEF2B,YAAY,CAAED,CAFZ,CAFM,CAQC,CAAV,EAAqB,CAArB,CACV,CAVM,C,wBAoBA,GAAME,CAAAA,CAAuB,CAAG,SAACZ,CAAD,CAAWC,CAAX,CAA0B,CAS7D,MAAOf,WAAKC,IAAL,CAAU,CARD,CACZC,UAAU,CAAE,0CADA,CAEZC,IAAI,CAAE,CACFgB,QAAQ,CAAEL,CADR,CAEFM,UAAU,CAAEL,CAFV,CAFM,CAQC,CAAV,EAAqB,CAArB,CACV,CAVM,C,4BAkBA,GAAMY,CAAAA,CAAmB,CAAG,SAACb,CAAD,CAAc,CAQ7C,MAAOd,WAAKC,IAAL,CAAU,CAPD,CACZC,UAAU,CAAE,8BADA,CAEZC,IAAI,CAAE,CACFgB,QAAQ,CAAEL,CADR,CAFM,CAOC,CAAV,EAAqB,CAArB,CACV,CATM,C","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 .\n\n/**\n * A javascript module to handle calendar ajax actions.\n *\n * @module core_calendar/repository\n * @class repository\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport Ajax from 'core/ajax';\n\n/**\n * Delete a calendar event.\n *\n * @method deleteEvent\n * @param {number} eventId The event id.\n * @param {boolean} deleteSeries Whether to delete all events in the series\n * @return {promise} Resolved with requested calendar event\n */\nexport const deleteEvent = (eventId, deleteSeries = false) => {\n const request = {\n methodname: 'core_calendar_delete_calendar_events',\n args: {\n events: [{\n eventid: eventId,\n repeat: deleteSeries,\n }]\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get a calendar event by id.\n *\n * @method getEventById\n * @param {number} eventId The event id.\n * @return {promise} Resolved with requested calendar event\n */\nexport const getEventById = (eventId) => {\n\n const request = {\n methodname: 'core_calendar_get_calendar_event_by_id',\n args: {\n eventid: eventId\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Submit the form data for the event form.\n *\n * @method submitCreateUpdateForm\n * @param {string} formData The URL encoded values from the form\n * @return {promise} Resolved with the new or edited event\n */\nexport const submitCreateUpdateForm = (formData) => {\n const request = {\n methodname: 'core_calendar_submit_create_update_form',\n args: {\n formdata: formData\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar data for the month view.\n *\n * @method getCalendarMonthData\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The course id.\n * @param {number} categoryId The category id.\n * @param {boolean} includeNavigation Whether to include navigation.\n * @param {boolean} mini Whether the month is in mini view.\n * @param {number} day Day (optional)\n * @return {promise} Resolved with the month view data.\n */\nexport const getCalendarMonthData = (year, month, courseId, categoryId, includeNavigation, mini, day = 1) => {\n const request = {\n methodname: 'core_calendar_get_calendar_monthly_view',\n args: {\n year,\n month,\n courseid: courseId,\n categoryid: categoryId,\n includenavigation: includeNavigation,\n mini,\n day,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar data for the day view.\n *\n * @method getCalendarDayData\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} day Day\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise} Resolved with the day view data.\n */\nexport const getCalendarDayData = (year, month, day, courseId, categoryId) => {\n const request = {\n methodname: 'core_calendar_get_calendar_day_view',\n args: {\n year,\n month,\n day,\n courseid: courseId,\n categoryid: categoryId,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Change the start day for the given event id. The day timestamp\n * only has to be any time during the target day because only the\n * date information is extracted, the time of the day is ignored.\n *\n * @param {int} eventId The id of the event to update\n * @param {int} dayTimestamp A timestamp for some time during the target day\n * @return {promise}\n */\nexport const updateEventStartDay = (eventId, dayTimestamp) => {\n const request = {\n methodname: 'core_calendar_update_event_start_day',\n args: {\n eventid: eventId,\n daytimestamp: dayTimestamp\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar upcoming data.\n *\n * @method getCalendarUpcomingData\n * @param {number} courseId The course id.\n * @param {number} categoryId The category id.\n * @return {promise} Resolved with the month view data.\n */\nexport const getCalendarUpcomingData = (courseId, categoryId) => {\n const request = {\n methodname: 'core_calendar_get_calendar_upcoming_view',\n args: {\n courseid: courseId,\n categoryid: categoryId,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get the groups by course id.\n *\n * @param {Number} courseId The course id to fetch the groups from.\n * @return {promise} Resolved with the course groups.\n */\nexport const getCourseGroupsData = (courseId) => {\n const request = {\n methodname: 'core_group_get_course_groups',\n args: {\n courseid: courseId\n }\n };\n\n return Ajax.call([request])[0];\n};\n"],"file":"repository.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/repository.js"],"names":["deleteEvent","eventId","deleteSeries","Ajax","call","methodname","args","events","eventid","repeat","getEventById","submitCreateUpdateForm","formData","formdata","getCalendarMonthData","year","month","courseId","categoryId","includeNavigation","mini","day","courseid","categoryid","includenavigation","getCalendarDayData","updateEventStartDay","dayTimestamp","daytimestamp","getCalendarUpcomingData","getCourseGroupsData"],"mappings":"sTAuBA,uDAUO,GAAMA,CAAAA,CAAW,CAAG,SAACC,CAAD,CAAmC,IAAzBC,CAAAA,CAAyB,2DAW1D,MAAOC,WAAKC,I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UAAU,CAAE,qCADA,CAEZC,IAAI,CAAE,CACFS,IAAI,CAAJA,CADE,CAEFC,KAAK,CAALA,CAFE,CAGFK,GAAG,CAAHA,CAHE,CAIFC,QAAQ,CAAEL,CAJR,CAKFM,UAAU,CAAEL,CALV,CAFM,CAWC,CAAV,EAAqB,CAArB,CACV,CAbM,C,uBAwBA,GAAMQ,CAAAA,CAAmB,CAAG,SAACzB,CAAD,CAAU0B,CAAV,CAA2B,CAS1D,MAAOxB,WAAKC,IAAL,CAAU,CARD,CACZC,UAAU,CAAE,sCADA,CAEZC,IAAI,CAAE,CACFE,OAAO,CAAEP,CADP,CAEF2B,YAAY,CAAED,CAFZ,CAFM,CAQC,CAAV,EAAqB,CAArB,CACV,CAVM,C,wBAoBA,GAAME,CAAAA,CAAuB,CAAG,SAACZ,CAAD,CAAWC,CAAX,CAA0B,CAS7D,MAAOf,WAAKC,IAAL,CAAU,CARD,CACZC,UAAU,CAAE,0CADA,CAEZC,IAAI,CAAE,CACFgB,QAAQ,CAAEL,CADR,CAEFM,UAAU,CAAEL,CAFV,CAFM,CAQC,CAAV,EAAqB,CAArB,CACV,CAVM,C,4BAkBA,GAAMY,CAAAA,CAAmB,CAAG,SAACb,CAAD,CAAc,CAQ7C,MAAOd,WAAKC,IAAL,CAAU,CAPD,CACZC,UAAU,CAAE,8BADA,CAEZC,IAAI,CAAE,CACFgB,QAAQ,CAAEL,CADR,CAFM,CAOC,CAAV,EAAqB,CAArB,CACV,CATM,C","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 .\n\n/**\n * A javascript module to handle calendar ajax actions.\n *\n * @module core_calendar/repository\n * @class repository\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport Ajax from 'core/ajax';\n\n/**\n * Delete a calendar event.\n *\n * @method deleteEvent\n * @param {number} eventId The event id.\n * @param {boolean} deleteSeries Whether to delete all events in the series\n * @return {promise} Resolved with requested calendar event\n */\nexport const deleteEvent = (eventId, deleteSeries = false) => {\n const request = {\n methodname: 'core_calendar_delete_calendar_events',\n args: {\n events: [{\n eventid: eventId,\n repeat: deleteSeries,\n }]\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get a calendar event by id.\n *\n * @method getEventById\n * @param {number} eventId The event id.\n * @return {promise} Resolved with requested calendar event\n */\nexport const getEventById = (eventId) => {\n\n const request = {\n methodname: 'core_calendar_get_calendar_event_by_id',\n args: {\n eventid: eventId\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Submit the form data for the event form.\n *\n * @method submitCreateUpdateForm\n * @param {string} formData The URL encoded values from the form\n * @return {promise} Resolved with the new or edited event\n */\nexport const submitCreateUpdateForm = (formData) => {\n const request = {\n methodname: 'core_calendar_submit_create_update_form',\n args: {\n formdata: formData\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar data for the month view.\n *\n * @method getCalendarMonthData\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The course id.\n * @param {number} categoryId The category id.\n * @param {boolean} includeNavigation Whether to include navigation.\n * @param {boolean} mini Whether the month is in mini view.\n * @param {number} day Day (optional)\n * @return {promise} Resolved with the month view data.\n */\nexport const getCalendarMonthData = (year, month, courseId, categoryId, includeNavigation, mini, day = 1) => {\n const request = {\n methodname: 'core_calendar_get_calendar_monthly_view',\n args: {\n year,\n month,\n courseid: courseId,\n categoryid: categoryId,\n includenavigation: includeNavigation,\n mini,\n day,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar data for the day view.\n *\n * @method getCalendarDayData\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} day Day\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise} Resolved with the day view data.\n */\nexport const getCalendarDayData = (year, month, day, courseId, categoryId) => {\n const request = {\n methodname: 'core_calendar_get_calendar_day_view',\n args: {\n year,\n month,\n day,\n courseid: courseId,\n categoryid: categoryId,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Change the start day for the given event id. The day timestamp\n * only has to be any time during the target day because only the\n * date information is extracted, the time of the day is ignored.\n *\n * @param {int} eventId The id of the event to update\n * @param {int} dayTimestamp A timestamp for some time during the target day\n * @return {promise}\n */\nexport const updateEventStartDay = (eventId, dayTimestamp) => {\n const request = {\n methodname: 'core_calendar_update_event_start_day',\n args: {\n eventid: eventId,\n daytimestamp: dayTimestamp\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get calendar upcoming data.\n *\n * @method getCalendarUpcomingData\n * @param {number} courseId The course id.\n * @param {number} categoryId The category id.\n * @return {promise} Resolved with the month view data.\n */\nexport const getCalendarUpcomingData = (courseId, categoryId) => {\n const request = {\n methodname: 'core_calendar_get_calendar_upcoming_view',\n args: {\n courseid: courseId,\n categoryid: categoryId,\n }\n };\n\n return Ajax.call([request])[0];\n};\n\n/**\n * Get the groups by course id.\n *\n * @param {Number} courseId The course id to fetch the groups from.\n * @return {promise} Resolved with the course groups.\n */\nexport const getCourseGroupsData = (courseId) => {\n const request = {\n methodname: 'core_group_get_course_groups',\n args: {\n courseid: courseId\n }\n };\n\n return Ajax.call([request])[0];\n};\n"],"file":"repository.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/selectors.min.js.map b/calendar/amd/build/selectors.min.js.map
index cd5c94cd0e0..5e167210749 100644
--- a/calendar/amd/build/selectors.min.js.map
+++ b/calendar/amd/build/selectors.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/selectors.js"],"names":["define","eventFilterItem","eventType","site","category","course","group","user","other","popoverType","calendarPeriods","month","courseSelector","viewSelector","actions","create","edit","remove","viewEvent","elements","today","day","calendarMain","wrapper","eventItem","links","navLink","eventLink","miniDayLink","containers","loadingIcon"],"mappings":"AAuBAA,OAAM,2BAAC,EAAD,CAAK,UAAW,CAClB,MAAO,CACHC,eAAe,CAAE,mCADd,CAEHC,SAAS,CAAE,CACPC,IAAI,CAAE,uBADC,CAEPC,QAAQ,CAAE,2BAFH,CAGPC,MAAM,CAAE,yBAHD,CAIPC,KAAK,CAAE,wBAJA,CAKPC,IAAI,CAAE,uBALC,CAMPC,KAAK,CAAE,wBANA,CAFR,CAUHC,WAAW,CAAE,CACTN,IAAI,CAAE,+BADG,CAETC,QAAQ,CAAE,mCAFD,CAGTC,MAAM,CAAE,iCAHC,CAITC,KAAK,CAAE,gCAJE,CAKTC,IAAI,CAAE,+BALG,CAMTC,KAAK,CAAE,gCANE,CAVV,CAkBHE,eAAe,CAAE,CACbC,KAAK,CAAE,uBADM,CAlBd,CAqBHC,cAAc,CAAE,yBArBb,CAsBHC,YAAY,CAAE,oCAtBX,CAuBHC,OAAO,CAAE,CACLC,MAAM,CAAE,oCADH,CAELC,IAAI,CAAE,wBAFD,CAGLC,MAAM,CAAE,0BAHH,CAILC,SAAS,CAAE,8BAJN,CAvBN,CA6BHC,QAAQ,CAAE,CACNP,cAAc,CAAE,yBADV,CA7BP,CAgCHQ,KAAK,CAAE,QAhCJ,CAiCHC,GAAG,CAAE,uBAjCF,CAkCHC,YAAY,CAAE,4BAlCX,CAmCHC,OAAO,CAAE,kBAnCN,CAoCHC,SAAS,CAAE,uBApCR,CAqCHC,KAAK,CAAE,CACHC,OAAO,CAAE,8BADN,CAEHC,SAAS,CAAE,4BAFR,CAGHC,WAAW,CAAE,+BAHV,CArCJ,CA0CHC,UAAU,CAAE,CACRC,WAAW,CAAE,0CADL,CA1CT,CA8CV,CA/CK,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 .\n\n/**\n * This module is responsible for the calendar filter.\n *\n * @module core_calendar/calendar_selectors\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n eventFilterItem: \"[data-action='filter-event-type']\",\n eventType: {\n site: \"[data-eventtype-site]\",\n category: \"[data-eventtype-category]\",\n course: \"[data-eventtype-course]\",\n group: \"[data-eventtype-group]\",\n user: \"[data-eventtype-user]\",\n other: \"[data-eventtype-other]\",\n },\n popoverType: {\n site: \"[data-popover-eventtype-site]\",\n category: \"[data-popover-eventtype-category]\",\n course: \"[data-popover-eventtype-course]\",\n group: \"[data-popover-eventtype-group]\",\n user: \"[data-popover-eventtype-user]\",\n other: \"[data-popover-eventtype-other]\",\n },\n calendarPeriods: {\n month: \"[data-period='month']\",\n },\n courseSelector: 'select[name=\"course\"]',\n viewSelector: 'div[data-region=\"view-selector\"]',\n actions: {\n create: '[data-action=\"new-event-button\"]',\n edit: '[data-action=\"edit\"]',\n remove: '[data-action=\"delete\"]',\n viewEvent: '[data-action=\"view-event\"]',\n },\n elements: {\n courseSelector: 'select[name=\"course\"]',\n },\n today: '.today',\n day: '[data-region=\"day\"]',\n calendarMain: '[data-region=\"calendar\"]',\n wrapper: '.calendarwrapper',\n eventItem: '[data-type=\"event\"]',\n links: {\n navLink: '.calendarwrapper .arrow_link',\n eventLink: \"[data-region='event-item']\",\n miniDayLink: \"[data-region='mini-day-link']\",\n },\n containers: {\n loadingIcon: '[data-region=\"overlay-icon-container\"]',\n },\n };\n});\n"],"file":"selectors.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/selectors.js"],"names":["define","eventFilterItem","eventType","site","category","course","group","user","other","popoverType","calendarPeriods","month","courseSelector","viewSelector","actions","create","edit","remove","viewEvent","elements","today","day","calendarMain","wrapper","eventItem","links","navLink","eventLink","miniDayLink","containers","loadingIcon"],"mappings":"AAsBAA,OAAM,2BAAC,EAAD,CAAK,UAAW,CAClB,MAAO,CACHC,eAAe,CAAE,mCADd,CAEHC,SAAS,CAAE,CACPC,IAAI,CAAE,uBADC,CAEPC,QAAQ,CAAE,2BAFH,CAGPC,MAAM,CAAE,yBAHD,CAIPC,KAAK,CAAE,wBAJA,CAKPC,IAAI,CAAE,uBALC,CAMPC,KAAK,CAAE,wBANA,CAFR,CAUHC,WAAW,CAAE,CACTN,IAAI,CAAE,+BADG,CAETC,QAAQ,CAAE,mCAFD,CAGTC,MAAM,CAAE,iCAHC,CAITC,KAAK,CAAE,gCAJE,CAKTC,IAAI,CAAE,+BALG,CAMTC,KAAK,CAAE,gCANE,CAVV,CAkBHE,eAAe,CAAE,CACbC,KAAK,CAAE,uBADM,CAlBd,CAqBHC,cAAc,CAAE,yBArBb,CAsBHC,YAAY,CAAE,oCAtBX,CAuBHC,OAAO,CAAE,CACLC,MAAM,CAAE,oCADH,CAELC,IAAI,CAAE,wBAFD,CAGLC,MAAM,CAAE,0BAHH,CAILC,SAAS,CAAE,8BAJN,CAvBN,CA6BHC,QAAQ,CAAE,CACNP,cAAc,CAAE,yBADV,CA7BP,CAgCHQ,KAAK,CAAE,QAhCJ,CAiCHC,GAAG,CAAE,uBAjCF,CAkCHC,YAAY,CAAE,4BAlCX,CAmCHC,OAAO,CAAE,kBAnCN,CAoCHC,SAAS,CAAE,uBApCR,CAqCHC,KAAK,CAAE,CACHC,OAAO,CAAE,8BADN,CAEHC,SAAS,CAAE,4BAFR,CAGHC,WAAW,CAAE,+BAHV,CArCJ,CA0CHC,UAAU,CAAE,CACRC,WAAW,CAAE,0CADL,CA1CT,CA8CV,CA/CK,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 .\n\n/**\n * This module is responsible for the calendar filter.\n *\n * @module core_calendar/calendar_selectors\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n eventFilterItem: \"[data-action='filter-event-type']\",\n eventType: {\n site: \"[data-eventtype-site]\",\n category: \"[data-eventtype-category]\",\n course: \"[data-eventtype-course]\",\n group: \"[data-eventtype-group]\",\n user: \"[data-eventtype-user]\",\n other: \"[data-eventtype-other]\",\n },\n popoverType: {\n site: \"[data-popover-eventtype-site]\",\n category: \"[data-popover-eventtype-category]\",\n course: \"[data-popover-eventtype-course]\",\n group: \"[data-popover-eventtype-group]\",\n user: \"[data-popover-eventtype-user]\",\n other: \"[data-popover-eventtype-other]\",\n },\n calendarPeriods: {\n month: \"[data-period='month']\",\n },\n courseSelector: 'select[name=\"course\"]',\n viewSelector: 'div[data-region=\"view-selector\"]',\n actions: {\n create: '[data-action=\"new-event-button\"]',\n edit: '[data-action=\"edit\"]',\n remove: '[data-action=\"delete\"]',\n viewEvent: '[data-action=\"view-event\"]',\n },\n elements: {\n courseSelector: 'select[name=\"course\"]',\n },\n today: '.today',\n day: '[data-region=\"day\"]',\n calendarMain: '[data-region=\"calendar\"]',\n wrapper: '.calendarwrapper',\n eventItem: '[data-type=\"event\"]',\n links: {\n navLink: '.calendarwrapper .arrow_link',\n eventLink: \"[data-region='event-item']\",\n miniDayLink: \"[data-region='mini-day-link']\",\n },\n containers: {\n loadingIcon: '[data-region=\"overlay-icon-container\"]',\n },\n };\n});\n"],"file":"selectors.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/summary_modal.min.js.map b/calendar/amd/build/summary_modal.min.js.map
index 9146ef87058..bfc856849dd 100644
--- a/calendar/amd/build/summary_modal.min.js.map
+++ b/calendar/amd/build/summary_modal.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/summary_modal.js"],"names":["define","$","Str","Notification","CustomEvents","Modal","ModalRegistry","ModalFactory","ModalEvents","CalendarRepository","CalendarEvents","CalendarCrud","registered","SELECTORS","ROOT","EDIT_BUTTON","DELETE_BUTTON","ModalEventSummary","root","call","TYPE","prototype","Object","create","constructor","getEditButton","editButton","getFooter","find","getDeleteButton","deleteButton","getEventId","getBody","attr","getEventTitle","getEventCount","getEditUrl","isActionEvent","registerEventListeners","M","util","js_pending","getRoot","on","bodyRendered","getModal","data","eventTitle","eventId","eventCount","registerRemove","js_complete","bind","deleted","hide","events","activate","e","trigger","editActionEvent","editEvent","preventDefault","stopPropagation","originalEvent","register"],"mappings":"AAuBAA,OAAM,+BAAC,CACH,QADG,CAEH,UAFG,CAGH,mBAHG,CAIH,gCAJG,CAKH,YALG,CAMH,qBANG,CAOH,oBAPG,CAQH,mBARG,CASH,0BATG,CAUH,sBAVG,CAWH,oBAXG,CAAD,CAaN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,IAEMC,CAAAA,CAAU,GAFhB,CAGMC,CAAS,CAAG,CACZC,IAAI,CAAE,yCADM,CAEZC,WAAW,CAAE,wBAFD,CAGZC,aAAa,CAAE,0BAHH,CAHlB,CAcMC,CAAiB,CAAG,SAASC,CAAT,CAAe,CACnCb,CAAK,CAACc,IAAN,CAAW,IAAX,CAAiBD,CAAjB,CACH,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AAsD,SAASC,CAAT,CAAYX,CAAZ,CAAkB,CACpE,GAAI,KAAKT,aAAL,EAAJ,CAA0B,CAEtBpC,CAAC,CAAC,MAAD,CAAD,CAAUyD,OAAV,CAAkBhD,CAAc,CAACiD,eAAjC,CAAkD,CAAC,KAAKvB,UAAL,EAAD,CAAlD,CACH,CAHD,IAGO,CAGHnC,CAAC,CAAC,MAAD,CAAD,CAAUyD,OAAV,CAAkBhD,CAAc,CAACkD,SAAjC,CAA4C,CAAC,KAAK7B,UAAL,EAAD,CAA5C,CACH,CAGD,KAAKuB,IAAL,GAGAG,CAAC,CAACI,cAAF,GACAJ,CAAC,CAACK,eAAF,GACAhB,CAAI,CAACiB,aAAL,CAAmBF,cAAnB,GACAf,CAAI,CAACiB,aAAL,CAAmBD,eAAnB,EACH,CAlBqD,CAkBpDV,IAlBoD,CAkB/C,IAlB+C,CAAtD,CAmBH,CA9CD,CAkDA,GAAI,CAACxC,CAAL,CAAiB,CACbN,CAAa,CAAC0D,QAAd,CAAuB/C,CAAiB,CAACG,IAAzC,CAA+CH,CAA/C,CAAkE,mCAAlE,EACAL,CAAU,GACb,CAED,MAAOK,CAAAA,CACV,CAlMK,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 .\n\n/**\n * A javascript module to handle summary modal.\n *\n * @module core_calendar/summary_modal\n * @package core_calendar\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_registry',\n 'core/modal_factory',\n 'core/modal_events',\n 'core_calendar/repository',\n 'core_calendar/events',\n 'core_calendar/crud',\n],\nfunction(\n $,\n Str,\n Notification,\n CustomEvents,\n Modal,\n ModalRegistry,\n ModalFactory,\n ModalEvents,\n CalendarRepository,\n CalendarEvents,\n CalendarCrud\n) {\n\n var registered = false;\n var SELECTORS = {\n ROOT: \"[data-region='summary-modal-container']\",\n EDIT_BUTTON: '[data-action=\"edit\"]',\n DELETE_BUTTON: '[data-action=\"delete\"]',\n };\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n var ModalEventSummary = function(root) {\n Modal.call(this, root);\n };\n\n ModalEventSummary.TYPE = 'core_calendar-event_summary';\n ModalEventSummary.prototype = Object.create(Modal.prototype);\n ModalEventSummary.prototype.constructor = ModalEventSummary;\n\n /**\n * Get the edit button element from the footer. The button is cached\n * as it's not expected to change.\n *\n * @method getEditButton\n * @return {object} button element\n */\n ModalEventSummary.prototype.getEditButton = function() {\n if (typeof this.editButton == 'undefined') {\n this.editButton = this.getFooter().find(SELECTORS.EDIT_BUTTON);\n }\n\n return this.editButton;\n };\n\n /**\n * Get the delete button element from the footer. The button is cached\n * as it's not expected to change.\n *\n * @method getDeleteButton\n * @return {object} button element\n */\n ModalEventSummary.prototype.getDeleteButton = function() {\n if (typeof this.deleteButton == 'undefined') {\n this.deleteButton = this.getFooter().find(SELECTORS.DELETE_BUTTON);\n }\n\n return this.deleteButton;\n };\n\n /**\n * Get the id for the event being shown in this modal. This value is\n * not cached because it will change depending on which event is\n * being displayed.\n *\n * @method getEventId\n * @return {int}\n */\n ModalEventSummary.prototype.getEventId = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-event-id');\n };\n\n /**\n * Get the title for the event being shown in this modal. This value is\n * not cached because it will change depending on which event is\n * being displayed.\n *\n * @method getEventTitle\n * @return {String}\n */\n ModalEventSummary.prototype.getEventTitle = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-event-title');\n };\n\n /**\n * Get the number of events in the series for the event being shown in\n * this modal. This value is not cached because it will change\n * depending on which event is being displayed.\n *\n * @method getEventCount\n * @return {int}\n */\n ModalEventSummary.prototype.getEventCount = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-event-count');\n };\n\n /**\n * Get the url for the event being shown in this modal.\n *\n * @method getEventUrl\n * @return {String}\n */\n ModalEventSummary.prototype.getEditUrl = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-edit-url');\n };\n\n /**\n * Is this an action event.\n *\n * @method getEventUrl\n * @return {String}\n */\n ModalEventSummary.prototype.isActionEvent = function() {\n return (this.getBody().find(SELECTORS.ROOT).attr('data-action-event') == 'true');\n };\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n ModalEventSummary.prototype.registerEventListeners = function() {\n // Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n // We have to wait for the modal to finish rendering in order to ensure that\n // the data-event-title property is available to use as the modal title.\n M.util.js_pending('core_calendar/summary_modal:registerEventListeners:bodyRendered');\n this.getRoot().on(ModalEvents.bodyRendered, function() {\n this.getModal().data({\n eventTitle: this.getEventTitle(),\n eventId: this.getEventId(),\n eventCount: this.getEventCount(),\n })\n .attr('data-type', 'event');\n CalendarCrud.registerRemove(this.getModal());\n M.util.js_complete('core_calendar/summary_modal:registerEventListeners:bodyRendered');\n }.bind(this));\n\n $('body').on(CalendarEvents.deleted, function() {\n // Close the dialogue on delete.\n this.hide();\n }.bind(this));\n\n CustomEvents.define(this.getEditButton(), [\n CustomEvents.events.activate\n ]);\n\n this.getEditButton().on(CustomEvents.events.activate, function(e, data) {\n if (this.isActionEvent()) {\n // Action events cannot be edited on the event form and must be redirected to the module UI.\n $('body').trigger(CalendarEvents.editActionEvent, [this.getEditUrl()]);\n } else {\n // When the edit button is clicked we fire an event for the calendar UI to handle.\n // We don't care how the UI chooses to handle it.\n $('body').trigger(CalendarEvents.editEvent, [this.getEventId()]);\n }\n\n // There is nothing else for us to do so let's hide.\n this.hide();\n\n // We've handled this event so no need to propagate it.\n e.preventDefault();\n e.stopPropagation();\n data.originalEvent.preventDefault();\n data.originalEvent.stopPropagation();\n }.bind(this));\n };\n\n // Automatically register with the modal registry the first time this module is imported so that you can create modals\n // of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalEventSummary.TYPE, ModalEventSummary, 'core_calendar/event_summary_modal');\n registered = true;\n }\n\n return ModalEventSummary;\n});\n"],"file":"summary_modal.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/summary_modal.js"],"names":["define","$","Str","Notification","CustomEvents","Modal","ModalRegistry","ModalFactory","ModalEvents","CalendarRepository","CalendarEvents","CalendarCrud","registered","SELECTORS","ROOT","EDIT_BUTTON","DELETE_BUTTON","ModalEventSummary","root","call","TYPE","prototype","Object","create","constructor","getEditButton","editButton","getFooter","find","getDeleteButton","deleteButton","getEventId","getBody","attr","getEventTitle","getEventCount","getEditUrl","isActionEvent","registerEventListeners","M","util","js_pending","getRoot","on","bodyRendered","getModal","data","eventTitle","eventId","eventCount","registerRemove","js_complete","bind","deleted","hide","events","activate","e","trigger","editActionEvent","editEvent","preventDefault","stopPropagation","originalEvent","register"],"mappings":"AAsBAA,OAAM,+BAAC,CACH,QADG,CAEH,UAFG,CAGH,mBAHG,CAIH,gCAJG,CAKH,YALG,CAMH,qBANG,CAOH,oBAPG,CAQH,mBARG,CASH,0BATG,CAUH,sBAVG,CAWH,oBAXG,CAAD,CAaN,SACIC,CADJ,CAEIC,CAFJ,CAGIC,CAHJ,CAIIC,CAJJ,CAKIC,CALJ,CAMIC,CANJ,CAOIC,CAPJ,CAQIC,CARJ,CASIC,CATJ,CAUIC,CAVJ,CAWIC,CAXJ,CAYE,IAEMC,CAAAA,CAAU,GAFhB,CAGMC,CAAS,CAAG,CACZC,IAAI,CAAE,yCADM,CAEZC,WAAW,CAAE,wBAFD,CAGZC,aAAa,CAAE,0BAHH,CAHlB,CAcMC,CA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A1C,EAIA,KAAK/B,aAAL,GAAqBkB,EAArB,CAAwBvC,CAAY,CAACmD,MAAb,CAAoBC,QAA5C,CAAsD,SAASC,CAAT,CAAYX,CAAZ,CAAkB,CACpE,GAAI,KAAKT,aAAL,EAAJ,CAA0B,CAEtBpC,CAAC,CAAC,MAAD,CAAD,CAAUyD,OAAV,CAAkBhD,CAAc,CAACiD,eAAjC,CAAkD,CAAC,KAAKvB,UAAL,EAAD,CAAlD,CACH,CAHD,IAGO,CAGHnC,CAAC,CAAC,MAAD,CAAD,CAAUyD,OAAV,CAAkBhD,CAAc,CAACkD,SAAjC,CAA4C,CAAC,KAAK7B,UAAL,EAAD,CAA5C,CACH,CAGD,KAAKuB,IAAL,GAGAG,CAAC,CAACI,cAAF,GACAJ,CAAC,CAACK,eAAF,GACAhB,CAAI,CAACiB,aAAL,CAAmBF,cAAnB,GACAf,CAAI,CAACiB,aAAL,CAAmBD,eAAnB,EACH,CAlBqD,CAkBpDV,IAlBoD,CAkB/C,IAlB+C,CAAtD,CAmBH,CA9CD,CAkDA,GAAI,CAACxC,CAAL,CAAiB,CACbN,CAAa,CAAC0D,QAAd,CAAuB/C,CAAiB,CAACG,IAAzC,CAA+CH,CAA/C,CAAkE,mCAAlE,EACAL,CAAU,GACb,CAED,MAAOK,CAAAA,CACV,CAlMK,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 .\n\n/**\n * A javascript module to handle summary modal.\n *\n * @module core_calendar/summary_modal\n * @copyright 2017 Simey Lameze \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/str',\n 'core/notification',\n 'core/custom_interaction_events',\n 'core/modal',\n 'core/modal_registry',\n 'core/modal_factory',\n 'core/modal_events',\n 'core_calendar/repository',\n 'core_calendar/events',\n 'core_calendar/crud',\n],\nfunction(\n $,\n Str,\n Notification,\n CustomEvents,\n Modal,\n ModalRegistry,\n ModalFactory,\n ModalEvents,\n CalendarRepository,\n CalendarEvents,\n CalendarCrud\n) {\n\n var registered = false;\n var SELECTORS = {\n ROOT: \"[data-region='summary-modal-container']\",\n EDIT_BUTTON: '[data-action=\"edit\"]',\n DELETE_BUTTON: '[data-action=\"delete\"]',\n };\n\n /**\n * Constructor for the Modal.\n *\n * @param {object} root The root jQuery element for the modal\n */\n var ModalEventSummary = function(root) {\n Modal.call(this, root);\n };\n\n ModalEventSummary.TYPE = 'core_calendar-event_summary';\n ModalEventSummary.prototype = Object.create(Modal.prototype);\n ModalEventSummary.prototype.constructor = ModalEventSummary;\n\n /**\n * Get the edit button element from the footer. The button is cached\n * as it's not expected to change.\n *\n * @method getEditButton\n * @return {object} button element\n */\n ModalEventSummary.prototype.getEditButton = function() {\n if (typeof this.editButton == 'undefined') {\n this.editButton = this.getFooter().find(SELECTORS.EDIT_BUTTON);\n }\n\n return this.editButton;\n };\n\n /**\n * Get the delete button element from the footer. The button is cached\n * as it's not expected to change.\n *\n * @method getDeleteButton\n * @return {object} button element\n */\n ModalEventSummary.prototype.getDeleteButton = function() {\n if (typeof this.deleteButton == 'undefined') {\n this.deleteButton = this.getFooter().find(SELECTORS.DELETE_BUTTON);\n }\n\n return this.deleteButton;\n };\n\n /**\n * Get the id for the event being shown in this modal. This value is\n * not cached because it will change depending on which event is\n * being displayed.\n *\n * @method getEventId\n * @return {int}\n */\n ModalEventSummary.prototype.getEventId = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-event-id');\n };\n\n /**\n * Get the title for the event being shown in this modal. This value is\n * not cached because it will change depending on which event is\n * being displayed.\n *\n * @method getEventTitle\n * @return {String}\n */\n ModalEventSummary.prototype.getEventTitle = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-event-title');\n };\n\n /**\n * Get the number of events in the series for the event being shown in\n * this modal. This value is not cached because it will change\n * depending on which event is being displayed.\n *\n * @method getEventCount\n * @return {int}\n */\n ModalEventSummary.prototype.getEventCount = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-event-count');\n };\n\n /**\n * Get the url for the event being shown in this modal.\n *\n * @method getEventUrl\n * @return {String}\n */\n ModalEventSummary.prototype.getEditUrl = function() {\n return this.getBody().find(SELECTORS.ROOT).attr('data-edit-url');\n };\n\n /**\n * Is this an action event.\n *\n * @method getEventUrl\n * @return {String}\n */\n ModalEventSummary.prototype.isActionEvent = function() {\n return (this.getBody().find(SELECTORS.ROOT).attr('data-action-event') == 'true');\n };\n\n /**\n * Set up all of the event handling for the modal.\n *\n * @method registerEventListeners\n */\n ModalEventSummary.prototype.registerEventListeners = function() {\n // Apply parent event listeners.\n Modal.prototype.registerEventListeners.call(this);\n\n // We have to wait for the modal to finish rendering in order to ensure that\n // the data-event-title property is available to use as the modal title.\n M.util.js_pending('core_calendar/summary_modal:registerEventListeners:bodyRendered');\n this.getRoot().on(ModalEvents.bodyRendered, function() {\n this.getModal().data({\n eventTitle: this.getEventTitle(),\n eventId: this.getEventId(),\n eventCount: this.getEventCount(),\n })\n .attr('data-type', 'event');\n CalendarCrud.registerRemove(this.getModal());\n M.util.js_complete('core_calendar/summary_modal:registerEventListeners:bodyRendered');\n }.bind(this));\n\n $('body').on(CalendarEvents.deleted, function() {\n // Close the dialogue on delete.\n this.hide();\n }.bind(this));\n\n CustomEvents.define(this.getEditButton(), [\n CustomEvents.events.activate\n ]);\n\n this.getEditButton().on(CustomEvents.events.activate, function(e, data) {\n if (this.isActionEvent()) {\n // Action events cannot be edited on the event form and must be redirected to the module UI.\n $('body').trigger(CalendarEvents.editActionEvent, [this.getEditUrl()]);\n } else {\n // When the edit button is clicked we fire an event for the calendar UI to handle.\n // We don't care how the UI chooses to handle it.\n $('body').trigger(CalendarEvents.editEvent, [this.getEventId()]);\n }\n\n // There is nothing else for us to do so let's hide.\n this.hide();\n\n // We've handled this event so no need to propagate it.\n e.preventDefault();\n e.stopPropagation();\n data.originalEvent.preventDefault();\n data.originalEvent.stopPropagation();\n }.bind(this));\n };\n\n // Automatically register with the modal registry the first time this module is imported so that you can create modals\n // of this type using the modal factory.\n if (!registered) {\n ModalRegistry.register(ModalEventSummary.TYPE, ModalEventSummary, 'core_calendar/event_summary_modal');\n registered = true;\n }\n\n return ModalEventSummary;\n});\n"],"file":"summary_modal.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/build/view_manager.min.js.map b/calendar/amd/build/view_manager.min.js.map
index 91067138c9c..f9b4c830667 100644
--- a/calendar/amd/build/view_manager.min.js.map
+++ b/calendar/amd/build/view_manager.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/view_manager.js"],"names":["registerEventListeners","root","on","CalendarSelectors","links","eventLink","e","target","eventId","pendingPromise","Pending","matches","actions","viewEvent","closest","dataset","querySelector","preventDefault","stopPropagation","renderEventSummaryModal","then","resolve","catch","navLink","wrapper","find","view","data","courseId","categoryId","link","currentTarget","changeMonth","href","year","month","day","changeDay","viewSelector","CustomEvents","define","events","activate","option","classList","contains","courseid","categoryid","refreshMonthContent","window","history","pushState","fail","Notification","exception","refreshDayContent","reloadCurrentUpcoming","template","startLoading","attr","M","util","js_pending","get","join","includenavigation","mini","CalendarRepository","getCalendarMonthData","context","viewingmonth","Templates","render","html","js","replaceNode","document","dispatchEvent","CustomEvent","CalendarEvents","viewUpdated","always","js_complete","stopLoading","url","length","args","trigger","monthChanged","reloadCurrentMonth","getCalendarDayData","viewingday","reloadCurrentDay","dayChanged","loadingIconContainer","containers","loadingIcon","removeClass","addClass","getCalendarUpcomingData","viewingupcoming","getEventTypeClassFromType","eventType","getEventById","getEventResponse","event","Error","eventData","modalParams","title","name","type","SummaryModal","TYPE","body","templateContext","canedit","candelete","headerclasses","normalisedeventtype","isactionevent","action","ModalFactory","create","modal","getRoot","ModalEvents","hidden","destroy","show","init"],"mappings":"uzBAwBA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,O,4lBAOMA,CAAAA,CAAsB,CAAG,SAACC,CAAD,CAAU,CACrCA,CAAI,CAAG,cAAEA,CAAF,CAAP,CAGAA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBC,CAAiB,CAACC,KAAlB,CAAwBC,SAAzC,CAAoD,SAACC,CAAD,CAAO,IACjDC,CAAAA,CAAM,CAAGD,CAAC,CAACC,MADsC,CAEnDF,CAAS,CAAG,IAFuC,CAGnDG,CAAO,CAAG,IAHyC,CAIjDC,CAAc,CAAG,GAAIC,UAAJ,CAAY,4CAAZ,CAJgC,CAMvD,GAAIH,CAAM,CAACI,OAAP,CAAeR,CAAiB,CAACS,OAAlB,CAA0BC,SAAzC,CAAJ,CAAyD,CACrDR,CAAS,CAAGE,CACf,CAFD,IAEO,CACHF,CAAS,CAAGE,CAAM,CAACO,OAAP,CAAeX,CAAiB,CAACS,OAAlB,CAA0BC,SAAzC,CACf,CAED,GAAIR,CAAJ,CAAe,CACXG,CAAO,CAAGH,CAAS,CAACU,OAAV,CAAkBP,OAC/B,CAFD,IAEO,CACHA,CAAO,CAAGD,CAAM,CAACS,aAAP,CAAqBb,CAAiB,CAACS,OAAlB,CAA0BC,SAA/C,EAA0DE,OAA1D,CAAkEP,OAC/E,CAED,GAAIA,CAAJ,CAAa,CAGTF,CAAC,CAACW,cAAF,GAGAX,CAAC,CAACY,eAAF,GAEAC,CAAuB,CAACX,CAAD,CAAvB,CACCY,IADD,CACMX,CAAc,CAACY,OADrB,EAECC,KAFD,EAGH,CAXD,IAWO,CACHb,CAAc,CAACY,OAAf,EACH,CACJ,CAhCD,EAkCApB,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBC,CAAiB,CAACC,KAAlB,CAAwBmB,OAAzC,CAAkD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IAAIC,CAAAA,KAAJ,CAAU,mEAAqElG,CAA/E,CACT,CAED,MAAOgG,CAAAA,CAAgB,CAACC,KAC3B,CAPM,EAQNrF,IARM,CAQD,SAAAuF,CAAS,CAAI,CAEf,GAAMC,CAAAA,CAAW,CAAG,CAChBC,KAAK,CAAEF,CAAS,CAACG,IADD,CAEhBC,IAAI,CAAEC,UAAaC,IAFH,CAGhBC,IAAI,CAAE3C,UAAUC,MAAV,CAAiB,kCAAjB,CAAqDmC,CAArD,CAHU,CAIhBQ,eAAe,CAAE,CACbC,OAAO,CAAET,CAAS,CAACS,OADN,CAEbC,SAAS,CAAEV,CAAS,CAACU,SAFR,CAGbC,aAAa,CAAEjB,CAAyB,CAACM,CAAS,CAACY,mBAAX,CAH3B,CAIbC,aAAa,CAAEb,CAAS,CAACa,aAJZ,CAKbpC,GAAG,CAAEuB,CAAS,CAACvB,GALF,CAMbqC,MAAM,CAAEd,CAAS,CAACc,MANL,CAJD,CAApB,CAeA,MAAOC,WAAaC,MAAb,CAAoBf,CAApB,CACV,CA1BM,EA2BNxF,IA3BM,CA2BD,SAAAwG,CAAK,CAAI,CAEXA,CAAK,CAACC,OAAN,GAAgB3H,EAAhB,CAAmB4H,UAAYC,MAA/B,CAAuC,UAAW,CAE9CH,CAAK,CAACI,OAAN,EACH,CAHD,EAMAJ,CAAK,CAACK,IAAN,GAEA,MAAOL,CAAAA,CACV,CAtCM,EAuCNxG,IAvCM,CAuCD,SAAAwG,CAAK,CAAI,CACXnH,CAAc,CAACY,OAAf,GAEA,MAAOuG,CAAAA,CACV,CA3CM,EA4CNtG,KA5CM,CA4CA+B,UAAaC,SA5Cb,CA6CV,C,QAEmB,QAAP4E,CAAAA,IAAO,CAACjI,CAAD,CAAOyB,CAAP,CAAgB,CAChC1B,CAAsB,CAACC,CAAD,CAAOyB,CAAP,CACzB,C","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 .\n\n/**\n * A javascript module to handler calendar view changes.\n *\n * @module core_calendar/view_manager\n * @package core_calendar\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport Templates from 'core/templates';\nimport Notification from 'core/notification';\nimport * as CalendarRepository from 'core_calendar/repository';\nimport CalendarEvents from 'core_calendar/events';\nimport * as CalendarSelectors from 'core_calendar/selectors';\nimport ModalFactory from 'core/modal_factory';\nimport ModalEvents from 'core/modal_events';\nimport SummaryModal from 'core_calendar/summary_modal';\nimport CustomEvents from 'core/custom_interaction_events';\nimport Pending from 'core/pending';\n\n/**\n * Register event listeners for the module.\n *\n * @param {object} root The root element.\n */\nconst registerEventListeners = (root) => {\n root = $(root);\n\n // Bind click events to event links.\n root.on('click', CalendarSelectors.links.eventLink, (e) => {\n const target = e.target;\n let eventLink = null;\n let eventId = null;\n const pendingPromise = new Pending('core_calendar/view_manager:eventLink:click');\n\n if (target.matches(CalendarSelectors.actions.viewEvent)) {\n eventLink = target;\n } else {\n eventLink = target.closest(CalendarSelectors.actions.viewEvent);\n }\n\n if (eventLink) {\n eventId = eventLink.dataset.eventId;\n } else {\n eventId = target.querySelector(CalendarSelectors.actions.viewEvent).dataset.eventId;\n }\n\n if (eventId) {\n // A link was found. Show the modal.\n\n e.preventDefault();\n // We've handled the event so stop it from bubbling\n // and causing the day click handler to fire.\n e.stopPropagation();\n\n renderEventSummaryModal(eventId)\n .then(pendingPromise.resolve)\n .catch();\n } else {\n pendingPromise.resolve();\n }\n });\n\n root.on('click', CalendarSelectors.links.navLink, (e) => {\n const wrapper = root.find(CalendarSelectors.wrapper);\n const view = wrapper.data('view');\n const courseId = wrapper.data('courseid');\n const categoryId = wrapper.data('categoryid');\n const link = e.currentTarget;\n\n if (view === 'month') {\n changeMonth(root, link.href, link.dataset.year, link.dataset.month, courseId, categoryId, link.dataset.day);\n e.preventDefault();\n } else if (view === 'day') {\n changeDay(root, link.href, link.dataset.year, link.dataset.month, link.dataset.day, courseId, categoryId);\n e.preventDefault();\n }\n });\n\n const viewSelector = root.find(CalendarSelectors.viewSelector);\n CustomEvents.define(viewSelector, [CustomEvents.events.activate]);\n viewSelector.on(\n CustomEvents.events.activate,\n (e) => {\n e.preventDefault();\n\n const option = e.target;\n if (option.classList.contains('active')) {\n return;\n }\n\n const view = option.dataset.view,\n year = option.dataset.year,\n month = option.dataset.month,\n day = option.dataset.day,\n courseId = option.dataset.courseid,\n categoryId = option.dataset.categoryid;\n\n if (view == 'month') {\n refreshMonthContent(root, year, month, courseId, categoryId, root, 'core_calendar/calendar_month', day)\n .then(() => {\n return window.history.pushState({}, '', '?view=month');\n }).fail(Notification.exception);\n } else if (view == 'day') {\n refreshDayContent(root, year, month, day, courseId, categoryId, root, 'core_calendar/calendar_day')\n .then(() => {\n return window.history.pushState({}, '', '?view=day');\n }).fail(Notification.exception);\n } else if (view == 'upcoming') {\n reloadCurrentUpcoming(root, courseId, categoryId, root, 'core_calendar/calendar_upcoming')\n .then(() => {\n return window.history.pushState({}, '', '?view=upcoming');\n }).fail(Notification.exception);\n }\n }\n );\n};\n\n/**\n * Refresh the month content.\n *\n * @param {object} root The root element.\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The id of the course whose events are shown\n * @param {number} categoryId The id of the category whose events are shown\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @param {string} template The template to be rendered.\n * @param {number} day Day (optional)\n * @return {promise}\n */\nexport const refreshMonthContent = (root, year, month, courseId, categoryId, target = null, template = '', day = 1) => {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n M.util.js_pending([root.get('id'), year, month, courseId].join('-'));\n const includenavigation = root.data('includenavigation');\n const mini = root.data('mini');\n return CalendarRepository.getCalendarMonthData(year, month, courseId, categoryId, includenavigation, mini, day)\n .then(context => {\n context.viewingmonth = true;\n return Templates.render(template, context);\n })\n .then((html, js) => {\n return Templates.replaceNode(target, html, js);\n })\n .then(() => {\n document.querySelector('body').dispatchEvent(new CustomEvent(CalendarEvents.viewUpdated));\n return;\n })\n .always(() => {\n M.util.js_complete([root.get('id'), year, month, courseId].join('-'));\n return stopLoading(root);\n })\n .fail(Notification.exception);\n};\n\n/**\n * Handle changes to the current calendar view.\n *\n * @param {object} root The container element\n * @param {string} url The calendar url to be shown\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The id of the course whose events are shown\n * @param {number} categoryId The id of the category whose events are shown\n * @param {number} day Day (optional)\n * @return {promise}\n */\nexport const changeMonth = (root, url, year, month, courseId, categoryId, day = 1) => {\n return refreshMonthContent(root, year, month, courseId, categoryId, null, '', day)\n .then((...args) => {\n if (url.length && url !== '#') {\n window.history.pushState({}, '', url);\n }\n return args;\n })\n .then((...args) => {\n $('body').trigger(CalendarEvents.monthChanged, [year, month, courseId, categoryId]);\n return args;\n });\n};\n\n/**\n * Reload the current month view data.\n *\n * @param {object} root The container element.\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise}\n */\nexport const reloadCurrentMonth = (root, courseId = 0, categoryId = 0) => {\n const year = root.find(CalendarSelectors.wrapper).data('year');\n const month = root.find(CalendarSelectors.wrapper).data('month');\n const day = root.find(CalendarSelectors.wrapper).data('day');\n\n courseId = courseId || root.find(CalendarSelectors.wrapper).data('courseid');\n categoryId = categoryId || root.find(CalendarSelectors.wrapper).data('categoryid');\n\n return refreshMonthContent(root, year, month, courseId, categoryId, null, '', day);\n};\n\n\n/**\n * Refresh the day content.\n *\n * @param {object} root The root element.\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} day Day\n * @param {number} courseId The id of the course whose events are shown\n * @param {number} categoryId The id of the category whose events are shown\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @param {string} template The template to be rendered.\n *\n * @return {promise}\n */\nexport const refreshDayContent = (root, year, month, day, courseId, categoryId, target = null, template = '') => {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n M.util.js_pending([root.get('id'), year, month, day, courseId, categoryId].join('-'));\n const includenavigation = root.data('includenavigation');\n return CalendarRepository.getCalendarDayData(year, month, day, courseId, categoryId, includenavigation)\n .then((context) => {\n context.viewingday = true;\n return Templates.render(template, context);\n })\n .then((html, js) => {\n return Templates.replaceNode(target, html, js);\n })\n .then(() => {\n document.querySelector('body').dispatchEvent(new CustomEvent(CalendarEvents.viewUpdated));\n return;\n })\n .always(() => {\n M.util.js_complete([root.get('id'), year, month, day, courseId, categoryId].join('-'));\n return stopLoading(root);\n })\n .fail(Notification.exception);\n};\n\n/**\n * Reload the current day view data.\n *\n * @param {object} root The container element.\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise}\n */\nexport const reloadCurrentDay = (root, courseId = 0, categoryId = 0) => {\n const wrapper = root.find(CalendarSelectors.wrapper);\n const year = wrapper.data('year');\n const month = wrapper.data('month');\n const day = wrapper.data('day');\n\n courseId = courseId || root.find(CalendarSelectors.wrapper).data('courseid');\n categoryId = categoryId || root.find(CalendarSelectors.wrapper).data('categoryid');\n\n return refreshDayContent(root, year, month, day, courseId, categoryId);\n};\n\n/**\n * Handle changes to the current calendar view.\n *\n * @param {object} root The root element.\n * @param {String} url The calendar url to be shown\n * @param {Number} year Year\n * @param {Number} month Month\n * @param {Number} day Day\n * @param {Number} courseId The id of the course whose events are shown\n * @param {Number} categoryId The id of the category whose events are shown\n * @return {promise}\n */\nexport const changeDay = (root, url, year, month, day, courseId, categoryId) => {\n return refreshDayContent(root, year, month, day, courseId, categoryId)\n .then((...args) => {\n if (url.length && url !== '#') {\n window.history.pushState({}, '', url);\n }\n return args;\n })\n .then((...args) => {\n $('body').trigger(CalendarEvents.dayChanged, [year, month, courseId, categoryId]);\n return args;\n });\n};\n\n/**\n * Set the element state to loading.\n *\n * @param {object} root The container element\n * @method startLoading\n */\nconst startLoading = (root) => {\n const loadingIconContainer = root.find(CalendarSelectors.containers.loadingIcon);\n\n loadingIconContainer.removeClass('hidden');\n};\n\n/**\n * Remove the loading state from the element.\n *\n * @param {object} root The container element\n * @method stopLoading\n */\nconst stopLoading = (root) => {\n const loadingIconContainer = root.find(CalendarSelectors.containers.loadingIcon);\n\n loadingIconContainer.addClass('hidden');\n};\n\n/**\n * Reload the current month view data.\n *\n * @param {object} root The container element.\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @param {string} template The template to be rendered.\n * @return {promise}\n */\nexport const reloadCurrentUpcoming = (root, courseId = 0, categoryId = 0, target = null, template = '') => {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n courseId = courseId || root.find(CalendarSelectors.wrapper).data('courseid');\n categoryId = categoryId || root.find(CalendarSelectors.wrapper).data('categoryid');\n\n return CalendarRepository.getCalendarUpcomingData(courseId, categoryId)\n .then((context) => {\n context.viewingupcoming = true;\n return Templates.render(template, context);\n })\n .then((html, js) => {\n return Templates.replaceNode(target, html, js);\n })\n .then(() => {\n document.querySelector('body').dispatchEvent(new CustomEvent(CalendarEvents.viewUpdated));\n return;\n })\n .always(function() {\n return stopLoading(root);\n })\n .fail(Notification.exception);\n};\n\n/**\n * Get the CSS class to apply for the given event type.\n *\n * @param {string} eventType The calendar event type\n * @return {string}\n */\nconst getEventTypeClassFromType = (eventType) => {\n return 'calendar_event_' + eventType;\n};\n\n/**\n * Render the event summary modal.\n *\n * @param {Number} eventId The calendar event id.\n * @returns {Promise}\n */\nconst renderEventSummaryModal = (eventId) => {\n const pendingPromise = new Pending('core_calendar/view_manager:renderEventSummaryModal');\n\n // Calendar repository promise.\n return CalendarRepository.getEventById(eventId)\n .then((getEventResponse) => {\n if (!getEventResponse.event) {\n throw new Error('Error encountered while trying to fetch calendar event with ID: ' + eventId);\n }\n\n return getEventResponse.event;\n })\n .then(eventData => {\n // Build the modal parameters from the event data.\n const modalParams = {\n title: eventData.name,\n type: SummaryModal.TYPE,\n body: Templates.render('core_calendar/event_summary_body', eventData),\n templateContext: {\n canedit: eventData.canedit,\n candelete: eventData.candelete,\n headerclasses: getEventTypeClassFromType(eventData.normalisedeventtype),\n isactionevent: eventData.isactionevent,\n url: eventData.url,\n action: eventData.action\n }\n };\n\n // Create the modal.\n return ModalFactory.create(modalParams);\n })\n .then(modal => {\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Finally, render the modal!\n modal.show();\n\n return modal;\n })\n .then(modal => {\n pendingPromise.resolve();\n\n return modal;\n })\n .catch(Notification.exception);\n};\n\nexport const init = (root, view) => {\n registerEventListeners(root, view);\n};\n"],"file":"view_manager.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/view_manager.js"],"names":["registerEventListeners","root","on","CalendarSelectors","links","eventLink","e","target","eventId","pendingPromise","Pending","matches","actions","viewEvent","closest","dataset","querySelector","preventDefault","stopPropagation","renderEventSummaryModal","then","resolve","catch","navLink","wrapper","find","view","data","courseId","categoryId","link","currentTarget","changeMonth","href","year","month","day","changeDay","viewSelector","CustomEvents","define","events","activate","option","classList","contains","courseid","categoryid","refreshMonthContent","window","history","pushState","fail","Notification","exception","refreshDayContent","reloadCurrentUpcoming","template","startLoading","attr","M","util","js_pending","get","join","includenavigation","mini","CalendarRepository","getCalendarMonthData","context","viewingmonth","Templates","render","html","js","replaceNode","document","dispatchEvent","CustomEvent","CalendarEvents","viewUpdated","always","js_complete","stopLoading","url","length","args","trigger","monthChanged","reloadCurrentMonth","getCalendarDayData","viewingday","reloadCurrentDay","dayChanged","loadingIconContainer","containers","loadingIcon","removeClass","addClass","getCalendarUpcomingData","viewingupcoming","getEventTypeClassFromType","eventType","getEventById","getEventResponse","event","Error","eventData","modalParams","title","name","type","SummaryModal","TYPE","body","templateContext","canedit","candelete","headerclasses","normalisedeventtype","isactionevent","action","ModalFactory","create","modal","getRoot","ModalEvents","hidden","destroy","show","init"],"mappings":"uzBAuBA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,O,4lBAOMA,CAAAA,CAAsB,CAAG,SAACC,CAAD,CAAU,CACrCA,CAAI,CAAG,cAAEA,CAAF,CAAP,CAGAA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBC,CAAiB,CAACC,KAAlB,CAAwBC,SAAzC,CAAoD,SAACC,CAAD,CAAO,IACjDC,CAAAA,CAAM,CAAGD,CAAC,CAACC,MADsC,CAEnDF,CAAS,CAAG,IAFuC,CAGnDG,CAAO,CAAG,IAHyC,CAIjDC,CAAc,CAAG,GAAIC,UAAJ,CAAY,4CAAZ,CAJgC,CAMvD,GAAIH,CAAM,CAACI,OAAP,CAAeR,CAAiB,CAACS,OAAlB,CAA0BC,SAAzC,CAAJ,CAAyD,CACrDR,CAAS,CAAGE,CACf,CAFD,IAEO,CACHF,CAAS,CAAGE,CAAM,CAACO,OAAP,CAAeX,CAAiB,CAACS,OAAlB,CAA0BC,SAAzC,CACf,CAED,GAAIR,CAAJ,CAAe,CACXG,CAAO,CAAGH,CAAS,CAACU,OAAV,CAAkBP,OAC/B,CAFD,IAEO,CACHA,CAAO,CAAGD,CAAM,CAACS,aAAP,CAAqBb,CAAiB,CAACS,OAAlB,CAA0BC,SAA/C,EAA0DE,OAA1D,CAAkEP,OAC/E,CAED,GAAIA,CAAJ,CAAa,CAGTF,CAAC,CAACW,cAAF,GAGAX,CAAC,CAACY,eAAF,GAEAC,CAAuB,CAACX,CAAD,CAAvB,CACCY,IADD,CACMX,CAAc,CAACY,OADrB,EAECC,KAFD,EAGH,CAXD,IA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AChC1B,CAAsB,CAACC,CAAD,CAAOyB,CAAP,CACzB,C","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 .\n\n/**\n * A javascript module to handler calendar view changes.\n *\n * @module core_calendar/view_manager\n * @copyright 2017 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport Templates from 'core/templates';\nimport Notification from 'core/notification';\nimport * as CalendarRepository from 'core_calendar/repository';\nimport CalendarEvents from 'core_calendar/events';\nimport * as CalendarSelectors from 'core_calendar/selectors';\nimport ModalFactory from 'core/modal_factory';\nimport ModalEvents from 'core/modal_events';\nimport SummaryModal from 'core_calendar/summary_modal';\nimport CustomEvents from 'core/custom_interaction_events';\nimport Pending from 'core/pending';\n\n/**\n * Register event listeners for the module.\n *\n * @param {object} root The root element.\n */\nconst registerEventListeners = (root) => {\n root = $(root);\n\n // Bind click events to event links.\n root.on('click', CalendarSelectors.links.eventLink, (e) => {\n const target = e.target;\n let eventLink = null;\n let eventId = null;\n const pendingPromise = new Pending('core_calendar/view_manager:eventLink:click');\n\n if (target.matches(CalendarSelectors.actions.viewEvent)) {\n eventLink = target;\n } else {\n eventLink = target.closest(CalendarSelectors.actions.viewEvent);\n }\n\n if (eventLink) {\n eventId = eventLink.dataset.eventId;\n } else {\n eventId = target.querySelector(CalendarSelectors.actions.viewEvent).dataset.eventId;\n }\n\n if (eventId) {\n // A link was found. Show the modal.\n\n e.preventDefault();\n // We've handled the event so stop it from bubbling\n // and causing the day click handler to fire.\n e.stopPropagation();\n\n renderEventSummaryModal(eventId)\n .then(pendingPromise.resolve)\n .catch();\n } else {\n pendingPromise.resolve();\n }\n });\n\n root.on('click', CalendarSelectors.links.navLink, (e) => {\n const wrapper = root.find(CalendarSelectors.wrapper);\n const view = wrapper.data('view');\n const courseId = wrapper.data('courseid');\n const categoryId = wrapper.data('categoryid');\n const link = e.currentTarget;\n\n if (view === 'month') {\n changeMonth(root, link.href, link.dataset.year, link.dataset.month, courseId, categoryId, link.dataset.day);\n e.preventDefault();\n } else if (view === 'day') {\n changeDay(root, link.href, link.dataset.year, link.dataset.month, link.dataset.day, courseId, categoryId);\n e.preventDefault();\n }\n });\n\n const viewSelector = root.find(CalendarSelectors.viewSelector);\n CustomEvents.define(viewSelector, [CustomEvents.events.activate]);\n viewSelector.on(\n CustomEvents.events.activate,\n (e) => {\n e.preventDefault();\n\n const option = e.target;\n if (option.classList.contains('active')) {\n return;\n }\n\n const view = option.dataset.view,\n year = option.dataset.year,\n month = option.dataset.month,\n day = option.dataset.day,\n courseId = option.dataset.courseid,\n categoryId = option.dataset.categoryid;\n\n if (view == 'month') {\n refreshMonthContent(root, year, month, courseId, categoryId, root, 'core_calendar/calendar_month', day)\n .then(() => {\n return window.history.pushState({}, '', '?view=month');\n }).fail(Notification.exception);\n } else if (view == 'day') {\n refreshDayContent(root, year, month, day, courseId, categoryId, root, 'core_calendar/calendar_day')\n .then(() => {\n return window.history.pushState({}, '', '?view=day');\n }).fail(Notification.exception);\n } else if (view == 'upcoming') {\n reloadCurrentUpcoming(root, courseId, categoryId, root, 'core_calendar/calendar_upcoming')\n .then(() => {\n return window.history.pushState({}, '', '?view=upcoming');\n }).fail(Notification.exception);\n }\n }\n );\n};\n\n/**\n * Refresh the month content.\n *\n * @param {object} root The root element.\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The id of the course whose events are shown\n * @param {number} categoryId The id of the category whose events are shown\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @param {string} template The template to be rendered.\n * @param {number} day Day (optional)\n * @return {promise}\n */\nexport const refreshMonthContent = (root, year, month, courseId, categoryId, target = null, template = '', day = 1) => {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n M.util.js_pending([root.get('id'), year, month, courseId].join('-'));\n const includenavigation = root.data('includenavigation');\n const mini = root.data('mini');\n return CalendarRepository.getCalendarMonthData(year, month, courseId, categoryId, includenavigation, mini, day)\n .then(context => {\n context.viewingmonth = true;\n return Templates.render(template, context);\n })\n .then((html, js) => {\n return Templates.replaceNode(target, html, js);\n })\n .then(() => {\n document.querySelector('body').dispatchEvent(new CustomEvent(CalendarEvents.viewUpdated));\n return;\n })\n .always(() => {\n M.util.js_complete([root.get('id'), year, month, courseId].join('-'));\n return stopLoading(root);\n })\n .fail(Notification.exception);\n};\n\n/**\n * Handle changes to the current calendar view.\n *\n * @param {object} root The container element\n * @param {string} url The calendar url to be shown\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} courseId The id of the course whose events are shown\n * @param {number} categoryId The id of the category whose events are shown\n * @param {number} day Day (optional)\n * @return {promise}\n */\nexport const changeMonth = (root, url, year, month, courseId, categoryId, day = 1) => {\n return refreshMonthContent(root, year, month, courseId, categoryId, null, '', day)\n .then((...args) => {\n if (url.length && url !== '#') {\n window.history.pushState({}, '', url);\n }\n return args;\n })\n .then((...args) => {\n $('body').trigger(CalendarEvents.monthChanged, [year, month, courseId, categoryId]);\n return args;\n });\n};\n\n/**\n * Reload the current month view data.\n *\n * @param {object} root The container element.\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise}\n */\nexport const reloadCurrentMonth = (root, courseId = 0, categoryId = 0) => {\n const year = root.find(CalendarSelectors.wrapper).data('year');\n const month = root.find(CalendarSelectors.wrapper).data('month');\n const day = root.find(CalendarSelectors.wrapper).data('day');\n\n courseId = courseId || root.find(CalendarSelectors.wrapper).data('courseid');\n categoryId = categoryId || root.find(CalendarSelectors.wrapper).data('categoryid');\n\n return refreshMonthContent(root, year, month, courseId, categoryId, null, '', day);\n};\n\n\n/**\n * Refresh the day content.\n *\n * @param {object} root The root element.\n * @param {number} year Year\n * @param {number} month Month\n * @param {number} day Day\n * @param {number} courseId The id of the course whose events are shown\n * @param {number} categoryId The id of the category whose events are shown\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @param {string} template The template to be rendered.\n *\n * @return {promise}\n */\nexport const refreshDayContent = (root, year, month, day, courseId, categoryId, target = null, template = '') => {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n M.util.js_pending([root.get('id'), year, month, day, courseId, categoryId].join('-'));\n const includenavigation = root.data('includenavigation');\n return CalendarRepository.getCalendarDayData(year, month, day, courseId, categoryId, includenavigation)\n .then((context) => {\n context.viewingday = true;\n return Templates.render(template, context);\n })\n .then((html, js) => {\n return Templates.replaceNode(target, html, js);\n })\n .then(() => {\n document.querySelector('body').dispatchEvent(new CustomEvent(CalendarEvents.viewUpdated));\n return;\n })\n .always(() => {\n M.util.js_complete([root.get('id'), year, month, day, courseId, categoryId].join('-'));\n return stopLoading(root);\n })\n .fail(Notification.exception);\n};\n\n/**\n * Reload the current day view data.\n *\n * @param {object} root The container element.\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @return {promise}\n */\nexport const reloadCurrentDay = (root, courseId = 0, categoryId = 0) => {\n const wrapper = root.find(CalendarSelectors.wrapper);\n const year = wrapper.data('year');\n const month = wrapper.data('month');\n const day = wrapper.data('day');\n\n courseId = courseId || root.find(CalendarSelectors.wrapper).data('courseid');\n categoryId = categoryId || root.find(CalendarSelectors.wrapper).data('categoryid');\n\n return refreshDayContent(root, year, month, day, courseId, categoryId);\n};\n\n/**\n * Handle changes to the current calendar view.\n *\n * @param {object} root The root element.\n * @param {String} url The calendar url to be shown\n * @param {Number} year Year\n * @param {Number} month Month\n * @param {Number} day Day\n * @param {Number} courseId The id of the course whose events are shown\n * @param {Number} categoryId The id of the category whose events are shown\n * @return {promise}\n */\nexport const changeDay = (root, url, year, month, day, courseId, categoryId) => {\n return refreshDayContent(root, year, month, day, courseId, categoryId)\n .then((...args) => {\n if (url.length && url !== '#') {\n window.history.pushState({}, '', url);\n }\n return args;\n })\n .then((...args) => {\n $('body').trigger(CalendarEvents.dayChanged, [year, month, courseId, categoryId]);\n return args;\n });\n};\n\n/**\n * Set the element state to loading.\n *\n * @param {object} root The container element\n * @method startLoading\n */\nconst startLoading = (root) => {\n const loadingIconContainer = root.find(CalendarSelectors.containers.loadingIcon);\n\n loadingIconContainer.removeClass('hidden');\n};\n\n/**\n * Remove the loading state from the element.\n *\n * @param {object} root The container element\n * @method stopLoading\n */\nconst stopLoading = (root) => {\n const loadingIconContainer = root.find(CalendarSelectors.containers.loadingIcon);\n\n loadingIconContainer.addClass('hidden');\n};\n\n/**\n * Reload the current month view data.\n *\n * @param {object} root The container element.\n * @param {number} courseId The course id.\n * @param {number} categoryId The id of the category whose events are shown\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @param {string} template The template to be rendered.\n * @return {promise}\n */\nexport const reloadCurrentUpcoming = (root, courseId = 0, categoryId = 0, target = null, template = '') => {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n courseId = courseId || root.find(CalendarSelectors.wrapper).data('courseid');\n categoryId = categoryId || root.find(CalendarSelectors.wrapper).data('categoryid');\n\n return CalendarRepository.getCalendarUpcomingData(courseId, categoryId)\n .then((context) => {\n context.viewingupcoming = true;\n return Templates.render(template, context);\n })\n .then((html, js) => {\n return Templates.replaceNode(target, html, js);\n })\n .then(() => {\n document.querySelector('body').dispatchEvent(new CustomEvent(CalendarEvents.viewUpdated));\n return;\n })\n .always(function() {\n return stopLoading(root);\n })\n .fail(Notification.exception);\n};\n\n/**\n * Get the CSS class to apply for the given event type.\n *\n * @param {string} eventType The calendar event type\n * @return {string}\n */\nconst getEventTypeClassFromType = (eventType) => {\n return 'calendar_event_' + eventType;\n};\n\n/**\n * Render the event summary modal.\n *\n * @param {Number} eventId The calendar event id.\n * @returns {Promise}\n */\nconst renderEventSummaryModal = (eventId) => {\n const pendingPromise = new Pending('core_calendar/view_manager:renderEventSummaryModal');\n\n // Calendar repository promise.\n return CalendarRepository.getEventById(eventId)\n .then((getEventResponse) => {\n if (!getEventResponse.event) {\n throw new Error('Error encountered while trying to fetch calendar event with ID: ' + eventId);\n }\n\n return getEventResponse.event;\n })\n .then(eventData => {\n // Build the modal parameters from the event data.\n const modalParams = {\n title: eventData.name,\n type: SummaryModal.TYPE,\n body: Templates.render('core_calendar/event_summary_body', eventData),\n templateContext: {\n canedit: eventData.canedit,\n candelete: eventData.candelete,\n headerclasses: getEventTypeClassFromType(eventData.normalisedeventtype),\n isactionevent: eventData.isactionevent,\n url: eventData.url,\n action: eventData.action\n }\n };\n\n // Create the modal.\n return ModalFactory.create(modalParams);\n })\n .then(modal => {\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Finally, render the modal!\n modal.show();\n\n return modal;\n })\n .then(modal => {\n pendingPromise.resolve();\n\n return modal;\n })\n .catch(Notification.exception);\n};\n\nexport const init = (root, view) => {\n registerEventListeners(root, view);\n};\n"],"file":"view_manager.min.js"}
\ No newline at end of file
diff --git a/calendar/amd/src/calendar.js b/calendar/amd/src/calendar.js
index 96c0b087b5f..cf9b68f22a8 100644
--- a/calendar/amd/src/calendar.js
+++ b/calendar/amd/src/calendar.js
@@ -21,7 +21,6 @@
* triggered within the calendar UI.
*
* @module core_calendar/calendar
- * @package core_calendar
* @copyright 2017 Simey Lameze
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/calendar_filter.js b/calendar/amd/src/calendar_filter.js
index 415b3b3a8b6..fbd0535c41e 100644
--- a/calendar/amd/src/calendar_filter.js
+++ b/calendar/amd/src/calendar_filter.js
@@ -17,7 +17,6 @@
* This module is responsible for the calendar filter.
*
* @module core_calendar/calendar_filter
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/calendar_mini.js b/calendar/amd/src/calendar_mini.js
index e419a255d3e..92b99eba92c 100644
--- a/calendar/amd/src/calendar_mini.js
+++ b/calendar/amd/src/calendar_mini.js
@@ -21,7 +21,6 @@
* triggered within the calendar UI.
*
* @module core_calendar/calendar_mini
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/calendar_threemonth.js b/calendar/amd/src/calendar_threemonth.js
index 33545c3a8f4..b4b5a3f26d3 100644
--- a/calendar/amd/src/calendar_threemonth.js
+++ b/calendar/amd/src/calendar_threemonth.js
@@ -18,7 +18,6 @@
* movement through them.
*
* @module core_calendar/calendar_threemonth
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/calendar_view.js b/calendar/amd/src/calendar_view.js
index 5b4e589f8c9..030fa519532 100644
--- a/calendar/amd/src/calendar_view.js
+++ b/calendar/amd/src/calendar_view.js
@@ -17,7 +17,6 @@
* This module is responsible for handle calendar day and upcoming view.
*
* @module core_calendar/calendar
- * @package core_calendar
* @copyright 2017 Simey Lameze
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/crud.js b/calendar/amd/src/crud.js
index a82bee13a49..4672dd615bb 100644
--- a/calendar/amd/src/crud.js
+++ b/calendar/amd/src/crud.js
@@ -17,7 +17,6 @@
* A module to handle CRUD operations within the UI.
*
* @module core_calendar/crud
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/drag_drop_data_store.js b/calendar/amd/src/drag_drop_data_store.js
index 893d11abd65..6c203ab9672 100644
--- a/calendar/amd/src/drag_drop_data_store.js
+++ b/calendar/amd/src/drag_drop_data_store.js
@@ -21,7 +21,6 @@
* between the different stages of the drag/drop lifecycle.
*
* @module core_calendar/drag_drop_data_store
- * @package core_calendar
* @copyright 2017 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/event_form.js b/calendar/amd/src/event_form.js
index b64639aa6ac..53fbcb3ac20 100644
--- a/calendar/amd/src/event_form.js
+++ b/calendar/amd/src/event_form.js
@@ -17,7 +17,6 @@
* A javascript module to enhance the event form.
*
* @module core_calendar/event_form
- * @package core_calendar
* @copyright 2017 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/events.js b/calendar/amd/src/events.js
index a3d0244957c..5ead82790e2 100644
--- a/calendar/amd/src/events.js
+++ b/calendar/amd/src/events.js
@@ -18,7 +18,6 @@
*
* @module core_calendar/events
* @class calendar_events
- * @package core_calendar
* @copyright 2017 Simey Lameze
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/modal_delete.js b/calendar/amd/src/modal_delete.js
index e457761ef78..7e91b5f07d8 100644
--- a/calendar/amd/src/modal_delete.js
+++ b/calendar/amd/src/modal_delete.js
@@ -18,7 +18,6 @@
*
* @module core_calendar/modal_delete
* @class modal_delete
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/modal_event_form.js b/calendar/amd/src/modal_event_form.js
index be7f718e17e..cf2c5258776 100644
--- a/calendar/amd/src/modal_event_form.js
+++ b/calendar/amd/src/modal_event_form.js
@@ -16,9 +16,7 @@
/**
* Contain the logic for the quick add or update event modal.
*
- * @module calendar/modal_quick_add_event
- * @class modal_quick_add_event
- * @package core
+ * @module core_calendar/modal_quick_add_event
* @copyright 2017 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/month_navigation_drag_drop.js b/calendar/amd/src/month_navigation_drag_drop.js
index dca8f6178e0..cb880983161 100644
--- a/calendar/amd/src/month_navigation_drag_drop.js
+++ b/calendar/amd/src/month_navigation_drag_drop.js
@@ -23,7 +23,6 @@
*
* @module core_calendar/month_navigation_drag_drop
* @class month_navigation_drag_drop
- * @package core_calendar
* @copyright 2017 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/month_view_drag_drop.js b/calendar/amd/src/month_view_drag_drop.js
index b94af90d155..a59df72e9a6 100644
--- a/calendar/amd/src/month_view_drag_drop.js
+++ b/calendar/amd/src/month_view_drag_drop.js
@@ -19,7 +19,6 @@
*
* @module core_calendar/month_view_drag_drop
* @class month_view_drag_drop
- * @package core_calendar
* @copyright 2017 Ryan Wyllie
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/repository.js b/calendar/amd/src/repository.js
index baa66ca055d..06a9ac7b6ef 100644
--- a/calendar/amd/src/repository.js
+++ b/calendar/amd/src/repository.js
@@ -18,7 +18,6 @@
*
* @module core_calendar/repository
* @class repository
- * @package core_calendar
* @copyright 2017 Simey Lameze
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/selectors.js b/calendar/amd/src/selectors.js
index 6ecbea3e555..a8ae8b52b34 100644
--- a/calendar/amd/src/selectors.js
+++ b/calendar/amd/src/selectors.js
@@ -17,7 +17,6 @@
* This module is responsible for the calendar filter.
*
* @module core_calendar/calendar_selectors
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/summary_modal.js b/calendar/amd/src/summary_modal.js
index 5f92706423d..744f4edcbb7 100644
--- a/calendar/amd/src/summary_modal.js
+++ b/calendar/amd/src/summary_modal.js
@@ -17,7 +17,6 @@
* A javascript module to handle summary modal.
*
* @module core_calendar/summary_modal
- * @package core_calendar
* @copyright 2017 Simey Lameze
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/calendar/amd/src/view_manager.js b/calendar/amd/src/view_manager.js
index 37fca710b17..33a213f1cf2 100644
--- a/calendar/amd/src/view_manager.js
+++ b/calendar/amd/src/view_manager.js
@@ -17,7 +17,6 @@
* A javascript module to handler calendar view changes.
*
* @module core_calendar/view_manager
- * @package core_calendar
* @copyright 2017 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/contentbank/amd/build/actions.min.js.map b/contentbank/amd/build/actions.min.js.map
index ee0807e6a8e..3298e0b0915 100644
--- a/contentbank/amd/build/actions.min.js.map
+++ b/contentbank/amd/build/actions.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/actions.js"],"names":["define","$","Ajax","Notification","Str","Templates","Url","ModalFactory","ModalEvents","ACTIONS","DELETE_CONTENT","RENAME_CONTENT","Actions","registerEvents","prototype","click","e","preventDefault","contentname","data","contentid","contextid","deleteButtonText","get_strings","key","component","param","name","then","langStrings","modalTitle","modalContent","create","title","body","type","types","SAVE_CANCEL","large","done","modal","setSaveButtonText","getRoot","on","save","deleteContent","hidden","destroy","show","catch","exception","saveButtonText","render","newname","val","trim","renameContent","alert","requestType","call","methodname","args","contentids","result","message","params","statusmsg","errormsg","window","location","href","relativeUrl","fail","warnings","id","addNotification","fetchNotifications"],"mappings":"AAuBAA,OAAM,4BAAC,CACH,QADG,CAEH,WAFG,CAGH,mBAHG,CAIH,UAJG,CAKH,gBALG,CAMH,UANG,CAOH,oBAPG,CAQH,mBARG,CAAD,CASN,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAgCC,CAAhC,CAAqCC,CAArC,CAAgDC,CAAhD,CAAqDC,CAArD,CAAmEC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AAkB,CACtB,GAAIC,CAAAA,CAAM,CAAG,IAAb,CACA,GAAmB,SAAf,EAAAP,CAAJ,CAA8B,CAC1BO,CAAM,CAAG,CACLS,EAAE,CAAEtD,CADC,CAEL8C,SAAS,CAAEF,CAFN,CAAT,CAKAI,MAAM,CAACC,QAAP,CAAgBC,IAAhB,CAAuBhE,CAAG,CAACiE,WAAJ,CAAgB,sBAAhB,CAAwCN,CAAxC,IAC1B,CAPD,IAOO,CAEH9D,CAAY,CAACwE,eAAb,CAA6B,CACzBX,OAAO,CAAEA,CADgB,CAEzB7B,IAAI,CAAE,OAFmB,CAA7B,EAIAhC,CAAY,CAACyE,kBAAb,EACH,CAEJ,CAzBD,EAyBG3B,KAzBH,CAyBS9C,CAAY,CAAC+C,SAzBtB,CA0BH,CAED,MAAqD,CASjD,KAAQ,eAAW,CACf,MAAO,IAAItC,CAAAA,CACd,CAXgD,CAaxD,CAtPK,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 .\n\n/**\n * Module to manage content bank actions, such as delete or rename.\n *\n * @module core_contentbank/actions\n * @package core_contentbank\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/notification',\n 'core/str',\n 'core/templates',\n 'core/url',\n 'core/modal_factory',\n 'core/modal_events'],\nfunction($, Ajax, Notification, Str, Templates, Url, ModalFactory, ModalEvents) {\n\n /**\n * List of action selectors.\n *\n * @type {{DELETE_CONTENT: string}}\n */\n var ACTIONS = {\n DELETE_CONTENT: '[data-action=\"deletecontent\"]',\n RENAME_CONTENT: '[data-action=\"renamecontent\"]',\n };\n\n /**\n * Actions class.\n */\n var Actions = function() {\n this.registerEvents();\n };\n\n /**\n * Register event listeners.\n */\n Actions.prototype.registerEvents = function() {\n $(ACTIONS.DELETE_CONTENT).click(function(e) {\n e.preventDefault();\n\n var contentname = $(this).data('contentname');\n var contentid = $(this).data('contentid');\n var contextid = $(this).data('contextid');\n\n var strings = [\n {\n key: 'deletecontent',\n component: 'core_contentbank'\n },\n {\n key: 'deletecontentconfirm',\n component: 'core_contentbank',\n param: {\n name: contentname,\n }\n },\n {\n key: 'delete',\n component: 'core'\n },\n ];\n\n var deleteButtonText = '';\n Str.get_strings(strings).then(function(langStrings) {\n var modalTitle = langStrings[0];\n var modalContent = langStrings[1];\n deleteButtonText = langStrings[2];\n\n return ModalFactory.create({\n title: modalTitle,\n body: modalContent,\n type: ModalFactory.types.SAVE_CANCEL,\n large: true\n });\n }).done(function(modal) {\n modal.setSaveButtonText(deleteButtonText);\n modal.getRoot().on(ModalEvents.save, function() {\n // The action is now confirmed, sending an action for it.\n return deleteContent(contentid, contextid);\n });\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Show the modal.\n modal.show();\n\n return;\n }).catch(Notification.exception);\n });\n\n $(ACTIONS.RENAME_CONTENT).click(function(e) {\n e.preventDefault();\n\n var contentname = $(this).data('contentname');\n var contentid = $(this).data('contentid');\n\n var strings = [\n {\n key: 'renamecontent',\n component: 'core_contentbank'\n },\n {\n key: 'rename',\n component: 'core_contentbank'\n },\n ];\n\n var saveButtonText = '';\n Str.get_strings(strings).then(function(langStrings) {\n var modalTitle = langStrings[0];\n saveButtonText = langStrings[1];\n\n return ModalFactory.create({\n title: modalTitle,\n body: Templates.render('core_contentbank/renamecontent', {'contentid': contentid, 'name': contentname}),\n type: ModalFactory.types.SAVE_CANCEL\n });\n }).then(function(modal) {\n modal.setSaveButtonText(saveButtonText);\n modal.getRoot().on(ModalEvents.save, function(e) {\n // The action is now confirmed, sending an action for it.\n var newname = $(\"#newname\").val().trim();\n if (newname) {\n renameContent(contentid, newname);\n } else {\n var errorStrings = [\n {\n key: 'error',\n },\n {\n key: 'emptynamenotallowed',\n component: 'core_contentbank',\n },\n ];\n Str.get_strings(errorStrings).then(function(langStrings) {\n Notification.alert(langStrings[0], langStrings[1]);\n }).catch(Notification.exception);\n e.preventDefault();\n }\n });\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Show the modal.\n modal.show();\n\n return;\n }).catch(Notification.exception);\n });\n };\n\n /**\n * Delete content from the content bank.\n *\n * @param {int} contentid The content to delete.\n * @param {int} contextid The contextid where the content belongs.\n */\n function deleteContent(contentid, contextid) {\n var request = {\n methodname: 'core_contentbank_delete_content',\n args: {\n contentids: {contentid}\n }\n };\n\n var requestType = 'success';\n Ajax.call([request])[0].then(function(data) {\n if (data.result) {\n return 'contentdeleted';\n }\n requestType = 'error';\n return 'contentnotdeleted';\n\n }).done(function(message) {\n var params = {\n contextid: contextid\n };\n if (requestType == 'success') {\n params.statusmsg = message;\n } else {\n params.errormsg = message;\n }\n // Redirect to the main content bank page and display the message as a notification.\n window.location.href = Url.relativeUrl('contentbank/index.php', params, false);\n }).fail(Notification.exception);\n }\n\n /**\n * Rename content in the content bank.\n *\n * @param {int} contentid The content to rename.\n * @param {string} name The new name for the content.\n */\n function renameContent(contentid, name) {\n var request = {\n methodname: 'core_contentbank_rename_content',\n args: {\n contentid: contentid,\n name: name\n }\n };\n var requestType = 'success';\n Ajax.call([request])[0].then(function(data) {\n if (data.result) {\n return 'contentrenamed';\n }\n requestType = 'error';\n return data.warnings[0].message;\n\n }).then(function(message) {\n var params = null;\n if (requestType == 'success') {\n params = {\n id: contentid,\n statusmsg: message\n };\n // Redirect to the content view page and display the message as a notification.\n window.location.href = Url.relativeUrl('contentbank/view.php', params, false);\n } else {\n // Fetch error notifications.\n Notification.addNotification({\n message: message,\n type: 'error'\n });\n Notification.fetchNotifications();\n }\n return;\n }).catch(Notification.exception);\n }\n\n return /** @alias module:core_contentbank/actions */ {\n // Public variables and functions.\n\n /**\n * Initialise the contentbank actions.\n *\n * @method init\n * @return {Actions}\n */\n 'init': function() {\n return new Actions();\n }\n };\n});\n"],"file":"actions.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/actions.js"],"names":["define","$","Ajax","Notification","Str","Templates","Url","ModalFactory","ModalEvents","ACTIONS","DELETE_CONTENT","RENAME_CONTENT","Actions","registerEvents","prototype","click","e","preventDefault","contentname","data","contentid","contextid","deleteButtonText","get_strings","key","component","param","name","then","langStrings","modalTitle","modalContent","create","title","body","type","types","SAVE_CANCEL","large","done","modal","setSaveButtonText","getRoot","on","save","deleteContent","hidden","destroy","show","catch","exception","saveButtonText","render","newname","val","trim","renameContent","alert","requestType","call","methodname","args","contentids","result","message","params","statusmsg","errormsg","window","location","href","relativeUrl","fail","warnings","id","addNotification","fetchNotifications"],"mappings":"AAsBAA,OAAM,4BAAC,CACH,QADG,CAEH,WAFG,CAGH,mBAHG,CAIH,UAJG,CAKH,gBALG,CAMH,UANG,CAOH,oBAPG,CAQH,mBARG,CAAD,CASN,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAAgCC,CAAhC,CAAqCC,CAArC,CAAgDC,CAAhD,CAAqDC,CAArD,CAAmEC,CAAnE,CAAgF,IAOxEC,CAAAA,CAAO,CAAG,CACVC,cAAc,CAAE,iCADN,CAEVC,cAAc,CAAE,iCAFN,CAP8D,CAexEC,CAAO,CAAG,UAAW,CACrB,KAAKC,cAAL,EACH,CAjB2E,CAsB5ED,CAAO,CAACE,SAAR,CAAkBD,cAAlB,CAAmC,UAAW,CAC1CZ,CAAC,CAACQ,CAAO,CAACC,cAAT,CAAD,CAA0BK,KAA1B,CAAgC,SAASC,CAAT,CAAY,CACxCA,CAAC,CAACC,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zBX,OAAO,CAAEA,CADgB,CAEzB7B,IAAI,CAAE,OAFmB,CAA7B,EAIAhC,CAAY,CAACyE,kBAAb,EACH,CAEJ,CAzBD,EAyBG3B,KAzBH,CAyBS9C,CAAY,CAAC+C,SAzBtB,CA0BH,CAED,MAAqD,CASjD,KAAQ,eAAW,CACf,MAAO,IAAItC,CAAAA,CACd,CAXgD,CAaxD,CAtPK,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 .\n\n/**\n * Module to manage content bank actions, such as delete or rename.\n *\n * @module core_contentbank/actions\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/notification',\n 'core/str',\n 'core/templates',\n 'core/url',\n 'core/modal_factory',\n 'core/modal_events'],\nfunction($, Ajax, Notification, Str, Templates, Url, ModalFactory, ModalEvents) {\n\n /**\n * List of action selectors.\n *\n * @type {{DELETE_CONTENT: string}}\n */\n var ACTIONS = {\n DELETE_CONTENT: '[data-action=\"deletecontent\"]',\n RENAME_CONTENT: '[data-action=\"renamecontent\"]',\n };\n\n /**\n * Actions class.\n */\n var Actions = function() {\n this.registerEvents();\n };\n\n /**\n * Register event listeners.\n */\n Actions.prototype.registerEvents = function() {\n $(ACTIONS.DELETE_CONTENT).click(function(e) {\n e.preventDefault();\n\n var contentname = $(this).data('contentname');\n var contentid = $(this).data('contentid');\n var contextid = $(this).data('contextid');\n\n var strings = [\n {\n key: 'deletecontent',\n component: 'core_contentbank'\n },\n {\n key: 'deletecontentconfirm',\n component: 'core_contentbank',\n param: {\n name: contentname,\n }\n },\n {\n key: 'delete',\n component: 'core'\n },\n ];\n\n var deleteButtonText = '';\n Str.get_strings(strings).then(function(langStrings) {\n var modalTitle = langStrings[0];\n var modalContent = langStrings[1];\n deleteButtonText = langStrings[2];\n\n return ModalFactory.create({\n title: modalTitle,\n body: modalContent,\n type: ModalFactory.types.SAVE_CANCEL,\n large: true\n });\n }).done(function(modal) {\n modal.setSaveButtonText(deleteButtonText);\n modal.getRoot().on(ModalEvents.save, function() {\n // The action is now confirmed, sending an action for it.\n return deleteContent(contentid, contextid);\n });\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Show the modal.\n modal.show();\n\n return;\n }).catch(Notification.exception);\n });\n\n $(ACTIONS.RENAME_CONTENT).click(function(e) {\n e.preventDefault();\n\n var contentname = $(this).data('contentname');\n var contentid = $(this).data('contentid');\n\n var strings = [\n {\n key: 'renamecontent',\n component: 'core_contentbank'\n },\n {\n key: 'rename',\n component: 'core_contentbank'\n },\n ];\n\n var saveButtonText = '';\n Str.get_strings(strings).then(function(langStrings) {\n var modalTitle = langStrings[0];\n saveButtonText = langStrings[1];\n\n return ModalFactory.create({\n title: modalTitle,\n body: Templates.render('core_contentbank/renamecontent', {'contentid': contentid, 'name': contentname}),\n type: ModalFactory.types.SAVE_CANCEL\n });\n }).then(function(modal) {\n modal.setSaveButtonText(saveButtonText);\n modal.getRoot().on(ModalEvents.save, function(e) {\n // The action is now confirmed, sending an action for it.\n var newname = $(\"#newname\").val().trim();\n if (newname) {\n renameContent(contentid, newname);\n } else {\n var errorStrings = [\n {\n key: 'error',\n },\n {\n key: 'emptynamenotallowed',\n component: 'core_contentbank',\n },\n ];\n Str.get_strings(errorStrings).then(function(langStrings) {\n Notification.alert(langStrings[0], langStrings[1]);\n }).catch(Notification.exception);\n e.preventDefault();\n }\n });\n\n // Handle hidden event.\n modal.getRoot().on(ModalEvents.hidden, function() {\n // Destroy when hidden.\n modal.destroy();\n });\n\n // Show the modal.\n modal.show();\n\n return;\n }).catch(Notification.exception);\n });\n };\n\n /**\n * Delete content from the content bank.\n *\n * @param {int} contentid The content to delete.\n * @param {int} contextid The contextid where the content belongs.\n */\n function deleteContent(contentid, contextid) {\n var request = {\n methodname: 'core_contentbank_delete_content',\n args: {\n contentids: {contentid}\n }\n };\n\n var requestType = 'success';\n Ajax.call([request])[0].then(function(data) {\n if (data.result) {\n return 'contentdeleted';\n }\n requestType = 'error';\n return 'contentnotdeleted';\n\n }).done(function(message) {\n var params = {\n contextid: contextid\n };\n if (requestType == 'success') {\n params.statusmsg = message;\n } else {\n params.errormsg = message;\n }\n // Redirect to the main content bank page and display the message as a notification.\n window.location.href = Url.relativeUrl('contentbank/index.php', params, false);\n }).fail(Notification.exception);\n }\n\n /**\n * Rename content in the content bank.\n *\n * @param {int} contentid The content to rename.\n * @param {string} name The new name for the content.\n */\n function renameContent(contentid, name) {\n var request = {\n methodname: 'core_contentbank_rename_content',\n args: {\n contentid: contentid,\n name: name\n }\n };\n var requestType = 'success';\n Ajax.call([request])[0].then(function(data) {\n if (data.result) {\n return 'contentrenamed';\n }\n requestType = 'error';\n return data.warnings[0].message;\n\n }).then(function(message) {\n var params = null;\n if (requestType == 'success') {\n params = {\n id: contentid,\n statusmsg: message\n };\n // Redirect to the content view page and display the message as a notification.\n window.location.href = Url.relativeUrl('contentbank/view.php', params, false);\n } else {\n // Fetch error notifications.\n Notification.addNotification({\n message: message,\n type: 'error'\n });\n Notification.fetchNotifications();\n }\n return;\n }).catch(Notification.exception);\n }\n\n return /** @alias module:core_contentbank/actions */ {\n // Public variables and functions.\n\n /**\n * Initialise the contentbank actions.\n *\n * @method init\n * @return {Actions}\n */\n 'init': function() {\n return new Actions();\n }\n };\n});\n"],"file":"actions.min.js"}
\ No newline at end of file
diff --git a/contentbank/amd/build/search.min.js.map b/contentbank/amd/build/search.min.js.map
index ae3bad772ca..d618defb07e 100644
--- a/contentbank/amd/build/search.min.js.map
+++ b/contentbank/amd/build/search.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/search.js"],"names":["init","pendingPromise","Pending","root","selectors","regions","contentbank","registerListenerEvents","resolve","searchInput","find","elements","searchinput","on","actions","search","e","preventDefault","toggleSearchResultsView","value","clearSearch","focus","addEventListener","body","searchQuery","clearSearchButton","navbarBreadcrumb","cbnavbarbreadcrumb","navbarTotal","cbnavbartotalsearch","filteredContents","filterContents","length","classList","remove","add","innerHTML","searchTerm","contents","Array","from","listitem","searchResults","forEach","content","contentName","getAttribute","toLowerCase","includes","push","contentNameElement","querySelector","cbcontentname","highlight","text","highlightText","result","pos","indexOf","substr"],"mappings":"6NAwBA,OACA,OAEA,O,kXAQO,GAAMA,CAAAA,CAAI,CAAG,UAAM,IAChBC,CAAAA,CAAc,CAAG,GAAIC,UADL,CAGhBC,CAAI,CAAG,cAAEC,UAAUC,OAAV,CAAkBC,WAApB,CAHS,CAItBC,CAAsB,CAACJ,CAAD,CAAtB,CAEAF,CAAc,CAACO,OAAf,EACH,CAPM,C,YAeDD,CAAAA,CAAsB,CAAG,SAACJ,CAAD,CAAU,CAErC,GAAMM,CAAAA,CAAW,CAAGN,CAAI,CAACO,IAAL,CAAUN,UAAUO,QAAV,CAAmBC,WAA7B,EAA0C,CAA1C,CAApB,CAEAT,CAAI,CAACU,EAAL,CAAQ,OAAR,CAAiBT,UAAUU,OAAV,CAAkBC,MAAnC,CAA2C,SAASC,CAAT,CAAY,CACnDA,CAAC,CAACC,cAAF,GACAC,CAAuB,CAACf,CAAD,CAAOM,CAAW,CAACU,KAAnB,CAC1B,CAHD,EAKAhB,CAAI,CAACU,EAAL,CAAQ,OAAR,CAAiBT,UAAUU,OAAV,CAAkBM,WAAnC,CAAgD,SAASJ,CAAT,CAAY,CACxDA,CAAC,CAACC,cAAF,GACAR,CAAW,CAACU,KAAZ,CAAoB,EAApB,CACAV,CAAW,CAACY,KAAZ,GACAH,CA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,CAAG,CAAGF,CAAa,CAACvB,MAAhC,CACP,CACJ,CAED,MAAOwB,CAAAA,CACV,C","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 .\n\n/**\n * Search methods for finding contents in the content bank.\n *\n * @module core_contentbank/search\n * @package core_contentbank\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport selectors from 'core_contentbank/selectors';\nimport {get_string as getString} from 'core/str';\nimport Pending from 'core/pending';\nimport {debounce} from 'core/utils';\n\n/**\n * Set up the search.\n *\n * @method init\n */\nexport const init = () => {\n const pendingPromise = new Pending();\n\n const root = $(selectors.regions.contentbank);\n registerListenerEvents(root);\n\n pendingPromise.resolve();\n};\n\n/**\n * Register contentbank search related event listeners.\n *\n * @method registerListenerEvents\n * @param {Object} root The root element for the contentbank.\n */\nconst registerListenerEvents = (root) => {\n\n const searchInput = root.find(selectors.elements.searchinput)[0];\n\n root.on('click', selectors.actions.search, function(e) {\n e.preventDefault();\n toggleSearchResultsView(root, searchInput.value);\n });\n\n root.on('click', selectors.actions.clearSearch, function(e) {\n e.preventDefault();\n searchInput.value = \"\";\n searchInput.focus();\n toggleSearchResultsView(root, searchInput.value);\n });\n\n // The search input is also triggered.\n searchInput.addEventListener('input', debounce(() => {\n // Display the search results.\n toggleSearchResultsView(root, searchInput.value);\n }, 300));\n\n};\n\n/**\n * Toggle (display/hide) the search results depending on the value of the search query.\n *\n * @method toggleSearchResultsView\n * @param {HTMLElement} body The root element for the contentbank.\n * @param {String} searchQuery The search query.\n */\nconst toggleSearchResultsView = async(body, searchQuery) => {\n const clearSearchButton = body.find(selectors.actions.clearSearch)[0];\n\n const navbarBreadcrumb = body.find(selectors.elements.cbnavbarbreadcrumb)[0];\n const navbarTotal = body.find(selectors.elements.cbnavbartotalsearch)[0];\n // Update the results.\n const filteredContents = filterContents(body, searchQuery);\n if (searchQuery.length > 0) {\n // As the search query is present, search results should be displayed.\n\n // Display the \"clear\" search button in the activity chooser search bar.\n clearSearchButton.classList.remove('d-none');\n\n // Change the cb-navbar to display total items found.\n navbarBreadcrumb.classList.add('d-none');\n navbarTotal.innerHTML = await getString('itemsfound', 'core_contentbank', filteredContents.length);\n navbarTotal.classList.remove('d-none');\n } else {\n // As search query is not present, the search results should be removed.\n\n // Hide the \"clear\" search button in the activity chooser search bar.\n clearSearchButton.classList.add('d-none');\n\n // Display again the breadcrumb in the navbar.\n navbarBreadcrumb.classList.remove('d-none');\n navbarTotal.classList.add('d-none');\n }\n};\n\n/**\n * Return the list of contents which have a name that matches the given search term.\n *\n * @method filterContents\n * @param {HTMLElement} body The root element for the contentbank.\n * @param {String} searchTerm The search term to match.\n * @return {Array}\n */\nconst filterContents = (body, searchTerm) => {\n const contents = Array.from(body.find(selectors.elements.listitem));\n const searchResults = [];\n contents.forEach((content) => {\n const contentName = content.getAttribute('data-name');\n if (searchTerm === '' || contentName.toLowerCase().includes(searchTerm.toLowerCase())) {\n // The content matches the search criteria so it should be displayed and hightlighted.\n searchResults.push(content);\n const contentNameElement = content.querySelector(selectors.regions.cbcontentname);\n contentNameElement.innerHTML = highlight(contentName, searchTerm);\n content.classList.remove('d-none');\n } else {\n content.classList.add('d-none');\n }\n });\n\n return searchResults;\n};\n\n/**\n * Highlight a given string in a text.\n *\n * @method highlight\n * @param {String} text The whole text.\n * @param {String} highlightText The piece of text to highlight.\n * @return {String}\n */\nconst highlight = (text, highlightText) => {\n let result = text;\n if (highlightText !== '') {\n const pos = text.toLowerCase().indexOf(highlightText.toLowerCase());\n if (pos > -1) {\n result = text.substr(0, pos) + '' + text.substr(pos, highlightText.length) + '' +\n text.substr(pos + highlightText.length);\n }\n }\n\n return result;\n};\n"],"file":"search.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/search.js"],"names":["init","pendingPromise","Pending","root","selectors","regions","contentbank","registerListenerEvents","resolve","searchInput","find","elements","searchinput","on","actions","search","e","preventDefault","toggleSearchResultsView","value","clearSearch","focus","addEventListener","body","searchQuery","clearSearchButton","navbarBreadcrumb","cbnavbarbreadcrumb","navbarTotal","cbnavbartotalsearch","filteredContents","filterContents","length","classList","remove","add","innerHTML","searchTerm","contents","Array","from","listitem","searchResults","forEach","content","contentName","getAttribute","toLowerCase","includes","push","contentNameElement","querySelector","cbcontentname","highlight","text","highlightText","result","pos","indexOf","substr"],"mappings":"6NAuBA,OACA,OAEA,O,kXAQO,GAAMA,CAAAA,CAAI,CAAG,UAAM,IAChBC,CAAAA,CAAc,CAAG,GAAIC,UADL,CAGhBC,CAAI,CAAG,cAAEC,UAAUC,OAAV,CAAkBC,WAApB,CAHS,CAItBC,CAAsB,CAACJ,CAAD,CAAtB,CAEAF,CAAc,CAACO,OAAf,EACH,CAPM,C,YAeDD,CAAAA,CAAsB,CAAG,SAACJ,CAAD,CAAU,CAErC,GAAMM,CAAAA,CAAW,CAAGN,CAAI,CAACO,IAAL,CAAUN,UAAUO,QAAV,CAAmBC,WAA7B,EAA0C,CAA1C,CAApB,CAEAT,CAAI,CAACU,EAAL,CAAQ,OAAR,CAAiBT,UAAUU,OAAV,CAAkBC,MAAnC,CAA2C,SAASC,CAAT,CAAY,CACnDA,CAAC,CAACC,cAAF,GACAC,CAAuB,CAACf,CAAD,CAAOM,CAAW,CAACU,KAAnB,CAC1B,CAHD,EAKAhB,CAAI,CAACU,EAAL,CAAQ,OAAR,CAAiBT,UAAUU,OAAV,CAAkBM,WAAnC,CAAgD,SAASJ,CAAT,CAAY,CACxDA,CAAC,CAACC,cAAF,GACAR,CAAW,CAACU,K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CAAnD,CAA4F,SAA5F,CACLsB,CAAI,CAACK,MAAL,CAAYF,CAAG,CAAGF,CAAa,CAACvB,MAAhC,CACP,CACJ,CAED,MAAOwB,CAAAA,CACV,C","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 .\n\n/**\n * Search methods for finding contents in the content bank.\n *\n * @module core_contentbank/search\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport selectors from 'core_contentbank/selectors';\nimport {get_string as getString} from 'core/str';\nimport Pending from 'core/pending';\nimport {debounce} from 'core/utils';\n\n/**\n * Set up the search.\n *\n * @method init\n */\nexport const init = () => {\n const pendingPromise = new Pending();\n\n const root = $(selectors.regions.contentbank);\n registerListenerEvents(root);\n\n pendingPromise.resolve();\n};\n\n/**\n * Register contentbank search related event listeners.\n *\n * @method registerListenerEvents\n * @param {Object} root The root element for the contentbank.\n */\nconst registerListenerEvents = (root) => {\n\n const searchInput = root.find(selectors.elements.searchinput)[0];\n\n root.on('click', selectors.actions.search, function(e) {\n e.preventDefault();\n toggleSearchResultsView(root, searchInput.value);\n });\n\n root.on('click', selectors.actions.clearSearch, function(e) {\n e.preventDefault();\n searchInput.value = \"\";\n searchInput.focus();\n toggleSearchResultsView(root, searchInput.value);\n });\n\n // The search input is also triggered.\n searchInput.addEventListener('input', debounce(() => {\n // Display the search results.\n toggleSearchResultsView(root, searchInput.value);\n }, 300));\n\n};\n\n/**\n * Toggle (display/hide) the search results depending on the value of the search query.\n *\n * @method toggleSearchResultsView\n * @param {HTMLElement} body The root element for the contentbank.\n * @param {String} searchQuery The search query.\n */\nconst toggleSearchResultsView = async(body, searchQuery) => {\n const clearSearchButton = body.find(selectors.actions.clearSearch)[0];\n\n const navbarBreadcrumb = body.find(selectors.elements.cbnavbarbreadcrumb)[0];\n const navbarTotal = body.find(selectors.elements.cbnavbartotalsearch)[0];\n // Update the results.\n const filteredContents = filterContents(body, searchQuery);\n if (searchQuery.length > 0) {\n // As the search query is present, search results should be displayed.\n\n // Display the \"clear\" search button in the activity chooser search bar.\n clearSearchButton.classList.remove('d-none');\n\n // Change the cb-navbar to display total items found.\n navbarBreadcrumb.classList.add('d-none');\n navbarTotal.innerHTML = await getString('itemsfound', 'core_contentbank', filteredContents.length);\n navbarTotal.classList.remove('d-none');\n } else {\n // As search query is not present, the search results should be removed.\n\n // Hide the \"clear\" search button in the activity chooser search bar.\n clearSearchButton.classList.add('d-none');\n\n // Display again the breadcrumb in the navbar.\n navbarBreadcrumb.classList.remove('d-none');\n navbarTotal.classList.add('d-none');\n }\n};\n\n/**\n * Return the list of contents which have a name that matches the given search term.\n *\n * @method filterContents\n * @param {HTMLElement} body The root element for the contentbank.\n * @param {String} searchTerm The search term to match.\n * @return {Array}\n */\nconst filterContents = (body, searchTerm) => {\n const contents = Array.from(body.find(selectors.elements.listitem));\n const searchResults = [];\n contents.forEach((content) => {\n const contentName = content.getAttribute('data-name');\n if (searchTerm === '' || contentName.toLowerCase().includes(searchTerm.toLowerCase())) {\n // The content matches the search criteria so it should be displayed and hightlighted.\n searchResults.push(content);\n const contentNameElement = content.querySelector(selectors.regions.cbcontentname);\n contentNameElement.innerHTML = highlight(contentName, searchTerm);\n content.classList.remove('d-none');\n } else {\n content.classList.add('d-none');\n }\n });\n\n return searchResults;\n};\n\n/**\n * Highlight a given string in a text.\n *\n * @method highlight\n * @param {String} text The whole text.\n * @param {String} highlightText The piece of text to highlight.\n * @return {String}\n */\nconst highlight = (text, highlightText) => {\n let result = text;\n if (highlightText !== '') {\n const pos = text.toLowerCase().indexOf(highlightText.toLowerCase());\n if (pos > -1) {\n result = text.substr(0, pos) + '' + text.substr(pos, highlightText.length) + '' +\n text.substr(pos + highlightText.length);\n }\n }\n\n return result;\n};\n"],"file":"search.min.js"}
\ No newline at end of file
diff --git a/contentbank/amd/build/selectors.min.js.map b/contentbank/amd/build/selectors.min.js.map
index 62be4440b62..52de6bc7147 100644
--- a/contentbank/amd/build/selectors.min.js.map
+++ b/contentbank/amd/build/selectors.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/selectors.js"],"names":["getDataSelector","name","value","regions","cbcontentname","contentbank","filearea","actions","search","clearSearch","viewgrid","viewlist","sortname","sortdate","sortsize","sorttype","sortauthor","elements","listitem","cbnavbarbreadcrumb","cbnavbartotalsearch","searchinput","sortbutton"],"mappings":"+IAgCMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,aAAa,CAAEJ,CAAe,CAAC,QAAD,CAAW,iBAAX,CADzB,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,QAAQ,CAAEN,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CADE,CAMXO,OAAO,CAAE,CACLC,MAAM,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CADlB,CAELS,WAAW,CAAET,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLU,QAAQ,CAAEV,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CAILW,QAAQ,CAAEX,CAAe,CAAC,QAAD,CAAW,UAAX,CAJpB,CAKLY,QAAQ,CAAEZ,CAAe,CAAC,QAAD,CAAW,UAAX,CALpB,CAMLa,QAAQ,CAAEb,CAAe,CAAC,QAAD,CAAW,UAAX,CANpB,CAOLc,QAAQ,CAAEd,CAAe,CAAC,QAAD,CAAW,UAAX,CAPpB,CAQLe,QAAQ,CAAEf,CAAe,CAAC,QAAD,CAAW,UAAX,CARpB,CASLgB,UAAU,CAAEhB,CAAe,CAAC,QAAD,CAAW,YAAX,CATtB,CANE,CAiBXiB,QAAQ,CAAE,CACNC,QAAQ,CAAE,cADJ,CAENC,kBAAkB,CAAE,uBAFd,CAGNC,mBAAmB,CAAE,wBAHf,CAINC,WAAW,CAAE,cAJP,CAKNC,UAAU,CAAE,aALN,CAjBC,C","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 .\n\n/**\n * Define all of the selectors we will be using on the contentbank interface.\n *\n * @module core_contentbank/selectors\n * @package core_contentbank\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n *\n * @method getDataSelector\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n regions: {\n cbcontentname: getDataSelector('region', 'cb-content-name'),\n contentbank: getDataSelector('region', 'contentbank'),\n filearea: getDataSelector('region', 'filearea')\n },\n actions: {\n search: getDataSelector('action', 'searchcontent'),\n clearSearch: getDataSelector('action', 'clearsearch'),\n viewgrid: getDataSelector('action', 'viewgrid'),\n viewlist: getDataSelector('action', 'viewlist'),\n sortname: getDataSelector('action', 'sortname'),\n sortdate: getDataSelector('action', 'sortdate'),\n sortsize: getDataSelector('action', 'sortsize'),\n sorttype: getDataSelector('action', 'sorttype'),\n sortauthor: getDataSelector('action', 'sortauthor'),\n },\n elements: {\n listitem: '.cb-listitem',\n cbnavbarbreadcrumb: '.cb-navbar-breadbrumb',\n cbnavbartotalsearch: '.cb-navbar-totalsearch',\n searchinput: '#searchinput',\n sortbutton: '.cb-btnsort'\n },\n};\n"],"file":"selectors.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/selectors.js"],"names":["getDataSelector","name","value","regions","cbcontentname","contentbank","filearea","actions","search","clearSearch","viewgrid","viewlist","sortname","sortdate","sortsize","sorttype","sortauthor","elements","listitem","cbnavbarbreadcrumb","cbnavbartotalsearch","searchinput","sortbutton"],"mappings":"+IA+BMA,CAAAA,CAAe,CAAG,SAACC,CAAD,CAAOC,CAAP,CAAiB,CACrC,sBAAgBD,CAAhB,eAAyBC,CAAzB,OACH,C,GAEc,CACXC,OAAO,CAAE,CACLC,aAAa,CAAEJ,CAAe,CAAC,QAAD,CAAW,iBAAX,CADzB,CAELK,WAAW,CAAEL,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLM,QAAQ,CAAEN,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CADE,CAMXO,OAAO,CAAE,CACLC,MAAM,CAAER,CAAe,CAAC,QAAD,CAAW,eAAX,CADlB,CAELS,WAAW,CAAET,CAAe,CAAC,QAAD,CAAW,aAAX,CAFvB,CAGLU,QAAQ,CAAEV,CAAe,CAAC,QAAD,CAAW,UAAX,CAHpB,CAILW,QAAQ,CAAEX,CAAe,CAAC,QAAD,CAAW,UAAX,CAJpB,CAKLY,QAAQ,CAAEZ,CAAe,CAAC,QAAD,CAAW,UAAX,CALpB,CAMLa,QAAQ,CAAEb,CAAe,CAAC,QAAD,CAAW,UAAX,CANpB,CAOLc,QAAQ,CAAEd,CAAe,CAAC,QAAD,CAAW,UAAX,CAPpB,CAQLe,QAAQ,CAAEf,CAAe,CAAC,QAAD,CAAW,UAAX,CARpB,CASLgB,UAAU,CAAEhB,CAAe,CAAC,QAAD,CAAW,YAAX,CATtB,CANE,CAiBXiB,QAAQ,CAAE,CACNC,QAAQ,CAAE,cADJ,CAENC,kBAAkB,CAAE,uBAFd,CAGNC,mBAAmB,CAAE,wBAHf,CAINC,WAAW,CAAE,cAJP,CAKNC,UAAU,CAAE,aALN,CAjBC,C","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 .\n\n/**\n * Define all of the selectors we will be using on the contentbank interface.\n *\n * @module core_contentbank/selectors\n * @copyright 2020 Sara Arjona \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * A small helper function to build queryable data selectors.\n *\n * @method getDataSelector\n * @param {String} name\n * @param {String} value\n * @return {string}\n */\nconst getDataSelector = (name, value) => {\n return `[data-${name}=\"${value}\"]`;\n};\n\nexport default {\n regions: {\n cbcontentname: getDataSelector('region', 'cb-content-name'),\n contentbank: getDataSelector('region', 'contentbank'),\n filearea: getDataSelector('region', 'filearea')\n },\n actions: {\n search: getDataSelector('action', 'searchcontent'),\n clearSearch: getDataSelector('action', 'clearsearch'),\n viewgrid: getDataSelector('action', 'viewgrid'),\n viewlist: getDataSelector('action', 'viewlist'),\n sortname: getDataSelector('action', 'sortname'),\n sortdate: getDataSelector('action', 'sortdate'),\n sortsize: getDataSelector('action', 'sortsize'),\n sorttype: getDataSelector('action', 'sorttype'),\n sortauthor: getDataSelector('action', 'sortauthor'),\n },\n elements: {\n listitem: '.cb-listitem',\n cbnavbarbreadcrumb: '.cb-navbar-breadbrumb',\n cbnavbartotalsearch: '.cb-navbar-totalsearch',\n searchinput: '#searchinput',\n sortbutton: '.cb-btnsort'\n },\n};\n"],"file":"selectors.min.js"}
\ No newline at end of file
diff --git a/contentbank/amd/build/sort.min.js.map b/contentbank/amd/build/sort.min.js.map
index 06c091c29b6..14d7eac349f 100644
--- a/contentbank/amd/build/sort.min.js.map
+++ b/contentbank/amd/build/sort.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/sort.js"],"names":["init","contentBank","document","querySelector","selectors","regions","contentbank","Prefetch","prefetchStrings","registerListenerEvents","addEventListener","e","viewList","actions","viewlist","viewGrid","viewgrid","target","closest","classList","remove","add","setViewListPreference","fileArea","filearea","shownItems","querySelectorAll","elements","listitem","sortByName","sortname","ascending","updateSortButtons","updateSortOrder","sortByDate","sortdate","sortBySize","sortsize","sortByType","sorttype","sortByAuthor","sortauthor","request","methodname","args","preferences","type","value","Ajax","call","catch","Notification","exception","sortButton","sortButtons","sortbutton","forEach","button","updateButtonTitle","contains","sortString","dataset","string","then","columnName","sortByString","setAttribute","itemList","attribute","sortList","slice","sort","a","b","aa","getAttribute","bb","isNaN","parseInt","listItem","appendChild"],"mappings":"uNAwBA,OAEA,OACA,OACA,O,mDAOO,GAAMA,CAAAA,CAAI,CAAG,UAAM,CACtB,GAAMC,CAAAA,CAAW,CAAGC,QAAQ,CAACC,aAAT,CAAuBC,UAAUC,OAAV,CAAkBC,WAAzC,CAApB,CACAC,UAASC,eAAT,CAAyB,aAAzB,CAAwC,CAAC,aAAD,CAAgB,cAAhB,CAAgC,MAAhC,CAAwC,MAAxC,CAAgD,QAAhD,CAAxC,EACAD,UAASC,eAAT,CAAyB,QAAzB,CAAmC,CAAC,SAAD,CAAY,gBAAZ,CAAnC,EACAC,CAAsB,CAACR,CAAD,CACzB,CALM,C,YAaDQ,CAAAA,CAAsB,CAAG,SAACR,CAAD,CAAiB,CAE5CA,CAAW,CAACS,gBAAZ,CAA6B,OAA7B,CAAsC,SAAAC,CAAC,CAAI,IACjCC,CAAAA,CAAQ,CAAGX,CAAW,CAACE,aAAZ,CAA0BC,UAAUS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KAAK,CAACH,CAAD,CAAV,CAAgB,CACbA,CAAE,CAAGI,QAAQ,CAACJ,CAAD,CAAb,CACAE,CAAE,CAAGE,QAAQ,CAACF,CAAD,CACf,CAED,GAAI7C,CAAJ,CAAe,CACX,MAAO2C,CAAAA,CAAE,CAAGE,CAAL,CAAU,CAAV,CAAc,CAAC,CACzB,CAFD,IAEO,CACH,MAAOF,CAAAA,CAAE,CAAGE,CAAL,CAAU,CAAV,CAAc,CAAC,CACzB,CACJ,CAdgB,CAAjB,CAeAP,CAAQ,CAACb,OAAT,CAAiB,SAAAuB,CAAQ,QAAIxD,CAAAA,CAAQ,CAACyD,WAAT,CAAqBD,CAArB,CAAJ,CAAzB,CACH,C","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 .\n\n/**\n * Content bank UI actions.\n *\n * @module core_contentbank/sort\n * @package core_contentbank\n * @copyright 2020 Bas Brands \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport selectors from './selectors';\nimport {get_string as getString} from 'core/str';\nimport Prefetch from 'core/prefetch';\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Set up the contentbank views.\n *\n * @method init\n */\nexport const init = () => {\n const contentBank = document.querySelector(selectors.regions.contentbank);\n Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type', 'author']);\n Prefetch.prefetchStrings('moodle', ['sortbyx', 'sortbyxreverse']);\n registerListenerEvents(contentBank);\n};\n\n/**\n * Register contentbank related event listeners.\n *\n * @method registerListenerEvents\n * @param {HTMLElement} contentBank The DOM node of the content bank\n */\nconst registerListenerEvents = (contentBank) => {\n\n contentBank.addEventListener('click', e => {\n const viewList = contentBank.querySelector(selectors.actions.viewlist);\n const viewGrid = contentBank.querySelector(selectors.actions.viewgrid);\n\n // View as Grid button.\n if (e.target.closest(selectors.actions.viewgrid)) {\n contentBank.classList.remove('view-list');\n contentBank.classList.add('view-grid');\n viewGrid.classList.add('active');\n viewList.classList.remove('active');\n setViewListPreference(false);\n\n return;\n }\n\n // View as List button.\n if (e.target.closest(selectors.actions.viewlist)) {\n contentBank.classList.remove('view-grid');\n contentBank.classList.add('view-list');\n viewList.classList.add('active');\n viewGrid.classList.remove('active');\n setViewListPreference(true);\n\n return;\n }\n\n // TODO: This should _not_ use `document`. Every query should be constrained to the content bank container.\n const fileArea = document.querySelector(selectors.regions.filearea);\n const shownItems = fileArea.querySelectorAll(selectors.elements.listitem);\n\n if (fileArea && shownItems) {\n\n // Sort by file name alphabetical\n const sortByName = e.target.closest(selectors.actions.sortname);\n if (sortByName) {\n const ascending = updateSortButtons(contentBank, sortByName);\n updateSortOrder(fileArea, shownItems, 'data-file', ascending);\n return;\n }\n\n // Sort by date.\n const sortByDate = e.target.closest(selectors.actions.sortdate);\n if (sortByDate) {\n const ascending = updateSortButtons(contentBank, sortByDate);\n updateSortOrder(fileArea, shownItems, 'data-timemodified', ascending);\n return;\n }\n\n // Sort by size.\n const sortBySize = e.target.closest(selectors.actions.sortsize);\n if (sortBySize) {\n const ascending = updateSortButtons(contentBank, sortBySize);\n updateSortOrder(fileArea, shownItems, 'data-bytes', ascending);\n return;\n }\n\n // Sort by type.\n const sortByType = e.target.closest(selectors.actions.sorttype);\n if (sortByType) {\n const ascending = updateSortButtons(contentBank, sortByType);\n updateSortOrder(fileArea, shownItems, 'data-type', ascending);\n return;\n }\n\n // Sort by author.\n const sortByAuthor = e.target.closest(selectors.actions.sortauthor);\n if (sortByAuthor) {\n const ascending = updateSortButtons(contentBank, sortByAuthor);\n updateSortOrder(fileArea, shownItems, 'data-author', ascending);\n }\n return;\n }\n });\n};\n\n\n/**\n * Set the contentbank user preference in list view\n *\n * @param {Bool} viewList view ContentBank as list.\n * @return {Promise} Repository promise.\n */\nconst setViewListPreference = function(viewList) {\n\n // If the given status is not hidden, the preference has to be deleted with a null value.\n if (viewList === false) {\n viewList = null;\n }\n\n const request = {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [\n {\n type: 'core_contentbank_view_list',\n value: viewList\n }\n ]\n }\n };\n\n return Ajax.call([request])[0].catch(Notification.exception);\n};\n\n/**\n * Update the sort button view.\n *\n * @method updateSortButtons\n * @param {HTMLElement} contentBank The DOM node of the contentbank button\n * @param {HTMLElement} sortButton The DOM node of the sort button\n * @return {Bool} sort ascending\n */\nconst updateSortButtons = (contentBank, sortButton) => {\n const sortButtons = contentBank.querySelectorAll(selectors.elements.sortbutton);\n\n sortButtons.forEach((button) => {\n if (button !== sortButton) {\n button.classList.remove('dir-asc');\n button.classList.remove('dir-desc');\n button.classList.add('dir-none');\n\n updateButtonTitle(button, false);\n }\n });\n\n let ascending = true;\n\n if (sortButton.classList.contains('dir-none')) {\n sortButton.classList.remove('dir-none');\n sortButton.classList.add('dir-asc');\n } else if (sortButton.classList.contains('dir-asc')) {\n sortButton.classList.remove('dir-asc');\n sortButton.classList.add('dir-desc');\n ascending = false;\n } else if (sortButton.classList.contains('dir-desc')) {\n sortButton.classList.remove('dir-desc');\n sortButton.classList.add('dir-asc');\n }\n\n updateButtonTitle(sortButton, ascending);\n\n return ascending;\n};\n\n/**\n * Update the button title.\n *\n * @method updateButtonTitle\n * @param {HTMLElement} button Button to update\n * @param {Bool} ascending Sort direction\n * @return {Promise} string promise\n */\nconst updateButtonTitle = (button, ascending) => {\n\n const sortString = (ascending ? 'sortbyxreverse' : 'sortbyx');\n\n return getString(button.dataset.string, 'contentbank')\n .then(columnName => {\n return getString(sortString, 'core', columnName);\n })\n .then(sortByString => {\n button.setAttribute('title', sortByString);\n return sortByString;\n })\n .catch();\n};\n\n/**\n * Update the sort order of the itemlist and update the DOM\n *\n * @method updateSortOrder\n * @param {HTMLElement} fileArea the Dom container for the itemlist\n * @param {Array} itemList Nodelist of Dom elements\n * @param {String} attribute, the attribut to sort on\n * @param {Bool} ascending, Sort Ascending\n */\nconst updateSortOrder = (fileArea, itemList, attribute, ascending) => {\n const sortList = [].slice.call(itemList).sort(function(a, b) {\n\n let aa = a.getAttribute(attribute);\n let bb = b.getAttribute(attribute);\n if (!isNaN(aa)) {\n aa = parseInt(aa);\n bb = parseInt(bb);\n }\n\n if (ascending) {\n return aa > bb ? 1 : -1;\n } else {\n return aa < bb ? 1 : -1;\n }\n });\n sortList.forEach(listItem => fileArea.appendChild(listItem));\n};\n"],"file":"sort.min.js"}
\ No newline at end of file
+{"version":3,"sources":["../src/sort.js"],"names":["init","contentBank","document","querySelector","selectors","regions","contentbank","Prefetch","prefetchStrings","registerListenerEvents","addEventListener","e","viewList","actions","viewlist","viewGrid","viewgrid","target","closest","classList","remove","add","setViewListPreference","fileArea","filearea","shownItems","querySelectorAll","elements","listitem","sortByName","sortname","ascending","updateSortButtons","updateSortOrder","sortByDate","sortdate","sortBySize","sortsize","sortByType","sorttype","sortByAuthor","sortauthor","request","methodname","args","preferences","type","value","Ajax","call","catch","Notification","exception","sortButton","sortButtons","sortbutton","forEach","button","updateButtonTitle","contains","sortString","dataset","string","then","columnName","sortByString","setAttribute","itemList","attribute","sortList","slice","sort","a","b","aa","getAttribute","bb","isNaN","parseInt","listItem","appendChild"],"mappings":"uNAuBA,OAEA,OACA,OACA,O,mDAOO,GAAMA,CAAAA,CAAI,CAAG,UAAM,CACtB,GAAMC,CAAAA,CAAW,CAAGC,QAAQ,CAACC,aAAT,CAAuBC,UAAUC,OAAV,CAAkBC,WAAzC,CAApB,CACAC,UAASC,eAAT,CAAyB,aAAzB,CAAwC,CAAC,aAAD,CAAgB,cAAhB,CAAgC,MAAhC,CAAwC,MAAxC,CAAgD,QAAhD,CAAxC,EACAD,U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,CAA8C,CAClE,GAAMsC,CAAAA,CAAQ,CAAG,GAAGC,KAAH,CAASrB,IAAT,CAAckB,CAAd,EAAwBI,IAAxB,CAA6B,SAASC,CAAT,CAAYC,CAAZ,CAAe,IAErDC,CAAAA,CAAE,CAAGF,CAAC,CAACG,YAAF,CAAeP,CAAf,CAFgD,CAGrDQ,CAAE,CAAGH,CAAC,CAACE,YAAF,CAAeP,CAAf,CAHgD,CAIzD,GAAI,CAACS,KAAK,CAACH,CAAD,CAAV,CAAgB,CACbA,CAAE,CAAGI,QAAQ,CAACJ,CAAD,CAAb,CACAE,CAAE,CAAGE,QAAQ,CAACF,CAAD,CACf,CAED,GAAI7C,CAAJ,CAAe,CACX,MAAO2C,CAAAA,CAAE,CAAGE,CAAL,CAAU,CAAV,CAAc,CAAC,CACzB,CAFD,IAEO,CACH,MAAOF,CAAAA,CAAE,CAAGE,CAAL,CAAU,CAAV,CAAc,CAAC,CACzB,CACJ,CAdgB,CAAjB,CAeAP,CAAQ,CAACb,OAAT,CAAiB,SAAAuB,CAAQ,QAAIxD,CAAAA,CAAQ,CAACyD,WAAT,CAAqBD,CAArB,CAAJ,CAAzB,CACH,C","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 .\n\n/**\n * Content bank UI actions.\n *\n * @module core_contentbank/sort\n * @copyright 2020 Bas Brands \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport selectors from './selectors';\nimport {get_string as getString} from 'core/str';\nimport Prefetch from 'core/prefetch';\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\n\n/**\n * Set up the contentbank views.\n *\n * @method init\n */\nexport const init = () => {\n const contentBank = document.querySelector(selectors.regions.contentbank);\n Prefetch.prefetchStrings('contentbank', ['contentname', 'lastmodified', 'size', 'type', 'author']);\n Prefetch.prefetchStrings('moodle', ['sortbyx', 'sortbyxreverse']);\n registerListenerEvents(contentBank);\n};\n\n/**\n * Register contentbank related event listeners.\n *\n * @method registerListenerEvents\n * @param {HTMLElement} contentBank The DOM node of the content bank\n */\nconst registerListenerEvents = (contentBank) => {\n\n contentBank.addEventListener('click', e => {\n const viewList = contentBank.querySelector(selectors.actions.viewlist);\n const viewGrid = contentBank.querySelector(selectors.actions.viewgrid);\n\n // View as Grid button.\n if (e.target.closest(selectors.actions.viewgrid)) {\n contentBank.classList.remove('view-list');\n contentBank.classList.add('view-grid');\n viewGrid.classList.add('active');\n viewList.classList.remove('active');\n setViewListPreference(false);\n\n return;\n }\n\n // View as List button.\n if (e.target.closest(selectors.actions.viewlist)) {\n contentBank.classList.remove('view-grid');\n contentBank.classList.add('view-list');\n viewList.classList.add('active');\n viewGrid.classList.remove('active');\n setViewListPreference(true);\n\n return;\n }\n\n // TODO: This should _not_ use `document`. Every query should be constrained to the content bank container.\n const fileArea = document.querySelector(selectors.regions.filearea);\n const shownItems = fileArea.querySelectorAll(selectors.elements.listitem);\n\n if (fileArea && shownItems) {\n\n // Sort by file name alphabetical\n const sortByName = e.target.closest(selectors.actions.sortname);\n if (sortByName) {\n const ascending = updateSortButtons(contentBank, sortByName);\n updateSortOrder(fileArea, shownItems, 'data-file', ascending);\n return;\n }\n\n // Sort by date.\n const sortByDate = e.target.closest(selectors.actions.sortdate);\n if (sortByDate) {\n const ascending = updateSortButtons(contentBank, sortByDate);\n updateSortOrder(fileArea, shownItems, 'data-timemodified', ascending);\n return;\n }\n\n // Sort by size.\n const sortBySize = e.target.closest(selectors.actions.sortsize);\n if (sortBySize) {\n const ascending = updateSortButtons(contentBank, sortBySize);\n updateSortOrder(fileArea, shownItems, 'data-bytes', ascending);\n return;\n }\n\n // Sort by type.\n const sortByType = e.target.closest(selectors.actions.sorttype);\n if (sortByType) {\n const ascending = updateSortButtons(contentBank, sortByType);\n updateSortOrder(fileArea, shownItems, 'data-type', ascending);\n return;\n }\n\n // Sort by author.\n const sortByAuthor = e.target.closest(selectors.actions.sortauthor);\n if (sortByAuthor) {\n const ascending = updateSortButtons(contentBank, sortByAuthor);\n updateSortOrder(fileArea, shownItems, 'data-author', ascending);\n }\n return;\n }\n });\n};\n\n\n/**\n * Set the contentbank user preference in list view\n *\n * @param {Bool} viewList view ContentBank as list.\n * @return {Promise} Repository promise.\n */\nconst setViewListPreference = function(viewList) {\n\n // If the given status is not hidden, the preference has to be deleted with a null value.\n if (viewList === false) {\n viewList = null;\n }\n\n const request = {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [\n {\n type: 'core_contentbank_view_list',\n value: viewList\n }\n ]\n }\n };\n\n return Ajax.call([request])[0].catch(Notification.exception);\n};\n\n/**\n * Update the sort button view.\n *\n * @method updateSortButtons\n * @param {HTMLElement} contentBank The DOM node of the contentbank button\n * @param {HTMLElement} sortButton The DOM node of the sort button\n * @return {Bool} sort ascending\n */\nconst updateSortButtons = (contentBank, sortButton) => {\n const sortButtons = contentBank.querySelectorAll(selectors.elements.sortbutton);\n\n sortButtons.forEach((button) => {\n if (button !== sortButton) {\n button.classList.remove('dir-asc');\n button.classList.remove('dir-desc');\n button.classList.add('dir-none');\n\n updateButtonTitle(button, false);\n }\n });\n\n let ascending = true;\n\n if (sortButton.classList.contains('dir-none')) {\n sortButton.classList.remove('dir-none');\n sortButton.classList.add('dir-asc');\n } else if (sortButton.classList.contains('dir-asc')) {\n sortButton.classList.remove('dir-asc');\n sortButton.classList.add('dir-desc');\n ascending = false;\n } else if (sortButton.classList.contains('dir-desc')) {\n sortButton.classList.remove('dir-desc');\n sortButton.classList.add('dir-asc');\n }\n\n updateButtonTitle(sortButton, ascending);\n\n return ascending;\n};\n\n/**\n * Update the button title.\n *\n * @method updateButtonTitle\n * @param {HTMLElement} button Button to update\n * @param {Bool} ascending Sort direction\n * @return {Promise} string promise\n */\nconst updateButtonTitle = (button, ascending) => {\n\n const sortString = (ascending ? 'sortbyxreverse' : 'sortbyx');\n\n return getString(button.dataset.string, 'contentbank')\n .then(columnName => {\n return getString(sortString, 'core', columnName);\n })\n .then(sortByString => {\n button.setAttribute('title', sortByString);\n return sortByString;\n })\n .catch();\n};\n\n/**\n * Update the sort order of the itemlist and update the DOM\n *\n * @method updateSortOrder\n * @param {HTMLElement} fileArea the Dom container for the itemlist\n * @param {Array} itemList Nodelist of Dom elements\n * @param {String} attribute, the attribut to sort on\n * @param {Bool} ascending, Sort Ascending\n */\nconst updateSortOrder = (fileArea, itemList, attribute, ascending) => {\n const sortList = [].slice.call(itemList).sort(function(a, b) {\n\n let aa = a.getAttribute(attribute);\n let bb = b.getAttribute(attribute);\n if (!isNaN(aa)) {\n aa = parseInt(aa);\n bb = parseInt(bb);\n }\n\n if (ascending) {\n return aa > bb ? 1 : -1;\n } else {\n return aa < bb ? 1 : -1;\n }\n });\n sortList.forEach(listItem => fileArea.appendChild(listItem));\n};\n"],"file":"sort.min.js"}
\ No newline at end of file
diff --git a/contentbank/amd/src/actions.js b/contentbank/amd/src/actions.js
index 176b1277c1c..004ce4ab6f8 100644
--- a/contentbank/amd/src/actions.js
+++ b/contentbank/amd/src/actions.js
@@ -17,7 +17,6 @@
* Module to manage content bank actions, such as delete or rename.
*
* @module core_contentbank/actions
- * @package core_contentbank
* @copyright 2020 Sara Arjona
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/contentbank/amd/src/search.js b/contentbank/amd/src/search.js
index 40a99a5a0dc..9fa09c2317f 100644
--- a/contentbank/amd/src/search.js
+++ b/contentbank/amd/src/search.js
@@ -17,7 +17,6 @@
* Search methods for finding contents in the content bank.
*
* @module core_contentbank/search
- * @package core_contentbank
* @copyright 2020 Sara Arjona
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/contentbank/amd/src/selectors.js b/contentbank/amd/src/selectors.js
index f6de1b2a0fd..16d01a135ce 100644
--- a/contentbank/amd/src/selectors.js
+++ b/contentbank/amd/src/selectors.js
@@ -17,7 +17,6 @@
* Define all of the selectors we will be using on the contentbank interface.
*
* @module core_contentbank/selectors
- * @package core_contentbank
* @copyright 2020 Sara Arjona
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/contentbank/amd/src/sort.js b/contentbank/amd/src/sort.js
index ed67de5233f..6028b48cb6d 100644
--- a/contentbank/amd/src/sort.js
+++ b/contentbank/amd/src/sort.js
@@ -17,7 +17,6 @@
* Content bank UI actions.
*
* @module core_contentbank/sort
- * @package core_contentbank
* @copyright 2020 Bas Brands
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
diff --git a/course/amd/build/actions.min.js.map b/course/amd/build/actions.min.js.map
index 3cbade0df4a..313e81399e0 100644
--- a/course/amd/build/actions.min.js.map
+++ b/course/amd/build/actions.min.js.map
@@ -1 +1 @@
-{"version":3,"sources":["../src/actions.js"],"names":["define","$","ajax","templates","notification","str","url","Y","ModalFactory","ModalEvents","KeyCodes","log","CSS","EDITINPROGRESS","SECTIONDRAGGABLE","EDITINGMOVE","SELECTOR","ACTIVITYLI","ACTIONAREA","ACTIVITYACTION","MENU","TOGGLE","SECTIONLI","SECTIONACTIONMENU","ADDSECTIONS","use","courseformatselector","M","course","format","get_section_selector","getModuleId","element","id","Moodle","core_course","util","cm","getId","Node","get","getModuleName","name","getName","addActivitySpinner","activity","addClass","actionarea","find","spinner","add_spinner","show","addSectionSpinner","sectionelement","addSectionLightbox","lightbox","add_lightbox","removeSpinner","delay","window","setTimeout","removeClass","hide","removeLightbox","initActionMenu","elementid","coursebase","invoke_function","core","actionmenu","newDOMNode","one","focusActionItem","elementId","action","mainelement","selector","is","focus","findNextFocusable","mainElement","tabables","isInside","foundElement","each","contains","editModule","moduleElement","cmid","target","attr","promises","call","methodname","args","sectionreturn","closest","when","apply","done","data","elementToFocus","replaceWith","index","trigger","Event","ajaxreturn","fail","ex","e","exception","isDefaultPrevented","refreshModule","activityElement","replaceActivityHtmlWith","confirmDeleteModule","onconfirm","modtypename","match","modulename","get_string","pluginname","get_strings","key","param","type","s","confirm","confirmEditSection","message","replaceActionItem","actionitem","image","stringname","stringcomponent","newaction","component","then","strings","html","renderPix","pixhtml","catch","defaultEditSectionHandler","sectionElement","actionItem","courseformat","modules","i","section_availability","first","oldmarker","oldActionItem","activityHTML","editSection","sectionid","dataencoded","parseJSON","register_module","set_visibility_resource_ui","getDOMNode","initCoursePage","on","keyCode","moduleId","preventDefault","sectionId","strNumberSections","modalTitle","newSections","modalBody","create","title","types","SAVE_CANCEL","body","modal","numSections","getBody","addSections","parseInt","val","document","location","setSaveButtonText","getRoot","shown","select","enter","save","replaceSectionActionItem","debug"],"mappings":"AAwBAA,OAAM,uBAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,gBAAxB,CAA0C,mBAA1C,CAA+D,UAA/D,CAA2E,UAA3E,CAAuF,UAAvF,CACC,oBADD,CACuB,mBADvB,CAC4C,gBAD5C,CAC8D,UAD9D,CAAD,CAEF,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA6BC,CAA7B,CAA2CC,CAA3C,CAAgDC,CAAhD,CAAqDC,CAArD,CAAwDC,CAAxD,CAAsEC,CAAtE,CAAmFC,CAAnF,CAA6FC,CAA7F,CAAkG,IAC1FC,CAAAA,CAAG,CAAG,CACNC,cAAc,CAAE,gBADV,CAENC,gBAAgB,CAAE,kBAFZ,CAGNC,WAAW,CAAE,cAHP,CADoF,CAM1FC,CAAQ,CAAG,CACXC,UAAU,CAAE,aADD,CAEXC,UAAU,CAAE,UAFD,CAGXC,cAAc,CAAE,kBAHL,CAIXC,IAAI,CAAE,yDAJK,CAKXC,MAAM,CAAE,kCALG,CAMXC,SAAS,CAAE,YANA,CAOXC,i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gG,CAC5FC,QAAQ,CAACC,QAAT,CAAoB/E,CAAO,CAACd,IAAR,CAAa,MAAb,EAAuB,eAAvB,CAAyC0F,QAAQ,CAACH,CAAW,CAACI,GAAZ,EAAD,CACxE,CACJ,CAPD,CAQAL,CAAK,CAACQ,iBAAN,CAAwBhB,CAAxB,EACAQ,CAAK,CAACS,OAAN,GAAgBvB,EAAhB,CAAmBzJ,CAAW,CAACiL,KAA/B,CAAsC,UAAW,CAE7CT,CAAW,CAACnG,KAAZ,GAAoB6G,MAApB,GAA6BzB,EAA7B,CAAgC,SAAhC,CAA2C,SAASrD,CAAT,CAAY,CACnD,GAAIA,CAAC,CAACsD,OAAF,GAAczJ,CAAQ,CAACkL,KAA3B,CAAkC,CAC9BT,CAAW,EACd,CACJ,CAJD,CAKH,CAPD,EAQAH,CAAK,CAACS,OAAN,GAAgBvB,EAAhB,CAAmBzJ,CAAW,CAACoL,IAA/B,CAAqC,SAAShF,CAAT,CAAY,CAE7CA,CAAC,CAACwD,cAAF,GACAc,CAAW,EACd,CAJD,CAKH,CA5BD,CA6BH,CApCD,CAqCH,CA7G2C,CA4H5CW,wBAAwB,CAAE,kCAASzI,CAAT,CAAyBuB,CAAzB,CAAmCwD,CAAnC,CAA0CC,CAA1C,CACcC,CADd,CAC+BC,CAD/B,CAC0C,CAChE5H,CAAG,CAACoL,KAAJ,CAAU,+DAAV,EACA,GAAI5D,CAAAA,CAAU,CAAG9E,CAAc,CAACL,IAAf,CAAoBhC,CAAQ,CAACO,iBAAT,CAA6B,GAA7B,CAAmCqD,CAAvD,CAAjB,CACAsD,CAAiB,CAACC,CAAD,CAAaC,CAAb,CAAoBC,CAApB,CAAgCC,CAAhC,CAAiDC,CAAjD,CACpB,CAjI2C,CAmInD,CAzlBC,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 .\n\n/**\n * Various actions on modules and sections in the editing mode - hiding, duplicating, deleting, etc.\n *\n * @module core_course/actions\n * @package core\n * @copyright 2016 Marina Glancy\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 3.3\n */\ndefine(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str', 'core/url', 'core/yui',\n 'core/modal_factory', 'core/modal_events', 'core/key_codes', 'core/log'],\n function($, ajax, templates, notification, str, url, Y, ModalFactory, ModalEvents, KeyCodes, log) {\n var CSS = {\n EDITINPROGRESS: 'editinprogress',\n SECTIONDRAGGABLE: 'sectiondraggable',\n EDITINGMOVE: 'editing_move'\n };\n var SELECTOR = {\n ACTIVITYLI: 'li.activity',\n ACTIONAREA: '.actions',\n ACTIVITYACTION: 'a.cm-edit-action',\n MENU: '.moodle-actionmenu[data-enhance=moodle-core-actionmenu]',\n TOGGLE: '.toggle-display,.dropdown-toggle',\n SECTIONLI: 'li.section',\n SECTIONACTIONMENU: '.section_action_menu',\n ADDSECTIONS: '#changenumsections [data-add-sections]'\n };\n\n Y.use('moodle-course-coursebase', function() {\n var courseformatselector = M.course.format.get_section_selector();\n if (courseformatselector) {\n SELECTOR.SECTIONLI = courseformatselector;\n }\n });\n\n /**\n * Wrapper for Y.Moodle.core_course.util.cm.getId\n *\n * @param {JQuery} element\n * @returns {Integer}\n */\n var getModuleId = function(element) {\n var id;\n Y.use('moodle-course-util', function(Y) {\n id = Y.Moodle.core_course.util.cm.getId(Y.Node(element.get(0)));\n });\n return id;\n };\n\n /**\n * Wrapper for Y.Moodle.core_course.util.cm.getName\n *\n * @param {JQuery} element\n * @returns {String}\n */\n var getModuleName = function(element) {\n var name;\n Y.use('moodle-course-util', function(Y) {\n name = Y.Moodle.core_course.util.cm.getName(Y.Node(element.get(0)));\n });\n return name;\n };\n\n /**\n * Wrapper for M.util.add_spinner for an activity\n *\n * @param {JQuery} activity\n * @returns {Node}\n */\n var addActivitySpinner = function(activity) {\n activity.addClass(CSS.EDITINPROGRESS);\n var actionarea = activity.find(SELECTOR.ACTIONAREA).get(0);\n if (actionarea) {\n var spinner = M.util.add_spinner(Y, Y.Node(actionarea));\n spinner.show();\n return spinner;\n }\n return null;\n };\n\n /**\n * Wrapper for M.util.add_spinner for a section\n *\n * @param {JQuery} sectionelement\n * @returns {Node}\n */\n var addSectionSpinner = function(sectionelement) {\n sectionelement.addClass(CSS.EDITINPROGRESS);\n var actionarea = sectionelement.find(SELECTOR.SECTIONACTIONMENU).get(0);\n if (actionarea) {\n var spinner = M.util.add_spinner(Y, Y.Node(actionarea));\n spinner.show();\n return spinner;\n }\n return null;\n };\n\n /**\n * Wrapper for M.util.add_lightbox\n *\n * @param {JQuery} sectionelement\n * @returns {Node}\n */\n var addSectionLightbox = function(sectionelement) {\n var lightbox = M.util.add_lightbox(Y, Y.Node(sectionelement.get(0)));\n lightbox.show();\n return lightbox;\n };\n\n /**\n * Removes the spinner element\n *\n * @param {JQuery} element\n * @param {Node} spinner\n * @param {Number} delay\n */\n var removeSpinner = function(element, spinner, delay) {\n window.setTimeout(function() {\n element.removeClass(CSS.EDITINPROGRESS);\n if (spinner) {\n spinner.hide();\n }\n }, delay);\n };\n\n /**\n * Removes the lightbox element\n *\n * @param {Node} lightbox lighbox YUI element returned by addSectionLightbox\n * @param {Number} delay\n */\n var removeLightbox = function(lightbox, delay) {\n if (lightbox) {\n window.setTimeout(function() {\n lightbox.hide();\n }, delay);\n }\n };\n\n /**\n * Initialise action menu for the element (section or module)\n *\n * @param {String} elementid CSS id attribute of the element\n */\n var initActionMenu = function(elementid) {\n // Initialise action menu in the new activity.\n Y.use('moodle-course-coursebase', function() {\n M.course.coursebase.invoke_function('setup_for_resource', '#' + elementid);\n });\n if (M.core.actionmenu && M.core.actionmenu.newDOMNode) {\n M.core.actionmenu.newDOMNode(Y.one('#' + elementid));\n }\n };\n\n /**\n * Returns focus to the element that was clicked or \"Edit\" link if element is no longer visible.\n *\n * @param {String} elementId CSS id attribute of the element\n * @param {String} action data-action property of the element that was clicked\n */\n var focusActionItem = function(elementId, action) {\n var mainelement = $('#' + elementId);\n var selector = '[data-action=' + action + ']';\n if (action === 'groupsseparate' || action === 'groupsvisible' || action === 'groupsnone') {\n // New element will have different data-action.\n selector = '[data-action=groupsseparate],[data-action=groupsvisible],[data-action=groupsnone]';\n }\n if (mainelement.find(selector).is(':visible')) {\n mainelement.find(selector).focus();\n } else {\n // Element not visible, focus the \"Edit\" link.\n mainelement.find(SELECTOR.MENU).find(SELECTOR.TOGGLE).focus();\n }\n };\n\n /**\n * Find next after the element\n *\n * @param {JQuery} mainElement element that is about to be deleted\n * @returns {JQuery}\n */\n var findNextFocusable = function(mainElement) {\n var tabables = $(\"a:visible\");\n var isInside = false;\n var foundElement = null;\n tabables.each(function() {\n if ($.contains(mainElement[0], this)) {\n isInside = true;\n } else if (isInside) {\n foundElement = this;\n return false; // Returning false in .each() is equivalent to \"break;\" inside the loop in php.\n }\n });\n return foundElement;\n };\n\n /**\n * Performs an action on a module (moving, deleting, duplicating, hiding, etc.)\n *\n * @param {JQuery} moduleElement activity element we perform action on\n * @param {Number} cmid\n * @param {JQuery} target the element (menu item) that was clicked\n */\n var editModule = function(moduleElement, cmid, target) {\n var action = target.attr('data-action');\n var spinner = addActivitySpinner(moduleElement);\n var promises = ajax.call([{\n methodname: 'core_course_edit_module',\n args: {id: cmid,\n action: action,\n sectionreturn: target.attr('data-sectionreturn') ? target.attr('data-sectionreturn') : 0\n }\n }], true);\n\n var lightbox;\n if (action === 'duplicate') {\n lightbox = addSectionLightbox(target.closest(SELECTOR.SECTIONLI));\n }\n $.when.apply($, promises)\n .done(function(data) {\n var elementToFocus = findNextFocusable(moduleElement);\n moduleElement.replaceWith(data);\n // Initialise action menu for activity(ies) added as a result of this.\n $('