From 8a5200db66f15c639eb1d5e802276851d7b003a1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 10 Feb 2012 12:24:43 +0000 Subject: [PATCH] * CalDAV: allow to create private events on OS X iCal, fixing DAV header for new shared folders --- calendar/inc/class.calendar_ical.inc.php | 12 +++++++++++- phpgwapi/inc/class.groupdav.inc.php | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index a413b5119f..8df3e16e5e 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -522,6 +522,8 @@ class calendar_ical extends calendar_boupdate case 'CLASS': $attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE'; + // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!) + if (!$event['public']) $vcal->setAttribute('X-CALENDARSERVER-ACCESS', 'CONFIDENTIAL'); break; case 'ORGANIZER': @@ -2199,7 +2201,7 @@ class calendar_ical extends calendar_boupdate } if (!is_a($component, 'Horde_iCalendar_vevent') || - !($event = $this->vevent2egw($component, $component->getAttribute('VERSION'), $this->supportedFields, $principalURL))) + !($event = $this->vevent2egw($component, $component->_container->getAttribute('VERSION'), $this->supportedFields, $principalURL))) { return false; } @@ -2999,6 +3001,14 @@ class calendar_ical extends calendar_boupdate $event['recur_enddate'] = egw_time::to($last, 'server'); } + // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!) + if (($x_calendarserver_access = $component->_container->getAttribute('X-CALENDARSERVER-ACCESS')) && + !is_a($x_calendarserver_access, 'PEAR_Error')) + { + $event['public'] = (int)(strtoupper($x_calendarserver_access) == 'PUBLIC'); + } + //error_log(__METHOD__."() X-CALENDARSERVER-ACCESS=".array2string($x_calendarserver_access).' --> public='.array2string($event['public'])); + // if no end is given in iCal we use the default lenght from user prefs // whole day events get one day in calendar_boupdate::save() if (!isset($event['end'])) diff --git a/phpgwapi/inc/class.groupdav.inc.php b/phpgwapi/inc/class.groupdav.inc.php index f4a9e8eb44..21f0dfc69d 100644 --- a/phpgwapi/inc/class.groupdav.inc.php +++ b/phpgwapi/inc/class.groupdav.inc.php @@ -298,7 +298,7 @@ class groupdav extends HTTP_WebDAV_Server { $app = 'calendar'; } - elseif (strpos($path, '/addressbook/') !== false) + elseif (preg_match('#/addressbook(-[^/]+)?/#', $path)) // eg. //addressbook-/ { $app = 'addressbook'; } @@ -312,11 +312,12 @@ class groupdav extends HTTP_WebDAV_Server $dav[] = 'calendar-proxy'; // required by iOS iCal to use principal-property-search to autocomplete participants (and locations) $dav[] = 'calendarserver-principal-property-search'; + // required by iOS & OS X iCal to show private checkbox (X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALENDAR) + $dav[] = 'calendarserver-private-events'; // other capabilities calendarserver announces //$dav[] = 'calendar-schedule'; //$dav[] = 'calendar-availability'; //$dav[] = 'inbox-availability'; - //$dav[] = 'calendarserver-private-events'; //$dav[] = 'calendarserver-private-comments'; //$dav[] = 'calendarserver-sharing'; //$dav[] = 'calendarserver-sharing-no-scheduling';