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 -r1.25
--- openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 9 Nov 2008 23:29:22 -0000 1.24
+++ openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 27 Oct 2014 16:39:32 -0000 1.25
@@ -10,29 +10,27 @@
}
ad_proc dt_widget_month {
- {
- -calendar_details ""
- -date ""
- -days_of_week ""
- -large_calendar_p 1
- -master_bgcolor "black"
- -header_bgcolor "black"
- -header_text_color "white"
- -header_text_size "+2"
- -day_number_template {$day_number}
- -day_header_size 2
- -day_header_bgcolor "#666666"
- -calendar_width "100%"
- -day_bgcolor "#DDDDDD"
- -today_bgcolor "#DDDDDD"
- -day_text_color "white"
- -empty_bgcolor "white"
- -next_month_template ""
- -prev_month_template ""
- -prev_next_links_in_title 0
- -fill_all_days 0
- -show_calendar_name_p 1
- }
+ {-calendar_details ""}
+ {-date ""}
+ {-days_of_week ""}
+ {-large_calendar_p 1}
+ {-master_bgcolor "black"}
+ {-header_bgcolor "black"}
+ {-header_text_color "white"}
+ {-header_text_size "+2"}
+ {-day_number_template {$day_number}}
+ {-day_header_size 2}
+ {-day_header_bgcolor "#666666"}
+ {-calendar_width "100%"}
+ {-day_bgcolor "#DDDDDD"}
+ {-today_bgcolor "#DDDDDD"}
+ {-day_text_color "white"}
+ {-empty_bgcolor "white"}
+ {-next_month_template ""}
+ {-prev_month_template ""}
+ {-prev_next_links_in_title 0}
+ {-fill_all_days 0}
+ {-show_calendar_name_p 1}
} {
Returns a calendar for a specific month, with details supplied by
Julian date. Defaults to this month.
@@ -42,15 +40,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 +59,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]
}
@@ -140,7 +138,7 @@
set day_number 1
} elseif {$julian_date > $last_julian_date} {
break
- } elseif {$julian_date == [expr $last_julian_date_in_month+1]} {
+ } elseif {$julian_date == $last_julian_date_in_month + 1} {
set day_number 1
}
@@ -212,29 +210,27 @@
}
ad_proc dt_widget_month_small {
- {
- -calendar_details ""
- -date ""
- -days_of_week ""
- -large_calendar_p 0
- -master_bgcolor "black"
- -header_bgcolor "black"
- -header_text_color "white"
- -header_text_size "+1"
- -day_number_template {$day_number}
- -day_header_size 1
- -day_header_bgcolor "#666666"
- -calendar_width 0
- -day_bgcolor "#DDDDDD"
- -day_text_color "white"
- -empty_bgcolor "white"
- -next_month_template ""
- -prev_month_template ""
- }
+ {-calendar_details ""}
+ {-date ""}
+ {-days_of_week ""}
+ {-large_calendar_p 0}
+ {-master_bgcolor "black"}
+ {-header_bgcolor "black"}
+ {-header_text_color "white"}
+ {-header_text_size "+1"}
+ {-day_number_template {$day_number}}
+ {-day_header_size 1}
+ {-day_header_bgcolor "#666666"}
+ {-calendar_width 0}
+ {-day_bgcolor "#DDDDDD"}
+ {-day_text_color "white"}
+ {-empty_bgcolor "white"}
+ {-next_month_template ""}
+ {-prev_month_template ""}
} {
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 \
@@ -258,31 +254,29 @@
}
ad_proc dt_widget_month_centered {
- {
- -calendar_details ""
- -date ""
- -days_of_week ""
- -large_calendar_p 0
- -master_bgcolor "black"
- -header_bgcolor "black"
- -header_text_color "white"
- -header_text_size "+1"
- -day_number_template {$day_number}
- -day_header_size 1
- -day_header_bgcolor "#666666"
- -calendar_width 0
- -day_bgcolor "#DDDDDD"
- -day_text_color "white"
- -empty_bgcolor "white"
- -next_month_template ""
- -prev_month_template ""
- }
+ {-calendar_details ""}
+ {-date ""}
+ {-days_of_week ""}
+ {-large_calendar_p 0}
+ {-master_bgcolor "black"}
+ {-header_bgcolor "black"}
+ {-header_text_color "white"}
+ {-header_text_size "+1"}
+ {-day_number_template {$day_number}}
+ {-day_header_size 1}
+ {-day_header_bgcolor "#666666"}
+ {-calendar_width 0}
+ {-day_bgcolor "#DDDDDD"}
+ {-day_text_color "white"}
+ {-empty_bgcolor "white"}
+ {-next_month_template ""}
+ {-prev_month_template ""}
} {
Returns a calendar for a specific month, with details supplied by
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 ""
@@ -310,25 +304,24 @@
}
ad_proc dt_widget_year {
- {
- -calendar_details ""
- -date ""
- -days_of_week ""
- -large_calendar_p 0
- -master_bgcolor "black"
- -header_bgcolor "black"
- -header_text_color "white"
- -header_text_size "+1"
- -day_number_template {$day_number}
- -day_header_size 1
- -day_header_bgcolor "#666666"
- -calendar_width 0
- -day_bgcolor "#DDDDDD"
- -day_text_color "white"
- -empty_bgcolor "white"
- -next_month_template ""
- -prev_month_template ""
- -width 2}
+ {-calendar_details ""}
+ {-date ""}
+ {-days_of_week ""}
+ {-large_calendar_p 0}
+ {-master_bgcolor "black"}
+ {-header_bgcolor "black"}
+ {-header_text_color "white"}
+ {-header_text_size "+1"}
+ {-day_number_template {$day_number}}
+ {-day_header_size 1}
+ {-day_header_bgcolor "#666666"}
+ {-calendar_width 0}
+ {-day_bgcolor "#DDDDDD"}
+ {-day_text_color "white"}
+ {-empty_bgcolor "white"}
+ {-next_month_template ""}
+ {-prev_month_template ""}
+ {-width 2}
} {
Returns a year of small calendars given the starting month as a
date. Defaults to this month. Data in calendar_details will be
@@ -338,7 +331,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]"
}
@@ -367,31 +360,29 @@
}
ad_proc dt_widget_calendar_year {
- {
- -calendar_details ""
- -date ""
- -days_of_week ""
- -large_calendar_p 0
- -master_bgcolor "black"
- -header_bgcolor "black"
- -header_text_color "white"
- -header_text_size "+1"
- -day_number_template {$day_number}
- -day_header_size 1
- -day_header_bgcolor "#666666"
- -calendar_width 0
- -day_bgcolor "#DDDDDD"
- -day_text_color "white"
- -empty_bgcolor "white"
- -next_month_template ""
- -prev_month_template ""
- -width 2
- }
+ {-calendar_details ""}
+ {-date ""}
+ {-days_of_week ""}
+ {-large_calendar_p 0}
+ {-master_bgcolor "black"}
+ {-header_bgcolor "black"}
+ {-header_text_color "white"}
+ {-header_text_size "+1"}
+ {-day_number_template {$day_number}}
+ {-day_header_size 1}
+ {-day_header_bgcolor "#666666"}
+ {-calendar_width 0}
+ {-day_bgcolor "#DDDDDD"}
+ {-day_text_color "white"}
+ {-empty_bgcolor "white"}
+ {-next_month_template ""}
+ {-prev_month_template ""}
+ {-width 2}
} {
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]"
}
@@ -484,7 +475,7 @@
string.
} {
# Return immediately of the current view isn't month or year
- if {[lsearch -exact [list month year] $view] == -1} {
+ if {$view ni [list month year]} {
return ""
}
@@ -611,7 +602,6 @@
ad_proc dt_widget_calendar_navigation {
- {}
{base_url ""}
{view "week"}
{date ""}
@@ -632,24 +622,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 +652,13 @@
dt_get_info $date
set output "
-
+
[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 "
@@ -679,15 +669,15 @@
set months_list [dt_month_names]
set now [clock scan $date]
- set curr_month [expr [dt_trim_leading_zeros [clock format $now -format "%m"]]-1]
+ set curr_month [expr {[dt_trim_leading_zeros [clock format $now -format "%m"]] - 1}]
for {set i 0} {$i < 12} {incr i} {
set month [lindex $months_list $i]
# show 3 months in a row
- if {($i != 0) && ([expr $i % 3] == 0)} {
+ if {$i != 0 && $i % 3 == 0} {
append output "
"
}
@@ -698,7 +688,7 @@
\n"
} else {
set target_date [clock format \
- [clock scan "[expr $i-$curr_month] month" -base $now] -format "%Y-%m-%d"]
+ [clock scan "[expr {$i-$curr_month}] month" -base $now] -format "%Y-%m-%d"]
append output "
@@ -710,22 +700,22 @@
append output " |
"
- } elseif [string equal $view year] {
+ } elseif {$view eq "year"} {
# year view
append output "
-
+
\n"
set now [clock scan $date]
set curr_year $year
- set end_year [expr $year + 2]
+ set end_year [expr {$year + 2}]
set monthday [clock format $now -format "%m-%d"]
- for {set year [expr $curr_year - 2]} {$year <= $end_year} {incr year} {
+ for {set year [expr {$curr_year - 2}]} {$year <= $end_year} {incr year} {
if {$year == $curr_year} {
append output "
$year | \n"
@@ -749,7 +739,7 @@
-
+
"
@@ -758,7 +748,7 @@
foreach day_of_week $days_of_week {
append output "$day_of_week | \n"
}
- append output "
| "
+ append output "
| "
set day_of_week 1
set julian_date $first_julian_date
@@ -783,7 +773,7 @@
set day_number 1
} elseif {$julian_date > $last_julian_date} {
break
- } elseif {$julian_date == [expr $last_julian_date_in_month +1]} {
+ } elseif {$julian_date == $last_julian_date_in_month + 1} {
set day_number 1
}
@@ -799,7 +789,7 @@
"
} elseif {$julian_date == $julian_date_today} {
append output "
-
+ |
$day_number
| "
} else {
@@ -824,8 +814,8 @@
append today_url "$base_url" "view=day&date=[ns_urlencode [dt_sysdate]]"
append output "
-
-
+
+
|
@@ -834,12 +824,12 @@
- | | |