* 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-07 20:19:16 +00:00
parent fe0b914acc
commit aef04880e9
2 changed files with 18 additions and 4 deletions

View File

@ -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']))

View File

@ -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. /<username>/calendar-<otheruser>/
{
$app = 'calendar';
}
elseif (strpos($path, '/addressbook/') !== false)
elseif (preg_match('#/addressbook(-[^/]+)?/#', $path)) // eg. /<username>/addressbook-<otheruser>/
{
$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';