mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-30 03:24:47 +00:00
Add basic support for Calendar Server getctag extension
This commit is contained in:
parent
21d8f5129e
commit
5a9a86df52
@ -117,6 +117,12 @@ function namespace_array() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function calendar_server_tag( $tag ) {
|
||||||
|
add_namespace("A", "http://calendarserver.org/ns/");
|
||||||
|
return ns_tag( $tag, 'http://calendarserver.org/ns/' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function caldav_tag( $tag ) {
|
function caldav_tag( $tag ) {
|
||||||
return ns_tag( $tag, 'urn:ietf:params:xml:ns:caldav' );
|
return ns_tag( $tag, 'urn:ietf:params:xml:ns:caldav' );
|
||||||
}
|
}
|
||||||
@ -158,6 +164,7 @@ foreach( $request->xml_tags AS $k => $v ) {
|
|||||||
case 'GETCONTENTLENGTH': /** getcontentlength- should work fine */
|
case 'GETCONTENTLENGTH': /** getcontentlength- should work fine */
|
||||||
case 'GETCONTENTTYPE': /** getcontenttype - should work fine */
|
case 'GETCONTENTTYPE': /** getcontenttype - should work fine */
|
||||||
case 'GETETAG': /** getetag - should work fine */
|
case 'GETETAG': /** getetag - should work fine */
|
||||||
|
case 'GETCTAG': /** Calendar Server extension like etag - should work fine (we just return etag) */
|
||||||
case 'SUPPORTEDLOCK': /** supportedlock - should work fine */
|
case 'SUPPORTEDLOCK': /** supportedlock - should work fine */
|
||||||
case 'PRINCIPAL-URL': /** principal-url - should work fine */
|
case 'PRINCIPAL-URL': /** principal-url - should work fine */
|
||||||
case 'RESOURCETYPE': /** resourcetype - should work fine */
|
case 'RESOURCETYPE': /** resourcetype - should work fine */
|
||||||
@ -291,12 +298,10 @@ function add_principal_properties( &$prop, &$not_found, &$denied ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($attribute_list['DROPBOX-HOME-URL'] ) ) {
|
if ( isset($attribute_list['DROPBOX-HOME-URL'] ) ) {
|
||||||
add_namespace("A", "http://calendarserver.org/ns/");
|
$prop->NewElement(calendar_server_tag("dropbox-home-url"), new XMLElement('href', $request->principal->dropbox_url) );
|
||||||
$prop->NewElement("A:dropbox-home-url", new XMLElement('href', $request->principal->dropbox_url) );
|
|
||||||
}
|
}
|
||||||
if ( isset($attribute_list['NOTIFICATIONS-URL'] ) ) {
|
if ( isset($attribute_list['NOTIFICATIONS-URL'] ) ) {
|
||||||
add_namespace("A", "http://calendarserver.org/ns/");
|
$prop->NewElement(calendar_server_tag("notifications-url"), new XMLElement('href', $request->principal->notifications_url) );
|
||||||
$prop->NewElement("A:notifications-url", new XMLElement('href', $request->principal->notifications_url) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($attribute_list['CALENDAR-USER-ADDRESS-SET'] ) ) {
|
if ( isset($attribute_list['CALENDAR-USER-ADDRESS-SET'] ) ) {
|
||||||
@ -379,6 +384,10 @@ function collection_to_xml( $collection ) {
|
|||||||
if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['GETETAG']) ) {
|
if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['GETETAG']) ) {
|
||||||
$prop->NewElement("getetag", '"'.$collection->dav_etag.'"' );
|
$prop->NewElement("getetag", '"'.$collection->dav_etag.'"' );
|
||||||
}
|
}
|
||||||
|
if ( isset($attribute_list['GETCTAG']) ) {
|
||||||
|
// Calendar Server extension which only applies to collections. We return the etag, which does the needful.
|
||||||
|
$prop->NewElement(calendar_server_tag('getctag'),$collection->dav_etag );
|
||||||
|
}
|
||||||
if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['CURRENT-USER-PRIVILEGE-SET']) ) {
|
if ( isset($attribute_list['ALLPROP']) || isset($attribute_list['CURRENT-USER-PRIVILEGE-SET']) ) {
|
||||||
$prop->NewElement("current-user-privilege-set", privileges($request->permissions) );
|
$prop->NewElement("current-user-privilege-set", privileges($request->permissions) );
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
HTTP/1.1 207 Multi-Status
|
HTTP/1.1 207 Multi-Status
|
||||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||||
DAV: 1, 2, access-control, calendar-access
|
DAV: 1, 2, access-control, calendar-access
|
||||||
ETag: "45e62f9b3b6b55ac40673d4ef35948b9"
|
ETag: "f5bcdac4101184e674bfb4112dfe4b0c"
|
||||||
Content-Length: 623
|
Content-Length: 666
|
||||||
Content-Type: text/xml; charset="utf-8"
|
Content-Type: text/xml; charset="utf-8"
|
||||||
|
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:C1="http://calendarserver.org/ns/" xmlns:A="http://apple.com/ns/ical/">
|
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:A="http://calendarserver.org/ns/" xmlns:A1="http://apple.com/ns/ical/">
|
||||||
<response>
|
<response>
|
||||||
<href>/caldav.php/user1/home/</href>
|
<href>/caldav.php/user1/home/</href>
|
||||||
<propstat>
|
<propstat>
|
||||||
@ -16,13 +16,13 @@ Content-Type: text/xml; charset="utf-8"
|
|||||||
<C:calendar/>
|
<C:calendar/>
|
||||||
</resourcetype>
|
</resourcetype>
|
||||||
<displayname>home</displayname>
|
<displayname>home</displayname>
|
||||||
|
<A:getctag>faf25336de0e470a54075c14cbcf5272</A:getctag>
|
||||||
</prop>
|
</prop>
|
||||||
<status>HTTP/1.1 200 OK</status>
|
<status>HTTP/1.1 200 OK</status>
|
||||||
</propstat>
|
</propstat>
|
||||||
<propstat>
|
<propstat>
|
||||||
<prop>
|
<prop>
|
||||||
<C1:getctag/>
|
<A1:calendar-color/>
|
||||||
<A:calendar-color/>
|
|
||||||
<C:calendar-description/>
|
<C:calendar-description/>
|
||||||
</prop>
|
</prop>
|
||||||
<status>HTTP/1.1 404 Not Found</status>
|
<status>HTTP/1.1 404 Not Found</status>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user