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.11 -r1.12 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 18 Mar 2002 03:23:53 -0000 1.11 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 29 Mar 2002 20:08:43 -0000 1.12 @@ -97,6 +97,7 @@ -today_bgcolor "#DDDDDD" -day_text_color "white" -empty_bgcolor "white" + -overlap_p 0 } } { Returns a calendar for a specific day, with details supplied by @@ -118,16 +119,46 @@ # Select some basic stuff db_1row select_day_info {} - # Loop through the hours of the day - set return_html "
-\n" + set return_html "" if {$show_nav} { - append return_html "\n" + append return_html "
<     $day_of_the_week     >
<     $day_of_the_week     >

\n" } + # Loop through the hours of the day + append return_html "
+ \n" + + # The items that have no hour + set hour "" + set next_hour "" + set start_time "" + set display_hour "No Time" + append return_html "" + if {[ns_set find $calendar_details ""] != -1} { + append return_html "" + append return_html "" - if {[ns_set find $calendar_details $index_hour] != -1} { - append return_html "" + } else { + append return_html "[ns_set value $calendar_details $index]
\n" + } + ns_set delete $calendar_details $index } - append return_html "\n" + append return_html "\n" } append return_html "
 [subst $hour_template]" + } + + # Go through events + while {1} { + set index [ns_set find $calendar_details "X"] + if {$index == -1} { + break + } + + if {$overlap_p} { + append return_html "[lindex [ns_set value $calendar_details $index] 2]" + } else { + append return_html "[ns_set value $calendar_details $index]
\n" + } + + ns_set delete $calendar_details $index + } + for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { + set next_hour [expr $hour + 1] + if {$hour < 10} { set index_hour "0$hour" } else { @@ -162,27 +193,39 @@ } set display_hour [subst $hour_template] - append return_html "
$display_hour
 $display_hour" - } else { - append return_html "" - } - # Go through events while {1} { set index [ns_set find $calendar_details $index_hour] if {$index == -1} { break } - append return_html "[ns_set value $calendar_details $index]
\n" + if {$overlap_p} { + set one_item_val [ns_set value $calendar_details $index] + + # One ugly hack + set end_time_lst [split [lindex $one_item_val 1] ":"] + if {[string range [lindex $end_time_lst 1] 0 1] == "00"} { + set end_time [expr [string trimleft [lindex $end_time_lst 0] 0] - 1] + } else { + set end_time [lindex $end_time_lst 0] + } + + ns_log Notice "$end_time_lst / $end_time / $start_time" + + set start_time $hour + append return_html "
[lindex $one_item_val 2]
"