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.5 -r1.6 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 11 Feb 2002 06:07:23 -0000 1.5 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 11 Feb 2002 20:39:48 -0000 1.6 @@ -141,14 +141,14 @@ # Go through events while {1} { - set index [ns_set find $calendar_details ""] + set index [ns_set find $calendar_details "X"] if {$index == -1} { break } append return_html "[ns_set value $calendar_details $index]
\n" - ns_set delete $calendar_details "" + ns_set delete $calendar_details $index } for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 22 Jan 2002 05:15:39 -0000 1.1 +++ openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 11 Feb 2002 20:39:57 -0000 1.2 @@ -93,5 +93,32 @@ + + + + select to_char(start_date, 'HH24') as start_hour, + to_char(start_date, 'HH24:MI') as pretty_start_date, + to_char(end_date, 'HH24:MI') as pretty_end_date, + nvl(e.name, a.name) as name, + e.event_id as item_id +from acs_activities a, + acs_events e, + timespans s, + time_intervals t +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and start_date between + to_date(:current_date,:date_format) and + to_date(:current_date,:date_format) + (24 - 1/3600)/24 +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + ) + + + 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 -r1.3 -r1.4 --- openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 11 Feb 2002 06:07:39 -0000 1.3 +++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 11 Feb 2002 20:39:57 -0000 1.4 @@ -3,6 +3,9 @@ Utility functions for Displaying Calendar Things + NOTE: this needs some serious refactoring. This code is already refactored from Tcl scripts. + I'm working as fast as I can to fix this, but there is a LOT to fix (ben). + @author Ben Adida (ben@openforce) @creation-date Jan 21, 2002 @cvs-id $Id$ @@ -144,11 +147,19 @@ # ns_log Notice "bma: one calendar $calendar_name" db_foreach select_day_items {} { - set item "$pretty_start_date - $pretty_end_date: $name ($calendar_name)" + if {$pretty_start_date == "00:00" && $pretty_end_date == "00:00"} { + # Hack for no-time items + set item "$name ($calendar_name)" + set ns_set_pos "X" + } else { + set item "$pretty_start_date - $pretty_end_date: $name ($calendar_name)" + set ns_set_pos $start_hour + } + set item [subst $item_template] # ns_log Notice "bma-calendar: adding $item at $start_hour" - ns_set put $items $start_hour $item + ns_set put $items $ns_set_pos $item } } @@ -164,4 +175,70 @@ } + ad_proc -public list_display { + {-date ""} + {-calendar_id_list ""} + {-item_template {$item}} + } { + Creates a list widget + } { + if {[empty_string_p $date]} { + set date [dt_sysdate] + } + + set date_format "YYYY-MM-DD HH24:MI" + set current_date $date + + # If we were given no calendars, we assume we display the + # private calendar. It makes no sense for this to be called with + # no data whatsoever. + if {[empty_string_p $calendar_id_list]} { + set calendar_id_list [list [calendar_have_private_p -return_id 1 [ad_get_user_id]]] + } + + 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 {} { + # ns_log Notice "bma: one item" + set item "$pretty_start_date - $pretty_end_date: $name ($calendar_name)" + set item [subst $item_template] + + ns_set put $items $start_hour $item + } + + } + + set return_html "Items for [util_AnsiDatetoPrettyDate $date]:

" + + return $return_html + } + }