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.36 -r1.37 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 19 Dec 2002 16:26:19 -0000 1.36 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 13 Mar 2003 20:22:06 -0000 1.37 @@ -55,45 +55,27 @@ set current_date $date - set date_list [dt_ansi_to_list $current_date] - - set year [dt_trim_leading_zeros [lindex $date_list 0]] - set month [dt_trim_leading_zeros [lindex $date_list 1]] - set day [dt_trim_leading_zeros [lindex $date_list 2]] - - set current_date_julian [dt_ansi_to_julian $year $month $day] - - # 1 = Sun ... 7 = Sat - set current_date_weekday_no [expr [clock format [clock scan $date] -format %w] + 1] - - # What day does the week start on? - # 0 = Sunday, 6 = Saturday - set first_day_of_week [lc_get firstdayofweek] - - set first_day_of_week_julian [expr $current_date_julian - (($current_date_weekday_no + 6 - $first_day_of_week) % 7)] - - set last_week [dt_julian_to_ansi [expr $current_date_julian - 7]] - set last_week_pretty [lc_time_fmt $last_week "%q"] - set next_week [dt_julian_to_ansi [expr $current_date_julian + 7]] - set next_week_pretty [lc_time_fmt $next_week "%q"] - + # Get information for the week + db_1row select_week_info {} + # Initialize the ns_set - if { [empty_string_p $calendar_details] } { + if [empty_string_p $calendar_details] { set calendar_details [ns_set create calendar_details] } - set julian $first_day_of_week_julian - set return_html "\n" + # Loop through the days of the week + set julian $sunday_julian + set return_html "
\n" # Navigation Bar append return_html "
- - +
+
[subst $prev_week_template] - + - [lc_time_fmt [dt_julian_to_ansi $first_day_of_week_julian] "%Q"] - [lc_time_fmt [dt_julian_to_ansi [expr $first_day_of_week_julian + 6]] "%Q"] + [util_AnsiDatetoPrettyDate $sunday_date] - [util_AnsiDatetoPrettyDate $saturday_date] [subst $next_week_template] @@ -106,10 +88,13 @@ " - for { set julian $first_day_of_week_julian } { $julian < [expr $first_day_of_week_julian + 7] } { incr julian } { - set date [dt_julian_to_ansi $julian] - set pretty_date [string totitle [lc_time_fmt $date "%q"]] - set day [string totitle [lc_time_fmt $date "%A"]] + set days_of_week {Sunday Monday Tuesday Wednesday Thursday Friday Saturday} + foreach day $days_of_week { + + set lower_day [string tolower $day] + set julian [set ${lower_day}_julian] + set date [set ${lower_day}_date] + set pretty_date [util_AnsiDatetoPrettyDate $date] set day_html [subst $day_template] if {$date == $today_date} { @@ -149,6 +134,7 @@ append return_html "\n" + incr julian } append return_html "
" @@ -166,8 +152,8 @@ -start_hour {0} -end_hour {23} -show_nav 1 - -prev_nav_template {<} - -next_nav_template {>} + -prev_nav_template {\"back} + -next_nav_template {\"forward} -master_bgcolor "black" -header_bgcolor "black" -header_text_color "white" @@ -196,25 +182,12 @@ set calendar_details [ns_set create calendar_details] } - for { set hour 0 } { $hour < 24 } { incr hour } { - if { ($hour < $start_hour || $hour > $end_hour) && [ns_set find $calendar_details [format "%02d" $hour]] != -1 } { - if { $hour < $start_hour } { - set start_hour $hour - } elseif { $hour > $end_hour } { - set end_hour $hour - } - } - } - # Collect some statistics about the events (for overlap) for {set hour $start_hour} {$hour <= 23} {incr hour} { set n_events($hour) 0 set n_starting_events($hour) 0 } - - # Count number of overlapping events each hour - - # Make a copy of the calendar_details set that we can work on for a minute, discard afterwards. + set calendar_details_2 [ns_set copy $calendar_details] for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { @@ -252,13 +225,12 @@ for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { if {$max_n_events < $n_events($hour)} { set max_n_events $n_events($hour) + ns_log Notice "BMA-DEBUG-CAL: Setting max_n_events to $max_n_events" } } # Select some basic stuff, sets day_of_the_week, yesterday, tomorrow vars db_1row select_day_info {} - - set day_of_the_week [string totitle [lc_time_fmt $current_date "%Q"]] set return_html "" @@ -273,12 +245,12 @@ append return_html "\n" incr current_width @@ -364,8 +351,7 @@ { -calendar_details "" -date "" - -days_of_week "deprecated" - -weekday_format "1" + -days_of_week "S M T W T F S" -large_calendar_p 0 -master_bgcolor "black" -header_bgcolor "black" @@ -385,16 +371,13 @@ } { Returns a calendar year of small calendars for the year of the passed in date. Defaults to this year. - - @param weekday_format This can be either '1' for 1-character abbreviations, 'ab' for - standard 3-letter abbreviations, and 'long' for the full names of weekdays. } { dt_get_info $date return [dt_widget_year \ -calendar_details $calendar_details \ -date $beginning_of_year \ - -weekday_format $weekday_format \ + -days_of_week $days_of_week \ -large_calendar_p $large_calendar_p \ -master_bgcolor $master_bgcolor \ -header_bgcolor $header_bgcolor \ @@ -419,17 +402,16 @@ ad_proc -private dt_left_arrow {} { Returns the image location for a left navigation arrow } { - return "/doc/acs-datetime/pics/left.gif" + return "/shared/images/left.gif" } ad_proc -private dt_right_arrow {} { Returns the image location for a right navigation arrow } { - return "/doc/acs-datetime/pics/right.gif" + return "/shared/images/right.gif" } ad_proc -private dt_navbar_view { - {-link_current_view:boolean} view base_url date @@ -446,26 +428,16 @@ # ben: taking out year for now, since it doesn't work foreach viewname {list day week month} { - set text [string toupper $viewname 0] - ns_log bug "STC: $text" - switch -exact -- $text { - List {set text "[_ acs-datetime.List]"} - Day {set text "[_ acs-datetime.Day]"} - Week {set text "[_ acs-datetime.Week]"} - Month {set text "[_ acs-datetime.Month]"} - } - - set url "${base_url}view=$viewname&date=$date" - - if { !$link_current_view_p && [string equal $viewname $view] } { + set text [string toupper $viewname 0] + if { $viewname == $view } { # current view append result " " } else { append result " " @@ -497,20 +469,54 @@ set now [clock scan $date] # Compute formatted strings for curr, prev, and next - set prev_year [clock format [clock scan "1 year ago" -base $now] -format "%Y-%m-%d"] - set next_year [clock format [clock scan "1 year" -base $now] -format "%Y-%m-%d"] + + # Check that links to prev/next year don't lead to illegal dates that would bomb + if {[catch {set prev_year [clock format [clock scan "1 year ago" -base $now] -format "%Y-%m-%d"]} err]} { + set prev_year_legal_p 0 + } else { + if {[catch {clock scan $prev_year}]} { + set prev_year_legal_p 0 + } else { + set prev_year_legal_p 1 + } + } + + if {[catch {set next_year [clock format [clock scan "1 year" -base $now] -format "%Y-%m-%d"]} err]} { + set next_year_legal_p 0 + } else { + if {[catch {clock scan $next_year}]} { + set next_year_legal_p 0 + } else { + set next_year_legal_p 1 + } + } + set curr_year [clock format $now -format "%Y"] append result "
" - # The items that have no hour (all day events) + # The items that have no hour set hour "" set next_hour "" set start_time "" set odd_row_p 0 - set display_hour "\"No" + set display_hour "\"No" append return_html "" append return_html "" - - # Normal hour-by-hour display + for {set hour $start_hour} {$hour <= $end_hour} {incr hour} { set next_hour [expr $hour + 1] @@ -311,9 +282,34 @@ } else { set index_hour $hour } - - set display_hour [string tolower [string trimleft [lc_time_fmt "0000-00-00 ${hour}:00:00" "%X"] 0]] + # display stuff + if {$hour >= 12} { + set ampm_hour [expr $hour - 12] + set pm 1 + } else { + set ampm_hour $hour + set pm 0 + } + + if {$ampm_hour == 0} { + set ampm_hour 12 + } + + if {$ampm_hour < 10} { + set display_hour "$ampm_hour" + } else { + set display_hour "$ampm_hour" + } + + append display_hour ":00 " + + if {$pm} { + append display_hour "pm" + } else { + append display_hour "am" + } + if { $odd_row_p } { set class "odd" set odd_row_p 0 @@ -412,7 +408,7 @@ } { # Check for zero size if {[ns_set size $calendar_details] == 0} { - return "[_ acs-datetime.No_Items]" + return "No Items" } # The title @@ -422,15 +418,15 @@ } if {[empty_string_p $start_date] && ![empty_string_p $end_date]} { - set title "Items until [lc_time_fmt $end_date "%Q"]" + set title "Items until [util_AnsiDatetoPrettyDate $end_date]" } if {![empty_string_p $start_date] && [empty_string_p $end_date]} { - set title "Items starting [lc_time_fmt $start_date "%Q"]" + set title "Items starting [util_AnsiDatetoPrettyDate $start_date]" } if {![empty_string_p $start_date] && ![empty_string_p $end_date]} { - set title "[_ acs-datetime.Items_from] [lc_time_fmt $start_date "%Q"] [_ acs-datetime.to] [lc_time_fmt $end_date "%Q"]" + set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]" } set return_html "$title

