From cfeef982617bbb1a99b9f99ce20dedc6c85d2bb4 Mon Sep 17 00:00:00 2001 From: Daniel Buecheler Date: Wed, 30 Nov 2016 21:09:57 +0100 Subject: [PATCH 1/5] 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 }); } From e61bccab3673b54e6801870459ea6b112ffad5d6 Mon Sep 17 00:00:00 2001 From: Daniel Buecheler Date: Wed, 30 Nov 2016 21:24:04 +0100 Subject: [PATCH 2/5] Calendar Module: Added false as default for hidePrivate --- modules/default/calendar/calendar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index e643ea97..5e46e9fc 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -24,6 +24,7 @@ Module.register("calendar",{ urgency: 7, timeFormat: "relative", fadePoint: 0.25, // Start on 1/4th of the list. + hidePrivate: false, calendars: [ { symbol: "calendar", From c66ecbdd29127ee47d6f4272acfbb6a35e744b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCcheler?= Date: Wed, 30 Nov 2016 21:28:44 +0100 Subject: [PATCH 3/5] Added hidePrivate to README.md Added explanation of hidePrivate option to the Calendar Module's README --- modules/default/calendar/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md index 936abdde..e39fd393 100644 --- a/modules/default/calendar/README.md +++ b/modules/default/calendar/README.md @@ -134,6 +134,13 @@ The following properties can be configured:
Default value: 0 (disabled) + + hidePrivate + Hides private calendar events.
+
Possible values: true or false +
Default value: false + + From 7afc908c32d6f64a1caf2597b057ec6a9b04b728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCcheler?= Date: Wed, 30 Nov 2016 21:28:49 +0100 Subject: [PATCH 4/5] Added hidePrivate option of calendar module --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20f95c84..2902363a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). + +## Unpublished + +### Added +- Calendar module: option to hide private events + +### Fixed + +### Updated + ## [2.0.5] - 2016-09-20 ### Added From 243cdfefa230f27f090a01ea176d4dff3019d476 Mon Sep 17 00:00:00 2001 From: Daniel Buecheler Date: Thu, 22 Dec 2016 22:00:59 +0100 Subject: [PATCH 5/5] Fix failed linter test --- modules/default/calendar/calendarfetcher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 93be83f0..e24ee004 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -149,7 +149,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe startDate: startDate.format("x"), endDate: endDate.format("x"), fullDayEvent: fullDayEvent, - class: event.class + class: event.class, location: location, geo: geo, description: description