From cfeef982617bbb1a99b9f99ce20dedc6c85d2bb4 Mon Sep 17 00:00:00 2001 From: Daniel Buecheler Date: Wed, 30 Nov 2016 21:09:57 +0100 Subject: [PATCH] Private events are hidden Events with the class:PRIVATE iCal property are not shown in the calendar module. They are not added to the array of calendar events in createEventList. This feature can be turned on and off in the config via the property hidePrivate: true/false. --- modules/default/calendar/calendar.js | 6 ++++++ modules/default/calendar/calendarfetcher.js | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 3151467a..e643ea97 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -267,6 +267,12 @@ Module.register("calendar",{ var calendar = this.calendarData[c]; for (var e in calendar) { var event = calendar[e]; + if(this.config.hidePrivate) { + if(event.class === "PRIVATE") { + // do not add the current event, skip it + continue; + } + } event.url = c; event.today = event.startDate >= today && event.startDate < (today + 24 * 60 * 60 * 1000); events.push(event); diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 214e2e5a..398fac3f 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -108,6 +108,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe startDate: startDate.format("x"), endDate: endDate.format("x"), fullDayEvent: isFullDayEvent(event), + class: event.class, firstYear: event.start.getFullYear() }); } @@ -137,7 +138,8 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe title: title, startDate: startDate.format("x"), endDate: endDate.format("x"), - fullDayEvent: fullDayEvent + fullDayEvent: fullDayEvent, + class: event.class }); }