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.15 -r1.16 --- openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 28 Jun 2018 15:42:46 -0000 1.15 +++ openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 28 Jun 2018 15:44:56 -0000 1.16 @@ -27,15 +27,15 @@ return [clock format [clock seconds] -format $format] } -ad_proc -public dt_valid_time_p { - time +ad_proc -public dt_valid_time_p { + time } { @return 1 if "time" is a valid time specification, 0 otherwise. } { if {[catch { clock scan $time }]} { - return 0 + return 0 } else { - return 1 + return 1 } } @@ -45,9 +45,9 @@ time } { This proc should not be used, because it does not take internationalization into account. Use lc_time_fmt instead. - + @see lc_time_fmt -} { +} { return [clock format [clock scan $time] -format $format -gmt $gmt] } @@ -182,7 +182,7 @@ date and date-time strings. } { if {$ansi_date eq ""} { - set ansi_date [dt_sysdate] + set ansi_date [dt_sysdate] } return [lc_time_fmt $ansi_date "%x"] @@ -193,16 +193,16 @@ } { Parses the given ansi_date string into a list of year, month, day, hour, minute, and second. Works for any date than can be parsed - by clock scan. + by clock scan. } { if {$ansi_date eq ""} { - set ansi_date [dt_systime] + set ansi_date [dt_systime] } - foreach item [split [clock format [clock scan $ansi_date] -format "%Y %m %d %H %M %S"] " "] { - lappend date_info [util::trim_leading_zeros $item] + foreach item [split [clock format [clock scan $ansi_date] -format "%Y %m %d %H %M %S"] " "] { + lappend date_info [util::trim_leading_zeros $item] } - + return $date_info } @@ -253,7 +253,7 @@ # jarkko: added this check to avoid calendars bombing when prev month goes # beyond borders if {[catch {set next_month [clock format [clock scan $year-$month-01] -format %Y-%m-%d]} err]} { - return "" + return "" } return $next_month } @@ -274,7 +274,7 @@ # jarkko: added this check to avoid calendars bombing when prev month goes # beyond borders if {[catch {set prev_month [clock format [clock scan $year-$month-01] -format %Y-%m-%d]} err]} { - return "" + return "" } return $prev_month @@ -296,7 +296,7 @@ # jarkko: added this check to avoid calendars bombing when next month goes # beyond borders if {[catch {set next_name [clock format [clock scan $year-$month-01] -format %B]} err]} { - return "" + return "" } return [lc_time_fmt [clock_to_ansi [clock scan $year-$month-01]] "%B"] @@ -320,16 +320,16 @@ # beyond borders if {[catch {set prev_name [clock format [clock scan $year-$month-01] -format %B]} err]} { - return "" + return "" } return [lc_time_fmt [clock_to_ansi [clock scan $year-$month-01]] "%B"] } -ad_proc -public dt_widget_datetime { +ad_proc -public dt_widget_datetime { {-show_date 1} {-date_time_sep " "} - {-use_am_pm 0} + {-use_am_pm 0} {-default none} name {granularity days} @@ -338,7 +338,7 @@ @return an HTML form fragment for collecting date-time information with names "$name.year", "$name.month", "$name.day", "$name.hours", "$name.minutes", "$name.seconds", and "$name.ampm". - These will be numeric ("ampm" is 0 for am, 1 for pm) + These will be numeric ("ampm" is 0 for am, 1 for pm) Default specifies what should be set as the current time in the form. Valid defaults are "none", "now", or any valid date string @@ -351,7 +351,7 @@ All HTML widgets will be output *unless* show_date is 0; they will be hidden if not needed to satisfy the current granularity - level. Values default to 1 for MM/DD and 0 for HH/MI/SS/AM if not + level. Values default to 1 for MM/DD and 0 for HH/MI/SS/AM if not found in the input string or if below the granularity threshold. } { set to_precision [dt_precision $granularity] @@ -361,14 +361,14 @@ set show_minutes [expr {$to_precision < 60}] set show_seconds [expr {$to_precision < 1}] - if {$to_precision == 0} { - set to_precision 1 + if {$to_precision == 0} { + set to_precision 1 } switch $default { - none { set value [dt_systime] } - now { set value [dt_systime] } - default { set value [lc_time_fmt $default "%Y-%m-%d %H:%M:%S"] } + none { set value [dt_systime] } + now { set value [dt_systime] } + default { set value [lc_time_fmt $default "%Y-%m-%d %H:%M:%S"] } } set parsed_date [dt_ansi_to_list $value] @@ -404,32 +404,32 @@ if {$use_am_pm} { if { $hours > 12 } { append input [dt_widget_maybe_range \ - $show_hours "$name.hours" 1 12 [expr {$hours - 12}] 1 0] + $show_hours "$name.hours" 1 12 [expr {$hours - 12}] 1 0] } elseif {$hours == 0} { append input [dt_widget_maybe_range \ - $show_hours "$name.hours" 1 12 12 1 0] + $show_hours "$name.hours" 1 12 12 1 0] } else { append input [dt_widget_maybe_range \ - $show_hours "$name.hours" 1 12 $hours 1 0] + $show_hours "$name.hours" 1 12 $hours 1 0] } } else { append input [dt_widget_maybe_range \ - $show_hours "$name.hours" 0 23 $hours 1 0] + $show_hours "$name.hours" 0 23 $hours 1 0] } - if {$show_minutes} { - append input ":" + if {$show_minutes} { + append input ":" } append input [dt_widget_maybe_range \ - $show_minutes "$name.minutes" 0 59 $minutes $to_precision 1] + $show_minutes "$name.minutes" 0 59 $minutes $to_precision 1] - if {$show_seconds} { - append input ":" + if {$show_seconds} { + append input ":" } append input [dt_widget_maybe_range \ - $show_seconds "$name.seconds" 0 59 $seconds 1 1] + $show_seconds "$name.seconds" 0 59 $seconds 1 1] if {$use_am_pm} { if {$hours < 12 || ! $show_hours} { @@ -452,11 +452,11 @@ return $input } -ad_proc -public dt_widget_month_names { - name +ad_proc -public dt_widget_month_names { + name {selected_month 0} } { - @return a select widget for months of the year. + @return a select widget for months of the year. } { if {$selected_month eq ""} {set selected_month 0} if {![string is integer $selected_month]} {error "selected_month must be integer"} @@ -465,36 +465,36 @@ incr selected_month -1 for {set i 0} {$i < 12} {incr i} { - append input "