From adce3f48a95f1339dd601f675ac5c1a5233d83ff Mon Sep 17 00:00:00 2001 From: Florian Schlichting Date: Mon, 2 Jan 2017 21:57:41 +0100 Subject: [PATCH] provide a .ics download link in collection view and document $c->get_includes_subcollections --- config/example-config.php | 8 ++++++++ inc/ui/collection-edit.php | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/config/example-config.php b/config/example-config.php index 95de82d1..42badddc 100644 --- a/config/example-config.php +++ b/config/example-config.php @@ -29,6 +29,14 @@ $c->pg_connect[] = "dbname=davical user=davical_app"; */ // $c->system_name = "DAViCal CalDAV Server"; +/** +* The CalDAV specification does not define GET on a collection, but typically this is +* used as a .ics download for the whole collection. This will also enable a download +* link in the web interface for calendars with entries. +* Default: false +*/ +// $c->get_includes_subcollections = true; + /** * If "hide_TODO" is true, then VTODO requested from someone other than the * admin or owner of a calendar will not get an answer. Often these todo are diff --git a/inc/ui/collection-edit.php b/inc/ui/collection-edit.php index 9ac41b49..9e3c4d69 100644 --- a/inc/ui/collection-edit.php +++ b/inc/ui/collection-edit.php @@ -217,6 +217,11 @@ $value_dav_name = $c->base_url.'/caldav.php'. ( $editor->Available() ? '##dav_na $prompt_load_file = translate('Load From File'); $prompt_displayname = translate('Displayname'); $prompt_entries = translate('Items in Collection'); +if ( $entries > 0 && $editor->Value('is_calendar') && isset($c->get_includes_subcollections) && $c->get_includes_subcollections + && ( bindec($permissions->priv) & privilege_to_bits( array('urn:ietf:params:xml:ns:caldav:read-free-busy','DAV::read')))) { + $entries = '' . $entries . ''; +} $prompt_public = translate('Publicly Readable'); $prompt_calendar = translate('Is a Calendar'); $prompt_addressbook = translate('Is an Addressbook');