Index: openacs-4/packages/acs-events/sql/oracle/acs-events-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/oracle/acs-events-create.sql,v diff -u -r1.10 -r1.10.6.1 --- openacs-4/packages/acs-events/sql/oracle/acs-events-create.sql 20 Apr 2005 11:48:56 -0000 1.10 +++ openacs-4/packages/acs-events/sql/oracle/acs-events-create.sql 30 Mar 2007 23:09:58 -0000 1.10.6.1 @@ -16,7 +16,7 @@ -- The event object begin acs_object_type.create_type ( - supertype => 'acs_object', + supertype =>g 'acs_object', object_type => 'acs_event', pretty_name => 'ACS Event', pretty_plural => 'ACS Events', @@ -445,7 +445,8 @@ procedure recurrence_timespan_edit ( event_id in acs_events.event_id%TYPE, start_date in time_intervals.start_date%TYPE, - end_date in time_intervals.end_date%TYPE + end_date in time_intervals.end_date%TYPE, + edit_past_events in char default 't' ); procedure activity_set ( @@ -729,7 +730,8 @@ procedure recurrence_timespan_edit ( event_id in acs_events.event_id%TYPE, start_date in time_intervals.start_date%TYPE, - end_date in time_intervals.end_date%TYPE + end_date in time_intervals.end_date%TYPE, + edit_past_events in char default 't' ) is v_timespan timespans%ROWTYPE; @@ -744,7 +746,8 @@ event_id= recurrence_timespan_edit.event_id; for v_timespan in - (select * from time_intervals where interval_id in (select interval_id from timespans where timespan_id in (select timespan_id from acs_events where recurrence_id = (select recurrence_id from acs_events where event_id = recurrence_timespan_edit.event_id)))) + (select * from time_intervals where interval_id in (select interval_id from timespans where timespan_id in (select timespan_id from acs_events where recurrence_id = (select recurrence_id from acs_events where event_id = recurrence_timespan_edit.event_id))) + and (edit_past_events = 't' or start_date >= to_date(recurrence_timespan_edit.start_date,'YYYY-MM-DD HH24:MI:SS') )) LOOP time_interval.edit(v_timespan.interval_id, v_timespan.start_date + (start_date - v_one_start_date), v_timespan.end_date + (end_date - v_one_end_date)); END LOOP; Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/acs-events/sql/oracle/upgrade/upgrade-0.6d1-0.6d2.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql,v diff -u -r1.14 -r1.14.2.1 --- openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql 8 Aug 2006 21:26:13 -0000 1.14 +++ openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql 30 Mar 2007 23:09:59 -0000 1.14.2.1 @@ -763,7 +763,6 @@ end;' language 'plpgsql'; - create or replace function acs_event__recurrence_timespan_edit ( integer, timestamptz, @@ -773,6 +772,25 @@ p_event_id alias for $1; p_start_date alias for $2; p_end_date alias for $3; +BEGIN + return acs_event__recurrence_timespan_edit ( + p_event_id, + p_start_date, + p_end_date, + ''t''); +END;' language 'plpgsql'; + +create or replace function acs_event__recurrence_timespan_edit ( + integer, + timestamptz, + timestamptz, + boolean +) returns integer as ' +DECLARE + p_event_id alias for $1; + p_start_date alias for $2; + p_end_date alias for $3; + p_edit_past_events_p alias for $4; v_timespan RECORD; v_one_start_date timestamptz; v_one_end_date timestamptz; @@ -787,7 +805,6 @@ where time_intervals.interval_id = timespans.interval_id and timespans.timespan_id = acs_events.timespan_id and event_id=p_event_id; - FOR v_timespan in select * from time_intervals @@ -797,6 +814,7 @@ from acs_events where recurrence_id = (select recurrence_id from acs_events where event_id = p_event_id))) + and (p_edit_past_events_p = ''t'' or start_date >= p_start_date) LOOP PERFORM time_interval__edit(v_timespan.interval_id, v_timespan.start_date + (p_start_date - v_one_start_date), Index: openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d1-0.6d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d1-0.6d2.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d1-0.6d2.sql 28 Mar 2007 19:43:25 -0000 1.1.2.1 +++ openacs-4/packages/acs-events/sql/postgresql/upgrade/upgrade-0.6d1-0.6d2.sql 30 Mar 2007 23:09:59 -0000 1.1.2.2 @@ -290,3 +290,68 @@ ); end;' language 'plpgsql'; + +-- Allow editing only future recurrences + +create or replace function acs_event__recurrence_timespan_edit ( + integer, + timestamptz, + timestamptz +) returns integer as ' +DECLARE + p_event_id alias for $1; + p_start_date alias for $2; + p_end_date alias for $3; +BEGIN + return acs_event__recurrence_timespan_edit ( + p_event_id, + p_start_date, + p_end_date, + ''t''); +END;' language 'plpgsql'; + +create or replace function acs_event__recurrence_timespan_edit ( + integer, + timestamptz, + timestamptz, + boolean +) returns integer as ' +DECLARE + p_event_id alias for $1; + p_start_date alias for $2; + p_end_date alias for $3; + p_edit_past_events_p alias for $4; + v_timespan RECORD; + v_one_start_date timestamptz; + v_one_end_date timestamptz; +BEGIN + -- get the initial offsets + select start_date, + end_date into v_one_start_date, + v_one_end_date + from time_intervals, + timespans, + acs_events + where time_intervals.interval_id = timespans.interval_id + and timespans.timespan_id = acs_events.timespan_id + and event_id=p_event_id; +raise notice ''DAVEB RECURRENCE edit_past_events_p = % start date = %'',p_edit_past_events_p,p_start_date; + FOR v_timespan in + select * + from time_intervals + where interval_id in (select interval_id + from timespans + where timespan_id in (select timespan_id + from acs_events + where recurrence_id = (select recurrence_id + from acs_events where event_id = p_event_id))) + and (p_edit_past_events_p = ''t'' or start_date >= p_start_date) + LOOP + PERFORM time_interval__edit(v_timespan.interval_id, + v_timespan.start_date + (p_start_date - v_one_start_date), + v_timespan.end_date + (p_end_date - v_one_end_date)); + END LOOP; + + return p_event_id; +END; +' language 'plpgsql';