From aef04880e97366c3a05afaa0498e1a9d64025506 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 7 Feb 2012 20:19:16 +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 | 10 +++++++--- 2 files changed, 18 insertions(+), 4 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 51a5e2ff5a..4ea419b2c7 100644 --- a/phpgwapi/inc/class.groupdav.inc.php +++ b/phpgwapi/inc/class.groupdav.inc.php @@ -289,11 +289,14 @@ class groupdav extends HTTP_WebDAV_Server */ function OPTIONS($path, &$dav, &$allow) { - if (preg_match('#/(calendar|inbox|outbox)/#', $path)) + // locking support + $dav[] = '2'; + + if (preg_match('#/(calendar(-[^/]+)?|inbox|outbox)/#', $path)) // eg. //calendar-/ { $app = 'calendar'; } - elseif (strpos($path, '/addressbook/') !== false) + elseif (preg_match('#/addressbook(-[^/]+)?/#', $path)) // eg. //addressbook-/ { $app = 'addressbook'; } @@ -307,11 +310,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';