Fisheye: Tag 1.6 refers to a dead (removed) revision in file `openacs-4/packages/calendar/www/view-list-display-oracle.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/calendar/www/view-list-display-postgresql.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
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 -r1.17 -r1.18
--- openacs-4/packages/calendar/www/view-list-display.tcl	9 Jan 2004 23:11:23 -0000	1.17
+++ openacs-4/packages/calendar/www/view-list-display.tcl	10 Jan 2004 00:19:03 -0000	1.18
@@ -78,8 +78,20 @@
 
 set last_pretty_start_date ""
 # Loop through the events, and add them
-    
-db_foreach select_list_items {} {
+
+set interval_limitation_clause " to_timestamp(:start_date,'YYYY-MM-DD HH24:MI:SS')  and      to_timestamp(:end_date, 'YYYY-MM-DD HH24:MI:SS')"
+
+set order_by_clause " order by $sort_by"
+set additional_limitations_clause ""
+
+if {[string match [db_type] "postgresql"]} {
+    set sysdate "now()"
+} else {
+    set sysdate "sysdate"
+}
+set additional_select_clause " , to_char($sysdate, 'YYYY-MM-DD HH24:MI:SS') as ansi_today, recurrence_id"
+
+db_foreach dbqd.calendar.www.views.select_items {} {
     # Timezonize
     set ansi_start_date [lc_time_system_to_conn $ansi_start_date]
     set ansi_end_date [lc_time_system_to_conn $ansi_end_date]
Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/calendar/www/view-month-display-oracle.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/calendar/www/view-month-display-postgresql.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
Index: openacs-4/packages/calendar/www/view-month-display.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-month-display.tcl,v
diff -u -r1.12 -r1.13
--- openacs-4/packages/calendar/www/view-month-display.tcl	9 Jan 2004 23:11:23 -0000	1.12
+++ openacs-4/packages/calendar/www/view-month-display.tcl	10 Jan 2004 00:19:03 -0000	1.13
@@ -103,8 +103,13 @@
 
 set current_day $first_julian_date_of_month
 
-db_foreach select_monthly_items {} {
+# Set the necessary variables for the unified calendar query in views.xql.
+set interval_limitation_clause " to_timestamp(:first_date_of_month_system,'YYYY-MM-DD HH24:MI:SS')  and      to_timestamp(:last_date_in_month_system, 'YYYY-MM-DD HH24:MI:SS')"
+set order_by_clause " order by ansi_start_date, ansi_end_date"
+set additional_limitations_clause ""
+set additional_select_clause ""
 
+db_foreach dbqd.calendar.www.views.select_items {} {
     # Convert from system timezone to user timezone
     set ansi_start_date [lc_time_system_to_conn $ansi_start_date]
     set ansi_end_date [lc_time_system_to_conn $ansi_end_date]
Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/calendar/www/view-one-day-display-oracle.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.12 refers to a dead (removed) revision in file `openacs-4/packages/calendar/www/view-one-day-display-postgresql.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
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 -r1.24 -r1.25
--- openacs-4/packages/calendar/www/view-one-day-display.tcl	9 Jan 2004 23:11:23 -0000	1.24
+++ openacs-4/packages/calendar/www/view-one-day-display.tcl	10 Jan 2004 00:19:03 -0000	1.25
@@ -71,7 +71,13 @@
 # Loop through the items without time
 multirow create day_items_without_time name status_summary item_id calendar_name full_item
 