" @@ -445,14 +441,14 @@ # Create the header append return_html "

[subst $hour_template]" @@ -300,8 +272,7 @@ append return_html "
- " + " if {$real_order_by != "item_type"} { - append return_html "" + append return_html "" } - append return_html "\n" + append return_html "\n" # initialize the item_type so we can do intermediate titles set old_item_type "" @@ -478,7 +474,7 @@ # Do we need a title? if {$real_order_by == "item_type" && $item_type != "$old_item_type"} { if {[empty_string_p $item_type]} { - set item_type_for_title "([_ acs-datetime.No_Item_Type])" + set item_type_for_title "(No Item Type)" } else { set item_type_for_title $item_type } 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.16 -r1.17 --- openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 22 Nov 2002 13:13:44 -0000 1.16 +++ openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 13 Mar 2003 20:22:06 -0000 1.17 @@ -13,8 +13,7 @@ { -calendar_details "" -date "" - -days_of_week "deprecated" - -weekday_format "long" + -days_of_week "Sunday Monday Tuesday Wednesday Thursday Friday Saturday" -large_calendar_p 1 -master_bgcolor "black" -header_bgcolor "black" @@ -54,7 +53,7 @@ set day_of_week $first_day_of_month set julian_date $first_julian_date - set month_heading [string totitle [lc_time_fmt $date "%B %Y"]] + set month_heading [format "%s %s" $month $year] set next_month_url "" set prev_month_url "" @@ -71,7 +70,7 @@ # We offer an option to put the links to next and previous months # in the title bar - if { !$prev_next_links_in_title } { + if { $prev_next_links_in_title == 0 } { set title " $title \n" - foreach weekday [dt_get_days_of_week -weekday_format $weekday_format] { + foreach day_of_week $days_of_week { append output " \n" } @@ -208,8 +207,7 @@ { -calendar_details "" -date "" - -days_of_week "deprecated" - -weekday_format "1" + -days_of_week "S M T W T F S" -large_calendar_p 0 -master_bgcolor "black" -header_bgcolor "black" @@ -227,14 +225,11 @@ } } { Returns a small calendar for a specific month. Defaults to this month. - - @param weekday_format This can be either '1' for 1-character abbreviations, 'ab' for - standard 3-letter abbreviations, and 'long' for the full names of weekdays. } { return [dt_widget_month \ -calendar_details $calendar_details \ -date $date \ - -weekday_format $weekday_format \ + -days_of_week $days_of_week \ -large_calendar_p $large_calendar_p \ -master_bgcolor $master_bgcolor \ -header_bgcolor $header_bgcolor \ @@ -255,8 +250,7 @@ { -calendar_details "" -date "" - -days_of_week "deprecated" - -weekday_format "1" + -days_of_week "S M T W T F S" -large_calendar_p 0 -master_bgcolor "black" -header_bgcolor "black" @@ -275,11 +269,8 @@ } { Returns a calendar for a specific month, with details supplied by Julian date. Defaults to this month. - - @param weekday_format This can be either '1' for 1-character abbreviations, 'ab' for - standard 3-letter abbreviations, and 'long' for the full names of weekdays. } { - set output {} + set output "" dt_get_info $date @@ -288,14 +279,14 @@ + [dt_widget_month_small -calendar_details $calendar_details -date $prev_month -days_of_week $days_of_week -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ]
[_ acs-datetime.Day_of_Week][_ acs-datetime.Date][_ acs-datetime.Start_Time][_ acs-datetime.End_Time]
Day of WeekDateStart TimeEnd Time[_ acs-datetime.Type]Type[_ acs-datetime.Title]
Title
$month_heading @@ -98,11 +97,11 @@
- $weekday + $day_of_week
- [dt_widget_month_small -calendar_details $calendar_details -date $prev_month -weekday_format $weekday_format -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ] - [dt_widget_month_small -calendar_details $calendar_details -date $date -weekday_format $weekday_format -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ] + [dt_widget_month_small -calendar_details $calendar_details -date $date -days_of_week $days_of_week -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ] - [dt_widget_month_small -calendar_details $calendar_details -date $next_month -weekday_format $weekday_format -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ] + [dt_widget_month_small -calendar_details $calendar_details -date $next_month -days_of_week $days_of_week -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ]
\n" @@ -307,8 +298,7 @@ { -calendar_details "" -date "" - -days_of_week "deprecated" - -weekday_format "1" + -days_of_week "S M T W T F S" -large_calendar_p 0 -master_bgcolor "black" -header_bgcolor "black" @@ -328,9 +318,6 @@ Returns a year of small calendars given the starting month as a date. Defaults to this month. Data in calendar_details will be ignored. - - @param weekday_format This can be either '1' for 1-character abbreviations, 'ab' for - standard 3-letter abbreviations, and 'long' for the full names of weekdays. } { if { $width < 1 || $width > 12 } { return "Width must be between 1 and 12" @@ -344,7 +331,7 @@ append output "
- [dt_widget_month_small -calendar_details $calendar_details -date $date -weekday_format $weekday_format -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ] + [dt_widget_month_small -calendar_details $calendar_details -date $date -days_of_week $days_of_week -large_calendar_p $large_calendar_p -master_bgcolor $master_bgcolor -header_bgcolor $header_bgcolor -header_text_color $header_text_color -header_text_size $header_text_size -day_number_template $day_number_template -day_header_size $day_header_size -day_header_bgcolor $day_header_bgcolor -calendar_width $calendar_width -day_bgcolor $day_bgcolor -day_text_color $day_text_color -empty_bgcolor $empty_bgcolor -next_month_template $next_month_template -prev_month_template $prev_month_template ] $text - + $text
-
+
" + + # Serve arrow link to prev year if it leads to legal date + if {$prev_year_legal_p != 0} { + append result " - - $curr_year + " + } + + append result " + $curr_year" + + # Serve arrow to next year if it leads to a legal date + if {$next_year_legal_p != 0} { + append result " - + " + } + + append result "
@@ -528,75 +534,61 @@ Returns the monthly navbar } { set now [clock scan $date] + set curr_month [clock format $now -format "%B"] + # Check that the arrows to prev/next months don't go to illegal dates and bomb + if {[catch {set prev_month [clock format [clock scan "1 month ago" -base $now] -format "%Y-%m-%d"]} err ]} { + set prev_month_legal_p 0 + } else { + if {[catch {clock scan $prev_month}]} { + set prev_month_legal_p 0 + } else { + set prev_month_legal_p 1 + } + } - set curr_month_localized [string totitle [lc_time_fmt [clock_to_ansi $now] "%B %Y"]] + if {[catch {set next_month [clock format [clock scan "1 month" -base $now] -format "%Y-%m-%d"]} err]} { + set next_month_legal_p 0 + } else { + if {[catch {clock scan $next_month}]} { + set next_month_legal_p 0 + } else { + set next_month_legal_p 1 + } + } - set prev_month [clock format [clock scan "1 month ago" -base $now] -format "%Y-%m-%d"] - set next_month [clock format [clock scan "1 month" -base $now] -format "%Y-%m-%d"] - - set prev_month_localized [string totitle [lc_time_fmt $prev_month "%B %Y"]] - set next_month_localized [string totitle [lc_time_fmt $next_month "%B %Y"]] - append results "
- - \n" + + \n" + + return $results } ad_proc dt_widget_calendar_navigation { - {-today_bgcolor "#e9e99c"} - {-weekday_format "1"} - -link_current_view:boolean + {} {base_url ""} {view "week"} {date ""} @@ -614,6 +606,7 @@ The date must be formatted YYYY-MM-DD. } { + # valid views are "list" "day" "week" "month" "year" if {![exists_and_not_null base_url]} { @@ -648,25 +641,20 @@ set output "
- - $curr_month_localized - -
" - return $results -} - -ad_proc dt_get_days_of_week { - {-weekday_format "1"} -} { - Get the localized names of the days of week, starting with the - correct day according to the locale (e.g., Sunday in the US, Monday in - Europe). - - @param weekday_format: '1' for one-character abbreviations, 'ab' for 3-character abbreviations, - and 'long' for full weekday names. - @return A list of localized weekday names starting with the first day of week according to the connection's locale. -} { - set first_day_of_week [lc_get firstdayofweek] - - # Let's first get the localized weekday names from the localization-procs - switch -exact $weekday_format { - 1 { - set localized_weekdays [list] - foreach day [lc_get abday] { - lappend localized_weekdays [string range $day 0 0] - } - } - ab { - set localized_weekdays [lc_get abday] - } - long { - set localized_weekdays [lc_get day] - } - default { - error "dt_get_days_of_week only knows about formats 1, ab, and long. We were given the format '$weekday_format'." - } + # Output link to previous month only if it's legal + if {$prev_month_legal_p != 0} { + append results " + + " } - # And now let's put them in the right order according to what day the week starts - set days_of_week [list] - for { set i 0 } { $i < 7 } { incr i } { - lappend days_of_week [string totitle [lindex $localized_weekdays [expr ($i + $first_day_of_week) % 7 ]]] - } + append results " + $curr_month" - return $days_of_week + # Output link to next month only if it's a legal month + if {$next_month_legal_p != 0} { + append results " + + " + } + + append results " +
- [dt_navbar_view -link_current_view=$link_current_view_p $view $base_url $date] + [dt_navbar_view $view $base_url $date] [dt_navbar_year $view $base_url $date]\n" if [string equal $view month] { # month view - append output "
" - - set months_list [list] - foreach month_name [nsv_get locale [lang::conn::locale],mon] { - lappend months_list [string totitle $month_name] - } + 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] @@ -730,8 +718,6 @@ append output "" } else { - - # day or week view append output " [dt_navbar_month $view $base_url $date] @@ -744,17 +730,17 @@ " - foreach weekday [dt_get_days_of_week -weekday_format 1] { - append output "\n" + set days_of_week [list S M T W T F S] + + foreach day_of_week $days_of_week { + append output "\n" } append output "" set day_of_week 1 set julian_date $first_julian_date set day_number $first_day - set julian_date_todays_date [dt_ansi_to_julian_single_arg [dt_sysdate]] - while {1} { if {$julian_date < $first_julian_date_of_month} { @@ -782,26 +768,20 @@ append output "\n" } - if { $julian_date == $julian_date_todays_date } { - set bgcolor " bgcolor=\"${today_bgcolor}\"" - } else { - set bgcolor {} - } - if {$before_month_p || $after_month_p} { append output " - " } elseif {$julian_date == $julian_date_today} { append output " - " } else { append output " - " @@ -837,17 +817,17 @@ " if { $view == "day" && [dt_sysdate] == $date } { - append output "[_ acs-datetime.Today]" + append output "Today" } else { append output " - [_ acs-datetime.Today] " + Today " } append output " - [_ acs-datetime.is] [lc_time_fmt [dt_sysdate] "%q"] + is [dt_ansi_to_pretty]
$weekday$day_of_week

