Index: openacs-4/packages/calendar/www/view-one-day-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-one-day-display.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/calendar/www/view-one-day-display.tcl 5 Nov 2003 18:02:49 -0000 1.22 +++ openacs-4/packages/calendar/www/view-one-day-display.tcl 11 Dec 2003 21:39:59 -0000 1.23 @@ -38,11 +38,7 @@ set base_url "" } -set current_date $date -if { [info exists start_display_hour]} { - set current_date_system "$current_date $start_display_hour:00:00" -} else { - set current_date_system "$current_date 00:00:00" +if { ![info exists start_display_hour]} { set start_display_hour 0 } @@ -53,12 +49,17 @@ if {[exists_and_not_null calendar_id_list]} { set calendars_clause "and on_which_calendar in ([join $calendar_id_list ","]) and (cals.private_p='f' or (cals.private_p='t' and cals.owner_id= :user_id))" } else { - set calendars_clause "and ((cals.package_id= :package_id and cals.private_p='f') or (cals.private_p='t' and cals.owner_id= :user_id))" + set calendars_clause { + and ((cals.package_id = :package_id and cals.private_p = 'f') + or (cals.private_p = 't' and cals.owner_id = :user_id)) + } } # The database needs this for proper formatting. set ansi_date_format "YYYY-MM-DD HH24:MI:SS" +set current_date $date +set current_date_system "$date 00:00:00" if {[empty_string_p $date]} { # Default to todays date in the users (the connection) timezone set server_now_time [dt_systime] @@ -119,13 +120,20 @@ set start_time [lc_time_fmt $ansi_start_date "%X"] set end_time [lc_time_fmt $ansi_end_date "%X"] + regexp {([1-9][0-9]*)} $start_hour match start_hour_no + regexp {([1-9][0-9]*)} $end_hour match end_hour_no + for { set item_current_hour $start_hour } { $item_current_hour < $end_hour } { incr item_current_hour } { set item_current_hour [expr [string trimleft $item_current_hour 0]+0] - if {$start_hour == $item_current_hour && $start_hour >= $start_display_hour } { - lappend day_items_per_hour [list $item_current_hour $name $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time] - } elseif { $end_hour <= $end_display_hour } { - lappend day_items_per_hour [list $item_current_hour "" $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time] - } + + if { $start_hour_no == $item_current_hour } { + + lappend day_items_per_hour \ + [list $item_current_hour $name $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time] + } else { + lappend day_items_per_hour \ + [list $item_current_hour {} $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time] + } incr items_per_hour($item_current_hour) } } @@ -145,14 +153,17 @@ set item_start_hour [expr [string trimleft [lindex $this_item 5] 0]+0] set item_end_hour [expr [string trimleft [lindex $this_item 6] 0]+0] set rowspan [expr $item_end_hour - $item_start_hour] - if {$item_start_hour > $day_current_hour} { + + if {$item_start_hour > $day_current_hour && \ + $item_start_hour >= $start_display_hour && $item_end_hour <= $end_display_hour} { # need to add dummy entries to show all hours for { } { $day_current_hour < $item_start_hour } { incr day_current_hour } { set localized_day_current_hour [lc_time_fmt "$current_date $day_current_hour:00:00" "%X"] - multirow append day_items_with_time "[subst $hour_template]" $day_current_hour $localized_day_current_hour "" "" "" "" "" "" "" "" 0 0 "" + multirow append day_items_with_time [subst $hour_template] $day_current_hour $localized_day_current_hour "" "" "" "" "" "" "" "" 0 0 "" } } + set day_current_hour [lindex $this_item 0] set localized_day_current_hour [lc_time_fmt "$current_date $day_current_hour:00:00" "%X"] # reset url stub @@ -171,11 +182,17 @@ set end_time [lindex $this_item 8] set item [lindex $this_item 1] + set item_id [lindex $this_item 2] set full_item [subst $item_template] - set current_hour_link "[subst $hour_template]" + set current_hour_link [subst $hour_template] - multirow append day_items_with_time $current_hour_link $day_current_hour $localized_day_current_hour [lindex $this_item 1] [lindex $this_item 2] [lindex $this_item 3] [lindex $this_item 4] [lindex $this_item 5] [lindex $this_item 6] [lindex $this_item 7] [lindex $this_item 8] 0 $rowspan $full_item + multirow append day_items_with_time \ + $current_hour_link $day_current_hour $localized_day_current_hour \ + [lindex $this_item 1] [lindex $this_item 2] [lindex $this_item 3] \ + [lindex $this_item 4] [lindex $this_item 5] [lindex $this_item 6] \ + [lindex $this_item 7] [lindex $this_item 8] 0 $rowspan $full_item + set day_current_hour [expr [lindex $this_item 0] +1 ] }