mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
supported-report-set as required for CardDAV and Sogo connector
This commit is contained in:
parent
291890c5cc
commit
46f3d19e1c
@ -325,6 +325,22 @@ class addressbook_groupdav extends groupdav_handler
|
||||
return '"'.$result[0]['modified'].'"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add extra properties for addressbook collections
|
||||
*
|
||||
* @param array $props=array() regular props by the groupdav handler
|
||||
* @return array
|
||||
*/
|
||||
static function extra_properties(array $props=array())
|
||||
{
|
||||
// supported reports (required property for CardDAV)
|
||||
$props[] = HTTP_WebDAV_Server::mkprop('supported-report-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('supported-report','addressbook-query'),
|
||||
HTTP_WebDAV_Server::mkprop('supported-report','addressbook-multiget'),
|
||||
));
|
||||
return $props;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the handler and set the supported fields
|
||||
*
|
||||
|
@ -758,8 +758,9 @@ class HTTP_WebDAV_Server
|
||||
. "GMT</D:getlastmodified>\n";
|
||||
break;
|
||||
case "resourcetype":
|
||||
case "supported-report-set":
|
||||
if (!is_array($prop['val'])) {
|
||||
echo " <D:resourcetype><D:$prop[val]/></D:resourcetype>\n";
|
||||
echo " <D:$prop[name]><D:$prop[val]/></D:$prop[name]>\n";
|
||||
} else { // multiple resourcetypes from different namespaces as required by GroupDAV
|
||||
$vals = $extra_ns = '';
|
||||
foreach($prop['val'] as $subprop)
|
||||
@ -781,10 +782,17 @@ class HTTP_WebDAV_Server
|
||||
} else {
|
||||
$ns_name = '';
|
||||
}
|
||||
$vals .= "<$ns_name$subprop[val]/>";
|
||||
// check if $prop[val] should be returned as attribute or value
|
||||
if ($subprop['name'] == $subprop['val'] ||
|
||||
$subprop['name'] == $prop['name']) {
|
||||
$vals .= "<$ns_name$subprop[val]/>";
|
||||
} else {
|
||||
$vals .= "<$ns_name$subprop[name]>$subprop[val]</$ns_name$subprop[name]>";
|
||||
}
|
||||
}
|
||||
echo " <D:resourcetype$extra_ns>$vals</D:resourcetype>\n";
|
||||
//error_log("resourcetype: <D:resourcetype$extra_ns>$vals</D:resourcetype>");
|
||||
echo " <D:$prop[name]$extra_ns>$vals</D:$prop[name]>\n";
|
||||
//error_log(array2string($prop));
|
||||
//error_log("<D:$prop[name]$extra_ns>$vals</D:$prop[name]>");
|
||||
}
|
||||
break;
|
||||
case "supportedlock":
|
||||
|
@ -497,7 +497,16 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
default:
|
||||
$ns = $prop['ns'];
|
||||
}
|
||||
$arr[$ns.':'.$prop['name']] = $prop['val'];
|
||||
// allow multiple values for same name
|
||||
if (isset($arr[$ns.':'.$prop['name']]))
|
||||
{
|
||||
$arr[$ns.':'.$prop['name']] = (array)$arr[$ns.':'.$prop['name']];
|
||||
$arr[$ns.':'.$prop['name']][] = $prop['val'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr[$ns.':'.$prop['name']] = $prop['val'];
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user