* CalDAV: allow to create private events on OS X iCal, fixing DAV header for new shared folders

This commit is contained in:
Ralf Becker 2012-02-10 12:24:43 +00:00
parent ceef3a3866
commit 8a5200db66
2 changed files with 14 additions and 3 deletions

View File

@ -522,6 +522,8 @@ class calendar_ical extends calendar_boupdate
case 'CLASS': case 'CLASS':
$attributes['CLASS'] = $event['public'] ? 'PUBLIC' : 'PRIVATE'; $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; break;
case 'ORGANIZER': case 'ORGANIZER':
@ -2199,7 +2201,7 @@ class calendar_ical extends calendar_boupdate
} }
if (!is_a($component, 'Horde_iCalendar_vevent') || 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; return false;
} }
@ -2999,6 +3001,14 @@ class calendar_ical extends calendar_boupdate
$event['recur_enddate'] = egw_time::to($last, 'server'); $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 // 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() // whole day events get one day in calendar_boupdate::save()
if (!isset($event['end'])) if (!isset($event['end']))

View File

@ -298,7 +298,7 @@ class groupdav extends HTTP_WebDAV_Server
{ {
$app = 'calendar'; $app = 'calendar';
} }
elseif (strpos($path, '/addressbook/') !== false) elseif (preg_match('#/addressbook(-[^/]+)?/#', $path)) // eg. /<username>/addressbook-<otheruser>/
{ {
$app = 'addressbook'; $app = 'addressbook';
} }
@ -312,11 +312,12 @@ class groupdav extends HTTP_WebDAV_Server
$dav[] = 'calendar-proxy'; $dav[] = 'calendar-proxy';
// required by iOS iCal to use principal-property-search to autocomplete participants (and locations) // required by iOS iCal to use principal-property-search to autocomplete participants (and locations)
$dav[] = 'calendarserver-principal-property-search'; $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 // other capabilities calendarserver announces
//$dav[] = 'calendar-schedule'; //$dav[] = 'calendar-schedule';
//$dav[] = 'calendar-availability'; //$dav[] = 'calendar-availability';
//$dav[] = 'inbox-availability'; //$dav[] = 'inbox-availability';
//$dav[] = 'calendarserver-private-events';
//$dav[] = 'calendarserver-private-comments'; //$dav[] = 'calendarserver-private-comments';
//$dav[] = 'calendarserver-sharing'; //$dav[] = 'calendarserver-sharing';
//$dav[] = 'calendarserver-sharing-no-scheduling'; //$dav[] = 'calendarserver-sharing-no-scheduling';