Index: openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql,v diff -u -r1.15 -r1.16 --- openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql 13 Aug 2003 16:08:33 -0000 1.15 +++ openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql 9 Jan 2004 22:55:52 -0000 1.16 @@ -2,9 +2,103 @@ postgresql7.1 + + + select CASE WHEN :start_date::timestamptz <= :end_date::timestamptz + THEN 1 + ELSE -1 + END + + - + + select + i.cal_item_id, + 0 as n_attachments, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as start_date_ansi, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as end_date_ansi, + coalesce(e.name, a.name) as name, + coalesce(e.description, a.description) as description, + recurrence_id, + i.item_type_id, + it.type as item_type, + on_which_calendar as calendar_id, + c.calendar_name, + o.creation_user + from + acs_events e join timespans s + on (e.timespan_id = s.timespan_id) + join time_intervals t + on (s.interval_id = t.interval_id) + join acs_activities a + on (e.activity_id = a.activity_id) + join cal_items i + on (e.event_id = i.cal_item_id) + left join cal_item_types it + on (it.item_type_id = i.item_type_id) + left join calendars c + on (c.calendar_id = i.on_which_calendar) + left join acs_objects o + on (o.object_id = i.cal_item_id) + where + e.event_id = :cal_item_id + + + + + + select + i.cal_item_id, + (select count(*) from attachments where object_id = cal_item_id) as n_attachments, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as start_date_ansi, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as end_date_ansi, + coalesce(a.name, e.name) as name, + coalesce(e.description, a.description) as description, + recurrence_id, + i.item_type_id, + it.type as item_type, + on_which_calendar as calendar_id, + c.calendar_name, + o.creation_user + from + acs_events e join timespans s + on (e.timespan_id = s.timespan_id) + join time_intervals t + on (s.interval_id = t.interval_id) + join acs_activities a + on (e.activity_id = a.activity_id) + join cal_items i + on (e.event_id = i.cal_item_id) + left join cal_item_types it + on (it.item_type_id = i.item_type_id) + left join calendars c + on (c.calendar_id = i.on_which_calendar) + left join acs_objects o + on (o.object_id = i.cal_item_id) + where + e.event_id = :cal_item_id + + + + + +select recurrence__new(:interval_type, + :every_n, + :days_of_week, + :recur_until, + NULL) + + + + + +select acs_event__insert_instances(:cal_item_id, NULL); + + + + + select acs_activity__new ( null, :name, @@ -22,7 +116,7 @@ - + select timespan__new ( :start_date::timestamptz, @@ -33,11 +127,11 @@ - + select cal_item__new ( null, - :on_which_calendar, + :calendar_id, null, null, null, @@ -46,7 +140,7 @@ :activity_id, null, 'cal_item', - :on_which_calendar, + :calendar_id, now(), :creation_user, :creation_ip @@ -56,28 +150,28 @@ - + - select time_interval__edit ( - :interval_id, - :start_date::timestamptz, - :end_date::timestamptz + select cal_item__delete ( + :cal_item_id ) - - + - select cal_item__delete ( - :cal_item_id + select time_interval__edit ( + :interval_id, + :start_date::timestamptz, + :end_date::timestamptz ) - + + select cal_item__delete_all ( :recurrence_id @@ -86,7 +180,7 @@ - + select acs_event__recurrence_timespan_edit ( @@ -96,5 +190,5 @@ ) - +