-db_foreach select_day_items {} {
+# Set the necessary variables for the unified calendar query in views.xql.
+set interval_limitation_clause " to_date(:current_date_system,'YYYY-MM-DD HH24:MI:SS') and to_date(:current_date_system,'YYYY-MM-DD HH24:MI:SS') + cast('23 hours 59 minutes 59 seconds' as interval)"
+set additional_limitations_clause " and to_char(start_date, 'HH24:MI') = '00:00' and  to_char(end_date, 'HH24:MI') = '00:00'"
+set additional_select_clause ""
+set order_by_clause " order by name"
+
+db_foreach dbqd.calendar.www.views.select_items {} {
     # reset url stub
     set url_stub ""
     
@@ -107,8 +113,10 @@
 }
 
 
+set additional_limitations_clause " and (to_char(start_date, 'HH24:MI') <> '00:00' or to_char(end_date, 'HH24:MI') <> '00:00')"
+set order_by_clause " order by to_char(start_date,'HH24')"
 set day_items_per_hour {}
-db_foreach select_day_items_with_time {} {
+db_foreach dbqd.calendar.www.views.select_items {} {
     set ansi_start_date [lc_time_system_to_conn $ansi_start_date]
     set ansi_end_date [lc_time_system_to_conn $ansi_end_date]
 
@@ -201,8 +209,7 @@
     }
 }
 
-# Select some basic stuff, sets day_of_the_week, yesterday, tomorrow vars
-db_1row select_day_info {}
+db_1row dbqd.calendar.www.views.select_day_info {}
 
 # Check that the previous and next days are in the tcl boundaries
 # so that the calendar widget doesn't bomb when it creates the next/prev links
Index: openacs-4/packages/calendar/www/view-week-display-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-week-display-oracle.xql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/calendar/www/view-week-display-oracle.xql	9 Jan 2004 23:11:23 -0000	1.5
+++ openacs-4/packages/calendar/www/view-week-display-oracle.xql	10 Jan 2004 00:19:03 -0000	1.6
@@ -15,37 +15,6 @@
 </querytext>
 </fullquery>
 
-<fullquery name="select_week_items">
-<querytext>
-select   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,
-         trunc(start_date - to_date(:first_weekday_of_the_week_tz,
-         'YYYY-MM-DD HH24:MI:SS')) as day_of_week,
-         nvl(e.name, a.name) as name,
-         nvl(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= ci.item_type_id) as item_type,
-         cals.calendar_id,
-	 cals.calendar_name
-from     acs_activities a,
-         acs_events e,
-         timespans s,
-         time_intervals t,
-         cal_items ci,
-         calendars cals
-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(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') and
-         to_date(:last_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS')
-and      cals.calendar_id = ci.on_which_calendar
-and      e.event_id = ci.cal_item_id
-$calendars_clause
-order by to_char(start_date, 'J'), to_char(start_date,'HH24:MI')
-</querytext>
-</fullquery>
-
 <fullquery name="select_week_info">
 <querytext>
 select  to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D') as day_of_the_week, 
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 -r1.8 -r1.9
--- openacs-4/packages/calendar/www/view-week-display-postgresql.xql	9 Jan 2004 23:11:23 -0000	1.8
+++ openacs-4/packages/calendar/www/view-week-display-postgresql.xql	10 Jan 2004 00:19:03 -0000	1.9
@@ -15,15 +15,9 @@
 </querytext>
 </fullquery>
 
+
 <fullquery name="select_week_items">
 <querytext>
-select   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,
-         (to_date(start_date,'YYYY-MM-DD HH24:MI:SS')  - to_date(:first_weekday_of_the_week_tz,
-         'YYYY-MM-DD HH24:MI:SS')) as day_of_week,
          (select type from cal_item_types where item_type_id= cal_items.item_type_id) as item_type,
          cals.calendar_id,
 	 cals.calendar_name
@@ -37,12 +31,8 @@
 and      s.interval_id = t.interval_id
 and      e.activity_id = a.activity_id
 and      start_date between
-         to_date(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') and
-         to_date(:last_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS')
-and      cals.calendar_id = ci.on_which_calendar
-and      e.event_id = ci.cal_item_id
-$calendars_clause
-order by to_char(start_date, 'J'), to_char(start_date,'HH24:MI')
+
+
 </querytext>
 </fullquery>
 
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 -r1.13 -r1.14
--- openacs-4/packages/calendar/www/view-week-display.tcl	9 Jan 2004 23:11:23 -0000	1.13
+++ openacs-4/packages/calendar/www/view-week-display.tcl	10 Jan 2004 00:19:03 -0000	1.14
@@ -62,7 +62,11 @@
 set first_weekday_of_the_week_tz [lc_time_conn_to_system "$first_weekday_of_the_week 00:00:00"]
 set last_weekday_of_the_week_tz [lc_time_conn_to_system "$last_weekday_of_the_week 00:00:00"]
 
-db_foreach select_week_items {} {
+set order_by_clause " order by to_char(start_date, 'J'), to_char(start_date,'HH24:MI')"
+set interval_limitation_clause " to_date(:first_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS') and to_date(:last_weekday_of_the_week_tz, 'YYYY-MM-DD HH24:MI:SS')"
+set additional_limitations_clause ""
+set additional_select_clause " , (to_date(start_date,'YYYY-MM-DD HH24:MI:SS')  - to_date(:first_weekday_of_the_week_tz,         'YYYY-MM-DD HH24:MI:SS')) as day_of_week"
+db_foreach dbqd.calendar.www.views.select_items {} {
     # Convert from system timezone to user timezone
     set ansi_start_date [lc_time_system_to_conn $ansi_start_date]
     set ansi_end_date [lc_time_system_to_conn $ansi_end_date]
Index: openacs-4/packages/calendar/www/views-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/views-oracle.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar/www/views-oracle.xql	10 Jan 2004 00:19:03 -0000	1.1
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+<queryset>
+   <rdbms><type>oracle</type><version>8.1.6</version></rdbms>
+
+<fullquery name="select_items">
+<querytext>
+	select 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,
+         trunc(start_date - to_date(:first_weekday_of_the_week_tz,
+         'YYYY-MM-DD HH24:MI:SS')) as day_of_week,
+         nvl(e.name, a.name) as name,
+         nvl(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= ci.item_type_id) as item_type,
+	 cals.calendar_id,
+	 cals.calendar_name
+from     acs_activities a,
+         acs_events e,
+         timespans s,
+         time_intervals t,
+         cal_items ci,
+         calendars cals
+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_system,'YYYY-MM-DD HH24:MI:SS') and
+         (to_date(:current_date_system,'YYYY-MM-DD HH24:MI:SS') + (:end_display_hour - 1/3600)/:end_display_hour)
+and      ci.cal_item_id = e.event_id
+and      (to_char(start_date, 'HH24:MI') <> '00:00' or
+          to_char(end_date, 'HH24:MI') <> '00:00')
+and      cals.calendar_id = ci.on_which_calendar
+and      e.event_id = ci.cal_item_id
+$additional_limitations_clause
+$calendars_clause
+$order_by_clause
+</querytext>
+</fullquery>
+	
+<fullquery name="select_day_info">      
+<querytext>
+select   to_char(to_date(:current_date, 'yyyy-mm-dd'), 'Day, DD Month YYYY') 
+as day_of_the_week,
+to_char((to_date(:current_date, 'yyyy-mm-dd') - 1), 'yyyy-mm-dd')
+as yesterday,
+to_char((to_date(:current_date, 'yyyy-mm-dd') + 1), 'yyyy-mm-dd')
+as tomorrow
+from     dual
+</querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/calendar/www/views-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/views-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar/www/views-postgresql.xql	10 Jan 2004 00:19:03 -0000	1.1
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+
+<queryset>
+   <rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+<fullquery name="select_items">
+<querytext>
+select   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= ci.item_type_id) as item_type,
+	 cals.calendar_id,
+	 cals.calendar_name
+$additional_select_clause
+from     acs_activities a,
+         acs_events e,
+         timespans s,
+         time_intervals t,
+         cal_items ci,
+         calendars cals
+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 $interval_limitation_clause
+and      ci.cal_item_id= e.event_id
+and      cals.calendar_id = ci.on_which_calendar
+and      e.event_id = ci.cal_item_id
+$additional_limitations_clause
+$calendars_clause
+$order_by_clause
+</querytext>
+</fullquery>
+
+<fullquery name="select_day_info">      
+<querytext>
+  select   to_char(to_date(:current_date, 'yyyy-mm-dd'), 
+    'Day, DD Month YYYY') as day_of_the_week,
+  to_char(to_date(:current_date, 'yyyy-mm-dd') - 
+    cast('1 day' as interval), 'yyyy-mm-dd')   as yesterday,
+  to_char(to_date(:current_date, 'yyyy-mm-dd') + 
+    cast('1 day' as interval), 'yyyy-mm-dd')
+  as tomorrow
+from     dual
+</querytext>
+</fullquery>
+
+</queryset>