From c2794db775aa34ea4708f71bae02be4f715fc425 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 28 Oct 2007 18:19:14 +1300 Subject: [PATCH] Maxime Delorme suggested that we should do this differently now that the iCalendar class is more functional. I agree. --- inc/caldav-GET.php | 7 ++++++- inc/caldav-REPORT.php | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/inc/caldav-GET.php b/inc/caldav-GET.php index 9c3b4547..e2b1bb57 100644 --- a/inc/caldav-GET.php +++ b/inc/caldav-GET.php @@ -45,6 +45,10 @@ else if ( $qry->rows > 1 ) { */ include_once("iCalendar.php"); $response = iCalendar::iCalHeader(); + $collqry = new PgQuery( "SELECT * FROM collection WHERE collection.user_no = ? AND collection.dav_name = ?;", $request->user_no, $request->path); + if ( $collqry->Exec("GET") && $collection = $collqry->Fetch() ) { + $response .= "X-WR-CALNAME:$collection->dav_displayname\r\n"; + } $timezones = array(); while( $event = $qry->Fetch() ) { $ical = new iCalendar( array( "icalendar" => $event->caldav_data ) ); @@ -63,7 +67,8 @@ else if ( $qry->rows > 1 ) { } elseif ( $c->hide_alarm ) { // Otherwise we hide the alarms (if configured to) - $response .= $ical->Render( false, $event->caldav_type, $ical->DefaultPropertyList() ); + $ical->component->ClearComponents('VALARM'); + $response .= $ical->render(true, $event->caldav_type ); } else { $response .= $ical->Render( false, $event->caldav_type ); diff --git a/inc/caldav-REPORT.php b/inc/caldav-REPORT.php index e688cc76..02c7abd1 100644 --- a/inc/caldav-REPORT.php +++ b/inc/caldav-REPORT.php @@ -73,14 +73,15 @@ function calendar_to_xml( $properties, $item ) { 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 = new iCalendar( array( "icalendar" => $caldav_data) ); $ical->Put( 'SUMMARY', $displayname ); - $caldav_data = $ical->render(true, $item->caldav_type, $ical->DefaultPropertyList() ); + $caldav_data = $ical->render(true, $caldav_type, $ical->DefaultPropertyList() ); } 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() ); + $ical = new iCalendar( array( "icalendar" => $caldav_data) ); + $ical->component->ClearComponents('VALARM'); + $caldav_data = $ical->render(true, $caldav_type ); } } } @@ -90,7 +91,7 @@ function calendar_to_xml( $properties, $item ) { foreach( $properties AS $k => $v ) { switch( $k ) { case 'GETCONTENTLENGTH': - $contentlength = strlen($item->caldav_data); + $contentlength = strlen($caldav_data); $prop->NewElement("getcontentlength", $contentlength ); break; case 'CALENDAR-DATA':