Improve iPhone iCal support

This commit is contained in:
Jörg Lehrke 2010-08-15 06:37:34 +00:00
parent e43f290d11
commit c8b9bf7e68
4 changed files with 38 additions and 4 deletions

View File

@ -867,6 +867,15 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f
*/
static function extra_properties(array $props=array(), $displayname, $base_uri=null)
{
if (strlen($GLOBALS['egw_info']['user']['preferences']['calendar']['display_color']) == 9 &&
$GLOBALS['egw_info']['user']['preferences']['calendar']['display_color'][0] == '#')
{
$display_color = $GLOBALS['egw_info']['user']['preferences']['calendar']['display_color'];
}
else
{
$display_color = '#0040A0FF';
}
// calendar description
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-description',$displayname);
/*
@ -903,7 +912,7 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-data',array(
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/calendar', 'version'=> '2.0')),
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-data', array('content-type' => 'text/x-calendar', 'version'=> '1.0'))));
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::ICAL,'calendar-color','#0040A0FF'); // TODO: make it configurable
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::ICAL,'calendar-color',$display_color);
//$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALENDARSERVER,'publish-url',array(
// HTTP_WebDAV_Server::mkprop('href',$base_uri.'/calendar/')));
@ -920,7 +929,7 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f
{
$handler = new calendar_ical();
$handler->setSupportedFields('GroupDAV',$this->agent);
if ($this->debug > 1) error_log("ical Handler called:" . $this->agent);
if ($this->debug > 1) error_log("ical Handler called: " . $this->agent);
return $handler;
}
}

View File

@ -409,6 +409,16 @@ class calendar_hooks
'xmlrpc' => True,
'admin' => False
),
'display_color' => array(
'type' => 'input',
'size' => 9,
'label' => 'Select a color for this calendar',
'name' => 'display_color',
'help' => 'The Apple iCal Apps use this color to display events from this calendar.',
'forced' => '#0040A0FF',
'xmlrpc' => True,
'admin' => False
),
'default_private' => array(
'type' => 'check',
'label' => 'Set new events to private',

View File

@ -619,8 +619,19 @@ class calendar_ical extends calendar_boupdate
$rrule = $rriter->generate_rrule($version);
if ($event['recur_enddate'])
{
$length = ($event['end'] - $event['start']) / 2;
$rrule['UNTIL']->modify($length . ' second');
if ($this->productManufacturer == 'groupdav' && $this->productName == 'iphone')
{
// Fix iPhone issue
$length = ($event['end'] - $event['start']);
$rrule['UNTIL']->modify($length . ' second');
$rrule['UNTIL']->setTime(23, 59, 59);
}
else
{
$length = ($event['end'] - $event['start']) / 2;
$rrule['UNTIL']->modify($length . ' second');
}
if (!$tzid || $version != '1.0')
{
if (!isset(self::$tz_cache['UTC']))

View File

@ -341,6 +341,7 @@ abstract class groupdav_handler
// identify the agent (GroupDAV client) from the HTTP_USER_AGENT header
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
foreach(array(
'iphone' => 'iphone', // Apple iPhone iCal
'davkit' => 'davkit', // Apple iCal
'cfnetwork' => 'cfnetwork', // Apple Addressbook
'bionicmessage.net' => 'funambol', // funambol GroupDAV connector from bionicmessage.net
@ -372,6 +373,9 @@ abstract class groupdav_handler
}
}
}
if ($debug) error_log(__METHOD__."GroupDAV client: $agent");
return $agent;
}
}