Index: openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs-postgresql.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql 23 May 2003 13:16:08 -0000 1.10 +++ openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql 26 May 2003 09:59:54 -0000 1.11 @@ -3,51 +3,6 @@ postgresql7.1 - - - - select to_char(start_date, 'J') as start_date, - to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, - to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, - coalesce(e.name, a.name) as name, - coalesce(e.description, a.description) as description, - coalesce(e.status_summary, a.status_summary) as status_summary, - e.event_id as item_id, - (select on_which_calendar from cal_items where cal_item_id = e.event_id) as calendar_id, - (select calendar_name from calendars - where calendar_id = (select on_which_calendar from cal_items where cal_item_id= e.event_id)) - as calendar_name - from acs_activities a, - acs_events e, - timespans s, - time_intervals t - where e.timespan_id = s.timespan_id - and s.interval_id = t.interval_id - and e.activity_id = a.activity_id - and e.event_id - in ( - select cal_item_id - from cal_items - where on_which_calendar in ([join $calendar_id_list ","]) - ) - order by start_date,end_date - - - - - - - select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D') - as day_of_the_week, - to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')- '1 week'::interval, 'Sunday'), 'YYYY-MM-DD') - as sunday_of_the_week, - to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'), 'YYYY-MM-DD') - as saturday_of_the_week - from dual - - - - select to_char(start_date, 'J') as start_date_julian, @@ -84,78 +39,6 @@ - - - select to_char(start_date, 'HH24') as start_hour, - to_char(start_date, 'HH24:MI') as start_date, - to_char(end_date, 'HH24:MI') as end_date, - to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, - to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, - coalesce(e.name, a.name) as name, - coalesce(e.status_summary, a.status_summary) as status_summary, - e.event_id as item_id, - (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, - on_which_calendar as calendar_id, - (select calendar_name from calendars - where calendar_id = on_which_calendar) - as calendar_name -from acs_activities a, - acs_events e, - timespans s, - time_intervals t, - cal_items -where e.timespan_id = s.timespan_id -and s.interval_id = t.interval_id -and e.activity_id = a.activity_id -and start_date between - to_date(:current_date,:date_format) and - to_date(:current_date,:date_format) + cast('23 hours 59 minutes 59 seconds' as interval) -and cal_items.cal_item_id= e.event_id -and e.event_id -in ( - select cal_item_id - from cal_items - where on_which_calendar in ([join $calendar_id_list ","]) - ) - - - - - - - select to_char(start_date, 'HH24') as start_hour, - to_char(start_date, 'YYYY-MM-DD') as pretty_start_date, - to_char(start_date, 'HH24:MI:SS') as start_time, - to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, - to_char(end_date, 'YYYY-MM-DD') as pretty_end_date, - to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, - coalesce(e.name, a.name) as name, - e.event_id as item_id, - (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, - to_char(start_date, 'Day') as pretty_weekday -from acs_activities a, - acs_events e, - timespans s, - time_intervals t, - cal_items -where e.timespan_id = s.timespan_id -and s.interval_id = t.interval_id -and e.activity_id = a.activity_id -and cal_items.cal_item_id= e.event_id -and (start_date > to_date(:start_date,:date_format) or :start_date is null) and - (start_date < to_date(:end_date,:date_format) or :end_date is null) -and e.event_id -in ( - select cal_item_id - from cal_items - where on_which_calendar = :calendar_id - ) -order by $sort_by - - - - - select to_char(start_date, 'HH24') as start_hour, 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.34 -r1.35 --- openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 17 May 2003 10:20:50 -0000 1.34 +++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 26 May 2003 09:59:54 -0000 1.35 @@ -14,103 +14,6 @@ namespace eval calendar { - ad_proc -public one_month_display { - {-calendar_id_list ""} - {-day_template "\$day_number"} - {-item_template "\$item"} - {-item_add_template ""} - {-date ""} - {-url_stub_callback ""} - {-show_calendar_name_p 1} - {-prev_month_template ""} - {-next_month_template ""} - } { - 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. - } { - if {[empty_string_p $date]} { - set date [dt_systime] - } - - # 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] - - - 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 {![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) - } - - set item "$name" - set item "[subst $item_template]" - - if {![dt_no_time_p -start_time $start_time -end_time $end_time]} { - set item "$start_time $item" - } - - 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 - } - - - # Display stuff - if {[empty_string_p $item_add_template]} { - set day_number_template "$day_template" - } else { - set day_number_template "$day_template     $item_add_template" - } - - return [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 \ - -prev_month_template $prev_month_template \ - -next_month_template $next_month_template \ - -day_number_template $day_number_template] - } - ad_proc -public one_week_display { {-calendar_id_list ""} {-day_template "\$day   -   \$pretty_date"} @@ -171,7 +74,7 @@ if {[dt_no_time_p -start_time $start_date -end_time $end_date]} { set time_details "" } else { - set time_details "$pretty_start_date - $pretty_end_date:" + set time_details "$ansi_start_date - $ansi_end_date:" } set item "$time_details $item_details" @@ -269,7 +172,7 @@ set item $name set item_subst [subst $item_template] - if {[dt_no_time_p -start_time $pretty_start_date -end_time $pretty_end_date]} { + if {[dt_no_time_p -start_time $ansi_start_date -end_time $ansi_end_date]} { # Hack for no-time items set item "$item_subst" if {![empty_string_p $item_details]} { @@ -278,7 +181,7 @@ set ns_set_pos "X" } else { - set item "$pretty_start_date - $pretty_end_date: $item_subst" + set item "$ansi_start_date - $ansi_end_date: $item_subst" if {![empty_string_p $item_details]} { append item " ($item_details)" } @@ -306,147 +209,4 @@ -calendar_details $items -date $date -overlap_p 1] } - - ad_proc -public list_display { - {-date ""} - {-start_date ""} - {-end_date ""} - {-calendar_id_list ""} - {-item_template {$item}} - {-url_template {?sort_by=$order_by}} - {-url_stub_callback ""} - {-show_calendar_name_p 1} - {-sort_by "item_type"} - } { - create a list display of items - } { - # 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]]] - } - - # sort by cannot be empty - if {[empty_string_p $sort_by]} { - set sort_by "item_type" - } - - set date_format "YYYY-MM-DD HH24:MI" - set current_date $date - 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_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)" - } - - ns_set put $items $start_hour [list $pretty_date $pretty_start_date $pretty_end_date $pretty_weekday $item_type $item] - } - - } - - # Now we have the items in a big ns_set - # We call the widget maker - return [dt_widget_list -order_by $sort_by \ - -item_template $item_template \ - -calendar_details $items \ - -start_date $start_date \ - -end_date $end_date \ - -url_template $url_template] - - } - -# 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 -# } - - - } Index: openacs-4/packages/calendar/www/cal-item-delete-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-delete-confirm.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/calendar/www/cal-item-delete-confirm.tcl 18 Nov 2002 18:01:11 -0000 1.5 +++ openacs-4/packages/calendar/www/cal-item-delete-confirm.tcl 26 May 2003 10:00:10 -0000 1.6 @@ -21,6 +21,6 @@ set cal_item(no_time_p) [dt_no_time_p -start_time $cal_item(start_time) -end_time $cal_item(end_time)] # cal nav -set cal_nav [dt_widget_calendar_navigation -link_current_view "view" day $cal_item(start_date) "calendar_id="] +set cal_nav [dt_widget_calendar_navigation "view" day $cal_item(start_date) "calendar_id="] ad_return_template Index: openacs-4/packages/calendar/www/cal-item-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-edit.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/calendar/www/cal-item-edit.tcl 19 Dec 2002 16:27:22 -0000 1.16 +++ openacs-4/packages/calendar/www/cal-item-edit.tcl 26 May 2003 10:00:10 -0000 1.17 @@ -102,7 +102,7 @@ } -set cal_nav [dt_widget_calendar_navigation -link_current_view "view" day $cal_item(start_date) "calendar_id"] +set cal_nav [dt_widget_calendar_navigation "view" day $cal_item(start_date) "calendar_id"] ad_return_template Index: openacs-4/packages/calendar/www/cal-item-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/calendar/www/cal-item-new.adp 18 Nov 2002 18:01:11 -0000 1.6 +++ openacs-4/packages/calendar/www/cal-item-new.adp 26 May 2003 10:00:10 -0000 1.7 @@ -8,13 +8,12 @@

