diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php
index 145b793e..26dcdad8 100644
--- a/inc/caldav-REPORT.php
+++ b/inc/caldav-REPORT.php
@@ -59,58 +59,76 @@ function calendar_to_xml( $properties, $item ) {
dbg_error_log("REPORT","Building XML Response for item '%s'", $item->dav_name );
- $url = $c->protocol_server_port_script . $item->dav_name;
- $prop = new XMLElement("prop");
- if ( isset($properties['GETCONTENTLENGTH']) ) {
- $contentlength = strlen($item->caldav_data);
- $prop->NewElement("getcontentlength", $contentlength );
- }
- if ( isset($properties['CALENDAR-DATA']) ) {
+ $caldav_data = $item->caldav_data;
+ $displayname = $item->summary;
+ if ( isset($properties['CALENDAR-DATA']) || isset($properties['DISPLAYNAME']) ) {
if ( !is_numeric(strpos($item->permissions,'A')) && $session->user_no != $item->user_no ){
// the user is not admin / owner of this calendarlooking at his calendar and can not admin the other cal
if ( $item->class == 'CONFIDENTIAL' ) {
// if the event is confidential we fake one that just says "Busy"
+ $displayname = translate("Busy");
$ical = new iCalendar( array( "icalendar" => $item->caldav_data) );
- $ical->Put( 'SUMMARY', translate("Busy") );
+ $ical->Put( 'SUMMARY', $displayname );
$caldav_data = $ical->render(true, $item->caldav_type, $ical->DefaultPropertyList() );
- $prop->NewElement("calendar-data","$caldav_data" , array("xmlns" => "urn:ietf:params:xml:ns:caldav") );
}
elseif ( $c->hide_alarm ) {
// Otherwise we hide the alarms (if configured to)
$ical = new iCalendar( array( "icalendar" => $item->caldav_data) );
$caldav_data = $ical->render(true, $item->caldav_type, $ical->DefaultPropertyList() );
- $prop->NewElement("calendar-data","$caldav_data" , array("xmlns" => "urn:ietf:params:xml:ns:caldav") );
- }
- else {
- // Just send the raw event
- $prop->NewElement("calendar-data", $item->caldav_data, array("xmlns" => "urn:ietf:params:xml:ns:caldav") );
}
}
- else
- // Just send the raw event
- $prop->NewElement("calendar-data", $item->caldav_data, array("xmlns" => "urn:ietf:params:xml:ns:caldav") );
}
- if ( isset($properties['GETCONTENTTYPE']) ) {
- $prop->NewElement("getcontenttype", "text/calendar" );
- }
- if ( isset($properties['RESOURCETYPE']) ) {
- $prop->NewElement("resourcetype", new XMLElement("calendar", false, array("xmlns" => "urn:ietf:params:xml:ns:caldav")) );
- }
- if ( isset($properties['DISPLAYNAME']) ) {
- $prop->NewElement("displayname");
- }
- if ( isset($properties['GETETAG']) ) {
- $prop->NewElement("getetag", '"'.$item->dav_etag.'"' );
- }
- if ( isset($properties['CURRENT-USER-PRIVILEGE-SET']) ) {
- $prop->NewElement("current-user-privilege-set", privileges($request->permissions) );
+
+ $url = $c->protocol_server_port_script . $item->dav_name;
+ $prop = new XMLElement("prop");
+ foreach( $properties AS $k => $v ) {
+ switch( $k ) {
+ case 'GETCONTENTLENGTH':
+ $contentlength = strlen($item->caldav_data);
+ $prop->NewElement("getcontentlength", $contentlength );
+ break;
+ case 'CALENDAR-DATA':
+ $prop->NewElement("calendar-data","$caldav_data" , array("xmlns" => "urn:ietf:params:xml:ns:caldav") );
+ break;
+ case 'GETCONTENTTYPE':
+ $prop->NewElement("getcontenttype", "text/calendar" );
+ break;
+ case 'RESOURCETYPE':
+ $prop->NewElement("resourcetype", new XMLElement("calendar", false, array("xmlns" => "urn:ietf:params:xml:ns:caldav")) );
+ break;
+ case 'DISPLAYNAME':
+ $prop->NewElement("displayname", $displayname );
+ break;
+ case 'GETETAG':
+ $prop->NewElement("getetag", '"'.$item->dav_etag.'"' );
+ break;
+ case 'CURRENT-USER-PRIVILEGE-SET':
+ $prop->NewElement("current-user-privilege-set", privileges($request->permissions) );
+ break;
+ case 'SOME-DENIED-PROPERTY': /** TODO: indicating the style for future expansion */
+ $denied[] = $v;
+ break;
+ default:
+ dbg_error_log( 'REPORT', "Request for unsupported property '%s' of calendar item.", $v );
+ $unsupported[] = $v;
+ }
}
$status = new XMLElement("status", "HTTP/1.1 200 OK" );
$propstat = new XMLElement( "propstat", array( $prop, $status) );
$href = new XMLElement("href", $url );
+ $elements = array($href,$propstat);
- $response = new XMLElement( "response", array($href,$propstat));
+ if ( count($denied) > 0 ) {
+ $status = new XMLElement("status", "HTTP/1.1 403 Forbidden" );
+ $noprop = new XMLElement("prop");
+ foreach( $denied AS $k => $v ) {
+ $noprop->NewElement( strtolower($v) );
+ }
+ $elements[] = new XMLElement( "propstat", array( $noprop, $status) );
+ }
+
+ $response = new XMLElement( "response", $elements );
return $response;
}
diff --git a/testing/tests/regression-suite/230-Moz-REPORT-Tasks-Completed.result b/testing/tests/regression-suite/230-Moz-REPORT-Tasks-Completed.result
index ee3181b1..71abec17 100644
--- a/testing/tests/regression-suite/230-Moz-REPORT-Tasks-Completed.result
+++ b/testing/tests/regression-suite/230-Moz-REPORT-Tasks-Completed.result
@@ -1,6 +1,6 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
-ETag: "33afbc22a1752a395d24e4248bacbc6c"
+ETag: "8f48e613721a5ccb5e44c277f7a1a909"
Content-Length: 1630
Content-Type: text/xml; charset="utf-8"
@@ -10,6 +10,7 @@ Content-Type: text/xml; charset="utf-8"
http://myapms/calendar/caldav.php/user1/home/2178279a-aec2-471f-832d-1f6df6203f2f.ics
+ "509b0f0d8a3363379f9f5727f5dd74a0"
BEGIN:VCALENDAR
PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN
VERSION:2.0
@@ -25,7 +26,6 @@ DESCRIPTION:This task is incomplete and has not been cancelled (has no
END:VTODO
END:VCALENDAR
- "509b0f0d8a3363379f9f5727f5dd74a0"
HTTP/1.1 200 OK
@@ -34,6 +34,7 @@ END:VCALENDAR
http://myapms/calendar/caldav.php/user1/home/917b9e47-b748-4550-a566-657fbe672447.ics
+ "cb3d9dc3e8c157f53eba3ea0e1e0f146"
BEGIN:VCALENDAR
PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN
VERSION:2.0
@@ -51,7 +52,6 @@ DESCRIPTION:This task is in progress (50% complete) and has not been
END:VTODO
END:VCALENDAR
- "cb3d9dc3e8c157f53eba3ea0e1e0f146"
HTTP/1.1 200 OK
diff --git a/testing/tests/regression-suite/850-Spec-REPORT-1.result b/testing/tests/regression-suite/850-Spec-REPORT-1.result
index c491ae48..c7741cd1 100644
--- a/testing/tests/regression-suite/850-Spec-REPORT-1.result
+++ b/testing/tests/regression-suite/850-Spec-REPORT-1.result
@@ -1,6 +1,6 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
-ETag: "06d6c0c2aaf949e8b6d470d4e04521d4"
+ETag: "3140e532d35ae4918005eb9bf5fcc26b"
Content-Length: 1456
Content-Type: text/xml; charset="utf-8"
@@ -10,6 +10,7 @@ Content-Type: text/xml; charset="utf-8"
http://mycaldav/caldav.php/user1/home/20061101T073004Z.ics
+ "c3658901fd4689d4a1e1d6f08601ef4f"
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
@@ -51,7 +52,6 @@ END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
- "c3658901fd4689d4a1e1d6f08601ef4f"
HTTP/1.1 200 OK
diff --git a/testing/tests/regression-suite/851-Spec-REPORT-1.result b/testing/tests/regression-suite/851-Spec-REPORT-1.result
index 665a513a..65b824a8 100644
--- a/testing/tests/regression-suite/851-Spec-REPORT-1.result
+++ b/testing/tests/regression-suite/851-Spec-REPORT-1.result
@@ -1,6 +1,6 @@
HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
-ETag: "633dcc2b9b64b628d737e4bb25104d16"
+ETag: "8bb1ae7c599f81130860154adb77364b"
Content-Length: 5175
Content-Type: text/xml; charset="utf-8"
@@ -10,6 +10,7 @@ Content-Type: text/xml; charset="utf-8"
http://mycaldav/caldav.php/user1/home/3F4CF6227300FD062D9EF3CDFB30D32D-0.ics
+ "2c32a2f8aba853654eb17fe037a4db4d"
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//mulberrymail.com//Mulberry v4.0//EN
@@ -44,7 +45,6 @@ UID:5A55230C8866CA8D3D325F3A@CA1CBED546AAE36FF3BC722E
END:VEVENT
END:VCALENDAR
- "2c32a2f8aba853654eb17fe037a4db4d"
HTTP/1.1 200 OK
@@ -53,6 +53,7 @@ END:VCALENDAR
http://mycaldav/caldav.php/user1/home/20061101T073004Z.ics
+ "c3658901fd4689d4a1e1d6f08601ef4f"
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
@@ -94,7 +95,6 @@ END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
- "c3658901fd4689d4a1e1d6f08601ef4f"
HTTP/1.1 200 OK
@@ -103,6 +103,7 @@ END:VCALENDAR
http://mycaldav/caldav.php/user1/home/4aaf8f37-f232-4c8e-a72e-e171d4c4fe54.ics
+ "a1c6404d61190f9574e2bfd69383f144"
BEGIN:VCALENDAR
PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN
VERSION:2.0
@@ -140,7 +141,6 @@ END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
- "a1c6404d61190f9574e2bfd69383f144"
HTTP/1.1 200 OK
@@ -149,6 +149,7 @@ END:VCALENDAR
http://mycaldav/caldav.php/user1/home/1906b3ca-4890-468a-9b58-1de74bf2c716.ics
+ "5def8ae2b20893a1c7f4dbaeb008f2f1"
BEGIN:VCALENDAR
PRODID:-//Mozilla Calendar//NONSGML Sunbird//EN
VERSION:2.0
@@ -187,7 +188,6 @@ END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
- "5def8ae2b20893a1c7f4dbaeb008f2f1"
HTTP/1.1 200 OK