+ $day_number + $day_number + $day_number

-
[_ acs-datetime.Date_as_YYYYMMDD] +
Date as YYYYMMDD " @@ -877,7 +857,7 @@ Returns the following (example for the_date = 2000-12-08): julian_date_today 2451887 - month December (localized) + month December year 2000 first_julian_date 2451875 first_julian_date_of_month 2451880 @@ -891,8 +871,8 @@ prev_month 2000-11-08 beginning_of_year 2000-01-01 days_in_last_month 30 - next_month_name January (localized) - prev_month_name November (localized) + next_month_name January + prev_month_name November Input: @@ -918,7 +898,7 @@ ns_set put $dt_info_set julian_date_today \ [dt_ansi_to_julian $year $month $day] ns_set put $dt_info_set month \ - [lc_time_fmt $the_date "%B"] + [clock format [clock scan $the_date] -format %B] ns_set put $dt_info_set year \ [clock format [clock scan $the_date] -format %Y] ns_set put $dt_info_set first_julian_date_of_month \ @@ -941,23 +921,19 @@ [dt_next_month_name $year $month] ns_set put $dt_info_set prev_month_name \ [dt_prev_month_name $year $month] - ns_set put $dt_info_set first_day_of_week \ - [nsv_get locale [lang::conn::locale],firstdayofweek] - # We need the variables from the ns_set here + # We need the variables from the ns_set ad_ns_set_to_tcl_vars $dt_info_set ns_set put $dt_info_set first_julian_date \ - [expr $first_julian_date_of_month - (($first_day_of_month + 6 - $first_day_of_week) % 7)] - + [expr $first_julian_date_of_month + 1 - $first_day_of_month] ns_set put $dt_info_set first_day \ - [expr $days_in_last_month - (($first_day_of_month + 6 - $first_day_of_week) %7) + 1] - + [expr $days_in_last_month + 2 - $first_day_of_month] ns_set put $dt_info_set last_julian_date_in_month \ [expr $first_julian_date_of_month + $num_days_in_month - 1] set days_in_next_month \ - [expr (7-(($num_days_in_month + $first_day_of_month - $first_day_of_week - 1) % 7)) % 7] + [expr (7-(($num_days_in_month + $first_day_of_month - 1) % 7)) % 7] ns_set put $dt_info_set last_julian_date \ [expr $first_julian_date_of_month + $num_days_in_month - 1 + $days_in_next_month] Index: openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql 18 Feb 2003 20:53:45 -0000 1.2 +++ openacs-4/packages/acs-kernel/sql/oracle/rel-segments-create.sql 13 Mar 2003 20:22:57 -0000 1.3 @@ -352,22 +352,23 @@ p_rel_type in acs_rels.rel_type%TYPE ) is - v_segment_id rel_segments.segment_id%TYPE; begin add_one(p_party_id, p_member_id); -- if the relation type is mapped to a relational segment map that too - select segment_id into v_segment_id - from rel_segments s - where s.rel_type = p_rel_type - and s.group_id = p_party_id; + for v_segments in (select segment_id + from rel_segments + where group_id = p_party_id + and rel_type in (select object_type + from acs_object_types + start with object_type = p_rel_type + connect by prior supertype = object_type)) + loop + add_one(v_segments.segment_id, p_member_id); + end loop; - exception when no_data_found then return; - - add_one(v_segment_id, p_member_id); - end add; procedure remove_one ( @@ -395,22 +396,23 @@ p_rel_type in acs_rels.rel_type%TYPE ) is - v_segment_id rel_segments.segment_id%TYPE; begin remove_one(p_party_id, p_member_id); -- if the relation type is mapped to a relational segment unmap that too - select segment_id into v_segment_id - from rel_segments s - where s.rel_type = p_rel_type - and s.group_id = p_party_id; + for v_segments in (select segment_id + from rel_segments + where group_id = p_party_id + and rel_type in (select object_type + from acs_object_types + start with object_type = p_rel_type + connect by prior supertype = object_type)) + loop + remove_one(v_segments.segment_id, p_member_id); + end loop; - exception when no_data_found then return; - - remove_one(v_segment_id, p_member_id); - end remove; end party_approved_member; Index: openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql,v diff -u -r1.20 -r1.21 --- openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql 18 Feb 2003 20:54:32 -0000 1.20 +++ openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql 13 Mar 2003 20:23:24 -0000 1.21 @@ -10,9 +10,6 @@ -- TRIGGERS -- -------------- -drop trigger membership_rels_in_tr on membership_rels; -drop function membership_rels_in_tr (); - -- The insert trigger was dummied up in groups-create.sql, so we just need -- to replace the trigger function, not create the trigger. @@ -26,7 +23,10 @@ -- this will be the right thing to do if the PG folks fix this problem or when -- we drop support of PG 7.2 and no longer need to declare these as type "opaque" -create function membership_rels_in_tr () returns opaque as ' +drop trigger membership_rels_in_tr on membership_rels; +drop function membership_rels_in_tr (); + +create or replace function membership_rels_in_tr () returns opaque as ' declare v_object_id_one acs_rels.object_id_one%TYPE; v_object_id_two acs_rels.object_id_two%TYPE; @@ -140,6 +140,9 @@ create trigger membership_rels_del_tr before delete on membership_rels for each row execute procedure membership_rels_del_tr (); +drop trigger composition_rels_in_tr on composition_rels; +drop function composition_rels_in_tr (); + create or replace function composition_rels_in_tr () returns opaque as ' declare v_object_id_one acs_rels.object_id_one%TYPE; @@ -755,7 +758,7 @@ -- function new select define_function_args('acs_group__new','group_id,object_type;group,creation_date;now(),creation_user,creation_ip,email,url,group_name,join_policy,context_id'); -create or replace function acs_group__new (integer,varchar,timestamp with time zone,integer,varchar,varchar,varchar,varchar,varchar,integer) +create or replace function acs_group__new (integer,varchar,timestamptz,integer,varchar,varchar,varchar,varchar,varchar,integer) returns integer as ' declare new__group_id alias for $1; -- default null Index: openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-create.sql 18 Feb 2003 20:54:32 -0000 1.6 +++ openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-create.sql 13 Mar 2003 20:23:24 -0000 1.7 @@ -200,19 +200,23 @@ p_member_id alias for $2; p_rel_id alias for $3; p_rel_type alias for $4; - v_segment_id rel_segments.segment_id%TYPE; + v_segments record; begin perform party_approved_member__add_one(p_party_id, p_member_id, p_rel_id); - select into v_segment_id segment_id - from rel_segments s - where s.rel_type = p_rel_type - and s.group_id = p_party_id; + -- if the relation type is mapped to relational segments unmap them too - if found then - perform party_approved_member__add_one(v_segment_id, p_member_id, p_rel_id); - end if; + for v_segments in select segment_id + from rel_segments s, acs_object_types o1, acs_object_types o2 + where + o1.object_type = p_rel_type + and o1.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey) + and s.rel_type = o2.object_type + and s.group_id = p_party_id + loop + perform party_approved_member__add_one(v_segments.segment_id, p_member_id, p_rel_id); + end loop; return 1; @@ -241,22 +245,24 @@ p_member_id alias for $2; p_rel_id alias for $3; p_rel_type alias for $4; - v_segment_id rel_segments.segment_id%TYPE; + v_segments record; begin perform party_approved_member__remove_one(p_party_id, p_member_id, p_rel_id); - -- if the relation type is mapped to a relational segment unmap that too + -- if the relation type is mapped to relational segments unmap them too - select into v_segment_id segment_id - from rel_segments s - where s.rel_type = p_rel_type - and s.group_id = p_party_id; + for v_segments in select segment_id + from rel_segments s, acs_object_types o1, acs_object_types o2 + where + o1.object_type = p_rel_type + and o1.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey) + and s.rel_type = o2.object_type + and s.group_id = p_party_id + loop + perform party_approved_member__remove_one(v_segments.segment_id, p_member_id, p_rel_id); + end loop; - if found then - perform party_approved_member__remove_one(v_segment_id, p_member_id, p_rel_id); - end if; - return 1; end;' language 'plpgsql'; Index: openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 26 Feb 2003 09:39:37 -0000 1.11 +++ openacs-4/packages/acs-lang/tcl/lang-catalog-procs.tcl 13 Mar 2003 20:24:00 -0000 1.12 @@ -153,7 +153,7 @@ set value [xml_node_get_attribute $element $attribute] if { [empty_string_p $value] } { - error "Required attribute \"$attribute\" missing from <[dom::node cget $element -nodeName]>" + error "Required attribute \"$attribute\" missing from <[ns_xml node get name $element]>" } return $value @@ -168,7 +168,7 @@ set content [xml_node_get_content $element] if { [empty_string_p $content] } { - error "Required content missing from element <[dom::node cget $element -nodeName]>" + error "Required content missing from element <[ns_xml node get name $element]>" } return $content Index: openacs-4/packages/acs-subsite/www/shared/images/add.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/add.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/bold-button.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/bold-button.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/checkbox.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/checkbox.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/checkboxchecked.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/checkboxchecked.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/diamond.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/diamond.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/go.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/go.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/italic-button.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/italic-button.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/left.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/left.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/new.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/new.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/radio.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/radio.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/radiochecked.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/radiochecked.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/right.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/right.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/underline-button.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/underline-button.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-subsite/www/shared/images/url-button.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/images/url-button.gif,v diff -u -r1.1 -r1.2 Binary files differ Index: openacs-4/packages/acs-tcl/tcl/30-xml-utils-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/30-xml-utils-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/30-xml-utils-procs.tcl 10 Feb 2002 22:11:31 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/30-xml-utils-procs.tcl 13 Mar 2003 20:24:53 -0000 1.5 @@ -145,12 +145,12 @@ # Get Node Attribute proc xml_node_get_attribute {node_id attribute_name} { - return [ns_xml node getattr $node_id $attribute_name] + return [ns_xml node get attr $node_id $attribute_name] } # Get Content proc xml_node_get_content {node_id} { - return [ns_xml node getcontent $node_id] + return [ns_xml node get content $node_id] } ## Index: openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 10 Mar 2003 19:29:40 -0000 1.16 +++ openacs-4/packages/acs-tcl/tcl/apm-xml-procs.tcl 13 Mar 2003 20:24:53 -0000 1.17 @@ -9,21 +9,6 @@ @cvs-id $Id$ } -ad_proc -private -deprecated -warn apm_load_xml_packages {} { - -

