From d898e6c627b7d2334d4d2ca6aa69954f4fb4420e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 20 Oct 2011 14:01:16 +0000 Subject: [PATCH] calendar-timezone needs full vcalendar component, not just a vtimezone --- calendar/inc/class.calendar_groupdav.inc.php | 2 +- calendar/inc/class.calendar_timezones.inc.php | 21 +++++++++++++++---- infolog/inc/class.infolog_groupdav.inc.php | 12 +++++------ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/calendar/inc/class.calendar_groupdav.inc.php b/calendar/inc/class.calendar_groupdav.inc.php index e4e6114f41..9802db4089 100644 --- a/calendar/inc/class.calendar_groupdav.inc.php +++ b/calendar/inc/class.calendar_groupdav.inc.php @@ -1047,7 +1047,7 @@ class calendar_groupdav extends groupdav_handler if ($this->groupdav->prop_requested('calendar-timezone')) { $props['calendar-timezone'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-timezone', - calendar_timezones::user_timezone($user, 'component')); + calendar_timezones::user_timezone($user)); } return $props; } diff --git a/calendar/inc/class.calendar_timezones.inc.php b/calendar/inc/class.calendar_timezones.inc.php index 9da9dbd64f..a3045b9572 100644 --- a/calendar/inc/class.calendar_timezones.inc.php +++ b/calendar/inc/class.calendar_timezones.inc.php @@ -373,10 +373,10 @@ class calendar_timezones * Query timezone of a given user, returns 'tzid' or VTIMEZONE 'component' * * @param int $user=null - * @param string $type='component' everything tz2id supports + * @param string $type='vcalendar' 'tzid' or everything tz2id supports, default 'vcalendar' = full vcalendar component * @return string */ - public static function user_timezone($user=null, $type='component') + public static function user_timezone($user=null, $type='vcalendar') { if (!$user || $user == $GLOBALS['egw_info']['user']['account_id']) { @@ -390,9 +390,22 @@ class calendar_timezones } if (!$tzid) $tzid = egw_time::$server_timezone->getName(); - if ($type != 'tzid') + switch ($type) { - return self::tz2id($tzid,$type); + case 'vcalendar': + include_once EGW_SERVER_ROOT.'/phpgwapi/inc/horde/lib/core.php'; + // checking type of $val, now we included the object definition (no need to always include it!) + $vcal = new Horde_iCalendar; + $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. + strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); + self::add_vtimezone($vcal, $tzid); + $tzid = $vcal->exportvCalendar('utf-8'); + break; + case 'tzid': + break; + default: + $tzid = self::tz2id($tzid,$type == 'vcalendar' ? 'component' : $type); + break; } return $tzid; } diff --git a/infolog/inc/class.infolog_groupdav.inc.php b/infolog/inc/class.infolog_groupdav.inc.php index 0303963dbf..d1751e74cf 100644 --- a/infolog/inc/class.infolog_groupdav.inc.php +++ b/infolog/inc/class.infolog_groupdav.inc.php @@ -591,17 +591,17 @@ class infolog_groupdav extends groupdav_handler { // calendar description $displayname = translation::convert(lang('Tasks of'),translation::charset(),'utf-8').' '.$displayname; - $props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-description',$displayname); + $props['calendar-description'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-description',$displayname); // supported components, currently only VEVENT - $props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-component-set',array( + $props['supported-calendar-component-set'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-component-set',array( HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'comp',array('name' => 'VCALENDAR')), HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'comp',array('name' => 'VTODO')), )); // supported reports - $props[] = HTTP_WebDAV_Server::mkprop('supported-report-set',array( - HTTP_WebDAV_Server::mkprop('report',array( - HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-query',''))), + $props['supported-report-set'] = HTTP_WebDAV_Server::mkprop('supported-report-set',array( HTTP_WebDAV_Server::mkprop('supported-report',array( + HTTP_WebDAV_Server::mkprop('report',array( + HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-query',''))), HTTP_WebDAV_Server::mkprop('report',array( HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-multiget',''))))))); @@ -609,7 +609,7 @@ class infolog_groupdav extends groupdav_handler if ($this->groupdav->prop_requested('calendar-timezone')) { $props['calendar-timezone'] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-timezone', - calendar_timezones::user_timezone($user, 'component')); + calendar_timezones::user_timezone($user)); } return $props; }