Updated MKCOL/MKCALENDAR to support setting a supported-calendar-component-set

This commit is contained in:
Andrew McMillan 2011-10-03 17:57:28 +02:00
parent 323e6a3011
commit 8e18449096
10 changed files with 341 additions and 10 deletions

View File

@ -1590,8 +1590,20 @@ EOQRY;
case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set':
if ( ! $this->_is_collection ) return false;
if ( $this->IsCalendar() )
$set_of_components = array( 'VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE', 'VFREEBUSY' );
if ( $this->IsCalendar() ) {
if ( !isset($this->dead_properties) ) $this->FetchDeadProperties();
if ( isset($this->dead_properties[$tag]) ) {
$set_of_components = explode('"', $this->dead_properties[$tag]);
foreach( $set_of_components AS $k => $v ) {
if ( !preg_match('{(VEVENT|VTODO|VJOURNAL|VTIMEZONE|VFREEBUSY)}', $v) ) {
unset( $set_of_components[$k] );
}
}
}
else {
$set_of_components = array( 'VEVENT', 'VTODO', 'VJOURNAL', 'VTIMEZONE', 'VFREEBUSY' );
}
}
else if ( $this->IsSchedulingCollection() )
$set_of_components = array( 'VEVENT', 'VTODO', 'VFREEBUSY' );
else return false;

View File