- @cal_nav@ + @cal_nav;noquote@

- Index: openacs-4/packages/calendar/www/cal-item-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/calendar/www/cal-item-new.tcl 17 May 2003 10:21:14 -0000 1.7 +++ openacs-4/packages/calendar/www/cal-item-new.tcl 26 May 2003 10:00:10 -0000 1.8 @@ -115,6 +115,6 @@ } } -set cal_nav [dt_widget_calendar_navigation -link_current_view "view" day $date "calendar_id=$calendar_id"] +set cal_nav [dt_widget_calendar_navigation "view" day $date "calendar_id=$calendar_id"] ad_return_template Index: openacs-4/packages/calendar/www/cal-item-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-view.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/calendar/www/cal-item-view.tcl 18 Nov 2002 18:01:11 -0000 1.9 +++ openacs-4/packages/calendar/www/cal-item-view.tcl 26 May 2003 10:00:10 -0000 1.10 @@ -49,7 +49,7 @@ } # cal nav -set cal_nav [dt_widget_calendar_navigation -link_current_view "view" day $cal_item(start_date) "calendar_id="] +set cal_nav [dt_widget_calendar_navigation "view" day $cal_item(start_date) "calendar_id="] ad_return_template Index: openacs-4/packages/calendar/www/cal-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/calendar/www/cal-item.tcl 13 Sep 2002 10:43:59 -0000 1.13 +++ openacs-4/packages/calendar/www/cal-item.tcl 26 May 2003 10:00:10 -0000 1.14 @@ -115,8 +115,6 @@ set cal_item_types [calendar::get_item_types -calendar_id $force_calendar_id] # forced error checking - set name [ad_quotehtml $name] - set description [ad_quotehtml $description] } elseif { [string equal $action "add"] } { # get calendar names that user has calendar Index: openacs-4/packages/calendar/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/index.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/calendar/www/index.tcl 30 Nov 2002 17:28:09 -0000 1.10 +++ openacs-4/packages/calendar/www/index.tcl 26 May 2003 10:00:10 -0000 1.11 @@ -26,7 +26,7 @@ if {![db_string private_calendar_count_qry {}]} { # Create a personal calendar for the user - calendar::new -owner_id $user_id -private_p "t" -calendar_name "Personal" -package_id $package_id +# calendar::new -owner_id $user_id -private_p "t" -calendar_name "Personal" -package_id $package_id } ad_returnredirect "view" Index: openacs-4/packages/calendar/www/view-list-display-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/view-list-display-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-list-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,42 @@ + + + + postgresql7.1 + + + + select to_char(start_date, 'HH24') as start_hour, + to_char(start_date, 'YYYY-MM-DD') as pretty_start_date, + to_char(start_date, 'HH24:MI:SS') as start_time, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(end_date, 'YYYY-MM-DD') as pretty_end_date, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + coalesce(e.name, a.name) as name, + e.event_id as item_id, + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + to_char(start_date, 'Day') as pretty_weekday +from acs_activities a, + acs_events e, + timespans s, + time_intervals t, + cal_items +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and cal_items.cal_item_id= e.event_id +and (start_date > to_date(:start_date,:date_format) or :start_date is null) and + (start_date < to_date(:end_date,:date_format) or :end_date is null) +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + ) +order by $sort_by + + + + + + + Index: openacs-4/packages/calendar/www/view-list-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-list-display.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-list-display.adp 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,14 @@ +@title@

