By default calendar items are PUBLIC.

This commit is contained in:
Andrew Ruthven 2007-10-26 09:41:18 +13:00 committed by Andrew Ruthven
parent 613fcb4417
commit 06431170c8
2 changed files with 27 additions and 6 deletions

View File

@ -1,13 +1,13 @@
-- Adding a primary key to the calendar_item table
-- Make sure that class is set to something, by default PUBLIC.
-- According to RFC2445, 4.8.1.3.
BEGIN;
SELECT check_db_revision(1,1,8);
ALTER TABLE calendar_item ADD PRIMARY KEY (user_no, dav_name );
UPDATE calendar_item SET class = 'PUBLIC' WHERE class IS NULL;
SELECT new_db_revision(1,1,9, 'September' );
SELECT new_db_revision(1,1,9, 'October' );
COMMIT;
ROLLBACK;
VACUUM FULL ANALYZE;

View File

@ -185,6 +185,16 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) {
$dtstamp = $last_modified;
}
/*
* It seems that some calendar clients don't set a class...
* RFC2445, 4.8.1.3:
* Default is PUBLIC
*/
$class = $ic->Get("class");
if ( !isset($class) || $class == '' ) {
$class = 'PUBLIC'
}
$sql .= <<<EOSQL
INSERT INTO calendar_item (user_no, dav_name, dav_etag, uid, dtstamp, dtstart, dtend, summary, location, class, transp,
description, rrule, tz_id, last_modified, url, priority, created, due, percent_complete )
@ -193,7 +203,7 @@ EOSQL;
$qry = new PgQuery( $sql, $user_no, $event_path, $etag, $ic->Get('uid'), $dtstamp,
$ic->Get('dtstart'), $ic->Get('summary'), $ic->Get('location'),
$ic->Get('class'), $ic->Get('transp'), $ic->Get('description'), $ic->Get('rrule'), $ic->Get('tz_id'),
$class, $ic->Get('transp'), $ic->Get('description'), $ic->Get('rrule'), $ic->Get('tz_id'),
$last_modified, $ic->Get('url'), $ic->Get('priority'), $ic->Get('created'),
$ic->Get('due'), $ic->Get('percent-complete')
);
@ -315,6 +325,17 @@ function putCalendarResource( &$request, $author, $caldav_context ) {
$dtstamp = $last_modified;
}
/*
* It seems that some calendar clients don't set a class...
* RFC2445, 4.8.1.3:
* Default is PUBLIC
*/
$class = $ic->Get("class");
if ( !isset($class) || $class == '' ) {
$class = 'PUBLIC'
}
if ( $put_action_type != 'INSERT' ) {
$sql .= "DELETE FROM calendar_item WHERE user_no=$request->user_no AND dav_name=".qpg($request->path).";";
}
@ -327,7 +348,7 @@ EOSQL;
$qry = new PgQuery( $sql, $request->user_no, $request->path, $etag, $ic->Get('UID'), $dtstamp,
$ic->Get('DTSTART'), $ic->Get('SUMMARY'), $ic->Get('LOCATION'),
$ic->Get('CLASS'), $ic->Get('TRANSP'), $ic->Get('DESCRIPTION'), $ic->Get('RRULE'), $ic->Get('TZ_ID'),
$class, $ic->Get('TRANSP'), $ic->Get('DESCRIPTION'), $ic->Get('RRULE'), $ic->Get('TZ_ID'),
$last_modified, $ic->Get('URL'), $ic->Get('PRIORITY'), $ic->Get('CREATED'),
$ic->Get('DUE'), $ic->Get('PERCENT-COMPLETE'), $ic->Get('STATUS')
);