From 8e184490962163ba46b51f5b306f842ee5c71b58 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 3 Oct 2011 17:57:28 +0200 Subject: [PATCH] Updated MKCOL/MKCALENDAR to support setting a supported-calendar-component-set --- inc/DAVResource.php | 16 +- inc/caldav-MKCOL.php | 7 +- .../0557-iPhone-MKCALENDAR.result | 25 +++ .../0557-iPhone-MKCALENDAR.test | 38 ++++ .../0558-iPhone-PROPFIND.result | 180 ++++++++++++++++++ .../0558-iPhone-PROPFIND.test | 27 +++ .../0602-Soho-PROPFIND.result | 26 ++- .../0603-Soho-PROPFIND.result | 26 ++- .../0902-PUT-collection.result | 2 +- .../tests/regression-suite/0924-MOVE.result | 4 +- 10 files changed, 341 insertions(+), 10 deletions(-) create mode 100644 testing/tests/regression-suite/0557-iPhone-MKCALENDAR.result create mode 100644 testing/tests/regression-suite/0557-iPhone-MKCALENDAR.test create mode 100644 testing/tests/regression-suite/0558-iPhone-PROPFIND.result create mode 100644 testing/tests/regression-suite/0558-iPhone-PROPFIND.test diff --git a/inc/DAVResource.php b/inc/DAVResource.php index 1847585d..93e5cc8e 100644 --- a/inc/DAVResource.php +++ b/inc/DAVResource.php @@ -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; diff --git a/inc/caldav-MKCOL.php b/inc/caldav-MKCOL.php index a3f06ec9..3ae1dc48 100644 --- a/inc/caldav-MKCOL.php +++ b/inc/caldav-MKCOL.php @@ -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 */ diff --git a/testing/tests/regression-suite/0557-iPhone-MKCALENDAR.result b/testing/tests/regression-suite/0557-iPhone-MKCALENDAR.result new file mode 100644 index 00000000..f74faf47 --- /dev/null +++ b/testing/tests/regression-suite/0557-iPhone-MKCALENDAR.result @@ -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: > + +< + diff --git a/testing/tests/regression-suite/0557-iPhone-MKCALENDAR.test b/testing/tests/regression-suite/0557-iPhone-MKCALENDAR.test new file mode 100644 index 00000000..1e93120c --- /dev/null +++ b/testing/tests/regression-suite/0557-iPhone-MKCALENDAR.test @@ -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 + + + + + Untitled + #391B71A0 + + + + + + +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 + diff --git a/testing/tests/regression-suite/0558-iPhone-PROPFIND.result b/testing/tests/regression-suite/0558-iPhone-PROPFIND.result new file mode 100644 index 00000000..bd292414 --- /dev/null +++ b/testing/tests/regression-suite/0558-iPhone-PROPFIND.result @@ -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" + + + + + /caldav.php/user1/ + + + User 1 + + + + + + HTTP/1.1 200 OK + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/home/ + + + user1 home + + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/created/ + + + created + + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/.in/ + + + User 1 Inbox + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/.out/ + + + User 1 Outbox + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/6E20BB7C-EFD9-4F0F-9BDC-5335E04D47E0/ + + + iCal Calendar + + + + + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/ + + + Untitled + + + + + + + + + HTTP/1.1 200 OK + + + + /caldav.php/user1/calendar-proxy-read/ + + + /user1/calendar-proxy-read/ + + + + + + HTTP/1.1 200 OK + + + + + + HTTP/1.1 404 Not Found + + + + /caldav.php/user1/calendar-proxy-write/ + + + /user1/calendar-proxy-write/ + + + + + + HTTP/1.1 200 OK + + + + + + HTTP/1.1 404 Not Found + + + diff --git a/testing/tests/regression-suite/0558-iPhone-PROPFIND.test b/testing/tests/regression-suite/0558-iPhone-PROPFIND.test new file mode 100644 index 00000000..13cc7c8c --- /dev/null +++ b/testing/tests/regression-suite/0558-iPhone-PROPFIND.test @@ -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 + + + + + + + + +ENDDATA diff --git a/testing/tests/regression-suite/0602-Soho-PROPFIND.result b/testing/tests/regression-suite/0602-Soho-PROPFIND.result index 8b6ec173..0af03256 100644 --- a/testing/tests/regression-suite/0602-Soho-PROPFIND.result +++ b/testing/tests/regression-suite/0602-Soho-PROPFIND.result @@ -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" @@ -558,6 +558,28 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 404 Not Found + + /caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/ + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + /caldav.php/user1/calendar-proxy-read/ diff --git a/testing/tests/regression-suite/0603-Soho-PROPFIND.result b/testing/tests/regression-suite/0603-Soho-PROPFIND.result index e4855a55..99d79f02 100644 --- a/testing/tests/regression-suite/0603-Soho-PROPFIND.result +++ b/testing/tests/regression-suite/0603-Soho-PROPFIND.result @@ -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" @@ -140,6 +140,28 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 404 Not Found + + /caldav.php/user1/VTODO-EFD9-4F0F-9BDC-5335E04D47E0/ + + + + /caldav.php/user1/ + + + mailto:user1@example.net + /caldav.php/user1/ + + + HTTP/1.1 200 OK + + + + + + + HTTP/1.1 404 Not Found + + /caldav.php/user1/calendar-proxy-read/ diff --git a/testing/tests/regression-suite/0902-PUT-collection.result b/testing/tests/regression-suite/0902-PUT-collection.result index 76c248bf..2518ea37 100644 --- a/testing/tests/regression-suite/0902-PUT-collection.result +++ b/testing/tests/regression-suite/0902-PUT-collection.result @@ -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/< diff --git a/testing/tests/regression-suite/0924-MOVE.result b/testing/tests/regression-suite/0924-MOVE.result index 861b0c66..d95425a3 100644 --- a/testing/tests/regression-suite/0924-MOVE.result +++ b/testing/tests/regression-suite/0924-MOVE.result @@ -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<