mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-27 02:54:27 +00:00
Add support for resource-id and parent-set properties.
This commit is contained in:
parent
897ace4f1d
commit
8fc2a76cea
@ -1206,8 +1206,36 @@ EOQRY;
|
||||
$prop->NewElement('href', ConstructURL($this->dav_name) );
|
||||
break;
|
||||
|
||||
case 'DAV::resource_id':
|
||||
$prop->NewElement('href', ConstructURL('.resources/'.$this->resource_id) );
|
||||
case 'DAV::resource-id':
|
||||
if ( $this->resource_id > 0 )
|
||||
$reply->DAVElement( $prop, 'resource-id', $reply->href(ConstructURL('/.resources/'.$this->resource_id) ) );
|
||||
else
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 'DAV::parent-set':
|
||||
$parent_set = $reply->DAVElement( $prop, 'parent-set' );
|
||||
if ( preg_match( '{^(.*)/([^/]+)/?$}', $this->bound_from, $matches ) ) {
|
||||
$reply->DAVElement($parent_set, 'parent', array(
|
||||
new XMLElement( 'href', ConstructURL($matches[1])),
|
||||
new XMLElement( 'segment', $matches[2])
|
||||
));
|
||||
$sql = <<<EOQRY
|
||||
SELECT regexp_replace( b.parent_container, '/$', '') AS parent,
|
||||
regexp_replace( replace( b.dav_name, b.parent_container, ''), '/$', '') AS segment
|
||||
FROM dav_binding b JOIN collection c ON(b.bound_source_id=c.collection_id)
|
||||
WHERE regexp_replace( b.dav_name, '^.*/', c.dav_name ) = :bound_from
|
||||
EOQRY;
|
||||
$qry = new AwlQuery($sql, array( ':bound_from' => $this->bound_from ) );
|
||||
if ( $qry->Exec('DAVResource',__LINE__,__FILE__) && $qry->rows() > 0 ) {
|
||||
while( $row = $qry->Fetch() ) {
|
||||
$reply->DAVElement($parent_set, 'parent', array(
|
||||
new XMLElement( 'href', ConstructURL($row->parent)),
|
||||
new XMLElement( 'segment', $row->segment)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'DAV::getcontenttype':
|
||||
|
||||
@ -5,6 +5,10 @@
|
||||
<propstat>
|
||||
<prop>
|
||||
<displayname>User 4</displayname>
|
||||
<resource-id>
|
||||
<href>/caldav.php/.resources/6</href>
|
||||
</resource-id>
|
||||
<parent-set/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
@ -14,6 +18,19 @@
|
||||
<propstat>
|
||||
<prop>
|
||||
<displayname>User 2's Calendar, as uploaded by Admin</displayname>
|
||||
<resource-id>
|
||||
<href>/caldav.php/.resources/11</href>
|
||||
</resource-id>
|
||||
<parent-set>
|
||||
<parent>
|
||||
<href>/caldav.php/user2</href>
|
||||
<segment>home</segment>
|
||||
</parent>
|
||||
<parent>
|
||||
<href>/caldav.php/user4</href>
|
||||
<segment>user2</segment>
|
||||
</parent>
|
||||
</parent-set>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
@ -23,6 +40,15 @@
|
||||
<propstat>
|
||||
<prop>
|
||||
<displayname>mir-test</displayname>
|
||||
<resource-id>
|
||||
<href>/caldav.php/.resources/13</href>
|
||||
</resource-id>
|
||||
<parent-set>
|
||||
<parent>
|
||||
<href>/caldav.php/user4</href>
|
||||
<segment>home</segment>
|
||||
</parent>
|
||||
</parent-set>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
@ -32,17 +58,41 @@
|
||||
<propstat>
|
||||
<prop>
|
||||
<displayname>/user4/calendar-proxy-read/</displayname>
|
||||
<parent-set>
|
||||
<parent>
|
||||
<href>/caldav.php/user4</href>
|
||||
<segment>calendar-proxy-read</segment>
|
||||
</parent>
|
||||
</parent-set>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
<propstat>
|
||||
<prop>
|
||||
<resource-id/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 404 Not Found</status>
|
||||
</propstat>
|
||||
</response>
|
||||
<response>
|
||||
<href>/caldav.php/user4/calendar-proxy-write/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<displayname>/user4/calendar-proxy-write/</displayname>
|
||||
<parent-set>
|
||||
<parent>
|
||||
<href>/caldav.php/user4</href>
|
||||
<segment>calendar-proxy-write</segment>
|
||||
</parent>
|
||||
</parent-set>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
<propstat>
|
||||
<prop>
|
||||
<resource-id/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 404 Not Found</status>
|
||||
</propstat>
|
||||
</response>
|
||||
</multistatus>
|
||||
|
||||
@ -15,6 +15,8 @@ BEGINDATA
|
||||
<propfind xmlns="DAV:">
|
||||
<prop>
|
||||
<displayname/>
|
||||
<resource-id/>
|
||||
<parent-set/>
|
||||
</prop>
|
||||
</propfind>
|
||||
ENDDATA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user