Index: openacs-4/packages/calendar/calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/calendar.info,v diff -u -r1.17 -r1.18 --- openacs-4/packages/calendar/calendar.info 17 May 2003 10:19:55 -0000 1.17 +++ openacs-4/packages/calendar/calendar.info 21 Jul 2003 19:21:36 -0000 1.18 @@ -6,12 +6,8 @@ Calendars f f - + - - oracle - postgresql - Lilian Tong Charles Mok straight port @@ -21,11 +17,13 @@ - + + + - + Index: openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl 4 Dec 2002 09:44:35 -0000 1.7 +++ openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl 21 Jul 2003 19:21:36 -0000 1.8 @@ -70,6 +70,8 @@ set row(pretty_day_of_week) [lc_time_fmt $row(ansi_start_date) "%A"] set row(day_of_month) [lc_time_fmt $row(ansi_start_date) "%d"] set row(pretty_short_start_date) [lc_time_fmt $row(ansi_start_date) "%x"] + set row(full_start_date) [lc_time_fmt $row(ansi_start_date) "%x"] + set row(full_end_date) [lc_time_fmt $row(ansi_end_date) "%x"] set row(end_time) [lc_time_fmt $row(ansi_end_date) "%X"] } Index: openacs-4/packages/calendar/tcl/calendar-2-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-2-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/calendar/tcl/calendar-2-procs.tcl 18 Nov 2002 18:01:10 -0000 1.9 +++ openacs-4/packages/calendar/tcl/calendar-2-procs.tcl 21 Jul 2003 19:21:36 -0000 1.10 @@ -9,6 +9,65 @@ namespace eval calendar { + ad_proc -public get_month_multirow_information { + {-current_day:required} + {-today_julian_date:required} + {-first_julian_date_of_month:required} + } { + @author Dirk Gomez (openacs@dirkgomez.de) + @creation-date 20-July-2003 + } { + i18n_display_parameters + if {$current_day == $today_julian_date} { + set today_p t + } else { + set today_p f + } + set day_number [expr $current_day - $first_julian_date_of_month +1] + set weekday [expr $current_day % 7] + + set beginning_of_week_p f + set end_of_week_p f + if {$weekday == $week_ends_on} { + set end_of_week_p t + } elseif {$weekday == $week_begins_on} { + set beginning_of_week_p t + } + return [list day_number $day_number \ + today_p $today_p \ + beginning_of_week_p $beginning_of_week_p \ + end_of_week_p $end_of_week_p] + } + + ad_proc -public get_weekday_list { + } { + Return a list of the weekdays one letter each. You need to be wary + that your settings here coincide with other basic configuration + parameters. + + Not-yet i18nized. + @author Dirk Gomez (openacs@dirkgomez.de) + @creation-date 20-July-2003 + } { + # This will be retrieved from a apm_parameter or a user setting + return [list S M T W T F S] + } + + ad_proc -public i18n_display_parameters { + } { + Basic parameters to make calendar displaying locale-dependent. + + Not-yet i18nized. + + @author Dirk Gomez (openacs@dirkgomez.de) + @creation-date 20-July-2003 + } { + uplevel 1 { + set week_ends_on 5 + set week_begins_on 6 + } + } + ad_proc -public from_sql_datetime { {-sql_date:required} {-format:required} @@ -111,7 +170,7 @@ if {[string compare $calendar_list {{}}] == 0} { set calendar_list [list] } - + if {[llength $calendar_list] > 0} { set sql_clause "and calendar_id in ([join $calendar_list ","]) " } else { @@ -203,4 +262,17 @@ db_dml rename_calendar {} } + ad_proc -private compare_day_items_by_current_hour {a b} { + Compare a day item by the current hour (field 0) + } { + set a_criterium [lindex $a 0] + set b_criterium [lindex $b 0] + if {$a_criterium > $b_criterium} { + return 1 + } elseif {$a_criterium < $b_criterium} { + return -1 + } + return 0 + } + } Index: openacs-4/packages/calendar/tcl/calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/calendar/tcl/calendar-procs.tcl 17 May 2003 10:20:50 -0000 1.12 +++ openacs-4/packages/calendar/tcl/calendar-procs.tcl 21 Jul 2003 19:21:36 -0000 1.13 @@ -313,7 +313,7 @@ } #------------------------------------------------ -# find out the name of a calendar < roll into pl/sql > +# find out the name of a calendar # NOTE: calendar.name() ad_proc calendar_get_name { calendar_id } { @@ -339,18 +339,6 @@ and 'f' if it is not } { - -# return [db_string check_calendar_permission { -# select acs_permission.permission_p( -# :calendar_id, -# acs.magic_object_id('the_public'), -# 'calendar_read' -# ) -# from dual -# -# }] -# - set private_p [db_string check_calendar_p "select private_p from calendars where calendar_id = :calendar_id"] if { $private_p == "t" } { Index: openacs-4/packages/calendar/www/cal-item-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-create.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/calendar/www/cal-item-create.tcl 18 Sep 2002 12:12:03 -0000 1.15 +++ openacs-4/packages/calendar/www/cal-item-create.tcl 21 Jul 2003 19:21:36 -0000 1.16 @@ -21,7 +21,6 @@ {return_url ""} {recurrence_p 0} {item_type_id ""} - {show_cal_nav 1} } if { $date == "now" } { @@ -125,7 +124,7 @@ # Fix up the return URL if {[empty_string_p $return_url]} { - set return_url "cal-item-view?[export_url_vars date action view cal_item_id show_cal_nav return_url]" + set return_url "cal-item-view?[export_url_vars date action view cal_item_id return_url]" } if {$recurrence_p} { Index: openacs-4/packages/calendar/www/cal-item-delete-all-occurrences.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-delete-all-occurrences.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/cal-item-delete-all-occurrences.tcl 10 Sep 2002 22:22:31 -0000 1.2 +++ openacs-4/packages/calendar/www/cal-item-delete-all-occurrences.tcl 21 Jul 2003 19:21:36 -0000 1.3 @@ -6,7 +6,6 @@ @creation-date April 25, 2002 } { recurrence_id - {show_cal_nav 1} {return_url "./"} } Index: openacs-4/packages/calendar/www/cal-item-delete-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-delete-confirm.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/calendar/www/cal-item-delete-confirm.adp 22 May 2003 14:25:22 -0000 1.9 +++ openacs-4/packages/calendar/www/cal-item-delete-confirm.adp 21 Jul 2003 19:21:36 -0000 1.10 @@ -1,22 +1,13 @@ - - - #calendar.Calendar_Item_Delete#: @cal_item.name;noquote@ #calendar.Delete# + 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.6 -r1.7 --- openacs-4/packages/calendar/www/cal-item-delete-confirm.tcl 26 May 2003 10:00:10 -0000 1.6 +++ openacs-4/packages/calendar/www/cal-item-delete-confirm.tcl 21 Jul 2003 19:21:36 -0000 1.7 @@ -12,15 +12,12 @@ Confirm Deletion } { cal_item_id - {show_cal_nav 1} } calendar::item::get -cal_item_id $cal_item_id -array cal_item # no time? 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 "view" day $cal_item(start_date) "calendar_id="] - +set date $cal_item(start_date) ad_return_template Index: openacs-4/packages/calendar/www/cal-item-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-edit.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/calendar/www/cal-item-edit.adp 22 May 2003 14:25:22 -0000 1.6 +++ openacs-4/packages/calendar/www/cal-item-edit.adp 21 Jul 2003 19:21:36 -0000 1.7 @@ -2,13 +2,14 @@ #calendar.Calendar_Edit_Item##calendar.Edit#cal_item.title +
-

- @cal_nav;noquote@ +

@@ -38,7 +29,7 @@ #calendar.lt_Are_you_sure_you_want_1#
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.17 -r1.18 --- openacs-4/packages/calendar/www/cal-item-edit.tcl 26 May 2003 10:00:10 -0000 1.17 +++ openacs-4/packages/calendar/www/cal-item-edit.tcl 21 Jul 2003 19:21:36 -0000 1.18 @@ -102,7 +102,7 @@ } -set cal_nav [dt_widget_calendar_navigation "view" day $cal_item(start_date) "calendar_id"] +set date $cal_item(start_date) 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.7 -r1.8 --- openacs-4/packages/calendar/www/cal-item-new.adp 26 May 2003 10:00:10 -0000 1.7 +++ openacs-4/packages/calendar/www/cal-item-new.adp 21 Jul 2003 19:21:36 -0000 1.8 @@ -3,12 +3,14 @@ #calendar.Add#cal_item.title + +

- @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.8 -r1.9 --- openacs-4/packages/calendar/www/cal-item-new.tcl 26 May 2003 10:00:10 -0000 1.8 +++ openacs-4/packages/calendar/www/cal-item-new.tcl 21 Jul 2003 19:21:36 -0000 1.9 @@ -87,7 +87,6 @@ # Stop here ad_script_abort } - # Hide the type widget if there *are* no types to choose from if { [llength [element get_property cal_item item_type_id options]] <= 1 } { element set_properties cal_item item_type_id -widget hidden @@ -115,6 +114,4 @@ } } -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-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item-view-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar/www/cal-item-view-postgresql.xql 28 Apr 2002 21:03:43 -0000 1.1 +++ openacs-4/packages/calendar/www/cal-item-view-postgresql.xql 21 Jul 2003 19:21:36 -0000 1.2 @@ -31,4 +31,35 @@ + + + select + i.cal_item_id, + 0 as n_attachments, + to_char(start_date, 'YYYY-MM-DD HH:MI:SS') as start_date, + end_date 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.description, a.description) as description, + recurrence_id, + i.item_type_id, + it.type as item_type, + on_which_calendar as calendar_id + from + acs_events e join timespans s + on (e.timespan_id = s.timespan_id) + join time_intervals t + on (s.interval_id = t.interval_id) + join acs_activities a + on (e.activity_id = a.activity_id) + join cal_items i + on (e.event_id = i.cal_item_id) + left join cal_item_types it + on (it.item_type_id = i.item_type_id) + where + e.event_id = :cal_item_id + + + Index: openacs-4/packages/calendar/www/cal-item-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-view.adp,v diff -u -r1.16 -r1.17 --- openacs-4/packages/calendar/www/cal-item-view.adp 22 May 2003 14:25:22 -0000 1.16 +++ openacs-4/packages/calendar/www/cal-item-view.adp 21 Jul 2003 19:21:36 -0000 1.17 @@ -1,45 +1,117 @@ - - - #calendar.Calendar_Item#: @cal_item.name;noquote@ #calendar.Item# -

- @cal_nav;noquote@ +

+ +
+ - + - + + + + + + + + + + + + + + + + + + + + + + +
-

- @cal_nav;noquote@ -

+ + - - - - - - -
#calendar.Date_1# #calendar.and_Time#:@cal_item.pretty_short_start_date@, #calendar.from# @cal_item.start_time@ #calendar.to# @cal_item.end_time@
#calendar.Title#@cal_item.name@
@cal_item.description@
#calendar.Type#@cal_item.item_type@
#calendar.Attachments# -<% -foreach attachment $item_attachments { - template::adp_puts "[lindex $attachment 1]  " -} -%> -
-

- #calendar.edit# | #calendar.delete# @attachment_options@ - -

-#calendar.sync_with_Outlook# #calendar.single_event# | #calendar.all_events# +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
+ Calendar Event Details:
#calendar.Title# + @cal_item.name@
Description: + @cal_item.description@ +
#calendar.Date_1# + + #calendar.and_Time# + + : + + @cal_item.pretty_short_start_date@ + , #calendar.from# @cal_item.start_time@ + #calendar.to# @cal_item.end_time@ +
+ #calendar.Type# + + @cal_item.item_type@ +
+ #calendar.Attachments# + + + <% + foreach attachment $item_attachments { + template::adp_puts "[lindex $attachment 1]  " + } + %> +
+ Actions: +
- + +
+ #calendar.edit# + Edit this calendar event
+ #calendar.delete# + Delete this calendar event
+ #calendar.single_event# + #calendar.sync_with_Outlook#
+ #calendar.all_events# + Sync all events with Outlook
+ 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.10 -r1.11 --- openacs-4/packages/calendar/www/cal-item-view.tcl 26 May 2003 10:00:10 -0000 1.10 +++ openacs-4/packages/calendar/www/cal-item-view.tcl 21 Jul 2003 19:21:36 -0000 1.11 @@ -1,32 +1,21 @@ -# /packages/calendar/www/index.tcl - ad_page_contract { View one event @author Ben Adida (ben@openforce.net) @creation-date April 09, 2002 @cvs-id $Id$ } { - cal_item_id + cal_item_id:integer {return_url ""} - {show_cal_nav 1} } -# find out the user_id set user_id [ad_verify_and_get_user_id] - set package_id [ad_conn package_id] -# Require read permission (FIXME) -# ad_require_permission $cal_item_id read +ad_require_permission $cal_item_id read -# write permission set edit_p [ad_permission_p $cal_item_id cal_item_write] - -# delete permission set delete_p [ad_permission_p $cal_item_id cal_item_delete] - -# admin permission set admin_p [ad_permission_p $cal_item_id calendar_admin] calendar::item::get -cal_item_id $cal_item_id -array cal_item @@ -48,8 +37,7 @@ set attachment_options {} } -# cal nav -set cal_nav [dt_widget_calendar_navigation "view" day $cal_item(start_date) "calendar_id="] +set date $cal_item(start_date) ad_return_template Index: openacs-4/packages/calendar/www/cal-item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-item.adp,v diff -u -r1.14 -r1.15 --- openacs-4/packages/calendar/www/cal-item.adp 7 Nov 2002 12:45:07 -0000 1.14 +++ openacs-4/packages/calendar/www/cal-item.adp 21 Jul 2003 19:21:36 -0000 1.15 @@ -10,14 +10,12 @@
- - 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.14 -r1.15 --- openacs-4/packages/calendar/www/cal-item.tcl 26 May 2003 10:00:10 -0000 1.14 +++ openacs-4/packages/calendar/www/cal-item.tcl 21 Jul 2003 19:21:36 -0000 1.15 @@ -16,7 +16,6 @@ {end_time "now"} {return_url ""} {force_calendar_id ""} - {show_cal_nav 1} } -properties { cal_item_id:onevalue Index: openacs-4/packages/calendar/www/cal-options.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-options.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/calendar/www/cal-options.adp 3 Jun 2002 04:08:17 -0000 1.3 +++ openacs-4/packages/calendar/www/cal-options.adp 21 Jul 2003 19:21:36 -0000 1.4 @@ -1,16 +1,10 @@ - - - + +

+Calendars:

  • @calendars.calendar_name@
+ Index: openacs-4/packages/calendar/www/cal-options.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-options.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/calendar/www/cal-options.tcl 10 Sep 2002 22:22:31 -0000 1.4 +++ openacs-4/packages/calendar/www/cal-options.tcl 21 Jul 2003 19:21:36 -0000 1.5 @@ -19,12 +19,16 @@ set calendar_list [calendar::calendar_list] -set calendar_list_sql "[join $calendar_list ","]" +if {[llength $calendar_list] > 0} { + set calendar_list_sql "[join $calendar_list ","]" -db_multirow calendars select_calendars " + db_multirow calendars select_calendars " select calendar_id, calendar_name from calendars where calendar_id in ($calendar_list_sql) -" + " +} else { + multirow create calendars +} ad_return_template Index: openacs-4/packages/calendar/www/calendar-choose.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/calendar-choose.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/calendar/www/calendar-choose.adp 7 Nov 2002 12:45:07 -0000 1.4 +++ openacs-4/packages/calendar/www/calendar-choose.adp 21 Jul 2003 19:21:36 -0000 1.5 @@ -2,13 +2,14 @@ #calendar.lt_Calendar_Choose_Calen# #calendar.Choose# + Index: openacs-4/packages/calendar/www/calendar-choose.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/calendar-choose.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/calendar-choose.tcl 7 Nov 2002 12:45:07 -0000 1.2 +++ openacs-4/packages/calendar/www/calendar-choose.tcl 21 Jul 2003 19:21:36 -0000 1.3 @@ -49,6 +49,4 @@ ad_script_abort } -set cal_nav [dt_widget_calendar_navigation "view" day $date "calendar_id=$calendar_id"] - ad_return_template Index: openacs-4/packages/calendar/www/calendar.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/calendar.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/calendar.css 21 Jul 2003 19:21:36 -0000 1.1 @@ -0,0 +1,754 @@ +body {font-size: 75%; background-color: #ffffff; color: #000000;} + +table, td, form { + color: #333333; font-family: Arial, Helvetica, sans-serif; + font-size: 100%; +} + +ul, ol, li { + color: #333333; font-family: Arial, Helvetica, sans-serif; + margin-top: 5px ; + margin-bottom: 1px ; +} + +p {font-weight: normal; font-size: 100%; color: #333333; font-family: Arial, Helvetica, sans-serif;} + +a {text-decoration:none;} +a:link {color: #003399; font-family: Arial, Helvetica, sans-serif;} +a:hover {text-decoration: underline; font-family: Arial, Helvetica, sans-serif;} +a:active {color: #cc0000; font-family: Arial, Helvetica, sans-serif;} +a:visited {color: #003399; font-family: Arial, Helvetica, sans-serif;} + + +h1 {font-weight: bold; font-size: 130%; color: #990000; font-family: Arial, Helvetica, sans-serif; margin: 0px; } +h2 {font-weight: bold; font-size: 120%; color: #990000; font-family: Arial, Helvetica, sans-serif; margin: 0px;} +h3 {font-weight: bold; font-size: 100%; color: #333333; font-family: Arial, Helvetica, sans-serif; margin: 0px;} +h4 {font-weight: bold; font-size: 100%; color: #990000; font-family: Arial, Helvetica, sans-serif; margin: 0px;} +h5 {font-weight: bold; font-size: 100%; color: #666666; font-family: Arial, Helvetica, sans-serif; margin: 0px;} +h6 {font-weight: normal; font-size: 80%; color: #333333; font-family: Arial, Helvetica, sans-serif; margin: 0px;} + + +/* netscape 6 correction */ +.null {font-size: 1px;} + +/* linux correction */ +.block {display: block;} + +.dark-line { + font-size: 1px; + background-color: #CC6633; +} + +.light-line { + font-size: 1px; + background-color: #E7B59C; +} + +.header-img { + COLOR: white; + border: 0px none; +} + +.header-logo { + WIDTH: 100px; + COLOR: white; + PADDING-RIGHT: 35px; + PADDING-BOTTOM: 10px; +} + +.header-text { + WHITE-SPACE: nowrap; + font-weight: bold; + font-size: 150%; + padding-left: 3px; +} + +.element-header-text { + COLOR: #000000; + font-style: normal; + font-weight: bold; + background-color: #DDEEFF; + border-top: 0px solid #99CCFF; + border-right: 0px solid #99CCFF; + border-bottom: 0px solid #99CCFF; + border-left: 0px solid #99CCFF; +} + +.element-text { + FONT-SIZE: small; +} + +.table-header { + BACKGROUND: #99CCFF; + color: #000000; + margin: 0px; + padding: 0px; + font-weight: bold; + +} + +.table-header a { + color: #0055AA; +} +.table-header a:hover { + TEXT-DECORATION: underline; +} + +.selected { + BACKGROUND: #002D59; + COLOR: white; + font-weight: bold; + BORDER-RIGHT: medium none; + BORDER-TOP: medium none; + BORDER-LEFT: medium none; + BORDER-BOTTOM: medium none; +} + +.element-content { + padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px +} + +.main_color { + color: #CC6633; +} + +.table-title { + background: #FFFFFF; + font-weight: bold; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 1px; + border-left-width: 0px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #99CCFF; + border-right-color: #99CCFF; + border-bottom-color: #99CCFF; + border-left-color: #99CCFF; +} + +.cal-week { + BACKGROUND: #FFFFFF; + VALIGN: top; + font-weight: bold; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 1px; + border-left-width: 0px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #99CCFF; + border-right-color: #99CCFF; + border-bottom-color: #99CCFF; + border-left-color: #99CCFF; + + + +} + +.cal-month-day { + BACKGROUND: #DDEEFF; + BORDER: 0px none; + color: #003366; + font-weight: bold; + font-size: 90%; + vertical-align: top; + + + + +} + +.element { + border-top: 1px solid #99CCFF; + border-bottom: 1px solid #99CCFF; + border-left: 0px solid #99CCFF; + border-right: 0px solid #99CCFF; +} + +.no-border { + BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; +} + +.footer { + FONT-SIZE: x-small; +} + +.navbar a { + color: #999999; +} + +.navbar a:visited { + COLOR: #999999; +} + +.navbar a:hover { + COLOR: #000000; + TEXT-DECORATION: none; +} + +.navbar { + COLOR: #999999; + TEXT-DECORATION: none; + padding-top: 4px; + padding-bottom:4px; + text-align: center; + FONT-SIZE: 8pt; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + font-weight: bold; + border-top: 0px solid #99CCFF; + border-right: 0px solid #99CCFF; + border-bottom: 1px solid #99CCFF; + border-left: 0px solid #99CCFF; +} + +.navbar-selected { + FONT-SIZE: 8pt; + COLOR: #004080; + TEXT-DECORATION: none; + text-align: center; + font-weight: bold; + padding-top: 4px; + padding-bottom:4px; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + background-color: #CEE6FF; + border-top: 0px solid #99CCFF; + border-right: 0px solid #99CCFF; + border-bottom: 1px solid #99CCFF; + border-left: 0px solid #99CCFF; +} + +.table-display { + width: 100%; + border: 0px none; + margin: 0px; + padding: 0px; + +} + +.portlet-config { + cellpadding: 0; + cellspacing: 0; + border: 1 solid #000000; + width: 100%; +} + +.field { + font-size: 8pt; + color: #000000; + margin: 0px; + padding: 0px; + border: 1px solid #99CCFF; + background-color: #FFFFFF; +} + +.text-button { + font-size: 9pt; + color: #000000; + text-decoration: underline; + background-color: #FFFFFF; + border: 0px solid #770000; + margin: 0px; + padding: 0px; + cursor: hand; +} + +.frm-compact { + font-size: 9pt; + color: #000000; + margin: 0px; + padding: 0px; + border: 0px solid #000000; + vertical-align: top; +} +.show-here { + width: 100%; +} + +.portal-page-body { + cellpadding: 0; + cellspacing: 0; + margin: 0px; + padding: 0px; + border: 0 none; + width: 100%; +} + +.portal-page-header { + cellpadding: 0; + cellspacing: 0; + background: #FFDDB0; + border: 0; + width: 100%; +} + +.portal-page-config { + cellpadding: 0; + cellspacing: 0; + margin: 0px; + padding: 0px; + background: white; + border: 1px solid #CC6633; + width: 100%; +} + +.bottom-border { + BORDER-Bottom: #CC6633 1px solid; +} + +.page-table { + width: 100%; + border: 0px none #CCCCFF; + background-color: #FFFFFF; +} + +.navbar-spacer { + COLOR: #000000; + FONT-SIZE: 8pt; + text-align: center; + font-weight: bold; + TEXT-DECORATION: none; + padding-top: 4px; + padding-bottom:4px; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + border-top: 1px solid #000000; + border-right: 0px solid #000000; + border-bottom: 0px solid #000000; + border-left: 0px solid #000000; + background-color: #CEE6FF; +} + +.navbar-spacer-end { + COLOR: #000000; + FONT-SIZE: 8pt; + text-align: center; + font-weight: bold; + TEXT-DECORATION: none; + padding-top: 4px; + padding-bottom:4px; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + border-top: 1px solid #000000; + border-right: 0px solid #000000; + border-bottom: 0px solid #000000; + border-left: 0px solid #000000; + background-color: #CEE6FF; +} + +.navbar-end { + COLOR: #000000; + FONT-SIZE: 8pt; + text-align: center; + font-weight: bold; + TEXT-DECORATION: none; + padding-top: 4px; + padding-bottom:4px; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + border-top: 0px solid #99CCFF; + border-right: 0px solid #99CCFF; + border-bottom: 0px solid #99CCFF; + border-left: 1px solid #99CCFF; +} + +.navbar-spacer-start { + border-top-width: 1px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #000000; + border-left-color: #000000; + border-right-color: #000000; + border-bottom-color: #000000; + background-color: #CEE6FF; +} + +.navbar-spacer-selected { + COLOR: #000000; + FONT-SIZE: 8pt; + text-align: center; + font-weight: bold; + TEXT-DECORATION: none; + padding-top: 4px; + padding-bottom:4px; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + background-color: #CEE6FF; + border: 0px solid #000000; +} + +.navbar-spacer-body { + background-color: #DDDDFF; + COLOR: #000000; + FONT-SIZE: 8pt; + TEXT-DECORATION: none; + padding-top: 4px; + padding-bottom:4px; + padding-right: 8px; + padding-left: 8px; + white-space: nowrap; + border-top-width: 0px; + border-right-width: 1px; + border-bottom-width: 0px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-right-color: #663399; + border-left-color: #FFFFFF; +} + +.topnavbar { + font-size: 10pt; + font-weight: bold; + color: #000000; + background-color: #CEE6FF; + border-top-width: 1px; + border-right-width: 0px; + border-bottom-width: 1px; + border-left-width: 0px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #99CCFF; + border-right-color: #99CCFF; + border-bottom-color: #99CCFF; + border-left-color: #99CCFF; +} + +.topnavbar a { + color: #003399; +} + +.topnavbar a:hover{ + text-decoration: underline; +} + +.navbar-spacer-selected-start { + background-color: #CEE6FF; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #FFFFFF; + border-right-color: #FFFFFF; + border-bottom-color: #FFFFFF; + border-left-color: #FFFFFF; +} + +.col-left { + background-color: #FFFFFF; + padding-left: 4px; + padding-right: 4px; + padding-top: 4px; + padding-bottom: 4px; +} + +.col-middle { + background-color: #FFFFFF; + padding-left: 4px; + padding-right: 4px; + padding-top: 4px; + padding-bottom: 4px; +} + +.col-right { + background-color: #FFFFFF; + padding-left: 4px; + padding-right: 4px; + padding-top: 4px; + padding-bottom: 4px; +} + +.button-sml { + font-family: Arial, Helvetica, sans-serif; + font-size: 8pt; + font-weight: bold; + background-color: #CC0000; + margin: 0px; + padding: 0px; + border: 1px solid #000000; + cursor: hand; + color: #FFFFFF; +} + +.row-dark { + BACKGROUND: #DDEEFF; +} + +.row-light { + BACKGROUND: #FFFFFF; +} + +.row-hi { + font-weight: bold; + border: 0px solid #7D7DFF; + +} + +.row-lo { + color: #999999; + border: 0px solid #7D7DFF; +} + +.body-big {font-size: 100%; background-color: #ffffff; color: #000000;} + +.cal-day { + font-weight: bold; + background-color: #DDEEFF; + text-align: right; +} + +.cal-day-today { + font-weight: bold; + background-color: #003366; + text-align: right; + color: #FFFFFF; + +} + +.cal-day-inactive { + font-weight: bold; + background-color: #DDEEFF; + text-align: right; + color: #999999; +} + +.cal-day-inactive a { + color: #999999; +} + +.cal-day-title { + font-weight: bold; + background-color: #FFFFFF; + text-align: right; + color: #000000; + border: 0px solid #002C5A; +} + +.cal-day-table { + font-weight: normal; + background-color: #FFFFFF; + width: 100%; + margin: 0px; + padding: 0px; + border: 0px solid; + line-height: 140%; +} + +.cal-spacer { + line-height: 1px; + font-size: 0px; + margin: 0px; + padding: 0px; + border-top: 0px solid #003366; + border-right: 0px solid #003366; + border-bottom: 1px solid #003366; + border-left: 0px solid #003366; +} +.cal-month-title { + background-color: #003366; + vertical-align: middle; +} +.cal-month-title-text { + font-size: 140%; + font-weight: bold; + background-color: #003366; + text-align: center; + color: #FFFFFF; +} + +.cal-table { + border: 1px solid #99CCFF; + font-size: 90%; + +} +.cal-month-today { + font-weight: bold; + background-color: #003366; + text-align: left; + color: #FFFFFF; + border: 0px solid; + font-size: 90%; + vertical-align: top; + +} +.cal-month-today a { + color: #DDEEFF; +} +.cal-month { + font-weight: bold; + background-color: #DDEEFF; + text-align: center; + line-height: 160%; + +} +.cal-week-table { + width: 100%; + border: 0px none; + background-color: #FFFFFF; + +} +.text-grey-sml { + font-size: 75%; + color: #999999; + font-weight: normal; + +} +.cal-week-events { + width: 100%; + background-color: #DDEEFF; + + +} +.cal-month-day-title { + BACKGROUND: #FFFFFF; + BORDER: 0px none; + color: #000000; + font-weight: bold; + text-align: center; + margin: 0px; + padding: 0px; + + +} +.cal-month-event { + text-align: left; + font-weight: normal; + font-size: 120%; +} +.cal-month-event a { + font-weight: normal; +} +.cal-month-table { + + width: 100%; + border: 0px none; + margin: 0px; + padding: 0px; +} +.cal-month-thismonth { + font-weight: bold; + background-color: #003366; + text-align: center; + color: #FFFFFF; + line-height: 160%; + border: 0px solid; +} +.cal-month-day-inactive { + BACKGROUND: #EEEEEE; + BORDER: 0px none; + color: #999999; +} +.cal-month-event-notime { + text-align: left; + font-weight: bold; + font-size: 120%; +} +.cal-day-time { + font-weight: bold; + text-align: right; + + + + + + +} +.cal-day-event { + text-align: left; + white-space: nowrap; + vertical-align: top; +} +.cal-week-event-notime { + background-color: #DDEEFF; + font-weight: bold; +} +.cal-week-event-notime a { + background-color: #DDEEFF; +} +.cal-day-event-notime { + font-weight: bold; +} +.cal-day-event-notime a { + font-weight: bold; +} +.cal-day-event-spans { + text-align: left; + white-space: nowrap; + vertical-align: top; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width: 2px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #000066; + border-right-color: #000066; + border-bottom-color: #000066; + border-left-color: #000066; + +} +.table-data-title { + background: #FFFFFF; + font-weight: bold; + border: 0px solid #99CCFF; + text-align: right; + padding-top: 0px; + padding-right: 10px; + padding-bottom: 0px; + padding-left: 0px; + width: 1%; + white-space: nowrap; + + + +} +.table-data-action { + background: #DDEEFF; + font-weight: bold; + border: 1px solid #99CCFF; + text-align: center; + width: 1%; + white-space: nowrap; + padding: 2px; + font-size: 95%; + + + +} +.button { + background: #DDEEFF; + font-weight: bold; + border: 1px solid #99CCFF; + text-align: center; + white-space: nowrap; + color: #003366; + cursor: hand; + +} Index: openacs-4/packages/calendar/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/index.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/calendar/www/index.tcl 26 May 2003 10:00:10 -0000 1.11 +++ openacs-4/packages/calendar/www/index.tcl 21 Jul 2003 19:21:36 -0000 1.12 @@ -1,5 +1,3 @@ -# /packages/calendar/www/index.tcl - ad_page_contract { Main Calendar Page @@ -20,13 +18,9 @@ ad_script_abort } -# Check for a personal, private calendar, create if missing -# FIXME BUG: this should be moved to new pages to allow users -# to create/delete/modify/admin their calendars. - 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/mini-calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/mini-calendar.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/mini-calendar.adp 21 Jul 2003 19:21:36 -0000 1.1 @@ -0,0 +1,149 @@ +

- @cal_nav@ -

+ +

+ + + + + + + + + + + + + + + + + + + + + \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 " - " - - if {$real_sort_by != "item_type"} { - append return_html "" - } - - append return_html "\n" - incr flip +db_foreach select_list_items {} { + # Adjust the display of no-time items + if {[dt_no_time_p -start_time $pretty_start_date -end_time $pretty_end_date]} { + set pretty_start_time "--" + set pretty_end_time "--" } -} + if {[string equal $pretty_start_time "00:00"]} { + set pretty_start_time "--" + } + if {[string equal $pretty_end_time "00:00"]} { + set pretty_end_time "--" + } + if {![string equal $pretty_start_date $last_pretty_start_date]} { + set last_pretty_start_date $pretty_start_date + incr flip + } + + if {$julian_start_date == $today_julian_date} { + set today row-hi + } elseif {$julian_start_date < $today_julian_date} { + set today row-lo + } else { + set today "" + } + + multirow append calendar_items $calendar_name $item_id $name $item_type $pretty_weekday $pretty_start_date $pretty_end_date $pretty_start_time $pretty_end_time $flip $today + +} + 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-month-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-month-display-postgresql.xql 21 Jul 2003 19:21:36 -0000 1.2 @@ -5,9 +5,10 @@ - select to_char(start_date, 'J') as start_date, + select to_char(start_date, 'J') as julian_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, + to_char(start_date, 'HH24:MI') as ansi_start_time, + to_char(end_date, 'HH24:MI') as ansi_end_time, coalesce(e.name, a.name) as name, coalesce(e.description, a.description) as description, coalesce(e.status_summary, a.status_summary) as status_summary, @@ -23,13 +24,16 @@ 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_julian_date_of_month,'J') and + to_date(:last_julian_date_in_month,'J') 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 + order by ansi_start_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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-month-display.adp 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-month-display.adp 21 Jul 2003 19:21:36 -0000 1.2 @@ -1 +1,72 @@ -@foobar;noquote@ +
+ + + + + + +
+ + @prev_year_url;noquote@ + + @curr_year@ + @prev_year_url;noquote@ + + + + @prev_month_url;noquote@ + + @curr_month@ + @next_month_url;noquote@ + + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ @months.name@ + + + @months.name@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@days_of_week.day_short@
+ +
+ + @days.day_number@ + + @days.day_number@ + + + @days.day_number@ +
+ + +
+
+ +
+ + + + +
+ + + + Today + + + + Today + + + is <%=[dt_ansi_to_pretty]%>

+ +
Date as YYYYMMDD + + @form_vars;noquote@ + +
+
Index: openacs-4/packages/calendar/www/mini-calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/mini-calendar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/www/mini-calendar.tcl 21 Jul 2003 19:21:36 -0000 1.1 @@ -0,0 +1,136 @@ +if {![exists_and_not_null base_url]} { + set base_url [ad_conn url] +} + +if {![exists_and_not_null date]} { + set date [dt_sysdate] +} + +# Create row with existing views +multirow create views name text active_p +foreach viewname {list day week month} { + if { [string equal $viewname $view] } { + set active_p t + } else { + set active_p f + } + multirow append views [string toupper $viewname 0] $viewname $active_p +} + +set list_of_vars [list] + +# Get the current month, day, and the first day of the month + +dt_get_info $date + + +set now [clock scan $date] +set output "" + +if [string equal $view month] { + set curr_year [clock format $now -format "%Y"] + 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"] + set prev_year_url "" + set next_year_url "" + + 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] + + multirow create months name current_month_p new_row_p target_date + + for {set i 0} {$i < 12} {incr i} { + + set month [lindex $months_list $i] + + # show 3 months in a row + + if {($i != 0) && ([expr $i % 3] == 0)} { + set new_row_p t + } else { + set new_row_p f + } + + if {$i == $curr_month} { + set current_month_p t + set encoded_target_date "" + } else { + set current_month_p f + set target_date [clock format \ + [clock scan "[expr $i-$curr_month] month" -base $now] -format "%Y-%m-%d"] + set encoded_target_date [ad_urlencode $target_date] + } + multirow append months $month $current_month_p $new_row_p $encoded_target_date + + } +} else { + set curr_month [clock format $now -format "%B"] + 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_url "" + set next_month_url "" + + multirow create days_of_week day_short + # I18N ! + foreach day_of_week [list S M T W T F S] { + multirow append days_of_week $day_of_week + } + + set day_of_week 1 + set day_number $first_day + + multirow create days day_number ansi_date beginning_of_week_p end_of_week_p today_p greyed_p + + for {set julian_date $first_julian_date} {$julian_date <= $last_julian_date} {incr julian_date} { + set today_p f + set greyed_p f + + if {$julian_date < $first_julian_date_of_month} { + set greyed_p t + } elseif {$julian_date > $last_julian_date_in_month} { + set greyed_p t + } + set ansi_date [dt_julian_to_ansi $julian_date] + + if {$julian_date == $first_julian_date_of_month} { + set day_number 1 + } elseif {$julian_date == [expr $last_julian_date_in_month +1]} { + set day_number 1 + } + + if { $day_of_week == 1} { + set beginning_of_week_p t + } else { + set beginning_of_week_p f + } + + if {$julian_date == $julian_date_today} { + set today_p t + } + + if { $day_of_week == 7 } { + set day_of_week 0 + set end_of_week_p t + } else { + set end_of_week_p f + } + multirow append days $day_number [ad_urlencode $ansi_date] $beginning_of_week_p $end_of_week_p $today_p $greyed_p + incr day_of_week + incr day_number + } +} + +set today_url "$base_url?view=day&date=[ad_urlencode [dt_sysdate]]" + +if { $view == "day" && [dt_sysdate] == $date } { + set today_p t +} else { + set today_p f +} + + +set form_vars "" +foreach var $list_of_vars { + append form_vars "" +} Index: openacs-4/packages/calendar/www/no-time.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/no-time.gif,v diff -u Binary files differ Index: openacs-4/packages/calendar/www/spacer.gif =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/spacer.gif,v diff -u Binary files differ 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-list-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-list-display-postgresql.xql 21 Jul 2003 19:21:36 -0000 1.2 @@ -5,16 +5,21 @@ - select to_char(start_date, 'HH24') as start_hour, + select + to_char(start_date, 'J') as julian_start_date, + 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, + to_char(start_date, 'HH24:MI') as pretty_start_time, + to_char(end_date, 'HH24:MI') as pretty_end_time, 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 + to_char(start_date, 'Day') as pretty_weekday, + 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, @@ -24,14 +29,9 @@ 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 - ) +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) +$calendar_where_clause 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-list-display.adp 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-list-display.adp 21 Jul 2003 19:21:36 -0000 1.2 @@ -1,14 +1,52 @@ -@title@

+ +

+ + + + + +
+
@title@
+
+ Events over a day rolling period + @form_vars;noquote@ +
+
+ + - + + + + + + + - - - + - + + + + + + + -@return_html;noquote@ + + + + + + + + + + + +
Day of WeekDateStart TimeEnd Time
Day of WeekStart DateStart TimeEnd TimeTypeTitle
TypeTitle
@calendar_items.pretty_weekday@@calendar_items.pretty_start_date@@calendar_items.pretty_start_time@@calendar_items.pretty_end_time@@calendar_items.item_type@@calendar_items.name@ + (@calendar_items.calendar_name@)
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.1 -r1.2 --- openacs-4/packages/calendar/www/view-list-display.tcl 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-list-display.tcl 21 Jul 2003 19:21:36 -0000 1.2 @@ -3,18 +3,20 @@ # 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 calendar_where_clause " and e.event_id in ([join $calendar_id_list ","])" +} else { + set calendar_where_clause "" } # sort by cannot be empty if {[empty_string_p $sort_by]} { - set sort_by "item_type" + set sort_by "start_date" } 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 "" } @@ -30,63 +32,51 @@ set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]" } -set return_html "" +set today_date [dt_sysdate] +set today_ansi_list [dt_ansi_to_list $today_date] +set today_julian_date [dt_ansi_to_julian [lindex $today_ansi_list 0] [lindex $today_ansi_list 1] [lindex $today_ansi_list 2]] -# 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] +set item_type_url "view?view=list&sort_by=item_type&start_date=$start_date" +set start_date_url "view?view=list&sort_by=start_date&start_date=$start_date" +set view list +set form_vars [export_form_vars start_date sort_by view] -# initialize the item_type so we can do intermediate titles -set old_item_type "" +set flip -1 -set flip 0 +multirow create calendar_items calendar_name item_id name item_type pretty_weekday pretty_start_date pretty_end_date pretty_start_time pretty_end_time flip today +set last_pretty_start_date "" # 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
$pretty_weekday$pretty_start_date$pretty_start_date$pretty_end_date$item_type$item_details
+ + + + +
+ + + + +
+ @prev_month_url;noquote@ + back one month + + @month@ @year@ + @next_month_url;noquote@ + forward one month +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ @weekday_names.weekday_short@ +
  + + + + + + + #calendar.Add_Item# + @days_of_a_month.day_number@ + + + +
@days_of_a_month.ansi_start_time@ + @days_of_a_month.calendar_item@ + [@days_of_a_month.calendar_name@] +
+
+
+ +
+ 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.1 -r1.2 --- openacs-4/packages/calendar/www/view-month-display.tcl 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-month-display.tcl 21 Jul 2003 19:21:36 -0000 1.2 @@ -1,89 +1,78 @@ -# 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. +# Show a calendar month widget - if {![info exists date] || [empty_string_p $date]} { set date [dt_systime] } +dt_get_info $date -if {![info exists day_template] || [empty_string_p $day_template]} { - set day_template "\$day_number" -} +# 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 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] + + +set today_date [dt_sysdate] +set next_month_url "" +set prev_month_url "" + +multirow create weekday_names weekday_short +foreach weekday [calendar::get_weekday_list] { + multirow append weekday_names $weekday +} + + +calendar::i18n_display_parameters + +set number_day_cells 0 + +set day_number $first_day + +set today_ansi_list [dt_ansi_to_list $today_date] +set today_julian_date [dt_ansi_to_julian [lindex $today_ansi_list 0] [lindex $today_ansi_list 1] [lindex $today_ansi_list 2]] + + +multirow create days_of_a_month calendar_item item_id ansi_start_date ansi_start_time day_number calendar_name beginning_of_week_p end_of_week_p today_p outside_month_p + +for {set current_day $first_julian_date} {$current_day < $first_julian_date_of_month} {incr current_day} { + if {$current_day == $first_julian_date} { + set beginning_of_week_p t + } else { + set beginning_of_week_p f + } + multirow append days_of_a_month "" "" [dt_julian_to_ansi [expr $first_julian_date_of_month + $current_day -1]] "" "" "" $beginning_of_week_p f "" t +} + +set current_day $first_julian_date_of_month + 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) + if {$current_day < $julian_start_date} { + for {} {$current_day < $julian_start_date} {incr current_day} { + array set display_information [calendar::get_month_multirow_information -current_day $current_day -today_julian_date $today_julian_date -first_julian_date_of_month $first_julian_date_of_month] + multirow append days_of_a_month "" "" [dt_julian_to_ansi $current_day] "" $display_information(day_number) "" $display_information(beginning_of_week_p) $display_information(end_of_week_p) $display_information(today_p) f + } } - - 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 {[string equal $ansi_start_time "00:00"] && [string equal $ansi_end_time "00:00"]} { + set ansi_start_time "--" } - - 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 + + array set display_information [calendar::get_month_multirow_information -current_day $current_day -today_julian_date $today_julian_date -first_julian_date_of_month $first_julian_date_of_month] + multirow append days_of_a_month $name $item_id [dt_julian_to_ansi $current_day] $ansi_start_time $display_information(day_number) $calendar_name $display_information(beginning_of_week_p) $display_information(end_of_week_p) $display_information(today_p) f } - - -# 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] +for {} {$current_day <= $last_julian_date_in_month} {incr current_day} { + array set display_information [calendar::get_month_multirow_information -current_day $current_day -today_julian_date $today_julian_date -first_julian_date_of_month $first_julian_date_of_month] + multirow append days_of_a_month "" "" [dt_julian_to_ansi $current_day] "" $display_information(day_number) "" $display_information(beginning_of_week_p) $display_information(end_of_week_p) $display_information(today_p) f + incr number_day_cells +} +set remaining_days [expr 6 - $current_day % 7] + +if {$remaining_days > 0 } { + for {} {$current_day <= [expr $last_julian_date_in_month + $remaining_days]} {incr current_day} { + multirow append days_of_a_month "" "" "" "" "" "" f f "" t + } +} \ No newline at end of file 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-one-day-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-one-day-display-postgresql.xql 21 Jul 2003 19:21:36 -0000 1.2 @@ -6,10 +6,9 @@ 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, + to_char(start_date, 'HH24:MI') as start_time, + to_char(end_date, 'HH24') as end_hour, + to_char(end_date, 'HH24:MI') as end_time, coalesce(e.name, a.name) as name, coalesce(e.status_summary, a.status_summary) as status_summary, e.event_id as item_id, @@ -30,15 +29,53 @@ 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 ","]) - ) - +and to_char(start_date, 'HH24') = '00' + + + select to_char(start_date, 'HH24') as start_hour, + to_char(end_date, 'HH24') as end_hour, + to_char(start_date, 'HH24:MI') as start_time, + to_char(end_date, 'HH24:MI') as end_time, + 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 to_char(start_date, 'HH24') <> '' +order by start_hour + + + + + +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 + + + + 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-one-day-display.adp 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-one-day-display.adp 21 Jul 2003 19:21:36 -0000 1.2 @@ -1 +1,71 @@ -@foobar;noquote@ + + + +
+ + + + +
+ @url_previous_week;noquote@ + back one day + + @dates;noquote@ + @url_next_week;noquote@ + forward one day +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
No Time@day_items_without_time.name@
@day_items_with_time.current_hour@ + @day_items_with_time.start_time@ + - @day_items_with_time.end_time@ + @day_items_with_time.name@@day_items_with_time.calendar_name@ +   
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.1 -r1.2 --- openacs-4/packages/calendar/www/view-one-day-display.tcl 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-one-day-display.tcl 21 Jul 2003 19:21:36 -0000 1.2 @@ -1,88 +1,127 @@ -set widget_start_hour $start_hour -set widget_end_hour $end_hour +# Show calendar items per one day. +# This needs to be internationalized! -- Dirk set date_format "YYYY-MM-DD HH24:MI" if {[empty_string_p $date]} { set date [dt_sysdate] } - set current_date $date +# The following code is original code which I don't really grasp yet. (Dirk) +# ---------------------- # 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 +multirow create day_items_without_time name status_summary item_id calendar_name + 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) + multirow append day_items_without_time $name $status_summary $item_id $calendar_name +} + +multirow create day_items_with_time current_hour name item_id calendar_name status_summary start_hour end_hour start_time end_time colspan rowspan + +for {set i 0 } { $i < 24 } { incr i } { + set items_per_hour($i) 0 +} + +set day_items_per_hour {} +db_foreach select_day_items_with_time {} { + set start_hour [expr int($start_hour)] + + for { set item_current_hour $start_hour } { $item_current_hour < $end_hour } { incr item_current_hour } { + if {$start_hour == $item_current_hour} { + lappend day_items_per_hour [list $item_current_hour $name $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time] + } else { + lappend day_items_per_hour [list $item_current_hour "" $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time] + } + incr items_per_hour($item_current_hour) + } - - set item_details "" - - if {$show_calendar_name_p} { - append item_details $calendar_name + +} + +set day_items_per_hour [lsort -command calendar::compare_day_items_by_current_hour $day_items_per_hour] +set day_current_hour 0 + +# Get the maximum items per hour +set max_items_per_hour 0 +for {set i 0 } { $i < 24 } { incr i } { + if {$items_per_hour($i) > $max_items_per_hour} { + set max_items_per_hour $items_per_hour($i) } - - if {![empty_string_p $item_type]} { - if {![empty_string_p $item_details]} { - append item_details " - " - } - - append item_details "$item_type" +} + +# Get the colspan for each hour +for {set i 0 } { $i < 24 } { incr i } { + set colspan($i) $max_items_per_hour +} + +foreach item $day_items_per_hour { + set item_id [lindex $item 1] + set item_start_hour [lindex $item 5] + set item_end_hour [lindex $item 6] +} + + +foreach item $day_items_per_hour { + set item_start_hour [lindex $item 5] + set item_end_hour [lindex $item 6] + set rowspan [expr $item_end_hour - $item_start_hour] + if {$item_start_hour > $day_current_hour} { + # need to add dummy entries to show all hours + for { } { $day_current_hour < $item_start_hour } { incr day_current_hour } { + multirow append day_items_with_time $day_current_hour "" "" "" "" "" "" "" "" 0 0 + } } - - 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 + multirow append day_items_with_time [lindex $item 0] [lindex $item 1] [lindex $item 2] [lindex $item 3] [lindex $item 4] [lindex $item 5] [lindex $item 6] [lindex $item 7] [lindex $item 8] [expr $max_items_per_hour - $items_per_hour($item_start_hour) +1] $rowspan + set day_current_hour [expr [lindex $item 0] +1 ] +} + +if {$day_current_hour < 24} { + # need to add dummy entries to show all hours + for { } { $day_current_hour < 24 } { incr day_current_hour } { + multirow append day_items_with_time $day_current_hour "" "" "" "" "" 0 0 } - - 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} +# Select some basic stuff, sets day_of_the_week, yesterday, tomorrow vars +db_1row select_day_info {} -set hour_template [subst $hour_template] +# 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 +if {[catch {set yest [clock format [clock scan "1 day ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { + set previous_link "" +} else { + if {[catch {clock scan $yest}]} { + set previous_link "" + } else { + set previous_link "
<" + } +} -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] +if {[catch {set tomor [clock format [clock scan "1 day" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { + set next_link "" +} else { + if {[catch {clock scan $tomor}]} { + set next_link "" + } else { + set next_link ">" + } +} +set dates "[util_AnsiDatetoPrettyDate $date]" +set ansi_list [split $date "- "] +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 julian_date [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day] + +set url_previous_week "" +set url_next_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.1 -r1.2 --- openacs-4/packages/calendar/www/view-week-display-postgresql.xql 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-week-display-postgresql.xql 21 Jul 2003 19:21:36 -0000 1.2 @@ -5,11 +5,11 @@ - select to_char(to_date(:current_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(:current_date, 'yyyy-mm-dd')- '1 week'::interval, 'Sunday'), 'YYYY-MM-DD') + to_char(next_day(to_date(:start_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') + to_char(next_day(to_date(:start_date, 'yyyy-mm-dd'), 'Saturday'), 'YYYY-MM-DD') as saturday_of_the_week from dual @@ -18,8 +18,12 @@ 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, 'D') as day_of_week, + to_char(start_date, 'Day') as start_date_weekday, + to_char(start_date,'YYYY-MM-DD') as start_date, + to_char(end_date,'YYYY-MM-DD') as end_date, + to_char(start_date,'HH24:MI') as start_time, + to_char(end_date,'HH24:MI') as end_time, 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, @@ -48,9 +52,63 @@ from cal_items where on_which_calendar in ([join $calendar_id_list ","]) ) +order by start_date_julian, start_time + + +select to_char(to_date(:start_date, 'yyyy-mm-dd'), 'D') +as day_of_the_week, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') as date) +as sunday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday'),'J') +as sunday_julian, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('1 day' as interval) as date) +as monday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('1 day' as interval),'J') +as monday_julian, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('2 days' as interval) as date) +as tuesday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('2 days' as interval),'J') +as tuesday_julian, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('3 days' as interval) as date) +as wednesday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('3 days' as interval),'J') +as wednesday_julian, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('4 days' as interval) as date) +as thursday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('4 days' as interval),'J') +as thursday_julian, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('5 days' as interval) as date) +as friday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('5 days' as interval),'J') +as friday_julian, +cast(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('6 days' as interval) as date) +as saturday_date, +to_char(next_day(to_date(:start_date, 'yyyy-mm-dd') - cast('7 days' as interval), 'Sunday') + cast('6 days' as interval),'J') +as saturday_julian, +cast(:start_date::timestamptz - cast('7 days' as interval) as date) as last_week, +to_char(:start_date::timestamptz - cast('7 days' as interval), 'Month DD, YYYY') as last_week_pretty, +cast(:start_date::timestamptz + cast('7 days' as interval) as date) as next_week, +to_char(:start_date::timestamptz + cast('7 days' as interval), 'Month DD, YYYY') as next_week_pretty +from dual + + + + +select to_char(to_date(:start_date, 'yyyy-mm-dd'), 'Day, DD Month YYYY') +as day_of_the_week, +to_char(to_date(:start_date, 'yyyy-mm-dd') - cast('1 day' as interval), 'yyyy-mm-dd') +as yesterday, +to_char(to_date(:start_date, 'yyyy-mm-dd') + cast('1 day' as interval), 'yyyy-mm-dd') +as tomorrow +from dual + + + + + 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 -r1.1 -r1.2 --- openacs-4/packages/calendar/www/view-week-display.adp 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-week-display.adp 21 Jul 2003 19:21:36 -0000 1.2 @@ -1 +1,79 @@ -@foobar;noquote@ + + + + + + + +
+ + + + +
+ @url_previous_week;noquote@ + back one week + + @dates;noquote@ + @url_next_week;noquote@ + forward one week + +
+
+ + + + + + + + + + + + + + + +
+ @week_items.start_date_weekday@: + + + + #calendar.Add_Item#@week_items.start_date@ +
+ + + + + + + + + + + +
+ + + + + + + @week_items.start_time@ - @week_items.end_time@ + + @week_items.name@ + + + + + [@week_items.calendar_name@] +
+
+
+ +
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.1 -r1.2 --- openacs-4/packages/calendar/www/view-week-display.tcl 26 May 2003 10:00:10 -0000 1.1 +++ openacs-4/packages/calendar/www/view-week-display.tcl 21 Jul 2003 19:21:36 -0000 1.2 @@ -1,64 +1,53 @@ - if {[empty_string_p $date]} { - set date [dt_sysdate] - } +# Show calendar items per one week. - set current_date $date +if {[empty_string_p $date]} { + set date [dt_sysdate] +} - # 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] +set start_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]]] +} - # This isn't going to be pretty. First we make it work, though. (ben) +db_1row select_weekday_info {} +db_1row select_week_info {} + +set current_weekday 1 - db_1row select_weekday_info {} +# this needs to be I18Nized +set weekday_english_names {Sunday Monday Tuesday Wednesday Thursday Friday Saturday} - # Loop through the calendars - db_foreach select_week_items {} { - ns_log Notice "ONE WEEK ITEM" +# Loop through the calendars +multirow create week_items name item_id start_date calendar_name status_summary day_of_week start_date_weekday start_time end_time no_time_p - # 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 +db_foreach select_week_items {} { + if {$day_of_week > $current_weekday} { + # need to add dummy entries to show all days + for { } { $current_weekday < $day_of_week } { incr current_weekday } { + multirow append week_items "" "" [dt_julian_to_ansi [expr $sunday_julian + $current_weekday -1]] "" "" $current_weekday [lindex $weekday_english_names [expr $current_weekday -1]] "" "" "" } + } + if {[string equal $start_time "00:00"]} { + set no_time_p t + } else { + set no_time_p f + } - # display stuff - -set day_template "\$day -
\$pretty_date     ([_ calendar.Add_Item])" + multirow append week_items $name $item_id $start_date $calendar_name $status_summary $day_of_week $start_date_weekday $start_time $end_time $no_time_p + set current_weekday $day_of_week +} -set foobar [dt_widget_week -calendar_details $items -date $date -day_template $day_template ] +if {$current_weekday < 8} { + # need to add dummy entries to show all hours + for { } { $current_weekday < 8 } { incr current_weekday } { + multirow append week_items "" "" [dt_julian_to_ansi [expr $sunday_julian + $current_weekday -1]] "" "" $current_weekday [lindex $weekday_english_names [expr $current_weekday -1]] "" "" "" + } +} + +# Navigation Bar +set dates "[util_AnsiDatetoPrettyDate $sunday_date] - [util_AnsiDatetoPrettyDate $saturday_date]" +set url_previous_week "" +set url_next_week "" Index: openacs-4/packages/calendar/www/view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/calendar/www/view.adp 26 May 2003 10:48:13 -0000 1.11 +++ openacs-4/packages/calendar/www/view.adp 21 Jul 2003 19:21:36 -0000 1.12 @@ -2,36 +2,38 @@ #calendar.Calendars# #calendar.Calendar# + + + Index: openacs-4/packages/calendar/www/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/calendar/www/view.tcl 26 May 2003 10:00:10 -0000 1.11 +++ openacs-4/packages/calendar/www/view.tcl 21 Jul 2003 19:21:36 -0000 1.12 @@ -1,8 +1,8 @@ - ad_page_contract { - Viewing Calendar Stuff + Viewing Calendar Information. Currently offers list, day, week, month view. + @author Dirk Gomez (openacs@dirkgomez.de) @author Ben Adida (ben@openforce.net) @creation-date May 29, 2002 @cvs-id $Id$ @@ -12,6 +12,8 @@ {julian_date ""} {calendar_list:multiple ""} {sort_by ""} + {start_date ""} + {period_days:integer "31"} } -validate { valid_date -requires { date } { if {![string equal $date ""]} { @@ -22,106 +24,24 @@ } } + + set package_id [ad_conn package_id] set user_id [ad_conn user_id] set calendar_list [calendar::adjust_calendar_list -calendar_list $calendar_list -package_id $package_id -user_id $user_id] set date [calendar::adjust_date -date $date -julian_date $julian_date] -# Calendar ID list - -# Set up some template -set item_template "\$item" -set hour_template "\$hour" -set item_add_template "\"[_" - - -# Depending on the view, make a different widget -if {$view == "day"} { - - # 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 - if {[catch {set yest [clock format [clock scan "1 day ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $yest}]} { - set previous_link "" - } else { - set previous_link "<" - } +if {$view == "list"} { + if {[empty_string_p $start_date]} { + set start_date $date } - if {[catch {set tomor [clock format [clock scan "1 day" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $tomor}]} { - set next_link "" - } else { - set next_link ">" - } - } -} - -if {$view == "week"} { - - # Check that the previous and next weeks are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set prev_w [clock format [clock scan "1 week ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $prev_w}]} { - set previous_link "" - } else { - set previous_link "<" - } - } - - if {[catch {set next_w [clock format [clock scan "1 week" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $next_w}]} { - set next_link "" - } else { - set next_link ">" - } - } -} - -if {$view == "month"} { - - # Check that the previous and next months are in the tcl boundaries - # so that the calendar widget doesn't bomb when it creates the next/prev links - if {[catch {set prev_m [clock format [clock scan "1 month ago" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set previous_link "" - } else { - if {[catch {clock scan $prev_m}]} { - set previous_link "" - } else { - set previous_link "<" - } - } - - if {[catch {set next_m [clock format [clock scan "1 month" -base [clock scan $date]] -format "%Y-%m-%d"]}]} { - set next_link "" - } else { - if {[catch {clock scan $next_m}]} { - set next_link "" - } else { - set next_link ">" - } - } - -} - -if {$view == "list"} { - set start_date $date - set ansi_list [split $date "- "] + set ansi_list [split $start_date "- "] 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 ] + 31]] + set end_date [dt_julian_to_ansi [expr [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + $period_days]] } -set cal_nav [dt_widget_calendar_navigation "view" $view $date "calendar_list="] - ad_return_template Index: openacs-4/packages/calendar/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/doc/index.html,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/doc/index.html 11 Jun 2003 09:13:50 -0000 1.2 +++ openacs-4/packages/calendar/www/doc/index.html 21 Jul 2003 19:21:36 -0000 1.3 @@ -13,10 +13,13 @@ Gomez

I took over calendar package maintainership in May 2003 and am currently - moving html generation into the adp pages. Calendar is currently - not recommended for production use. Here's the wish - list of things - in no particular order: + moving html generation into the adp pages. CVS head's Calendar is + currently not ready for production use, revert to the + "before-noquote" version if you need to have calendar up and running + now. +

Here's the wish list of things - in no particular order: +

  • Proper I18N:
      @@ -48,9 +51,33 @@
    • The calendar needs to be printable (at least for where I work) -
    +

    + Data Model suggestions. + +

    + Don:
    +Calendar items should map arbitrary objects (perhaps only content items) to a +given calendar and given acs-events. We shouldn't have to derive special +types from cal item type in order to attach it to a calendar (nor should we +have to duplicate content to attach it to two calendars as we do now) + +If we restricted the mapping to content items (i.e. calendar info some sort of +content type) we could use the CR's ability to map a template to a given +content type or item to make it possible for the calendar package to display +calendar item details using that facility, giving the package adding +something to the calendar control over how it is displayed. Much more +general. + + +

    Thanks to +

      +
    • Raad Al-Rawi from Cambridge University for calendar.css and all of the + layout. +
    + +

    This is old stuff and will probably disappear in the near future. (June-2003) Index: openacs-4/packages/calendar/www/ics/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/ics/index.vuh,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/www/ics/index.vuh 10 Jul 2002 14:58:25 -0000 1.2 +++ openacs-4/packages/calendar/www/ics/index.vuh 21 Jul 2003 19:21:36 -0000 1.3 @@ -19,8 +19,7 @@ ad_script_abort } -# Permission (FIXME: ben) -# ad_require_permission $cal_item_id read +ad_require_permission $cal_item_id read set ics_stuff [calendar::outlook::format_item -cal_item_id $cal_item_id -all_occurences_p $all_occurences_p]

-

- @cal_nav;noquote@ + +

-#calendar.Add_Item##calendar.Add_Item# -

- + #calendar.Add_Item##calendar.Add_Item# + +

+ +

@@ -45,9 +47,7 @@ +calendar_id_list= @calendar_list@>