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.1 -r1.2
--- openacs-4/packages/calendar/www/view-month-display.tcl 26 May 2003 10:00:10 -0000 1.1
+++ openacs-4/packages/calendar/www/view-month-display.tcl 21 Jul 2003 19:21:36 -0000 1.2
@@ -1,89 +1,78 @@
-# Creates a month widget with events for that month
-#
-# The url_stub_callback parameter allows a parameterizable URL stub
-# for each calendar_id. If the parameter is non-null, it is considered a proc
-# that can be called on a calendar_id to generate a URL stub.
+# Show a calendar month widget
-
if {![info exists date] || [empty_string_p $date]} {
set date [dt_systime]
}
+dt_get_info $date
-if {![info exists day_template] || [empty_string_p $day_template]} {
- set day_template "\$day_number"
-}
+# If we were given no calendars, we assume we display the private calendar. It
+# makes no sense for this to be called with no data whatsoever.
-if {![info exists item_template] || [empty_string_p $item_template]} {
- set item_template "\$item"
-}
-
-if {![info exists show_calendar_name_p] || [empty_string_p $show_calendar_name_p]} {
- set show_calendar_name_p 1
-}
-# If we were given no calendars, we assume we display the
-# private calendar. It makes no sense for this to be called with
-# no data whatsoever.
if {![info exists calendar_id_list] || [empty_string_p $calendar_id_list]} {
set calendar_id_list [list [calendar_have_private_p -return_id 1 [ad_get_user_id]]]
}
-set items [ns_set create]
+
+
+set today_date [dt_sysdate]
+set next_month_url ""
+set prev_month_url ""
+
+multirow create weekday_names weekday_short
+foreach weekday [calendar::get_weekday_list] {
+ multirow append weekday_names $weekday
+}
+
+
+calendar::i18n_display_parameters
+
+set number_day_cells 0
+
+set day_number $first_day
+
+set today_ansi_list [dt_ansi_to_list $today_date]
+set today_julian_date [dt_ansi_to_julian [lindex $today_ansi_list 0] [lindex $today_ansi_list 1] [lindex $today_ansi_list 2]]
+
+
+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
+
+for {set current_day $first_julian_date} {$current_day < $first_julian_date_of_month} {incr current_day} {
+ if {$current_day == $first_julian_date} {
+ set beginning_of_week_p t
+ } else {
+ set beginning_of_week_p f
+ }
+ multirow append days_of_a_month "" "" [dt_julian_to_ansi [expr $first_julian_date_of_month + $current_day -1]] "" "" "" $beginning_of_week_p f "" t
+}
+
+set current_day $first_julian_date_of_month
+
db_foreach select_monthly_items {} {
- # Calendar name now set in query
- # set calendar_name [calendar_get_name $calendar_id]
-
- # reset url stub
- set url_stub ""
-
- # In case we need to dispatch to a different URL (ben)
- if {[info exists url_stub_callback] && ![empty_string_p $url_stub_callback]} {
- # Cache the stuff
- if {![info exists url_stubs($calendar_id)]} {
- set url_stubs($calendar_id) [$url_stub_callback $calendar_id]
- }
-
- set url_stub $url_stubs($calendar_id)
+ if {$current_day < $julian_start_date} {
+ for {} {$current_day < $julian_start_date} {incr current_day} {
+ array set display_information [calendar::get_month_multirow_information -current_day $current_day -today_julian_date $today_julian_date -first_julian_date_of_month $first_julian_date_of_month]
+ multirow append days_of_a_month "" "" [dt_julian_to_ansi $current_day] "" $display_information(day_number) "" $display_information(beginning_of_week_p) $display_information(end_of_week_p) $display_information(today_p) f
+ }
}
-
- set item "$name"
- set item "[subst $item_template]"
-
- if {![dt_no_time_p -start_time $ansi_start_date -end_time $ansi_end_date]} {
- set item "$ansi_start_date $item"
+
+ if {[string equal $ansi_start_time "00:00"] && [string equal $ansi_end_time "00:00"]} {
+ set ansi_start_time "--"
}
-
- if {$show_calendar_name_p} {
- append item " ($calendar_name)"
- }
-
- # DRB: This ugly hack was added for dotlrn-events, to give us a way to
- # flag event status in red in accordance with the spec. When calendar
- # is rewritten we should come up with a way for objects derived from
- # acs-events to render their own name summary and full descriptions.
-
- if { [string length $status_summary] > 0 } {
- append item " $status_summary "
- }
-
- append item "
"
-
- ns_set put $items $start_date $item
+
+ array set display_information [calendar::get_month_multirow_information -current_day $current_day -today_julian_date $today_julian_date -first_julian_date_of_month $first_julian_date_of_month]
+ multirow append days_of_a_month $name $item_id [dt_julian_to_ansi $current_day] $ansi_start_time $display_information(day_number) $calendar_name $display_information(beginning_of_week_p) $display_information(end_of_week_p) $display_information(today_p) f
}
-
-
-# Display stuff
-set day_number_template "$day_template"
-set foobar [dt_widget_month -calendar_details $items -date $date \
- -master_bgcolor black \
- -header_bgcolor lavender \
- -header_text_color black \
- -header_text_size "+1" \
- -day_header_bgcolor lavender \
- -day_bgcolor white \
- -today_bgcolor #FFF8DC \
- -empty_bgcolor lightgrey \
- -day_text_color black \
- -prev_next_links_in_title 1 \
- -day_number_template $day_number_template]
+for {} {$current_day <= $last_julian_date_in_month} {incr current_day} {
+ array set display_information [calendar::get_month_multirow_information -current_day $current_day -today_julian_date $today_julian_date -first_julian_date_of_month $first_julian_date_of_month]
+ multirow append days_of_a_month "" "" [dt_julian_to_ansi $current_day] "" $display_information(day_number) "" $display_information(beginning_of_week_p) $display_information(end_of_week_p) $display_information(today_p) f
+ incr number_day_cells
+}
+set remaining_days [expr 6 - $current_day % 7]
+
+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
+ }
+}
\ No newline at end of file