mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 08:09:02 +01:00
ctag for addressbook, sogo connector seem to require it, thought it should be optional, anyway ctag makes sense
This commit is contained in:
parent
d82ca7378b
commit
d53f0c91bf
@ -22,7 +22,7 @@ class addressbook_groupdav extends groupdav_handler
|
||||
/**
|
||||
* bo class of the application
|
||||
*
|
||||
* @var addressbook_vcal
|
||||
* @var addressbook_bo
|
||||
*/
|
||||
var $bo;
|
||||
|
||||
@ -307,6 +307,24 @@ class addressbook_groupdav extends groupdav_handler
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query ctag for addressbook
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getctag($path,$user)
|
||||
{
|
||||
$filter = array();
|
||||
// show addressbook of a single user?
|
||||
if ($user && $path != '/addressbook/') $filter['contact_owner'] = $user;
|
||||
// should we hide the accounts addressbook
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
|
||||
|
||||
$result = $this->bo->search(array(),'MAX(contact_modified) AS contact_modified','','','','','',$filter);
|
||||
|
||||
return date('Y-m-d H:i:s',$result[0]['modified']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the handler and set the supported fields
|
||||
*
|
||||
|
@ -48,6 +48,10 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
* CardDAV namespace
|
||||
*/
|
||||
const CARDDAV = 'urn:ietf:params:xml:ns:carddav';
|
||||
/**
|
||||
* Calendarserver namespace (eg. for ctag)
|
||||
*/
|
||||
const CALENDARSERVER = 'http://calendarserver.org/ns/';
|
||||
/**
|
||||
* Realm and powered by string
|
||||
*/
|
||||
@ -229,7 +233,7 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
{
|
||||
if ($method != 'REPORT' && !$id) // no self URL for REPORT requests (only PROPFIND) or propfinds on an id
|
||||
{
|
||||
$files['files'][] = array(
|
||||
$files['files'][0] = array(
|
||||
'path' => '/'.$app.'/',
|
||||
// KAddressbook doubles the folder, if the self URL contains the GroupDAV/CalDAV resourcetypes
|
||||
'props' => $this->_properties($app,$app=='addressbook'&&strpos($_SERVER['HTTP_USER_AGENT'],'KHTML') !== false),
|
||||
@ -237,6 +241,12 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
}
|
||||
if (!$options['depth'] && !$id)
|
||||
{
|
||||
// add ctag if handler implements it (only for depth 0)
|
||||
if (method_exists($handler,'getctag'))
|
||||
{
|
||||
$files['files'][0]['props'][] = HTTP_WebDAV_Server::mkprop(
|
||||
groupdav::CALENDARSERVER,'getctag',$handler->getctag($options['path'],$user));
|
||||
}
|
||||
return true; // depth 0 --> show only the self url
|
||||
}
|
||||
return $handler->propfind($options['path'],$options,$files,$user,$id);
|
||||
|
Loading…
Reference in New Issue
Block a user