mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 09:53:20 +01:00
some modifications to get iPhone working with EGroupware
This commit is contained in:
parent
1b3563e9a5
commit
9e13d1a73f
@ -128,6 +128,7 @@ class calendar_groupdav extends groupdav_handler
|
||||
'text/calendar; charset=utf-8; component=VEVENT' : 'text/calendar'),
|
||||
// getlastmodified and getcontentlength are required by WebDAV and Cadaver eg. reports 404 Not found if not set
|
||||
HTTP_WebDAV_Server::mkprop('getlastmodified', $event['modified']),
|
||||
HTTP_WebDAV_Server::mkprop('resourcetype',''), // iPhone requires that attribute!
|
||||
);
|
||||
//error_log(__FILE__ . __METHOD__ . "Calendar Data : $calendar_data");
|
||||
if ($calendar_data)
|
||||
@ -175,7 +176,7 @@ class calendar_groupdav extends groupdav_handler
|
||||
{
|
||||
case 'comp-filter':
|
||||
if ($this->debug > 1) error_log(__METHOD__."($path,...) comp-filter='{$filter['attrs']['name']}'");
|
||||
|
||||
|
||||
switch($filter['attrs']['name'])
|
||||
{
|
||||
case 'VTODO':
|
||||
@ -253,7 +254,7 @@ class calendar_groupdav extends groupdav_handler
|
||||
if ($option['name'] == 'href')
|
||||
{
|
||||
$parts = explode('/',$option['data']);
|
||||
|
||||
|
||||
if (is_numeric($id = basename(array_pop($parts),'.ics'))) $ids[] = $id;
|
||||
}
|
||||
}
|
||||
@ -262,7 +263,7 @@ class calendar_groupdav extends groupdav_handler
|
||||
{
|
||||
$cal_filters['query'][] = 'egw_cal.cal_id IN ('.implode(',',array_map(create_function('$n','return (int)$n;'),$ids)).')';
|
||||
}
|
||||
|
||||
|
||||
if ($this->debug > 1) error_log(__FILE__ . __METHOD__ ."($path,,,$user,$id) calendar-multiget: ids=".implode(',',$ids));
|
||||
}
|
||||
return true;
|
||||
@ -302,10 +303,10 @@ class calendar_groupdav extends groupdav_handler
|
||||
if($this->debug) error_log(__METHOD__."($id, $user)".print_r($options,true));
|
||||
$return_no_access=true; // as handled by importVCal anyway and allows it to set the status for participants
|
||||
$event = $this->_common_get_put_delete('PUT',$options,$id,$return_no_access);
|
||||
|
||||
|
||||
if (!is_null($event) && !is_array($event))
|
||||
{
|
||||
|
||||
|
||||
if($this->debug) error_log(__METHOD__.print_r($event,true).function_backtrace());
|
||||
return $event;
|
||||
}
|
||||
@ -362,7 +363,7 @@ class calendar_groupdav extends groupdav_handler
|
||||
function read($id)
|
||||
{
|
||||
//$cal_read = $this->bo->read($id,null,false,'server');//njv: do we actually get anything
|
||||
if ($this->debug > 1) error_log("bo-ical read :$id:");//njv:
|
||||
if ($this->debug > 1) error_log("bo-ical read :$id:");//njv:
|
||||
return $this->bo->read($id,null,false,'server');
|
||||
}
|
||||
|
||||
@ -414,6 +415,11 @@ class calendar_groupdav extends groupdav_handler
|
||||
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',$_SERVER['SCRIPT_NAME'].'/');
|
||||
// email of the current user, see caldav-sheduling draft
|
||||
$props[] = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-user-address-set','MAILTO:'.$GLOBALS['egw_info']['user']['email']);
|
||||
// supported components, currently only VEVENT
|
||||
$props[] = $sc = HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'supported-calendar-component-set',array(
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'comp',array('name' => 'VEVENT')),
|
||||
// HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'comp',array('name' => 'VTODO')), // not yet supported
|
||||
));
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
@ -791,6 +791,49 @@ class HTTP_WebDAV_Server
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// allow multiple values and attributes, required eg. for caldav:supported-calendar-component-set
|
||||
if ($prop['ns'] && is_array($prop['val'])) {
|
||||
if (!isset($ns_hash[$prop['ns']])) {
|
||||
$ns_name = "ns".(count($ns_hash) + 1);
|
||||
$ns_hash[$prop['ns']] = $ns_name;
|
||||
}
|
||||
$vals = $extra_ns = '';
|
||||
foreach($prop['val'] as $subprop)
|
||||
{
|
||||
if ($subprop['ns'] && $subprop['ns'] != 'DAV:') {
|
||||
// register property namespace if not known yet
|
||||
if (!isset($ns_hash[$subprop['ns']])) {
|
||||
$ns_name = "ns".(count($ns_hash) + 1);
|
||||
$ns_hash[$subprop['ns']] = $ns_name;
|
||||
} else {
|
||||
$ns_name = $ns_hash[$subprop['ns']];
|
||||
}
|
||||
if (strchr($extra_ns,$extra=' xmlns:'.$ns_name.'="'.$subprop['ns'].'"') === false) {
|
||||
$extra_ns .= $extra;
|
||||
}
|
||||
$ns_name .= ':';
|
||||
} elseif ($subprop['ns'] == 'DAV:') {
|
||||
$ns_name = 'D:';
|
||||
} else {
|
||||
$ns_name = '';
|
||||
}
|
||||
$vals .= "<$ns_name$subprop[name]";
|
||||
if (is_array($subprop['val'])) // val contains only attributes, no value
|
||||
{
|
||||
foreach($subprop['val'] as $attr => $val)
|
||||
{
|
||||
$vals .= ' '.$attr.'="'.htmlspecialchars($val).'"';
|
||||
}
|
||||
$vals .= '/>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$vals .= '>'.htmlspecialchars($subprop['val'])."</$ns_name$subprop[name]>";
|
||||
}
|
||||
}
|
||||
echo " <".$ns_hash[$prop['ns']].":$prop[name]$extra_ns>$vals</".$ns_hash[$prop['ns']].":$prop[name]>\n";
|
||||
}
|
||||
else
|
||||
// properties from namespaces != "DAV:" or without any namespace
|
||||
if ($prop["ns"]) {
|
||||
echo " <" . $ns_hash[$prop["ns"]] . ":$prop[name]>"
|
||||
|
Loading…
Reference in New Issue
Block a user