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.10 -r1.11 --- openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 18 Mar 2002 03:23:53 -0000 1.10 +++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 29 Mar 2002 20:08:31 -0000 1.11 @@ -2,7 +2,10 @@ ad_library { 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$ @@ -184,13 +187,82 @@ set hour {$display_hour} set start_time {$hour} + set end_time {$next_hour} set hour_template [subst $hour_template] return [dt_widget_day -hour_template $hour_template \ -start_hour $widget_start_hour -end_hour $widget_end_hour \ - -calendar_details $items -date $date] + -calendar_details $items -date $date -overlap_p 1] } + 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 + } + + + }