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.2 -r1.3
--- openacs-4/packages/calendar/www/view-week-display-oracle.xql 14 Aug 2003 15:44:08 -0000 1.2
+++ openacs-4/packages/calendar/www/view-week-display-oracle.xql 21 Sep 2003 22:14:07 -0000 1.3
@@ -5,20 +5,22 @@
- select to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D')
+ select to_char(to_date(:start_date, 'yyyy-mm-dd'), 'D')
as day_of_the_week,
- to_char(next_day(to_date(:start_date, 'YYYY-MM-DD')-7, 'SUNDAY'))
- as sunday_of_the_week,
- to_char(next_day(to_date(:start_date, 'YYYY-MM-DD'), 'Saturday'))
- as saturday_of_the_week
- from dual
+ to_char(next_day(to_date(:start_date, 'yyyy-mm-dd')-7, :first_us_weekday))
+ as first_weekday_of_the_week,
+ to_char(next_day(to_date(:start_date, 'yyyy-mm-dd'), :last_us_weekday))
+ as last_weekday_of_the_week
+ from dual
select to_char(start_date, :ansi_date_format) as ansi_start_date,
to_char(end_date, :ansi_date_format) as ansi_end_date,
+ trunc(start_date - to_date(:first_weekday_of_the_week_tz,
+ :ansi_date_format)) 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,
@@ -34,10 +36,10 @@
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_system, :ansi_date_format) and
- to_date(:saturday_of_the_week_system, :ansi_date_format)
and cals.package_id= :package_id
+and start_date between
+ to_date(:first_weekday_of_the_week_tz, :ansi_date_format) and
+ to_date(:last_weekday_of_the_week_tz, :ansi_date_format)
and (cals.private_p='f' or (cals.private_p='t' and cals.owner_id= :user_id))
and cals.calendar_id = ci.on_which_calendar
and e.event_id = ci.cal_item_id
@@ -47,26 +49,16 @@
-select to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D') as day_of_the_week,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') as sunday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday'),'J') as sunday_julian,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 1 as monday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 1,'J') as monday_julian,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 2 as tuesday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 2,'J') as tuesday_julian,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 3 as wednesday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 3,'J') as wednesday_julian,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 4 as thursday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 4,'J') as thursday_julian,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 5 as friday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 5,'J') as friday_julian,
-next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 6 as saturday_date,
-to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, 'Sunday') + 6,'J') as saturday_julian,
+select to_char(to_date(:start_date, 'YYYY-MM-DD'), 'D') as day_of_the_week,
+next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday) as first_weekday_date,
+to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday),'J') as first_weekday_julian,
+next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday) + 6 as last_weekday_date,
+to_char(next_day(to_date(:start_date, 'YYYY-MM-DD') - 7, :first_us_weekday) + 6,'J') as last_weekday_julian,
to_char(to_date(:start_date) - 7, 'YYYY-MM-DD') as last_week,
to_char(to_date(:start_date) - 7, 'Month DD, YYYY') as last_week_pretty,
to_char(to_date(:start_date) + 7, 'YYYY-MM-DD') as next_week,
to_char(to_date(:start_date) + 7, 'Month DD, YYYY') as next_week_pretty
-from dual
+from dual