{"version":3,"sources":["https:\/\/virtual.arte.unicen.edu.ar\/calendar\/amd\/src\/view_manager.js"],"names":["define","$","Templates","Str","Notification","CalendarRepository","CalendarEvents","CalendarSelectors","ModalFactory","ModalEvents","SummaryModal","CustomEvents","registerEventListeners","root","on","links","eventLink","e","target","eventId","is","actions","viewEvent","closest","length","data","find","preventDefault","stopPropagation","renderEventSummaryModal","navLink","wrapper","view","courseId","categoryId","link","currentTarget","changeMonth","attr","changeDay","viewSelector","events","activate","option","hasClass","year","month","day","refreshMonthContent","then","window","history","pushState","fail","exception","refreshDayContent","reloadCurrentUpcoming","courseid","categoryid","template","startLoading","M","util","js_pending","get","join","includenavigation","mini","getCalendarMonthData","context","viewingmonth","render","html","js","replaceNode","trigger","viewUpdated","always","js_complete","stopLoading","url","arguments","monthChanged","getCalendarDayData","viewingday","dayChanged","loadingIconContainer","containers","loadingIcon","removeClass","addClass","getCalendarUpcomingData","viewingupcoming","getEventTypeClassFromType","eventType","typeClass","getEventById","getEventResponse","event","Error","eventData","normalisedeventtype","modalParams","title","name","type","TYPE","body","templateContext","canedit","candelete","headerclasses","isactionevent","create","done","modal","getRoot","hidden","destroy","show","init","reloadCurrentMonth","reloadCurrentDay"],"mappings":"AAuBAA,OAAM,8BAAC,CACH,QADG,CAEH,gBAFG,CAGH,UAHG,CAIH,mBAJG,CAKH,0BALG,CAMH,sBANG,CAOH,yBAPG,CAQH,oBARG,CASH,mBATG,CAUH,6BAVG,CAWH,gCAXG,CAAD,CAYH,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQCC,CARD,CASCC,CATD,CAUCC,CAVD,CAWCC,CAXD,CAYD,IAOUC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCA,CAAI,CAAGZ,CAAC,CAACY,CAAD,CAAR,CAGAA,CAAI,CAACC,EAAL,CAAQ,OAAR,CAAiBP,CAAiB,CAACQ,KAAlB,CAAwB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Af,CAAyBC,CAAzB,CAAqC,IACpDH,CAAAA,CAAO,CAAGlB,CAAI,CAACa,IAAL,CAAUnB,CAAiB,CAACwB,OAA5B,CAD0C,CAEpDc,CAAI,CAAGd,CAAO,CAACN,IAAR,CAAa,MAAb,CAF6C,CAGpDqB,CAAK,CAAGf,CAAO,CAACN,IAAR,CAAa,OAAb,CAH4C,CAIpDsB,CAAG,CAAGhB,CAAO,CAACN,IAAR,CAAa,KAAb,CAJ8C,CAMxD,GAAI,CAACQ,CAAL,CAAe,CACXA,CAAQ,CAAGpB,CAAI,CAACa,IAAL,CAAUnB,CAAiB,CAACwB,OAA5B,EAAqCN,IAArC,CAA0C,UAA1C,CACd,CAED,GAA0B,WAAtB,QAAOS,CAAAA,CAAX,CAAuC,CACnCA,CAAU,CAAGrB,CAAI,CAACa,IAAL,CAAUnB,CAAiB,CAACwB,OAA5B,EAAqCN,IAArC,CAA0C,YAA1C,CAChB,CAED,MAAO8B,CAAAA,CAAiB,CAAC1C,CAAD,CAAOgC,CAAP,CAAaC,CAAb,CAAoBC,CAApB,CAAyBd,CAAzB,CAAmCC,CAAnC,CAC3B,CAwJM,CAQHK,SAAS,CAAEA,CARR,CASHgB,iBAAiB,CAAEA,CAThB,CAUHC,qBAAqB,CAAEA,CAVpB,CAYV,CA3bC,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 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 *\/\ndefine([\n 'jquery',\n 'core\/templates',\n 'core\/str',\n 'core\/notification',\n 'core_calendar\/repository',\n 'core_calendar\/events',\n 'core_calendar\/selectors',\n 'core\/modal_factory',\n 'core\/modal_events',\n 'core_calendar\/summary_modal',\n 'core\/custom_interaction_events',\n], function(\n $,\n Templates,\n Str,\n Notification,\n CalendarRepository,\n CalendarEvents,\n CalendarSelectors,\n ModalFactory,\n ModalEvents,\n SummaryModal,\n CustomEvents\n) {\n\n \/**\n * Register event listeners for the module.\n *\n * @param {object} root The root element.\n *\/\n var registerEventListeners = function(root) {\n root = $(root);\n\n \/\/ Bind click events to event links.\n root.on('click', CalendarSelectors.links.eventLink, function(e) {\n var target = $(e.target);\n var eventId = null;\n\n var eventLink;\n if (target.is(CalendarSelectors.actions.viewEvent)) {\n eventLink = target;\n } else {\n eventLink = target.closest(CalendarSelectors.actions.viewEvent);\n }\n\n if (eventLink.length) {\n eventId = eventLink.data('eventId');\n } else {\n eventId = target.find(CalendarSelectors.actions.viewEvent).data('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 }\n });\n\n\n root.on('click', CalendarSelectors.links.navLink, function(e) {\n var wrapper = root.find(CalendarSelectors.wrapper);\n var view = wrapper.data('view');\n var courseId = wrapper.data('courseid');\n var categoryId = wrapper.data('categoryid');\n var link = $(e.currentTarget);\n\n if (view === 'month') {\n changeMonth(root, link.attr('href'), link.data('year'), link.data('month'), courseId, categoryId,\n link.data('day'));\n e.preventDefault();\n } else if (view === 'day') {\n changeDay(root, link.attr('href'), link.data('year'), link.data('month'), link.data('day'),\n courseId, categoryId);\n e.preventDefault();\n }\n\n });\n\n var viewSelector = root.find(CalendarSelectors.viewSelector);\n CustomEvents.define(viewSelector, [CustomEvents.events.activate]);\n viewSelector.on(\n CustomEvents.events.activate,\n function(e) {\n e.preventDefault();\n\n var option = $(e.target);\n if (option.hasClass('active')) {\n return;\n }\n\n var view = option.data('view'),\n year = option.data('year'),\n month = option.data('month'),\n day = option.data('day'),\n courseId = option.data('courseid'),\n categoryId = option.data('categoryid');\n\n if (view == 'month') {\n refreshMonthContent(root, year, month, courseId, categoryId, root, 'core_calendar\/calendar_month', day)\n .then(function() {\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(function() {\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(function() {\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 *\/\n var refreshMonthContent = function(root, year, month, courseid, categoryid, target, template, day) {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n day = day || 1;\n M.util.js_pending([root.get('id'), year, month, courseid].join('-'));\n var includenavigation = root.data('includenavigation');\n var mini = root.data('mini');\n return CalendarRepository.getCalendarMonthData(year, month, courseid, categoryid, includenavigation, mini, day)\n .then(function(context) {\n context.viewingmonth = true;\n return Templates.render(template, context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(target, html, js);\n })\n .then(function() {\n $('body').trigger(CalendarEvents.viewUpdated);\n return;\n })\n .always(function() {\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 *\/\n var changeMonth = function(root, url, year, month, courseid, categoryid, day) {\n day = day || 1;\n return refreshMonthContent(root, year, month, courseid, categoryid, null, null, day)\n .then(function() {\n if (url.length && url !== '#') {\n window.history.pushState({}, '', url);\n }\n return arguments;\n })\n .then(function() {\n $('body').trigger(CalendarEvents.monthChanged, [year, month, courseid, categoryid]);\n return arguments;\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 *\/\n var reloadCurrentMonth = function(root, courseId, categoryId) {\n var year = root.find(CalendarSelectors.wrapper).data('year');\n var month = root.find(CalendarSelectors.wrapper).data('month');\n var day = root.find(CalendarSelectors.wrapper).data('day');\n\n if (typeof courseId === 'undefined') {\n courseId = root.find(CalendarSelectors.wrapper).data('courseid');\n }\n\n if (typeof categoryId === 'undefined') {\n categoryId = root.find(CalendarSelectors.wrapper).data('categoryid');\n }\n\n return refreshMonthContent(root, year, month, courseId, categoryId, null, 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 *\/\n var refreshDayContent = function(root, year, month, day, courseid, categoryId, target, 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 var includenavigation = root.data('includenavigation');\n return CalendarRepository.getCalendarDayData(year, month, day, courseid, categoryId, includenavigation)\n .then(function(context) {\n context.viewingday = true;\n return Templates.render(template, context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(target, html, js);\n })\n .then(function() {\n $('body').trigger(CalendarEvents.viewUpdated);\n return;\n })\n .always(function() {\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 *\/\n var reloadCurrentDay = function(root, courseId, categoryId) {\n var wrapper = root.find(CalendarSelectors.wrapper);\n var year = wrapper.data('year');\n var month = wrapper.data('month');\n var day = wrapper.data('day');\n\n if (!courseId) {\n courseId = root.find(CalendarSelectors.wrapper).data('courseid');\n }\n\n if (typeof categoryId === 'undefined') {\n categoryId = root.find(CalendarSelectors.wrapper).data('categoryid');\n }\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 *\/\n var changeDay = function(root, url, year, month, day, courseId, categoryId) {\n return refreshDayContent(root, year, month, day, courseId, categoryId)\n .then(function() {\n if (url.length && url !== '#') {\n window.history.pushState({}, '', url);\n }\n return arguments;\n })\n .then(function() {\n $('body').trigger(CalendarEvents.dayChanged, [year, month, courseId, categoryId]);\n return arguments;\n });\n };\n\n \/**\n * Set the element state to loading.\n *\n * @param {object} root The container element\n * @method startLoading\n *\/\n var startLoading = function(root) {\n var 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 *\/\n var stopLoading = function(root) {\n var 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 {String} template The template to be rendered.\n * @param {object} target The element being replaced. If not specified, the calendarwrapper is used.\n * @return {promise}\n *\/\n var reloadCurrentUpcoming = function(root, courseId, categoryId, target, template) {\n startLoading(root);\n\n target = target || root.find(CalendarSelectors.wrapper);\n template = template || root.attr('data-template');\n\n if (typeof courseId === 'undefined') {\n courseId = root.find(CalendarSelectors.wrapper).data('courseid');\n }\n\n if (typeof categoryId === 'undefined') {\n categoryId = root.find(CalendarSelectors.wrapper).data('categoryid');\n }\n\n return CalendarRepository.getCalendarUpcomingData(courseId, categoryId)\n .then(function(context) {\n context.viewingupcoming = true;\n return Templates.render(template, context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(target, html, js);\n })\n .then(function() {\n $('body').trigger(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 *\/\n var getEventTypeClassFromType = function(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 *\/\n var renderEventSummaryModal = function(eventId) {\n var typeClass = '';\n\n \/\/ Calendar repository promise.\n CalendarRepository.getEventById(eventId).then(function(getEventResponse) {\n if (!getEventResponse.event) {\n throw new Error('Error encountered while trying to fetch calendar event with ID: ' + eventId);\n }\n var eventData = getEventResponse.event;\n typeClass = getEventTypeClassFromType(eventData.normalisedeventtype);\n\n return eventData;\n }).then(function(eventData) {\n \/\/ Build the modal parameters from the event data.\n var 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: typeClass,\n isactionevent: eventData.isactionevent,\n url: eventData.url\n }\n };\n\n \/\/ Create the modal.\n return ModalFactory.create(modalParams);\n\n }).done(function(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 }).fail(Notification.exception);\n };\n\n return {\n init: function(root, view) {\n registerEventListeners(root, view);\n },\n reloadCurrentMonth: reloadCurrentMonth,\n changeMonth: changeMonth,\n refreshMonthContent: refreshMonthContent,\n reloadCurrentDay: reloadCurrentDay,\n changeDay: changeDay,\n refreshDayContent: refreshDayContent,\n reloadCurrentUpcoming: reloadCurrentUpcoming\n };\n });\n"],"file":"view_manager.min.js"}