- NOTE: This proc doesn't do anything anymore. -

- -

- Loads XML packages into the running interpreter, if they're not - already there. We need to load these packages once per connection, - since AOLserver doesn't seem to deal with packages very well. -

- -} { -} - ad_proc -private apm_required_attribute_value { element attribute } { Returns an attribute of an XML element, throwing an error if the attribute @@ -32,7 +17,7 @@ } { set value [apm_attribute_value $element $attribute] if { [empty_string_p $value] } { - error "Required attribute \"$attribute\" missing from <[dom::node cget $element -nodeName]>" + error "Required attribute \"$attribute\" missing from <[ns_xml node name $element]>" } return $value } @@ -46,8 +31,7 @@ Parses the XML element to return the value for the specified attribute. } { - # set value [dom::element getAttribute $element $attribute] - set value [ns_xml node getattr $element $attribute] + set value [ns_xml node get attr $element $attribute] if { [empty_string_p $value] } { return $default @@ -64,18 +48,16 @@ } { Parses the XML element and returns the associated property name if it exists. } { - # set node [lindex [dom::element getElementsByTagName $root $property_name] 0] set node [lindex [xml_node_get_children_by_name $root $property_name] 0] if { ![empty_string_p $node] } { - # return [dom::node cget [dom::node cget $node -firstChild] -nodeValue] set child [lindex [ns_xml node children $node] 0] # JCD 20020914 ns_xml when given something like (i.e. empty content) # will have the node but the node will not have a child node and the # getcontent will then fail. if { ![empty_string_p $child] } { - return [ns_xml node getcontent $child] + return [ns_xml node get content $child] } } return $default @@ -249,8 +231,6 @@ set properties(path) $path set properties(mtime) $mtime - apm_load_xml_packages - apm_log APMDebug "Reading specification file at $path" set file [open $path] @@ -259,14 +239,11 @@ set xml_data [xml_prepare_data $xml_data] - # set tree [dom::DOMImplementation parse $xml_data] set tree [xml_parse $xml_data] - # set package [dom::node cget $tree -firstChild] set root_node [xml_doc_get_first_node_by_name $tree package] apm_log APMDebug "XML: root node is [ns_xml node name $root_node]" set package $root_node - # set root_name [dom::node cget $package -nodeName] set root_name [xml_node_get_name $package] # Debugging Children @@ -291,7 +268,6 @@ set properties(pretty-plural) [apm_tag_value -default "$properties(package-name)s" $package pretty-plural] - # set versions [dom::element getElementsByTagName $package version] set versions [xml_node_get_children_by_name $package version] if { [llength $versions] != 1 } { @@ -318,10 +294,8 @@ vendor url description format } { - # set node [lindex [dom::element getElementsByTagName $version $property_name] 0] set node [lindex [xml_node_get_children_by_name $version $property_name] 0] if { ![empty_string_p $node] } { - # set properties($property_name.$attribute_name) [dom::element getAttribute $node $attribute_name] set properties($property_name.$attribute_name) [apm_attribute_value $node $attribute_name] } else { set properties($property_name.$attribute_name) "" @@ -339,7 +313,6 @@ set properties(requires) [list] foreach dependency_type { provides requires } { - # set dependency_types [dom::element getElementsByTagName $version $dependency_type] set dependency_types [xml_node_get_children_by_name $version $dependency_type] foreach node $dependency_types { @@ -351,6 +324,32 @@ set properties(files) [list] +<<<<<<< apm-xml-procs.tcl + set files [xml_node_get_children_by_name $version files] + + foreach node $files { + set file_nodes [xml_node_get_children_by_name $node file] + + foreach file_node $file_nodes { + set file_path [apm_required_attribute_value $file_node path] + set type [apm_attribute_value $file_node type] + set db_type [apm_attribute_value $file_node db_type] + # Validate the file type: it must be null (unknown type) or + # some value in [apm_file_type_keys]. + if { ![empty_string_p $type] && [lsearch -exact [apm_file_type_keys] $type] < 0 } { + ns_log Warning "Unrecognized file type \"$type\" of file $file_path" + } + # Validate the database type: it must be null (unknown type) or + # some value in [apm_db_type_keys]. + if { ![empty_string_p $db_type] && [lsearch -exact [apm_db_type_keys] $db_type] < 0 } { + error "Invalid database type \"$db_type\"" + } + lappend properties(files) [list $file_path $type $db_type] + } + } + +======= +>>>>>>> 1.16 # Build a list of package callbacks array set callback_array {} @@ -387,13 +386,10 @@ set properties(owners) [list] - # set owners [dom::element getElementsByTagName $version "owner"] set owners [xml_node_get_children_by_name $version owner] foreach node $owners { - # set url [dom::element getAttribute $node url] set url [apm_attribute_value $node url] - # set name [dom::node cget [dom::node cget $node -firstChild] -nodeValue] set name [xml_node_get_content [lindex [xml_node_get_children $node] 0]] lappend properties(owners) [list $name $url] } @@ -403,27 +399,18 @@ set properties(parameters) [list] apm_log APMDebug "APM: Reading Parameters" - # set parameters [dom::element getElementsByTagName $version "parameters"] set parameters [xml_node_get_children_by_name $version parameters] foreach node $parameters { - # set parameter_nodes [dom::element getElementsByTagName $node "parameter"] set parameter_nodes [xml_node_get_children_by_name $node parameter] foreach parameter_node $parameter_nodes { - # set default_value [dom::element getAttribute $parameter_node default] set default_value [apm_attribute_value $parameter_node default] - # set min_n_values [dom::element getAttribute $parameter_node min_n_values] set min_n_values [apm_attribute_value $parameter_node min_n_values] - # set max_n_values [dom::element getAttribute $parameter_node max_n_values] set max_n_values [apm_attribute_value $parameter_node max_n_values] - # set description [dom::element getAttribute $parameter_node description] set description [apm_attribute_value $parameter_node description] - # set section_name [dom::element getAttribute $parameter_node section_name] set section_name [apm_attribute_value $parameter_node section_name] - # set datatype [dom::element getAttribute $parameter_node datatype] set datatype [apm_attribute_value $parameter_node datatype] - # set name [dom::element getAttribute $parameter_node name] set name [apm_attribute_value $parameter_node name] apm_log APMDebug "APM: Reading parameter $name with default $default_value" Index: openacs-4/packages/acs-templating/tcl/richtext-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/richtext-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 27 Jan 2003 16:42:32 -0000 1.3 +++ openacs-4/packages/acs-templating/tcl/richtext-procs.tcl 13 Mar 2003 20:25:06 -0000 1.4 @@ -162,9 +162,9 @@ if (document.selection) { document.write(''); document.write(''); - document.write(''); - document.write(''); - document.write(''); + document.write(''); + document.write(''); + document.write(''); document.write(''); document.write('
bolditaliclinkbolditaliclink
'); } Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 27 Jan 2003 13:55:09 -0000 1.17 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 13 Mar 2003 20:25:06 -0000 1.18 @@ -9,7 +9,37 @@ # This is free software distributed under the terms of the GNU Public # License. Full text of the license is available from the GNU Project: # http://www.fsf.org/copyleft/gpl.html +ad_proc -public template::widget {} { + The template::widget namespace contains the code + for the various input widgets. + @see template::widget::ampmFragment + @see template::widget::button + @see template::widget::checkbox + @see template::widget::comment + @see template::widget::currency + @see template::widget::date + @see template::widget::dateFragment + @see template::widget::file + @see template::widget::hidden + @see template::widget::inform + @see template::widget::input + @see template::widget::menu + @see template::widget::monthFragment + @see template::widget::multiselect + @see template::widget::numericRange + @see template::widget::password + @see template::widget::radio + @see template::widget::search + @see template::widget::select + @see template::widget::submit + @see template::widget::text + @see template::widget::textarea + + @see template::element::create +} - + + ad_proc -public template::widget::search { element_reference tag_attributes } { upvar $element_reference element @@ -129,7 +159,7 @@ switch $type { checkbox - radio { # There's a 'subst' done on the contents here - append output "" + append output "" # This is ugly, but it works: Only export the value when we're on a selected option append output "\[ad_decode \$checked \"checked\" \"\" \"\"\]" } Index: openacs-4/packages/calendar/tcl/calendar-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 19 Dec 2002 16:27:11 -0000 1.32 +++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 13 Mar 2003 20:25:27 -0000 1.33 @@ -46,10 +46,6 @@ db_foreach select_monthly_items {} { - # Localize - set start_time [lc_time_fmt $ansi_start_date "%X"] - set end_time [lc_time_fmt $ansi_end_date "%X"] - # Calendar name now set in query # set calendar_name [calendar_get_name $calendar_id] @@ -96,7 +92,7 @@ if {[empty_string_p $item_add_template]} { set day_number_template "$day_template" } else { - set day_number_template "$day_template $item_add_template" + set day_number_template "$day_template     $item_add_template" } return [dt_widget_month -calendar_details $items -date $date \ @@ -147,15 +143,13 @@ set items [ns_set create] - # Find the first day of the week in julian - set current_date_weekday_no [expr [clock format [clock scan $date] -format %w] + 1] - set first_day_of_week_julian [expr [dt_ansi_to_julian_single_arg $date] - (($current_date_weekday_no + 6 - [lc_get firstdayofweek]) % 7)] + # This isn't going to be pretty. First we make it work, though. (ben) + db_1row select_weekday_info {} + # Loop through the calendars db_foreach select_week_items {} { - # Localize - set pretty_start_date [lc_time_fmt $ansi_start_date "%X"] - set pretty_end_date [lc_time_fmt $ansi_end_date "%X"] + ns_log Notice "ONE WEEK ITEM" # now selected from the query # set calendar_name [calendar_get_name $calendar_id] @@ -210,8 +204,8 @@ {-calendar_id_list ""} {-hour_template {$hour}} {-item_template {$item}} - {-prev_nav_template {<}} - {-next_nav_template {>}} + {-prev_nav_template {\"back}} + {-next_nav_template {\"forward}} {-start_hour 0} {-end_hour 23} {-url_stub_callback ""} @@ -243,19 +237,8 @@ set items [ns_set create] - set timezone [lang::conn::timezone] - # Loop through the calendars db_foreach select_day_items {} { - # other date/time formats - set start_hour [lc_time_fmt $ansi_start_date "%H"] - set start_date [lc_time_fmt $ansi_start_date "%H:%M"] - set end_date [lc_time_fmt $ansi_end_date "%H:%M"] - - # Localize - set pretty_start_date [lc_time_fmt $ansi_start_date "%X"] - set pretty_end_date [lc_time_fmt $ansi_end_date "%X"] - # Not needed anymore # set calendar_name [calendar_get_name $calendar_id] @@ -306,6 +289,7 @@ append item " $status_summary " } + # ns_log Notice "bma-calendar: adding $item at $start_hour" ns_set put $items $ns_set_pos [list $start_date $end_date $item] } @@ -362,19 +346,14 @@ } db_foreach select_list_items {} { + ns_log Notice "BMA-CHECK: test $name" set item "$name" set item [subst $item_template] if {$show_calendar_name_p} { append item " ($calendar_name)" } - # Localize - set pretty_date [lc_time_fmt $ansi_start_date "%x"] - set pretty_weekday [lc_time_fmt $ansi_start_date "%A"] - set pretty_start_date [lc_time_fmt $ansi_start_date "%X"] - set pretty_end_date [lc_time_fmt $ansi_end_date "%X"] - ns_set put $items $start_hour [list $pretty_date $pretty_start_date $pretty_end_date $pretty_weekday $item_type $item] } @@ -391,4 +370,83 @@ } +# ad_proc -public list_display { +# {-date ""} +# {-calendar_id_list ""} +# {-item_template {$item}} +# {-url_stub_callback ""} +# {-show_calendar_name_p 1} +# } { +# Creates a list widget +# } { +# if {[empty_string_p $date]} { +# set date [dt_sysdate] +# } + +# set date_format "YYYY-MM-DD HH24:MI" +# set current_date $date + +# # 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 {[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] + +# # Loop through the calendars +# foreach calendar_id $calendar_id_list { +# set calendar_name [calendar_get_name $calendar_id] + +# # In case we need to dispatch to a different URL (ben) +# if {![empty_string_p $url_stub_callback]} { +# set url_stub [$url_stub_callback $calendar_id] +# } + +# db_foreach select_day_items {} { +# # ns_log Notice "bma: one item" +# set item "$pretty_start_date - $pretty_end_date: $name" + +# if {$show_calendar_name_p} { +# append item " ($calendar_name)" +# } + +# set item [subst $item_template] + +# ns_set put $items $start_hour $item +# } + +# } + +# set return_html "Items for [util_AnsiDatetoPrettyDate $date]:

    \n" + +# for {set i 0} {$i <= 23} {incr i} { +# if {$i < 10} { +# set index_hour "0$i" +# } else { +# set index_hour $i +# } + +# while {1} { +# set index [ns_set find $items $index_hour] +# if {$index == -1} { +# break +# } + +# # ns_log Notice "bma: one item found !!" + +# append return_html "
  • [ns_set value $items $index]\n" +# ns_set delete $items $index +# } +# append return_html "

    " +# } + +# append return_html "

" + +# return $return_html +# } + + + }