calendar-timezone needs full vcalendar component, not just a vtimezone

This commit is contained in:
Ralf Becker 2011-10-20 14:01:16 +00:00
parent ceaec3d3c1
commit d898e6c627
3 changed files with 24 additions and 11 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}