@ -104,7 +104,12 @@ if ( isset($request->xml_tags) ) {
$success[$tag] = 1;
break;
case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set': /** Ignored, since we will support all component types */
case 'urn:ietf:params:xml:ns:caldav:supported-calendar-component-set':
/** We allow this to be written as a dead property */
$dav_properties[$tag] = $content;
$success[$tag] = 1;
break;
case 'urn:ietf:params:xml:ns:caldav:supported-calendar-data': /** Ignored, since we will support iCalendar 2.0 */
case 'urn:ietf:params:xml:ns:caldav:calendar-data': /** Ignored, since we will support iCalendar 2.0 */
case 'urn:ietf:params:xml:ns:caldav:max-resource-size': /** Ignored, since we will support arbitrary size */

View File

@ -0,0 +1,25 @@
HTTP/1.1 201 Created
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule
Cache-Control: no-cache
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
dav_displayname: >Untitled<
is_calendar: >1<
parent_container: >/user1/<
public_events_onl: >0<
user_no: >10<
changed_by: >10<
property_name: >http://apple.com/ns/ical/:calendar-color<
property_value: >#391B71A0<
changed_by: >10<
property_name: >urn:ietf:params:xml:ns:caldav:supported-calendar-component-set<
property_value: >
<urn:ietf:params:xml:ns:caldav:comp name="VTODO"/>
<

View File

@ -0,0 +1,38 @@
#
# MKCALENDAR test for iCal
#
TYPE=MKCALENDAR
URL=http://mycaldav/caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/
HEADER=Content-Type: text/xml
HEAD
BEGINDATA
<?xml version="1.0" encoding="UTF-8" ?>
<x0:mkcalendar xmlns:x0="urn:ietf:params:xml:ns:caldav" xmlns:x1="DAV:" xmlns:x2="http://apple.com/ns/ical/">
<x1:set>
<x1:prop>
<x1:displayname>Untitled</x1:displayname>
<x2:calendar-color>#391B71A0</x2:calendar-color>
<x0:supported-calendar-component-set>
<x0:comp name="VTODO"/>
</x0:supported-calendar-component-set>
</x1:prop>
</x1:set>
</x0:mkcalendar>
ENDDATA
QUERY
SELECT user_no, parent_container, dav_displayname,
is_calendar, public_events_only
FROM collection
WHERE dav_name = '/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/';
ENDQUERY
QUERY
SELECT property_name, property_value, changed_by
FROM property
WHERE dav_name = '/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/';
ENDQUERY

View File

@ -0,0 +1,180 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule
ETag: "d98f282a5121894cde0b43b6ecf143df"
Content-Length: 4285
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/">
<response>
<href>/caldav.php/user1/</href>
<propstat>
<prop>
<displayname>User 1</displayname>
<resourcetype>
<collection/>
<principal/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<C:supported-calendar-component-set/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/home/</href>
<propstat>
<prop>
<displayname>user1 home</displayname>
<C:supported-calendar-component-set>
<C:comp name="VEVENT"/>
<C:comp name="VTODO"/>
<C:comp name="VJOURNAL"/>
<C:comp name="VTIMEZONE"/>
<C:comp name="VFREEBUSY"/>
</C:supported-calendar-component-set>
<resourcetype>
<collection/>
<C:calendar/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/created/</href>
<propstat>
<prop>
<displayname>created</displayname>
<C:supported-calendar-component-set>
<C:comp name="VEVENT"/>
<C:comp name="VTODO"/>
<C:comp name="VJOURNAL"/>
<C:comp name="VTIMEZONE"/>
<C:comp name="VFREEBUSY"/>
</C:supported-calendar-component-set>
<resourcetype>
<collection/>
<C:calendar/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/.in/</href>
<propstat>
<prop>
<displayname>User 1 Inbox</displayname>
<C:supported-calendar-component-set>
<C:comp name="VEVENT"/>
<C:comp name="VTODO"/>
<C:comp name="VFREEBUSY"/>
</C:supported-calendar-component-set>
<resourcetype>
<collection/>
<C:schedule-inbox/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/.out/</href>
<propstat>
<prop>
<displayname>User 1 Outbox</displayname>
<C:supported-calendar-component-set>
<C:comp name="VEVENT"/>
<C:comp name="VTODO"/>
<C:comp name="VFREEBUSY"/>
</C:supported-calendar-component-set>
<resourcetype>
<collection/>
<C:schedule-outbox/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/6E20BB7C-EFD9-4F0F-9BDC-5335E04D47E0/</href>
<propstat>
<prop>
<displayname>iCal Calendar</displayname>
<C:supported-calendar-component-set>
<C:comp name="VEVENT"/>
<C:comp name="VTODO"/>
<C:comp name="VJOURNAL"/>
<C:comp name="VTIMEZONE"/>
<C:comp name="VFREEBUSY"/>
</C:supported-calendar-component-set>
<resourcetype>
<collection/>
<C:calendar/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/</href>
<propstat>
<prop>
<displayname>Untitled</displayname>
<C:supported-calendar-component-set>
<C:comp name="VTODO"/>
</C:supported-calendar-component-set>
<resourcetype>
<collection/>
<C:calendar/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/calendar-proxy-read/</href>
<propstat>
<prop>
<displayname>/user1/calendar-proxy-read/</displayname>
<resourcetype>
<collection/>
<C1:calendar-proxy-read/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<C:supported-calendar-component-set/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/calendar-proxy-write/</href>
<propstat>
<prop>
<displayname>/user1/calendar-proxy-write/</displayname>
<resourcetype>
<collection/>
<C1:calendar-proxy-write/>
</resourcetype>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<C:supported-calendar-component-set/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
</multistatus>

View File

@ -0,0 +1,27 @@
#
# Testing with a process similar to iPhone 3.1
#
TYPE=PROPFIND
URL=http://mycaldav/caldav.php/user1/
HEAD
AUTH=user1:user1
HEADER=User-Agent: DAVKit/4.0 (728.3); iCalendar/1 (34); iPhone/3.0 7A341
HEADER=Content-Type: text/xml
HEADER=Depth: 1
#
# This query from the iPhone goes to the calendar-home-set and checks
# what is available under that collection.
#
BEGINDATA
<?xml version="1.0" encoding="utf-8"?>
<x0:propfind xmlns:x0="DAV:" xmlns:x1="urn:ietf:params:xml:ns:caldav">
<x0:prop>
<x0:displayname/>
<x1:supported-calendar-component-set/>
<x0:resourcetype/>
</x0:prop>
</x0:propfind>
ENDDATA

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule
ETag: "44487da270d6e0c4f71f784688a0896d"
Content-Length: 15362
ETag: "12c556718c27de34471b0b9f333610fc"
Content-Length: 15922
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -558,6 +558,28 @@ Content-Type: text/xml; charset="utf-8"
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/</href>
<propstat>
<prop>
<C:calendar-home-set>
<href>/caldav.php/user1/</href>
</C:calendar-home-set>
<C:calendar-user-address-set>
<href>mailto:user1@example.net</href>
<href>/caldav.php/user1/</href>
</C:calendar-user-address-set>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<A:dropbox-home-URL/>
<A:notifications-URL/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/calendar-proxy-read/</href>
<propstat>

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, calendar-proxy, bind, addressbook, calendar-auto-schedule
ETag: "ea92b512c27205b703cb6f52043bb6d3"
Content-Length: 4476
ETag: "2c82262a1c8f2caf0dccf46188970a65"
Content-Length: 5036
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -140,6 +140,28 @@ Content-Type: text/xml; charset="utf-8"
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/</href>
<propstat>
<prop>
<C:calendar-home-set>
<href>/caldav.php/user1/</href>
</C:calendar-home-set>
<C:calendar-user-address-set>
<href>mailto:user1@example.net</href>
<href>/caldav.php/user1/</href>
</C:calendar-user-address-set>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<A:dropbox-home-URL/>
<A:notifications-URL/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/user1/calendar-proxy-read/</href>
<propstat>

View File

@ -16,7 +16,7 @@ Content-Type: text/plain; charset="utf-8"
attendees: >40<
collection_id: >1563<
collection_id: >1564<
dav_displayname: >anotherone<
dav_etag: >f9a8ee6b41d9b02aa5176e6da349121a<
dav_name: >/user1/anotherone/<

View File

@ -6,9 +6,9 @@ Content-Length: 0
Content-Type: text/plain; charset="utf-8"
cd_collection: >1563<
cd_collection: >1564<
cd_user_no: >10<
ci_collection: >1563<
ci_collection: >1564<
ci_user_no: >10<
data_name: >/user1/anotherone/DAYPARTY-77C6-4FB7-BDD3-6882E2F1BE74.ics<
item_name: >/user1/anotherone/DAYPARTY-77C6-4FB7-BDD3-6882E2F1BE74.ics<