Index: openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 19 Jun 2002 19:14:30 -0000 1.28 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 22 Jul 2002 21:46:19 -0000 1.29 @@ -226,7 +226,7 @@ for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { if {$max_n_events < $n_events($hour)} { set max_n_events $n_events($hour) - #ns_log Notice "BMA-DEBUG-CAL: Setting max_n_events to $max_n_events" + ns_log Notice "BMA-DEBUG-CAL: Setting max_n_events to $max_n_events" } } @@ -358,9 +358,15 @@ } if {$n_processed_events == 0 || ($n_events($hour) < $max_n_events && $must_complete_p)} { - for {set i 0} {$i < [expr "$max_n_events - $n_events($hour)"]} {incr i} { - append return_html " " - } + if {$n_events($hour) == 0 || $n_events($hour) == $n_processed_events} { + append return_html " " + } else { + for {set i 0} {$i < [expr "$max_n_events - $n_events($hour)"]} {incr i} { + append return_html " " + } + } + + } append return_html "\n" Index: openacs-4/packages/acs-events/sql/postgresql/oracle-compat-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/oracle-compat-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-events/sql/postgresql/oracle-compat-create.sql 13 Jul 2001 02:48:51 -0000 1.1 +++ openacs-4/packages/acs-events/sql/postgresql/oracle-compat-create.sql 22 Jul 2002 21:46:19 -0000 1.2 @@ -78,14 +78,14 @@ integer, varchar ) -returns interval as ' +returns timespan as ' declare interval__number alias for $1; interval__units alias for $2; begin -- We should probably do unit checking at some point - return '''''''' || interval__number || '' '' || interval__units || '''''''' || ''::interval''; + return ('''''''' || interval__number || '' '' || interval__units || '''''''')::timespan; end;' language 'plpgsql'; Index: openacs-4/packages/calendar/calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/calendar.info,v diff -u -r1.11 -r1.12 --- openacs-4/packages/calendar/calendar.info 3 Jun 2002 04:08:17 -0000 1.11 +++ openacs-4/packages/calendar/calendar.info 22 Jul 2002 21:46:19 -0000 1.12 @@ -38,7 +38,9 @@ + + @@ -96,6 +98,7 @@ + @@ -133,6 +136,7 @@ + Index: openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql 18 Jun 2002 19:56:04 -0000 1.9 +++ openacs-4/packages/calendar/sql/postgresql/cal-item-create.sql 22 Jul 2002 21:46:19 -0000 1.10 @@ -194,12 +194,13 @@ RETURNS integer AS ' declare delete__recurrence_id alias for $1; - v_event_id integer; + v_event RECORD; begin - for v_event_id in (select event_id from acs_events - where recurrence_id= delete__recurrence_id) + for v_event in + select event_id from acs_events + where recurrence_id= delete__recurrence_id LOOP - PERFORM cal_item__delete(v_event_id); + PERFORM cal_item__delete(v_event.event_id); END LOOP; PERFORM recurrence__delete(delete__recurrence_id); Index: openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql 10 Jul 2002 14:58:25 -0000 1.3 +++ openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql 22 Jul 2002 21:46:19 -0000 1.4 @@ -10,6 +10,9 @@ cal_items.cal_item_id, 0 as n_attachments, to_char(start_date,'HH:MIpm')as start_time, + to_char(start_date,'D') as day_of_week, + to_char(start_date,'Day') as pretty_day_of_week, + to_char(start_date,'DD') as day_of_month, start_date as start_date, to_char(start_date, 'MM/DD/YYYY') as pretty_short_start_date, to_char(end_date, 'HH:MIpm') as end_time, @@ -44,6 +47,9 @@ cal_items.cal_item_id, (select count(*) from attachments where object_id = cal_item_id) as n_attachments, to_char(start_date,'HH:MIpm')as start_time, + to_char(start_date,'D') as day_of_week, + to_char(start_date,'Day') as pretty_day_of_week, + to_char(start_date,'DD') as day_of_month, start_date as start_date, to_char(start_date, 'MM/DD/YYYY') as pretty_short_start_date, to_char(end_date, 'HH:MIpm') as end_time, @@ -71,4 +77,23 @@ + + +begin + :1 := recurrence.new(interval_type => :interval_type, + every_nth_interval => :every_n, + days_of_week => :days_of_week, + recur_until => :recur_until); +end; + + + + + +begin + acs_event.insert_instances(event_id => :cal_item_id); +end; + + + Index: openacs-4/packages/calendar/tcl/cal-item-2-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar/tcl/cal-item-2-procs-postgresql.xql 6 Jul 2002 14:15:20 -0000 1.1 +++ openacs-4/packages/calendar/tcl/cal-item-2-procs-postgresql.xql 22 Jul 2002 21:46:19 -0000 1.2 @@ -9,6 +9,9 @@ i.cal_item_id, 0 as n_attachments, to_char(start_date,'HH:MIpm') as start_time, + to_char(start_date,'D') as day_of_week, + to_char(start_date,'Day') as pretty_day_of_week, + to_char(start_date,'DD') as day_of_month, to_char(start_date, 'YYYY-MM-DD HH:MI:SS') as start_date, to_char(start_date, 'MM/DD/YYYY') as pretty_short_start_date, to_char(end_date, 'HH:MIpm') as end_time, @@ -40,6 +43,9 @@ i.cal_item_id, (select count(*) from attachments where object_id = cal_item_id) as n_attachments, to_char(start_date,'HH:MIpm') as start_time, + to_char(start_date,'D') as day_of_week, + to_char(start_date,'Day') as pretty_day_of_week, + to_char(start_date,'DD') as day_of_month, to_char(start_date, 'YYYY-MM-DD HH:MI:SS') as start_date, to_char(start_date, 'MM/DD/YYYY') as pretty_short_start_date, to_char(end_date, 'HH:MIpm') as end_time, @@ -65,4 +71,20 @@ + + +select recurrence__new(:interval_type, + :every_n, + :days_of_week, + :recur_until, + NULL) + + + + + +select acs_event__insert_instances(:cal_item_id, NULL); + + + Index: openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl 2 Jul 2002 21:17:07 -0000 1.2 +++ openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl 22 Jul 2002 21:46:19 -0000 1.3 @@ -38,6 +38,32 @@ db_1row $query_name {} -column_array row } + ad_proc -public add_recurrence { + {-cal_item_id:required} + {-interval_type:required} + {-every_n:required} + {-days_of_week ""} + {-recur_until ""} + } { + Adds a recurrence for a calendar item + } { + # We do things in a transaction + db_transaction { + # Create the recurrence + set recurrence_id [db_exec_plsql create_recurrence {}] + + # Update the events table + db_dml update_event {} + + # Insert instances + db_exec_plsql insert_instances {} + + # Make sure they're all in the calendar! + db_dml insert_cal_items {} + } + } + + ad_proc -public edit { {-cal_item_id:required} {-start_date:required} Index: openacs-4/packages/calendar/tcl/cal-item-2-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/tcl/cal-item-2-procs.xql 22 Jul 2002 21:46:19 -0000 1.1 @@ -0,0 +1,27 @@ + + + + + + +update acs_events +set recurrence_id= :recurrence_id +where event_id= :cal_item_id + + + + + +insert into cal_items +(cal_item_id, on_which_calendar) +select +event_id, +(select on_which_calendar +as calendar_id from cal_items +where cal_item_id = :cal_item_id) +from acs_events where recurrence_id= :recurrence_id +and event_id <> :cal_item_id + + + + Index: openacs-4/packages/calendar/www/cal-item-create-recurrence-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-create-recurrence-2.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/calendar/www/cal-item-create-recurrence-2.tcl 15 Mar 2002 06:37:26 -0000 1.3 +++ openacs-4/packages/calendar/www/cal-item-create-recurrence-2.tcl 22 Jul 2002 21:46:19 -0000 1.4 @@ -21,6 +21,6 @@ ad_require_permission $cal_item_id cal_item_write # Set up the recurrence -calendar_item_add_recurrence -cal_item_id $cal_item_id -interval_type $interval_type -every_n $every_n -days_of_week $days_of_week -recur_until [calendar_make_datetime [array get recur_until]] +calendar::item::add_recurrence -cal_item_id $cal_item_id -interval_type $interval_type -every_n $every_n -days_of_week $days_of_week -recur_until [calendar_make_datetime [array get recur_until]] ad_returnredirect $return_url Index: openacs-4/packages/calendar/www/cal-item-create-recurrence.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-create-recurrence.adp,v diff -u -r1.7 -r1.8 --- openacs-4/packages/calendar/www/cal-item-create-recurrence.adp 11 Jul 2002 18:18:25 -0000 1.7 +++ openacs-4/packages/calendar/www/cal-item-create-recurrence.adp 22 Jul 2002 21:46:19 -0000 1.8 @@ -14,21 +14,21 @@ You are choosing to make this event recurrent, so that it appears more than once in your calendar. The event's details are:

-Date: @start_date@
-Time: @start_time@ - @end_time@
-Details: @description@ +Date: @cal_item.start_date@
+Time: @cal_item.start_time@ - @cal_item.end_time@
+Details: @cal_item.description@

- + Repeat every :
day (s)
<% foreach dow {{Sunday 0} {Monday 1} {Tuesday 2} {Wednesday 3} {Thursday 4} {Friday 5} {Saturday 6}} { - if {[lindex $dow 1] == [expr "$day_of_week -1"]} { + if {[lindex $dow 1] == [expr "$cal_item(day_of_week) -1"]} { set checked_html "CHECKED" } else { set checked_html "" @@ -39,8 +39,8 @@ %> of the week
day -@day_of_month@ of the month
- same @pretty_day_of_week@ of +@cal_item.day_of_month@ of the month
+ same @cal_item.pretty_day_of_week@ of the month
year
Repeat this event until: <%= [dt_widget_datetime -default [dt_systime] recur_until] %> Index: openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl 15 Mar 2002 06:37:26 -0000 1.3 +++ openacs-4/packages/calendar/www/cal-item-create-recurrence.tcl 22 Jul 2002 21:46:19 -0000 1.4 @@ -17,23 +17,7 @@ ad_require_permission $cal_item_id cal_item_write # Select basic information about the event -db_1row get_item_data { - select to_char(start_date,'HH24:MI')as start_time, - to_char(start_date, 'MM/DD/YYYY') as start_date, - to_char(end_date, 'HH24:MI') as end_time, - nvl(a. name, e.name) as name, - nvl(e.description, a.description) as description, - calendar_name, - to_char(start_date, 'D') as day_of_week, - to_char(start_date, 'Day') as pretty_day_of_week, - to_char(start_date, 'DD') as day_of_month - from acs_activities a, acs_events e, timespans s, time_intervals t, calendars c, cal_items ci - where e.timespan_id = s.timespan_id - and s.interval_id = t.interval_id - and e.activity_id = a.activity_id - and e.event_id = :cal_item_id - and ci.cal_item_id= :cal_item_id - and ci.on_which_calendar= c.calendar_id -} +calendar::item::get -cal_item_id $cal_item_id -array cal_item -# Select information about which day of the week it is, etc... +ad_return_template +