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.42.6.1 -r1.42.6.2 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 5 Sep 2013 11:50:59 -0000 1.42.6.1 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 1 Oct 2013 08:36:53 -0000 1.42.6.2 @@ -49,7 +49,7 @@ set today_date [dt_sysdate] - if {[empty_string_p $date]} { + if {$date eq ""} { set date $today_date } @@ -59,7 +59,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] } @@ -171,14 +171,14 @@ } { - 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 +207,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 +275,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 +285,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 +352,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 +369,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 +412,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 +444,7 @@ " - if {$real_order_by != "item_type"} { + if {$real_order_by ne "item_type"} { append return_html "" } @@ -473,8 +473,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 @@ -494,7 +494,7 @@ append return_html " " - if {$real_order_by != "item_type"} { + if {$real_order_by ne "item_type"} { append return_html "" } @@ -518,7 +518,7 @@ } { check if a time is midnight } { - if {$time == "00:00" || $time == ""} { + if {$time eq "00:00" || $time eq ""} { return 1 } @@ -568,9 +568,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}] } } Index: openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl,v diff -u -r1.24.6.1 -r1.24.6.2 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 5 Sep 2013 11:38:46 -0000 1.24.6.1 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 1 Oct 2013 08:36:53 -0000 1.24.6.2 @@ -42,15 +42,15 @@ Julian date of the day, and the value is a string (possibly with HTML formatting) that represents the details. } { - if [empty_string_p $days_of_week] { + if {$days_of_week eq ""} { set days_of_week "[_ acs-datetime.days_of_week]" } dt_get_info $date set today_date [dt_sysdate] - if [empty_string_p $calendar_details] { + if {$calendar_details eq ""} { set calendar_details [ns_set create calendar_details] } @@ -61,12 +61,12 @@ set next_month_url "" set prev_month_url "" - if ![empty_string_p $prev_month_template] { + if {$prev_month_template ne ""} { set ansi_date [ns_urlencode $prev_month] set prev_month_url [subst $prev_month_template] } - if ![empty_string_p $next_month_template] { + if {$next_month_template ne ""} { set ansi_date [ns_urlencode $next_month] set next_month_url [subst $next_month_template] } @@ -234,7 +234,7 @@ } { Returns a small calendar for a specific month. Defaults to this month. } { - if [empty_string_p $days_of_week] { + if {$days_of_week eq ""} { set days_of_week "[_ acs-datetime.short_days_of_week]" } return [dt_widget_month \ @@ -282,7 +282,7 @@ Julian date. Defaults to this month. } { - if [empty_string_p $days_of_week] { + if {$days_of_week eq ""} { set days_of_week "[_ acs-datetime.short_days_of_week]" } set output "" @@ -338,7 +338,7 @@ return "[_ acs-datetime.lt_Width_must_be_]" } - if [empty_string_p $days_of_week] { + if {$days_of_week eq ""} { set days_of_week "[_ acs-datetime.short_days_of_week]" } @@ -391,7 +391,7 @@ Returns a calendar year of small calendars for the year of the passed in date. Defaults to this year. } { - if [empty_string_p $days_of_week] { + if {$days_of_week eq ""} { set days_of_week "[_ acs-datetime.short_days_of_week]" } @@ -632,24 +632,24 @@ # valid views are "list" "day" "week" "month" "year" - if {![exists_and_not_null base_url]} { + if {$base_url eq ""} { set base_url [ns_conn url] } - if {[exists_and_not_null pass_in_vars]} { + if {$pass_in_vars ne ""} { append base_url "?$pass_in_vars&" } else { append base_url "?" } - if {![exists_and_not_null date]} { + if {$date eq ""} { set date [dt_sysdate] } set list_of_vars [list] # Ben: some annoying stuff to do here since we are passing in things in GET format already - if {![empty_string_p $pass_in_vars]} { + if {$pass_in_vars ne ""} { set vars [split $pass_in_vars "&"] foreach var $vars { set things [split $var "="] @@ -662,13 +662,13 @@ dt_get_info $date set output " -
Day of WeekDateStart TimeEnd TimeType
$weekday$date$start_time$end_time$item_type
+
[dt_navbar_view $view $base_url $date] [dt_navbar_year $view $base_url $date]\n" - if [string equal $view month] { + if {$view eq "month"} { # month view append output " @@ -687,7 +687,7 @@ # show 3 months in a row - if {($i != 0) && ($i % 3 == 0)} { + if {$i != 0 && $i % 3 == 0} { append output "" } @@ -710,14 +710,14 @@ append output "" - } elseif [string equal $view year] { + } elseif {$view eq "year"} { # year view append output "
- +
\n" set now [clock scan $date] @@ -749,7 +749,7 @@
- +
" @@ -758,7 +758,7 @@ foreach day_of_week $days_of_week { append output "\n" } - append output "" + append output "" set day_of_week 1 set julian_date $first_julian_date @@ -799,7 +799,7 @@ " } elseif {$julian_date == $julian_date_today} { append output " - " } else { @@ -824,8 +824,8 @@ append today_url "$base_url" "view=day&date=[ns_urlencode [dt_sysdate]]" append output " -
$day_of_week


+ $day_number
- + @@ -834,12 +834,12 @@ -
+
- +
+
" - if { $view == "day" && [dt_sysdate] == $date } { + if { $view eq "day" && [dt_sysdate] == $date } { append output "Today" } else { append output " @@ -849,15 +849,15 @@ append output " is [dt_ansi_to_pretty]

-
+
-
Date as YYYYMMDD - +
Date as YYYYMMDD +
" foreach var $list_of_vars { - append output "" + append output "" } append output " @@ -907,7 +907,7 @@ } { # If no date was passed in, let's set it to today - if [empty_string_p $the_date] { + if {$the_date eq ""} { set the_date [dt_sysdate] } Index: openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl,v diff -u -r1.12 -r1.12.14.1 --- openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 1 Mar 2005 00:01:22 -0000 1.12 +++ openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 1 Oct 2013 08:36:53 -0000 1.12.14.1 @@ -32,7 +32,7 @@ } { Returns 1 if "time" is a valid time specification, 0 otherwise. } { - if [catch { clock scan $time }] { + if {[catch { clock scan $time }]} { return 0 } else { return 1 @@ -89,7 +89,7 @@ of an invalid ANSI date argument (year less than 4713 BCE, greater than 9999 CE, or equal to 0) } { - if [empty_string_p $era] { + if {$era eq ""} { set era CE } @@ -101,28 +101,28 @@ # 1582-10-04; 1582-10-15) set julian_date [dt_ansi_to_julian 1582 10 15 CE] } else { - if {$era == "BCE"} { + if {$era eq "BCE"} { set year [expr -$year + 1] } if {$month > 2} { set year_n $year - set month_n [expr $month + 1] + set month_n [expr {$month + 1}] } else { - set year_n [expr $year - 1] - set month_n [expr $month + 13] + set year_n [expr {$year - 1}] + set month_n [expr {$month + 13}] } - set julian_date [expr floor(floor(365.25 * $year_n) + floor(30.6001 * $month_n) + ($day + 1720995))] + set julian_date [expr {floor(floor(365.25 * $year_n) + floor(30.6001 * $month_n) + ($day + 1720995))}] # check for change to the Gregorian Calendar - set gregorian [expr 15 + 31 * (10 + 12 * 1582)] + set gregorian [expr {15 + 31 * (10 + 12 * 1582)}] if {$day + 31 * ($month + 12 * $year) >= $gregorian} { - set julian_date [expr $julian_date + (2 - floor(0.01 * $year_n) + floor(0.25 * floor(0.01 * $year_n)))] + set julian_date [expr {$julian_date + (2 - floor(0.01 * $year_n) + floor(0.25 * floor(0.01 * $year_n)))}] } } - return [expr int($julian_date)] + return [expr {int($julian_date)}] } ad_proc -public dt_julian_to_ansi { @@ -134,32 +134,32 @@ set gregorian 2299161 if {$julian_date >= $gregorian} { - set calc [expr floor((($julian_date - 1867216) - 0.25) / 36524.25)] - set calc [expr $julian_date + 1 + $calc - floor(0.25 * $calc)] + set calc [expr {floor((($julian_date - 1867216) - 0.25) / 36524.25)}] + set calc [expr {$julian_date + 1 + $calc - floor(0.25 * $calc)}] } else { set calc $julian_date } # get initial calculations to set year, month, day - set calc [expr $calc + 1524] - set calc2 [expr floor(6680 + (($calc - 2439870) - 122.1) / 365.25)] - set calc3 [expr floor($calc2 * 365.25)] - set calc4 [expr floor(($calc - $calc3) / 30.6001)] + set calc [expr {$calc + 1524}] + set calc2 [expr {floor(6680 + (($calc - 2439870) - 122.1) / 365.25)}] + set calc3 [expr {floor($calc2 * 365.25)}] + set calc4 [expr {floor(($calc - $calc3) / 30.6001)}] # set year, month, day - set year [expr floor($calc2 - 4715)] - set month [expr floor($calc4 - 1)] + set year [expr {floor($calc2 - 4715)}] + set month [expr {floor($calc4 - 1)}] if {$month > 12} { - set month [expr $month - 12] + set month [expr {$month - 12}] } if {$month > 2 || $year <= 0} { - set year [expr $year - 1] + set year [expr {$year - 1}] } - set day [expr floor($calc - $calc3 - floor($calc4 * 30.6001))] + set day [expr {floor($calc - $calc3 - floor($calc4 * 30.6001))}] - set year [expr int($year)] - set month [expr int($month)] - set day [expr int($day)] + set year [expr {int($year)}] + set month [expr {int($month)}] + set day [expr {int($day)}] if {$month < 10} { set month 0$month @@ -179,7 +179,7 @@ returns the current date based on server time. Works for both date and date-time strings. } { - if [empty_string_p $ansi_date] { + if {$ansi_date eq ""} { set ansi_date [dt_sysdate] } @@ -193,7 +193,7 @@ hour, minute, and second. Works for any date than can be parsed by clock scan. } { - if [empty_string_p $ansi_date] { + if {$ansi_date eq ""} { set ansi_date [dt_systime] } @@ -213,13 +213,13 @@ if {$month == 0} { set month 01 } elseif {$month == 12} { - set year [expr $year + 1] + set year [expr {$year + 1}] set month 01 } elseif {$month == 13} { - set year [expr $year + 1] + set year [expr {$year + 1}] set month 02 } else { - set month [expr $month + 1] + set month [expr {$month + 1}] } return [clock format [clock scan "last day" -base [clock scan $year-$month-01]] -format %d] @@ -242,10 +242,10 @@ Returns the ANSI date for the next month } { if {$month == 12} { - set year [expr $year + 1] + set year [expr {$year + 1}] set month 01 } else { - set month [expr $month + 1] + set month [expr {$month + 1}] } # jarkko: added this check to avoid calendars bombing when prev month goes @@ -263,10 +263,10 @@ Returns the ANSI date for the previous month } { if {$month == 1} { - set year [expr $year - 1] + set year [expr {$year - 1}] set month 12 } else { - set month [expr $month - 1] + set month [expr {$month - 1}] } # jarkko: added this check to avoid calendars bombing when prev month goes @@ -285,10 +285,10 @@ Returns the ANSI date for the next month } { if {$month == 12} { - set year [expr $year + 1] + set year [expr {$year + 1}] set month 01 } else { - set month [expr $month + 1] + set month [expr {$month + 1}] } # jarkko: added this check to avoid calendars bombing when next month goes @@ -308,10 +308,10 @@ Returns the ANSI date for the previous month } { if {$month == 1} { - set year [expr $year - 1] + set year [expr {$year - 1}] set month 12 } else { - set month [expr $month - 1] + set month [expr {$month - 1}] } # jarkko: added this check to avoid calendars bombing when prev month goes @@ -351,10 +351,10 @@ } { set to_precision [dt_precision $granularity] - set show_day [expr $to_precision < 1441] - set show_hours [expr $to_precision < 61] - set show_minutes [expr $to_precision < 60] - set show_seconds [expr $to_precision < 1] + set show_day [expr {$to_precision < 1441}] + set show_hours [expr {$to_precision < 61}] + set show_minutes [expr {$to_precision < 60}] + set show_seconds [expr {$to_precision < 1}] if {$to_precision == 0} { set to_precision 1 @@ -378,10 +378,10 @@ # the other values too... if {$to_precision < 60} { - set minutes [expr [dt_round_to_precision $minutes $to_precision] % 60] + set minutes [expr {[dt_round_to_precision $minutes $to_precision] % 60}] } - if {$default == "none"} { + if {$default eq "none"} { set year "" set month "" set day "" @@ -454,11 +454,11 @@ Returns a select widget for months of the year. } { set month_names [dt_month_names] - set default [expr $default-1] + set default [expr {$default-1}] set input "