Index: openacs-4/packages/calendar/www/view-month-display.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-month-display.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/calendar/www/view-month-display.tcl 29 Aug 2003 20:46:43 -0000 1.5
+++ openacs-4/packages/calendar/www/view-month-display.tcl 12 Sep 2003 20:00:13 -0000 1.6
@@ -23,11 +23,39 @@
if { ![info exists item_template] } {
set item_template "\$item"
}
+
+# NEW
+if { ![info exists show_calendar_name_p] } {
+ set show_calendar_name_p 1
+}
+
+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 or (cals.private_p='f' or (cals.private_p='t' and cals.owner_id= :user_id)))"
+}
+
+if { ![info exists prev_month_template] } {
+ set prev_month_template ""
+}
+
+if { ![info exists next_month_template] } {
+ set next_month_template ""
+}
+
+if { ![info exists item_add_template] } {
+ set item_add_template ""
+}
# calendar-portlet
dt_get_info $date
+set date_list [dt_ansi_to_list $date]
+set this_year [dt_trim_leading_zeros [lindex $date_list 0]]
+set this_month [dt_trim_leading_zeros [lindex $date_list 1]]
+set this_day [dt_trim_leading_zeros [lindex $date_list 2]]
+set month_string [lindex [dt_month_names] [expr $this_month - 1]]
set ansi_date_format "YYYY-MM-DD HH24:MI:SS"
set package_id [ad_conn package_id]
@@ -36,19 +64,23 @@
set next_month_url ""
set prev_month_url ""
+set first_day_of_week [lc_get firstdayofweek]
+set last_day_of_week [expr [expr $first_day_of_week + 7] % 7]
+
+
+set week_days [lc_get abday]
multirow create weekday_names weekday_short
-foreach weekday [calendar::get_weekday_list] {
- multirow append weekday_names $weekday
+for {set i 0} {$i < 7} {incr i} {
+ multirow append weekday_names [lindex $week_days [expr [expr $i + $first_day_of_week] % 7]]
}
+
# Get the beginning and end of the month in the system timezone
set first_date_of_month [dt_julian_to_ansi $first_julian_date_of_month]
set first_date_of_month_system [lc_time_conn_to_system "$first_date_of_month 00:00:00"]
set last_date_in_month [dt_julian_to_ansi $last_julian_date_in_month]
set last_date_in_month_system [lc_time_conn_to_system "$last_date_in_month 23:59:59"]
-calendar::i18n_display_parameters
-
set number_day_cells 0
set day_number $first_day
@@ -59,8 +91,14 @@
multirow create days_of_a_month calendar_item item_id ansi_start_date ansi_start_time day_number calendar_name beginning_of_week_p end_of_week_p today_p outside_month_p full_item
-for {set current_day $first_julian_date} {$current_day < $first_julian_date_of_month} {incr current_day} {
- if {$current_day == $first_julian_date} {
+
+# Calculate number of greyed days
+set greyed_days_before_month [expr [expr [dt_first_day_of_month $this_year $this_month]] -1 ]
+# Adjust for i18n
+set greyed_days_before_month [expr [expr $greyed_days_before_month + 7 - $first_day_of_week] % 7]
+
+for {set current_day 0} {$current_day < $greyed_days_before_month} {incr current_day} {
+ if {$current_day == 0} {
set beginning_of_week_p t
} else {
set beginning_of_week_p f
@@ -119,9 +157,9 @@
incr number_day_cells
}
-set remaining_days [expr 6 - $current_day % 7]
+set remaining_days [expr [expr $first_day_of_week + 6 - $current_day % 7] % 7]
-if {$remaining_days > 0 } {
+if {$remaining_days > 0} {
for {} {$current_day <= [expr $last_julian_date_in_month + $remaining_days]} {incr current_day} {
multirow append days_of_a_month "" "" "" "" "" "" f f "" t ""
}