Tweaks to MKCALENDAR to make it work with iCal.

This commit is contained in:
Andrew McMillan 2007-11-24 21:34:29 +13:00
parent a293bac9bb
commit 114b4a1f26
3 changed files with 54 additions and 7 deletions

View File

@ -49,16 +49,26 @@ if ( isset($request->xml_tags) ) {
case 'DAV::DISPLAYNAME':
$displayname = $content;
dbg_error_log( "MKCALENDAR", "Displayname is '/' to '%s'", $request->path);
$parent_container = $request->path;
$request->path .= $content . '/';
/**
* TODO: This is definitely a bug in SOHO Organizer and we probably should respond
* with an error, rather than silently doing what they *seem* to want us to do.
*/
if ( preg_match( '/ SOHO Organizer\/6\./', $_SERVER['HTTP_USER_AGENT'] ) ) {
dbg_error_log( "MKCALENDAR", "Displayname is '/' to '%s'", $request->path);
$parent_container = $request->path;
$request->path .= $content . '/';
}
$success[$tag] = 1;
break;
case 'DAV::RESOURCETYPE':
/**
* Any value for resourcetype is ignored
*/
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-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 */
case 'URN:IETF:PARAMS:XML:NS:CALDAV:MIN-DATE-TIME': /** Ignored, since we will support arbitrary time */
case 'URN:IETF:PARAMS:XML:NS:CALDAV:MAX-DATE-TIME': /** Ignored, since we will support arbitrary time */
case 'URN:IETF:PARAMS:XML:NS:CALDAV:MAX-INSTANCES': /** Ignored, since we will support arbitrary instances */
case 'DAV::RESOURCETYPE': /** Any value for resourcetype is ignored */
$success[$tag] = 1;
break;

View File

@ -0,0 +1,8 @@
HTTP/1.1 201 Created
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, access-control, calendar-access
Cache-Control: no-cache
Content-Length: 0
Content-Type: text/plain; charset="utf-8"
10 --- /user1/ --- Untitled --- 1 --- 0

View File

@ -0,0 +1,29 @@
#
# MKCALENDAR test for iCal
#
TYPE=MKCALENDAR
URL=http://mycaldav/caldav.php/user1/6E20BB7C-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>#492BA1FF</x2:calendar-color>
</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/6E20BB7C-EFD9-4F0F-9BDC-5335E04D47E0/';
ENDQUERY