From 8d476dae23e5c4cfafa11cfc42385fc8b4e04976 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 29 Sep 2015 10:25:32 +0000 Subject: [PATCH] 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) --- calendar/inc/class.calendar_ical.inc.php | 17 +++++++++++++++-- etemplate/js/et2_widget_selectbox.js | 3 ++- phpgwapi/lang/egw_de.lang | 1 + phpgwapi/lang/egw_en.lang | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index cb4ab1a13e..96e20a3c4b 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -525,6 +525,7 @@ class calendar_ical extends calendar_boupdate break; 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'; // Apple iCal on OS X uses X-CALENDARSERVER-ACCESS: CONFIDENTIAL on VCALANDAR (not VEVENT!) if (!$event['public'] && $this->productManufacturer == 'groupdav') @@ -585,6 +586,10 @@ class calendar_ical extends calendar_boupdate case 'DTEND': 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']); } else @@ -677,6 +682,7 @@ class calendar_ical extends calendar_boupdate break; 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' && (strpos($this->productName, 'outlook') !== false || strpos($this->productName, 'pocket pc') !== false)) @@ -690,6 +696,7 @@ class calendar_ical extends calendar_boupdate break; case 'TRANSP': + if (!$event['non_blocking']) continue; // OPAQUE is default, no need to export, fails CalDAVTester if added as default if ($version == '1.0') { $attributes['TRANSP'] = ($event['non_blocking'] ? 1 : 0); @@ -2368,6 +2375,7 @@ class calendar_ical extends calendar_boupdate $vcardData = array( 'recur_type' => MCAL_RECUR_NONE, '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 foreach (array_merge( @@ -2392,8 +2400,6 @@ class calendar_ical extends calendar_boupdate } else { - $event['tzid'] = date_default_timezone_get(); - if (!empty($attributes['params']['TZID'])) { // 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 } } + 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; diff --git a/etemplate/js/et2_widget_selectbox.js b/etemplate/js/et2_widget_selectbox.js index 3bed3f2c18..c526c482f3 100644 --- a/etemplate/js/et2_widget_selectbox.js +++ b/etemplate/js/et2_widget_selectbox.js @@ -941,7 +941,8 @@ jQuery.extend(et2_selectbox, return [ {value: 1, label: 'low'}, {value: 2, label: 'normal'}, - {value: 3, label: 'high'} + {value: 3, label: 'high'}, + {value: 0, label: 'undefined'} ]; }, bool_options: function(widget) { diff --git a/phpgwapi/lang/egw_de.lang b/phpgwapi/lang/egw_de.lang index 949f5c5500..2fced1bd79 100644 --- a/phpgwapi/lang/egw_de.lang +++ b/phpgwapi/lang/egw_de.lang @@ -874,6 +874,7 @@ uganda common de UGANDA ukraine common de UKRAINE 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. +undefined common de unbestimmt underline common de Unterstrichen unicode common de Unicode united arab emirates common de VEREINIGTEN ARABISCHEN EMIRATE diff --git a/phpgwapi/lang/egw_en.lang b/phpgwapi/lang/egw_en.lang index c9e8b3c820..5d865d1468 100644 --- a/phpgwapi/lang/egw_en.lang +++ b/phpgwapi/lang/egw_en.lang @@ -874,6 +874,7 @@ uganda common en UGANDA ukraine common en UKRAINE un-delete common en Un-Delete unconnected nodes will be moved to %1. admin en Unconnected nodes will be moved to %1. +undefined common en undefined underline common en Underline unicode common en Unicode united arab emirates common en UNITED ARAB EMIRATES