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 -N -r1.42 -r1.43 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 9 Nov 2008 23:29:22 -0000 1.42 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 27 Oct 2014 16:39:32 -0000 1.43 @@ -11,27 +11,25 @@ } ad_proc dt_widget_week { - { - -calendar_details "" - -date "" - -large_calendar_p 1 - -master_bgcolor "" - -header_bgcolor "" - -header_text_color "white" - -header_text_size "+2" - -day_template {$day} - -day_header_size 2 - -day_header_bgcolor "#666666" - -calendar_width "100%" - -day_bgcolor "#DCDCDC" - -today_bgcolor "#FFF8DC" - -day_text_color "white" - -empty_bgcolor "white" - -next_week_template "" - -prev_week_template "" - -prev_next_links_in_title 0 - -fill_all_days 0 - } + {-calendar_details ""} + {-date ""} + {-large_calendar_p 1} + {-master_bgcolor ""} + {-header_bgcolor ""} + {-header_text_color "white"} + {-header_text_size "+2"} + {-day_template {$day}} + {-day_header_size 2} + {-day_header_bgcolor "#666666"} + {-calendar_width "100%"} + {-day_bgcolor "#DCDCDC"} + {-today_bgcolor "#FFF8DC"} + {-day_text_color "white"} + {-empty_bgcolor "white"} + {-next_week_template ""} + {-prev_week_template ""} + {-prev_next_links_in_title 0} + {-fill_all_days 0} } { Returns a calendar for a specific week, with details supplied by Julian date. Defaults to this week. @@ -49,7 +47,7 @@ set today_date [dt_sysdate] - if {[empty_string_p $date]} { + if {$date eq ""} { set date $today_date } @@ -59,7 +57,7 @@ db_1row select_week_info {} # Initialize the ns_set - if [empty_string_p $calendar_details] { + if {$calendar_details eq ""} { set calendar_details [ns_set create calendar_details] } @@ -145,40 +143,38 @@ ad_proc dt_widget_day { - { - -calendar_details "" - -date "" - -hour_template {$display_hour} - -start_hour {0} - -end_hour {23} - -show_nav 1 - -prev_nav_template {\"[_} - -next_nav_template {\"[_} - -master_bgcolor "black" - -header_bgcolor "black" - -header_text_color "white" - -header_text_size "+2" - -calendar_width "100%" - -day_bgcolor "#DDDDDD" - -today_bgcolor "yellow" - -day_text_color "white" - -empty_bgcolor "white" - -overlap_p 0 - } + {-calendar_details ""} + {-date ""} + {-hour_template {$display_hour}} + {-start_hour 0} + {-end_hour 23} + {-show_nav 1} + {-prev_nav_template {\"[_}} + {-next_nav_template {\"[_}} + {-master_bgcolor "black"} + {-header_bgcolor "black"} + {-header_text_color "white"} + {-header_text_size "+2"} + {-calendar_width "100%"} + {-day_bgcolor "#DDDDDD"} + {-today_bgcolor "yellow"} + {-day_text_color "white"} + {-empty_bgcolor "white"} + {-overlap_p 0} } { Returns a calendar for a specific day, with details supplied by hour. Defaults to today. } { - if {[empty_string_p $date]} { + if {$date eq ""} { set date [dt_sysdate] } set current_date $date # Initialize the ns_set - if [empty_string_p $calendar_details] { + if {$calendar_details eq ""} { set calendar_details [ns_set create calendar_details] } @@ -207,15 +203,15 @@ set item_val [ns_set value $calendar_details_2 $index] ns_set delete $calendar_details_2 $index # Count the num of events starting at this hour - set n_starting_events($hour) [expr $n_starting_events($hour) + 1] + set n_starting_events($hour) [expr {$n_starting_events($hour) + 1}] # Diff the hours set hours_diff [dt_hour_diff -start_time [lindex $item_val 0] -end_time [lindex $item_val 1]] # Count the num of events at the hours of operations for {set i 0} {$i <= $hours_diff} {incr i} { - set the_hour [expr $hour + $i] - set n_events($the_hour) [expr $n_events([expr $the_hour - $i]) + 1] + set the_hour [expr {$hour + $i}] + set n_events($the_hour) [expr {$n_events([expr {$the_hour - $i}]) + 1}] } } } @@ -275,7 +271,7 @@ for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { - set next_hour [expr $hour + 1] + set next_hour [expr {$hour + 1}] if {$hour < 10} { set index_hour "0$hour" @@ -285,7 +281,7 @@ # display stuff if {$hour >= 12} { - set ampm_hour [expr $hour - 12] + set ampm_hour [expr {$hour - 12}] set pm 1 } else { set ampm_hour $hour @@ -352,14 +348,14 @@ # HACK set colspan 1 set must_complete_p 1 - #set colspan [expr "$max_n_events - $n_events($hour) + 1"] + #set colspan [expr {$max_n_events - $n_events($hour) + 1}] } } { # Just make it one set colspan 1 } - append return_html "[lindex $one_item_val 2]" + append return_html "[lindex $one_item_val 2]" } else { append return_html "[ns_set value $calendar_details $index]
\n" } @@ -369,9 +365,9 @@ if {$n_processed_events == 0 || ($n_events($hour) < $max_n_events && $must_complete_p)} { if {$n_events($hour) == 0 || $n_events($hour) == $n_processed_events} { - append return_html " " + append return_html " " } else { - for {set i 0} {$i < [expr "$max_n_events - $n_events($hour)"]} {incr i} { + for {set i 0} {$i < $max_n_events - $n_events($hour)} {incr i} { append return_html " " } } @@ -412,21 +408,21 @@ } # The title - if {[empty_string_p $start_date] && [empty_string_p $end_date]} { + if {$start_date eq "" && $end_date eq ""} { #This used to be All Items but that was just taking up space and not adding value so now we assume All Items and only give a title if its something else. - Caroline@meekshome.com set title "" } - if {[empty_string_p $start_date] && ![empty_string_p $end_date]} { + if {$start_date eq "" && $end_date ne ""} { set $pretty_end_date [lc_time_fmt $end_date "%x"] set title "[_ acs-datetime.Items_until]" } - if {![empty_string_p $start_date] && [empty_string_p $end_date]} { + if {$start_date ne "" && $end_date eq ""} { set title "Items starting [util_AnsiDatetoPrettyDate $start_date]" } - if {![empty_string_p $start_date] && ![empty_string_p $end_date]} { + if {$start_date ne "" && $end_date ne ""} { set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]" } @@ -444,7 +440,7 @@ " - if {$real_order_by != "item_type"} { + if {$real_order_by ne "item_type"} { append return_html "" } @@ -473,8 +469,8 @@ } # Do we need a title? - if {$real_order_by == "item_type" && $item_type != "$old_item_type"} { - if {[empty_string_p $item_type]} { + if {$real_order_by eq "item_type" && $item_type != $old_item_type} { + if {$item_type eq ""} { set item_type_for_title "(No Item Type)" } else { set item_type_for_title $item_type @@ -485,7 +481,7 @@ set old_item_type $item_type - if {[expr $flip % 2] == 0} { + if {$flip % 2 == 0} { set z_class odd } else { set z_class even @@ -494,7 +490,7 @@ append return_html " " - if {$real_order_by != "item_type"} { + if {$real_order_by ne "item_type"} { append return_html "" } @@ -518,7 +514,7 @@ } { check if a time is midnight } { - if {$time == "00:00" || $time == ""} { + if {$time eq "00:00" || $time eq ""} { return 1 } @@ -568,9 +564,9 @@ set end_minutes [string range $end_time 3 4] # Special case when the hour is exact - if {[string compare $end_minutes "00"] == 0} { - return [expr "$end_hour - $start_hour - 1"] + if {$end_minutes eq "00" } { + return [expr {$end_hour - $start_hour - 1}] } else { - return [expr "$end_hour - $start_hour"] + return [expr {$end_hour - $start_hour}] } }
Day of WeekDateStart TimeEnd TimeType
$weekday$date$start_time$end_time$item_type