Index: openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs-oracle.xql,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 15 May 2002 22:34:57 -0000 1.10 +++ openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 25 Jul 2002 03:15:32 -0000 1.11 @@ -12,7 +12,11 @@ nvl(e.name, a.name) as name, nvl(e.description, a.description) as description, nvl(e.status_summary, a.status_summary) as status_summary, - e.event_id as item_id + e.event_id as item_id, + (select on_which_calendar from cal_items where cal_item_id = e.event_id) as calendar_id, + (select calendar_name from calendars + where calendar_id = (select on_which_calendar from cal_items where cal_item_id= e.event_id)) + as calendar_name from acs_activities a, acs_events e, timespans s, @@ -24,7 +28,7 @@ in ( select cal_item_id from cal_items - where on_which_calendar = :calendar_id + where on_which_calendar in ([join $calendar_id_list ","]) ) order by start_date,end_date @@ -55,7 +59,11 @@ nvl(e.name, a.name) as name, nvl(e.status_summary, a.status_summary) as status_summary, e.event_id as item_id, - (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + on_which_calendar as calendar_id, + (select calendar_name from calendars + where calendar_id = on_which_calendar) + as calendar_name from acs_activities a, acs_events e, timespans s, @@ -72,7 +80,7 @@ in ( select cal_item_id from cal_items - where on_which_calendar = :calendar_id + where on_which_calendar in ([join $calendar_id_list ","]) ) order by start_date @@ -88,7 +96,11 @@ nvl(e.name, a.name) as name, nvl(e.status_summary, a.status_summary) as status_summary, e.event_id as item_id, - (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + on_which_calendar as calendar_id, + (select calendar_name from calendars + where calendar_id = on_which_calendar) + as calendar_name from acs_activities a, acs_events e, timespans s, @@ -105,7 +117,7 @@ in ( select cal_item_id from cal_items - where on_which_calendar = :calendar_id + where on_which_calendar in ([join $calendar_id_list ","]) ) Index: openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs-postgresql.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql 8 Jul 2002 20:54:34 -0000 1.5 +++ openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql 25 Jul 2002 03:15:32 -0000 1.6 @@ -12,7 +12,11 @@ coalesce(e.name, a.name) as name, coalesce(e.description, a.description) as description, coalesce(e.status_summary, a.status_summary) as status_summary, - e.event_id as item_id + e.event_id as item_id, + (select on_which_calendar from cal_items where cal_item_id = e.event_id) as calendar_id, + (select calendar_name from calendars + where calendar_id = (select on_which_calendar from cal_items where cal_item_id= e.event_id)) + as calendar_name from acs_activities a, acs_events e, timespans s, @@ -24,7 +28,7 @@ in ( select cal_item_id from cal_items - where on_which_calendar = :calendar_id + where on_which_calendar in ([join $calendar_id_list ","]) ) order by start_date,end_date @@ -35,9 +39,9 @@ select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D') as day_of_the_week, - to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')- '1 week'::timespan, 'Sunday'), 'D') + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')- '1 week'::timespan, 'Sunday'), 'YYYY-MM-DD') as sunday_of_the_week, - to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'), 'D') + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'), 'YYYY-MM-DD') as saturday_of_the_week from dual @@ -54,7 +58,11 @@ coalesce(e.name, a.name) as name, coalesce(e.status_summary, a.status_summary) as status_summary, e.event_id as item_id, - (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + (select on_which_calendar from cal_items where cal_item_id = e.event_id) as calendar_id, + (select calendar_name from calendars + where calendar_id = (select on_which_calendar from cal_items where cal_item_id= e.event_id)) + as calendar_name from acs_activities a, acs_events e, timespans s, @@ -71,7 +79,7 @@ in ( select cal_item_id from cal_items - where on_which_calendar = :calendar_id + where on_which_calendar in ([join $calendar_id_list ","]) ) @@ -86,7 +94,11 @@ coalesce(e.name, a.name) as name, coalesce(e.status_summary, a.status_summary) as status_summary, e.event_id as item_id, - (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + on_which_calendar as calendar_id, + (select calendar_name from calendars + where calendar_id = on_which_calendar) + as calendar_name from acs_activities a, acs_events e, timespans s, @@ -103,7 +115,7 @@ in ( select cal_item_id from cal_items - where on_which_calendar = :calendar_id + where on_which_calendar in ([join $calendar_id_list ","]) ) Index: openacs-4/packages/calendar/tcl/calendar-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs.tcl,v diff -u -N -r1.24 -r1.25 --- openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 15 May 2002 23:37:49 -0000 1.24 +++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 25 Jul 2002 03:15:32 -0000 1.25 @@ -44,41 +44,49 @@ set items [ns_set create] - # Loop through calendars - foreach calendar_id $calendar_id_list { - set calendar_name [calendar_get_name $calendar_id] + + db_foreach select_monthly_items {} { + # Calendar name now set in query + # set calendar_name [calendar_get_name $calendar_id] + + # reset url stub + set url_stub "" - # In case we need to dispatch to a different URL (ben) - if {![empty_string_p $url_stub_callback]} { - set url_stub [$url_stub_callback $calendar_id] - } + # In case we need to dispatch to a different URL (ben) + if {![empty_string_p $url_stub_callback]} { + # Cache the stuff + if {![info exists url_stubs($calendar_id)]} { + set url_stubs($calendar_id) [$url_stub_callback $calendar_id] + } - db_foreach select_monthly_items {} { - set item "$name" - set item "[subst $item_template]" + set url_stub $url_stubs($calendar_id) + } + + set item "$name" + set item "[subst $item_template]" + + if {![dt_no_time_p -start_time $start_time -end_time $end_time]} { + set item "$start_time $item" + } + + if {$show_calendar_name_p} { + append item " ($calendar_name)" + } + + # DRB: This ugly hack was added for dotlrn-events, to give us a way to + # flag event status in red in accordance with the spec. When calendar + # is rewritten we should come up with a way for objects derived from + # acs-events to render their own name summary and full descriptions. + + if { [string length $status_summary] > 0 } { + append item " $status_summary " + } + + append item "
" + + ns_set put $items $start_date $item + } - if {![dt_no_time_p -start_time $start_time -end_time $end_time]} { - set item "$start_time $item" - } - - if {$show_calendar_name_p} { - append item " ($calendar_name)" - } - - # DRB: This ugly hack was added for dotlrn-events, to give us a way to - # flag event status in red in accordance with the spec. When calendar - # is rewritten we should come up with a way for objects derived from - # acs-events to render their own name summary and full descriptions. - - if { [string length $status_summary] > 0 } { - append item " $status_summary " - } - - append item "
" - - ns_set put $items $start_date $item - } - } # Display stuff if {[empty_string_p $item_add_template]} { @@ -140,39 +148,43 @@ db_1row select_weekday_info {} # Loop through the calendars - foreach calendar_id $calendar_id_list { - set calendar_name [calendar_get_name $calendar_id] + db_foreach select_week_items {} { + ns_log Notice "ONE WEEK ITEM" - # In case we need to dispatch to a different URL (ben) - if {![empty_string_p $url_stub_callback]} { - set url_stub [$url_stub_callback $calendar_id] - } + # now selected from the query + # set calendar_name [calendar_get_name $calendar_id] + + # In case we need to dispatch to a different URL (ben) + if {![empty_string_p $url_stub_callback]} { + # Cache the stuff + if {![info exists url_stubs($calendar_id)]} { + set url_stubs($calendar_id) [$url_stub_callback $calendar_id] + } - db_foreach select_week_items {} { - set item "$name" - set item_details "[subst $item_template]" - - # Add time details - if {[dt_no_time_p -start_time $start_date -end_time $end_date]} { - set time_details "" - } else { - set time_details "$pretty_start_date - $pretty_end_date:" - } - - set item "$time_details $item_details" - - if {$show_calendar_name_p} { - append item "($calendar_name)
" - } - - if { [string length $status_summary] > 0 } { - append item " $status_summary " - } - # ns_log Notice "CALENDAR-WEEK: one item $item" - - ns_set put $items $start_date_julian $item - } - + set url_stub $url_stubs($calendar_id) + } + + set item "$name" + set item_details "[subst $item_template]" + + # Add time details + if {[dt_no_time_p -start_time $start_date -end_time $end_date]} { + set time_details "" + } else { + set time_details "$pretty_start_date - $pretty_end_date:" + } + + set item "$time_details $item_details" + + if {$show_calendar_name_p} { + append item "($calendar_name)
" + } + + if { [string length $status_summary] > 0 } { + append item " $status_summary " + } + + ns_set put $items $start_date $item } # display stuff @@ -226,57 +238,59 @@ set items [ns_set create] # Loop through the calendars - foreach calendar_id $calendar_id_list { - set calendar_name [calendar_get_name $calendar_id] - # ns_log Notice "bma: one calendar $calendar_name" + db_foreach select_day_items {} { + # Not needed anymore + # set calendar_name [calendar_get_name $calendar_id] # In case we need to dispatch to a different URL (ben) if {![empty_string_p $url_stub_callback]} { - set url_stub [$url_stub_callback $calendar_id] - } + # Cache the stuff + if {![info exists url_stubs($calendar_id)]} { + set url_stubs($calendar_id) [$url_stub_callback $calendar_id] + } - db_foreach select_day_items {} { - set item_details "" - - if {$show_calendar_name_p} { - append item_details $calendar_name - } - - if {![empty_string_p $item_type]} { - if {![empty_string_p $item_details]} { - append item_details " - " - } - - append item_details "$item_type" - } - - set item $name - set item_subst [subst $item_template] - - if {[dt_no_time_p -start_time $pretty_start_date -end_time $pretty_end_date]} { - # Hack for no-time items - set item "$item_subst" - if {![empty_string_p $item_details]} { - append item " ($item_details)" - } - - set ns_set_pos "X" - } else { - set item "$pretty_start_date - $pretty_end_date: $item_subst" - if {![empty_string_p $item_details]} { - append item " ($item_details)" - } - set ns_set_pos $start_hour - } - - if { [string length $status_summary] > 0 } { - append item " $status_summary " - } - - # ns_log Notice "bma-calendar: adding $item at $start_hour" - ns_set put $items $ns_set_pos [list $start_date $end_date $item] + set url_stub $url_stubs($calendar_id) } + + set item_details "" + if {$show_calendar_name_p} { + append item_details $calendar_name + } + + if {![empty_string_p $item_type]} { + if {![empty_string_p $item_details]} { + append item_details " - " + } + + append item_details "$item_type" + } + + set item $name + set item_subst [subst $item_template] + + if {[dt_no_time_p -start_time $pretty_start_date -end_time $pretty_end_date]} { + # Hack for no-time items + set item "$item_subst" + if {![empty_string_p $item_details]} { + append item " ($item_details)" + } + + set ns_set_pos "X" + } else { + set item "$pretty_start_date - $pretty_end_date: $item_subst" + if {![empty_string_p $item_details]} { + append item " ($item_details)" + } + set ns_set_pos $start_hour + } + + if { [string length $status_summary] > 0 } { + append item " $status_summary " + } + + # ns_log Notice "bma-calendar: adding $item at $start_hour" + ns_set put $items $ns_set_pos [list $start_date $end_date $item] } set hour {$display_hour}