Make puck's patches for PUBLIC events actually work.

This commit is contained in:
Andrew McMillan 2007-10-27 00:11:44 +13:00
parent ff55979bfd
commit 04656674f7
3 changed files with 13 additions and 11 deletions

View File

@ -10,8 +10,9 @@ UPDATE calendar_item SET class = 'PUBLIC' WHERE class IS NULL;
-- Allow forcing all events in a calendar to be public
ALTER TABLE collection ADD COLUMN public_events_only BOOLEAN;
UPDATE collection SET public_events_only = FALSE;
ALTER TABLE collection ALTER public_events_only SET NOT NULL;
ALTER TABLE collection ALTER public_events_only SET DEFAULT 'f';
ALTER TABLE collection ALTER public_events_only SET DEFAULT FALSE;
SELECT new_db_revision(1,1,10, 'October' );
COMMIT;

View File

@ -77,6 +77,7 @@ CREATE TABLE collection (
is_calendar BOOLEAN,
created TIMESTAMP WITH TIME ZONE,
modified TIMESTAMP WITH TIME ZONE,
public_events_only BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY ( user_no, dav_name )
);
@ -141,4 +142,4 @@ CREATE TABLE freebusy_ticket (
GRANT INSERT,SELECT,UPDATE,DELETE ON TABLE freebusy_ticket TO general;
SELECT new_db_revision(1,1,9, 'September' );
SELECT new_db_revision(1,1,10, 'October' );

View File

@ -92,11 +92,11 @@ function controlRequestContainer( $username, $user_no, $path, $caldav_context )
function public_events_only( $user_no, $dav_name ) {
$sql = "SELECT public_events_only ";
$sql .= "FROM collection ";
$sql .= "WHERE user_no=? AND dav_name=?");
$sql .= "WHERE user_no=? AND dav_name=?";
$qry = new PgQuery($sql);
$qry = new PgQuery($sql, $user_no, $dav_name);
if( $qry->Exec($user_no, $dav_name) && $qry->rows == 1 ) {
if( $qry->Exec('PUT') && $qry->rows == 1 ) {
$collection = $qry->Fetch();
if ($collection->public_events_only == 't') {
@ -215,14 +215,14 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) {
if ( public_events_only($user_no, $path) ) {
$class = 'PUBLIC';
}
/*
* It seems that some calendar clients don't set a class...
* RFC2445, 4.8.1.3:
* Default is PUBLIC
*/
*/
if ( !isset($class) || $class == '' ) {
$class = 'PUBLIC'
$class = 'PUBLIC';
}
$sql .= <<<EOSQL
@ -360,14 +360,14 @@ function putCalendarResource( &$request, $author, $caldav_context ) {
if ( public_events_only($user_no, $path) ) {
$class = 'PUBLIC';
}
/*
* It seems that some calendar clients don't set a class...
* RFC2445, 4.8.1.3:
* Default is PUBLIC
*/
*/
if ( !isset($class) || $class == '' ) {
$class = 'PUBLIC'
$class = 'PUBLIC';
}