+ + + + + + + + + + +@return_html;noquote@ +
Day of WeekDateStart TimeEnd TimeTypeTitle
+ Index: openacs-4/packages/calendar/www/view-list-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-list-display.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-list-display.tcl 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,92 @@ +# 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]]] +} + +# sort by cannot be empty +if {[empty_string_p $sort_by]} { + set sort_by "item_type" +} + +set date_format "YYYY-MM-DD HH24:MI" + +# The title +if {[empty_string_p $start_date] && [empty_string_p $end_date]} { + #This used to be All Items but that was just taking up space and not adding value so now we assume All Items and only give a title if its something else. - Caroline@meekshome.com + set title "" +} + +if {[empty_string_p $start_date] && ![empty_string_p $end_date]} { + set title "Items until [util_AnsiDatetoPrettyDate $end_date]" +} + +if {![empty_string_p $start_date] && [empty_string_p $end_date]} { + set title "Items starting [util_AnsiDatetoPrettyDate $start_date]" +} + +if {![empty_string_p $start_date] && ![empty_string_p $end_date]} { + set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]" +} + +set return_html "" + +# Prepare the templates +set url_template "view?view=list&sort_by=\$sort_by" +set real_sort_by $sort_by +set sort_by "item_type" +set item_type_url [subst $url_template] +set sort_by "start_date" +set start_date_url [subst $url_template] + +# initialize the item_type so we can do intermediate titles +set old_item_type "" + +set flip 0 + +# Loop through the events, and add them +foreach calendar_id $calendar_id_list { + set calendar_name [calendar_get_name $calendar_id] + + db_foreach select_list_items {} { + set item_details "$name ($calendar_name)" + # Adjust the display of no-time items + if {[dt_no_time_p -start_time $pretty_start_date -end_time $pretty_end_date]} { + set start_time "--" + set end_time "--" + } + + # Do we need a title? + if {$real_sort_by == "item_type" && $item_type != "$old_item_type"} { + if {[empty_string_p $item_type]} { + set item_type_for_title "(No Item Type)" + } else { + set item_type_for_title $item_type + } + append return_html "$item_type_for_title\n" + set flip 0 + } + + set old_item_type $item_type + + if {[expr $flip % 2] == 0} { + set z_class odd + } else { + set z_class even + } + + append return_html " + $pretty_weekday$pretty_start_date$pretty_start_date$pretty_end_date" + + if {$real_sort_by != "item_type"} { + append return_html "$item_type" + } + + append return_html "$item_details\n" + incr flip + } +} + + + Index: openacs-4/packages/calendar/www/view-month-display-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/view-month-display-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-month-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,40 @@ + + + + postgresql7.1 + + + + select to_char(start_date, 'J') as start_date, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + coalesce(e.name, a.name) as name, + coalesce(e.description, a.description) as description, + coalesce(e.status_summary, a.status_summary) as status_summary, + e.event_id as item_id, + (select on_which_calendar from cal_items where cal_item_id = e.event_id) as calendar_id, + (select calendar_name from calendars + where calendar_id = (select on_which_calendar from cal_items where cal_item_id= e.event_id)) + as calendar_name + from acs_activities a, + acs_events e, + timespans s, + time_intervals t + where e.timespan_id = s.timespan_id + and s.interval_id = t.interval_id + and e.activity_id = a.activity_id + and e.event_id + in ( + select cal_item_id + from cal_items + where on_which_calendar in ([join $calendar_id_list ","]) + ) + order by start_date,end_date + + + + + + + + Index: openacs-4/packages/calendar/www/view-month-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-month-display.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-month-display.adp 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1 @@ +@foobar;noquote@ 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-month-display.tcl 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,89 @@ +# 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. + + +if {![info exists date] || [empty_string_p $date]} { + set date [dt_systime] +} + +if {![info exists day_template] || [empty_string_p $day_template]} { + set day_template "\$day_number" +} + +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] +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) + } + + 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 {$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 +} + + +# 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] + Index: openacs-4/packages/calendar/www/view-one-day-display-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/view-one-day-display-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-one-day-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,44 @@ + + + + postgresql7.1 + + + + select to_char(start_date, 'HH24') as start_hour, + to_char(start_date, 'HH24:MI') as start_date, + to_char(end_date, 'HH24:MI') as end_date, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + coalesce(e.name, a.name) as name, + coalesce(e.status_summary, a.status_summary) as status_summary, + e.event_id as item_id, + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + on_which_calendar as calendar_id, + (select calendar_name from calendars + where calendar_id = on_which_calendar) + as calendar_name +from acs_activities a, + acs_events e, + timespans s, + time_intervals t, + cal_items +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and start_date between + to_date(:current_date,:date_format) and + to_date(:current_date,:date_format) + cast('23 hours 59 minutes 59 seconds' as interval) +and cal_items.cal_item_id= e.event_id +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar in ([join $calendar_id_list ","]) + ) + + + + + + Index: openacs-4/packages/calendar/www/view-one-day-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-one-day-display.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-one-day-display.adp 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1 @@ +@foobar;noquote@ Index: openacs-4/packages/calendar/www/view-one-day-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-one-day-display.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-one-day-display.tcl 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,88 @@ +set widget_start_hour $start_hour +set widget_end_hour $end_hour + +set date_format "YYYY-MM-DD HH24:MI" + +if {[empty_string_p $date]} { + set date [dt_sysdate] +} + +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 +db_foreach select_day_items {} { + # Not needed anymore + # 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]} { + # 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) + } + + set item_details "" + + if {$show_calendar_name_p} { + append item_details $calendar_name + } + + if {![empty_string_p $item_type]} { + if {![empty_string_p $item_details]} { + append item_details " - " + } + + append item_details "$item_type" + } + + set item $name + set item_subst [subst $item_template] + + if {[dt_no_time_p -start_time $ansi_start_date -end_time $ansi_end_date]} { + # Hack for no-time items + set item "$item_subst" + if {![empty_string_p $item_details]} { + append item " ($item_details)" + } + + set ns_set_pos "X" + } else { + set item "$ansi_start_date - $ansi_end_date: $item_subst" + if {![empty_string_p $item_details]} { + append item " ($item_details)" + } + set ns_set_pos $start_hour + } + + if { [string length $status_summary] > 0 } { + 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] +} + +set hour {$display_hour} +set start_time {$hour} +set end_time {$next_hour} + +set hour_template [subst $hour_template] + +set foobar [dt_widget_day -hour_template $hour_template \ + -prev_nav_template $prev_nav_template \ + -next_nav_template $next_nav_template \ + -start_hour $widget_start_hour -end_hour $widget_end_hour \ + -calendar_details $items -date $date -overlap_p 1] + Index: openacs-4/packages/calendar/www/view-week-display-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-week-display-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-week-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,56 @@ + + + + postgresql7.1 + + + + select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D') + as day_of_the_week, + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')- '1 week'::interval, 'Sunday'), 'YYYY-MM-DD') + as sunday_of_the_week, + to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'), 'YYYY-MM-DD') + as saturday_of_the_week + from dual + + + + + +select to_char(start_date, 'J') as start_date_julian, + to_char(start_date,'HH24:MI') as start_date, + to_char(end_date,'HH24:MI') as end_date, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_start_date, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as ansi_end_date, + coalesce(e.name, a.name) as name, + coalesce(e.status_summary, a.status_summary) as status_summary, + e.event_id as item_id, + (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type, + (select on_which_calendar from cal_items where cal_item_id = e.event_id) as calendar_id, + (select calendar_name from calendars + where calendar_id = (select on_which_calendar from cal_items where cal_item_id= e.event_id)) + as calendar_name +from acs_activities a, + acs_events e, + timespans s, + time_intervals t, + cal_items +where e.timespan_id = s.timespan_id +and s.interval_id = t.interval_id +and e.activity_id = a.activity_id +and e.event_id = cal_items.cal_item_id +and start_date between + to_date(:sunday_of_the_week,'YYYY-MM-DD') and + to_date(:saturday_of_the_week,'YYYY-MM-DD') +and e.event_id +in ( + select cal_item_id + from cal_items + where on_which_calendar in ([join $calendar_id_list ","]) + ) + + + + + + Index: openacs-4/packages/calendar/www/view-week-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-week-display.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-week-display.adp 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1 @@ +@foobar;noquote@ Index: openacs-4/packages/calendar/www/view-week-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-week-display.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/view-week-display.tcl 26 May 2003 10:00:10 -0000 1.1 @@ -0,0 +1,64 @@ + if {[empty_string_p $date]} { + set date [dt_sysdate] + } + + 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] + + # 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 {} { + ns_log Notice "ONE WEEK ITEM" + + # now selected from the query + # 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]} { + # 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) + } + + set item "$name" + set item_details "[subst $item_template]" + + # Add time details + if {[dt_no_time_p -start_time $start_date -end_time $end_date]} { + set time_details "" + } else { + set time_details "$ansi_start_date - $ansi_end_date:" + } + + set item "$time_details $item_details" + + if {$show_calendar_name_p} { + append item "($calendar_name)
" + } + + if { [string length $status_summary] > 0 } { + append item " $status_summary " + } + + ns_set put $items $start_date_julian $item + } + + # display stuff + +set day_template "\$day - \$pretty_date     ([_ calendar.Add_Item])" + +set foobar [dt_widget_week -calendar_details $items -date $date -day_template $day_template ] Index: openacs-4/packages/calendar/www/view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/calendar/www/view.adp 22 May 2003 14:25:22 -0000 1.8 +++ openacs-4/packages/calendar/www/view.adp 26 May 2003 10:00:10 -0000 1.9 @@ -14,8 +14,42 @@ - @cal_stuff@ + + + + + + + + + + + + + + + + Index: openacs-4/packages/calendar/www/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/calendar/www/view.tcl 17 May 2003 10:21:14 -0000 1.10 +++ openacs-4/packages/calendar/www/view.tcl 26 May 2003 10:00:10 -0000 1.11 @@ -60,15 +60,6 @@ set next_link ">" } } - - set cal_stuff [calendar::one_day_display \ - -prev_nav_template $previous_link \ - -next_nav_template $next_link \ - -item_template $item_template \ - -hour_template $hour_template \ - -date $date -start_hour 7 -end_hour 22 \ - -calendar_id_list $calendar_list] - } if {$view == "week"} { @@ -94,15 +85,6 @@ set next_link ">" } } - - set cal_stuff [calendar::one_week_display \ - -item_template $item_template \ - -day_template "\$day - \$pretty_date     ([_ calendar.Add_Item])" \ - -date $date \ - -calendar_id_list $calendar_list \ - -prev_week_template $previous_link \ - -next_week_template $next_link] - } if {$view == "month"} { @@ -129,14 +111,6 @@ } } - set cal_stuff [calendar::one_month_display \ - -item_template "$item_template" \ - -day_template "\$day_number" \ - -date $date \ - -item_add_template "$item_add_template" \ - -calendar_id_list $calendar_list \ - -prev_month_template $previous_link \ - -next_month_template $next_link] } if {$view == "list"} { @@ -145,15 +119,7 @@ set ansi_year [lindex $ansi_list 0] set ansi_month [string trimleft [lindex $ansi_list 1] "0"] set ansi_day [string trimleft [lindex $ansi_list 2] "0"] - set end_date [dt_julian_to_ansi [expr [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + 1]] - set cal_stuff [calendar::list_display \ - -item_template $item_template \ - -start_date $start_date \ - -end_date $end_date \ - -date $date \ - -calendar_id_list $calendar_list \ - -sort_by $sort_by \ - -url_template "view?view=list&sort_by=\$order_by"] + set end_date [dt_julian_to_ansi [expr [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + 31]] } set cal_nav [dt_widget_calendar_navigation "view" $view $date "calendar_list="]