Index: openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 22 Jan 2002 05:15:39 -0000 1.1
@@ -0,0 +1,97 @@
+
+
+
+ oracle8.1.6
+
+
+
+
+ select to_char(start_date, 'j') as start_date,
+ nvl(e.name, a.name) as name,
+ nvl(e.description, a.description) as description,
+ e.event_id as item_id
+ 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 = :calendar_id
+ )
+
+
+
+
+
+
+
+ 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')-7, 'SUNDAY'))
+ as sunday_of_the_week,
+ to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'))
+ as saturday_of_the_week
+ from dual
+
+
+
+
+
+
+select to_char(start_date, 'J') as start_date,
+ to_char(start_date, 'HH24:MI') as pretty_start_date,
+ to_char(end_date, 'HH24:MI') as pretty_end_date,
+ nvl(e.name, a.name) as name,
+ e.event_id as item_id
+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 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 = :calendar_id
+ )
+
+
+
+
+
+ select to_char(start_date, 'HH24') as start_hour,
+ to_char(start_date, 'HH24:MI') as pretty_start_date,
+ to_char(end_date, 'HH24:MI') as pretty_end_date,
+ nvl(e.name, a.name) as name,
+ e.event_id as item_id
+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 start_date between
+ to_date(:current_date,:date_format) and
+ to_date(:current_date,:date_format) + (24 - 1/3600)/24
+and e.event_id
+in (
+ select cal_item_id
+ from cal_items
+ where on_which_calendar = :calendar_id
+ )
+
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 22 Jan 2002 05:15:39 -0000 1.1
@@ -0,0 +1,170 @@
+
+ad_library {
+
+ Utility functions for Displaying Calendar Things
+
+ @author Ben Adida (ben@openforce)
+ @creation-date Jan 21, 2002
+ @cvs-id $Id: calendar-display-procs.tcl,v 1.1 2002/01/22 05:15:39 ben Exp $
+
+}
+
+namespace eval calendar {
+
+ ad_proc -public one_month_display {
+ {-calendar_id_list ""}
+ {-one_day_link ""}
+ {-one_item_link ""}
+ {-item_add_link ""}
+ {-date ""}
+ } {
+ Creates a month widget with events for that month
+ } {
+ 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]
+
+ # Loop through calendars
+ foreach calendar_id $calendar_id_list {
+ set calendar_name [calendar_get_name $calendar_id]
+
+ db_foreach select_monthly_items {} {
+ set item "$name ($calendar_name)"
+ if {![empty_string_p $one_item_link]} {
+ set item "$item
"
+ }
+
+ ns_set put $items $start_date $item
+ }
+ }
+
+ # Display stuff
+ if {[empty_string_p $one_day_link]} {
+ set one_day_template {$day_number}
+ } else {
+ set one_day_template "\$day_number"
+ }
+
+ if {[empty_string_p $item_add_link]} {
+ set day_number_template "$one_day_template"
+ } else {
+ set day_number_template "ADD $one_day_template"
+ }
+
+ return [dt_widget_month -calendar_details $items -date $date -day_number_template $day_number_template -today_bgcolor #cccccc]
+ }
+
+ ad_proc -public one_week_display {
+ {-calendar_id_list ""}
+ {-one_day_link ""}
+ {-one_item_link ""}
+ {-item_add_link ""}
+ {-date ""}
+ } {
+ Creates a week widget
+ } {
+ 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
+ foreach calendar_id $calendar_id_list {
+ set calendar_name [calendar_get_name $calendar_id]
+
+ db_foreach select_week_items {} {
+ set item "$pretty_start_date - $pretty_end_date: $name ($calendar_name)"
+ if {![empty_string_p $one_item_link]} {
+ set item "$item
"
+ }
+
+ ns_set put $items $start_date $item
+ }
+
+ }
+
+ # display stuff
+ if {[empty_string_p $one_day_link]} {
+ set one_day_template {$day}
+ } else {
+ set one_day_template "\$day"
+ }
+
+ if {[empty_string_p $item_add_link]} {
+ set day_number_template "$one_day_template"
+ } else {
+ set day_number_template "$one_day_template (ADD)"
+ }
+
+ return [dt_widget_week -calendar_details $items -date $date -day_template $day_number_template -today_bgcolor #cccccc]
+
+ }
+
+ ad_proc -public one_day_display {
+ {-date ""}
+ {-calendar_id_list ""}
+ {-one_hour_link ""}
+ {-one_item_link ""}
+ } {
+ Creates a day widget
+ } {
+ 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
+ foreach calendar_id $calendar_id_list {
+ set calendar_name [calendar_get_name $calendar_id]
+
+ db_foreach select_day_items {} {
+ set item "$pretty_start_date - $pretty_end_date: $name ($calendar_name)"
+ if {![empty_string_p $one_item_link]} {
+ set item "$item
"
+ }
+
+ ns_set put $items $start_hour $item
+ }
+
+ }
+
+ return [dt_widget_day -calendar_details $items -date $date]
+
+ }
+
+}