Several fixed to cope better with CalDAVTester:

- adding priority=0=undefined to calendar, as it is iCalendar default
- no longer export iCalendar defaults PRIORITY=0, TRANSP=OPAQUE, CLASS=PUBLIC
- assume UTC if no timezone given, unfortunatly Horde_Icalendar currently does not tell UTC or local
- export DURATION instead of DTEND for UTC and duration less or equal 1 day (todo: store if user entered duration in db model, to be able export it as such again)
This commit is contained in:
Ralf Becker 2015-09-29 10:25:32 +00:00
parent b34cbded3a
commit 8d476dae23
4 changed files with 19 additions and 3 deletions

View File

@ -525,6 +525,7 @@ class calendar_ical extends calendar_boupdate
break; break;
case 'CLASS': case 'CLASS':
if ($event['public']) continue; // public is default, no need to export, fails CalDAVTester if added as default
$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!) // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!)
if (!$event['public'] && $this->productManufacturer == 'groupdav') if (!$event['public'] && $this->productManufacturer == 'groupdav')
@ -585,6 +586,10 @@ class calendar_ical extends calendar_boupdate
case 'DTEND': case 'DTEND':
if (empty($event['whole_day'])) if (empty($event['whole_day']))
{ {
// Hack for CalDAVTester to export duration instead of endtime
if ($tzid == 'UTC' && $event['end'] - $event['start'] <= 86400)
$attributes['duration'] = $event['end'] - $event['start'];
else
$attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']); $attributes['DTEND'] = self::getDateTime($event['end'],$tzid,$parameters['DTEND']);
} }
else else
@ -677,6 +682,7 @@ class calendar_ical extends calendar_boupdate
break; break;
case 'PRIORITY': case 'PRIORITY':
if (!$event['priority']) continue; // 0=undefined is default, no need to export, fails CalDAVTester if our default is added
if ($this->productManufacturer == 'funambol' && if ($this->productManufacturer == 'funambol' &&
(strpos($this->productName, 'outlook') !== false (strpos($this->productName, 'outlook') !== false
|| strpos($this->productName, 'pocket pc') !== false)) || strpos($this->productName, 'pocket pc') !== false))
@ -690,6 +696,7 @@ class calendar_ical extends calendar_boupdate
break; break;
case 'TRANSP': case 'TRANSP':
if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default
if ($version == '1.0') if ($version == '1.0')
{ {
$attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0); $attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0);
@ -2368,6 +2375,7 @@ class calendar_ical extends calendar_boupdate
$vcardData = array( $vcardData = array(
'recur_type' => MCAL_RECUR_NONE, 'recur_type' => MCAL_RECUR_NONE,
'recur_exception' => array(), 'recur_exception' => array(),
'priority' => 0, // iCalendar default is 0=undefined, not EGroupware 5=normal
); );
// we need to parse DTSTART, DTEND or DURATION (in that order!) first // we need to parse DTSTART, DTEND or DURATION (in that order!) first
foreach (array_merge( foreach (array_merge(
@ -2392,8 +2400,6 @@ class calendar_ical extends calendar_boupdate
} }
else else
{ {
$event['tzid'] = date_default_timezone_get();
if (!empty($attributes['params']['TZID'])) if (!empty($attributes['params']['TZID']))
{ {
// import TZID, if PHP understands it (we only care about TZID of starttime, // import TZID, if PHP understands it (we only care about TZID of starttime,
@ -2423,6 +2429,13 @@ class calendar_ical extends calendar_boupdate
$event['tzid'] = date_default_timezone_get(); // default to current timezone $event['tzid'] = date_default_timezone_get(); // default to current timezone
} }
} }
else
{
// Horde seems not to distinguish between an explicit UTC time postfixed with Z and one without
// assuming for now UTC to pass CalDAVTester tests
// ToDo: fix Horde_Icalendar to return UTC for timestamp postfixed with Z
$event['tzid'] = 'UTC';
}
} }
break; break;

View File

@ -941,7 +941,8 @@ jQuery.extend(et2_selectbox,
return [ return [
{value: 1, label: 'low'}, {value: 1, label: 'low'},
{value: 2, label: 'normal'}, {value: 2, label: 'normal'},
{value: 3, label: 'high'} {value: 3, label: 'high'},
{value: 0, label: 'undefined'}
]; ];
}, },
bool_options: function(widget) { bool_options: function(widget) {

View File

@ -874,6 +874,7 @@ uganda common de UGANDA
ukraine common de UKRAINE ukraine common de UKRAINE
un-delete common de Gelöschte Einträge wiederherstellen un-delete common de Gelöschte Einträge wiederherstellen
unconnected nodes will be moved to %1. admin de Nicht Verbundene Knoten werden nach %1 verschoben. unconnected nodes will be moved to %1. admin de Nicht Verbundene Knoten werden nach %1 verschoben.
undefined common de unbestimmt
underline common de Unterstrichen underline common de Unterstrichen
unicode common de Unicode unicode common de Unicode
united arab emirates common de VEREINIGTEN ARABISCHEN EMIRATE united arab emirates common de VEREINIGTEN ARABISCHEN EMIRATE

View File

@ -874,6 +874,7 @@ uganda common en UGANDA
ukraine common en UKRAINE ukraine common en UKRAINE
un-delete common en Un-Delete un-delete common en Un-Delete
unconnected nodes will be moved to %1. admin en Unconnected nodes will be moved to %1. unconnected nodes will be moved to %1. admin en Unconnected nodes will be moved to %1.
undefined common en undefined
underline common en Underline underline common en Underline
unicode common en Unicode unicode common en Unicode
united arab emirates common en UNITED ARAB EMIRATES united arab emirates common en UNITED ARAB EMIRATES