Merge branch 'master' of git+ssh://repo.or.cz/srv/git/davical

This commit is contained in:
Andrew McMillan 2008-09-16 09:50:11 +12:00
commit db4cc43bcf
4 changed files with 28 additions and 11 deletions

View File

@ -22,9 +22,13 @@ $session = new HTTPAuthSession();
* access-control is rfc3744, so we will say we do it, but I doubt if we do it
* in all (or even much of) it's glory really.
*/
$dav = "1, 2, access-control, calendar-access";
if ( isset($c->override_dav_header) ) {
$dav = $c->override_dav_header;
}
else {
$dav = "1, 2, access-control, calendar-access";
}
header( "DAV: $dav");
// header( "DAV: 1, 2, access-control, calendar-access, calendar-schedule");
require_once("CalDAVRequest.php");
$request = new CalDAVRequest();

View File

@ -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 ) {
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 'GETCONTENTTYPE': /** getcontenttype - 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 'PRINCIPAL-URL': /** principal-url - 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'] ) ) {
add_namespace("A", "http://calendarserver.org/ns/");
$prop->NewElement("A:dropbox-home-url", new XMLElement('href', $request->principal->dropbox_url) );
$prop->NewElement(calendar_server_tag("dropbox-home-url"), new XMLElement('href', $request->principal->dropbox_url) );
}
if ( isset($attribute_list['NOTIFICATIONS-URL'] ) ) {
add_namespace("A", "http://calendarserver.org/ns/");
$prop->NewElement("A:notifications-url", new XMLElement('href', $request->principal->notifications_url) );
$prop->NewElement(calendar_server_tag("notifications-url"), new XMLElement('href', $request->principal->notifications_url) );
}
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']) ) {
$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']) ) {
$prop->NewElement("current-user-privilege-set", privileges($request->permissions) );
}

View File

@ -1,5 +1,9 @@
<?php
/**
* @TODO Tidy up namespace handling in the responses.
*/
$responses = array();
/**

View File

@ -1,12 +1,12 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, access-control, calendar-access
ETag: "45e62f9b3b6b55ac40673d4ef35948b9"
Content-Length: 623
ETag: "f5bcdac4101184e674bfb4112dfe4b0c"
Content-Length: 666
Content-Type: text/xml; charset="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>
<href>/caldav.php/user1/home/</href>
<propstat>
@ -16,13 +16,13 @@ Content-Type: text/xml; charset="utf-8"
<C:calendar/>
</resourcetype>
<displayname>home</displayname>
<A:getctag>faf25336de0e470a54075c14cbcf5272</A:getctag>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<C1:getctag/>
<A:calendar-color/>
<A1:calendar-color/>
<C:calendar-description/>
</prop>
<status>HTTP/1.1 404 Not Found</status>