Index: openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql 2 Jul 2002 21:17:07 -0000 1.2 +++ openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql 10 Jul 2002 14:58:25 -0000 1.3 @@ -13,6 +13,9 @@ start_date as start_date, to_char(start_date, 'MM/DD/YYYY') as pretty_short_start_date, to_char(end_date, 'HH:MIpm') as end_time, + end_date as end_date, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as full_start_date, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as full_end_date, nvl(e.name, a.name) as name, nvl(e.description, a.description) as description, recurrence_id, @@ -44,6 +47,9 @@ start_date as start_date, to_char(start_date, 'MM/DD/YYYY') as pretty_short_start_date, to_char(end_date, 'HH:MIpm') as end_time, + end_date as end_date, + to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as full_start_date, + to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as full_end_date, nvl(e.name, a.name) as name, nvl(e.description, a.description) as description, recurrence_id, Index: openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl 3 Jul 2002 10:21:37 -0000 1.5 +++ openacs-4/packages/calendar/tcl/calendar-outlook-procs.tcl 10 Jul 2002 14:58:25 -0000 1.6 @@ -52,7 +52,7 @@ ad_proc -public format_item { {-cal_item_id:required} - {-all_occurences_p:boolean 0} + {-all_occurences_p 0} {-client_timezone 0} } { the cal_item_id is obvious. @@ -63,28 +63,72 @@ } { set date_format "YYYY-MM-DD HH24:MI:SS" - # Select the item information - db_1row select_calendar_item {} - + calendar::item::get -cal_item_id $cal_item_id -array cal_item # If necessary, select recurrence information # Here we have some fields # start_time end_time title description # For now we don't do recurrence - set DTSTART [ics_timestamp_format -timestamp $start_date] - set DTEND [ics_timestamp_format -timestamp $end_date] + set DTSTART [ics_timestamp_format -timestamp $cal_item(full_start_date)] + set DTEND [ics_timestamp_format -timestamp $cal_item(full_end_date)] # Put it together set ics_event "BEGIN:VCALENDAR\r\nPRODID:-//OpenACS//OpenACS 4.5 MIMEDIR//EN\r\nVERSION:2.0\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT\r\nDTSTART:$DTSTART\r\nDTEND:$DTEND\r\n" - regexp {^([0-9]*)T} $DTSTART all creation_date - set DESCRIPTION $description - set title $name + # Recurrence stuff + if {![empty_string_p $cal_item(recurrence_id)] && $all_occurences_p} { - append ics_event "LOCATION:Not Listed\r\nTRANSP:OPAQUE\r\nSEQUENCE:0\r\nUID:$cal_item_id\r\nDTSTAMP:$creation_date\r\nDESCRIPTION:$DESCRIPTION\r\nSUMMARY:$title\r\nPRIORITY:5\r\nCLASS:PUBLIC\r\n" + set recur_rule "RRULE:FREQ=" + # Select recurrence info + set recurrence_id $cal_item(recurrence_id) + db_1row select_recurrence {} -column_array recurrence + + switch -glob $recurrence(interval_name) { + day { append recur_rule "DAILY" } + week { append recur_rule "WEEKLY" } + *month* { append recur_rule "MONTHLY"} + year { append recur_rule "YEARLY"} + } + + if { $recurrence(interval_name) == "week" && ![empty_string_p $recurrence(days_of_week)] } { + + #DRB: Standard indicates ordinal week days are OK, but Outlook + #only takes two-letter abbreviation form. + + append recur_rule ";BYDAY=" + set week_list [list "SU" "MO" "TU" "WE" "TH" "FR" "SA" "SU"] + set sep "" + set day_list [split $recurrence(days_of_week) " "] + foreach day $day_list { + append recur_rule "$sep[lindex $week_list $day]" + set sep "," + } + } + + if { ![empty_string_p $recurrence(every_nth_interval)] } { + append recur_rule ";INTERVAL=$recurrence(every_nth_interval)" + } + + if { ![empty_string_p $recurrence(recur_until)] } { + #DRB: this should work with a DATE: type but doesn't with Outlook at least. + append recur_rule ";UNTIL=$recurrence(recur_until)" + append recur_rule "T000000Z" + } + + append ics_event "$recur_rule\r\n" + + } + + ns_log Notice "DTSTART = $DTSTART" + regexp {^([0-9]*)T} $DTSTART all CREATION_DATE + set DESCRIPTION $cal_item(description) + set TITLE $cal_item(name) + + append ics_event "LOCATION:Not Listed\r\nTRANSP:OPAQUE\r\nSEQUENCE:0\r\nUID:$cal_item_id\r\nDTSTAMP:$CREATION_DATE\r\nDESCRIPTION:$DESCRIPTION\r\nSUMMARY:$TITLE\r\nPRIORITY:5\r\nCLASS:PUBLIC\r\n" + append ics_event "END:VEVENT\r\nEND:VCALENDAR\r\n" return $ics_event Index: openacs-4/packages/calendar/tcl/calendar-outlook-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-outlook-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar/tcl/calendar-outlook-procs.xql 29 May 2002 23:20:55 -0000 1.1 +++ openacs-4/packages/calendar/tcl/calendar-outlook-procs.xql 10 Jul 2002 14:58:25 -0000 1.2 @@ -1,21 +1,14 @@ - + select -to_char(start_date, :date_format) as start_date, -to_char(end_date, :date_format) as end_date, -nvl(e.name,a.name) as name, -nvl(e.description, a.description) as description, -recurrence_id, -item_type_id -from acs_activities a, acs_events e, timespans s, time_intervals t, cal_items - where e.timespan_id = s.timespan_id - and s.interval_id = t.interval_id - and e.activity_id = a.activity_id - and e.event_id = :cal_item_id - and cal_items.cal_item_id = :cal_item_id +recurrence_id, recurrences.interval_type, interval_name, +every_nth_interval, days_of_week, recur_until +from recurrences, recurrence_interval_types +where recurrence_id= :recurrence_id +and recurrences.interval_type = recurrence_interval_types.interval_type 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.10 -r1.11 --- openacs-4/packages/calendar/www/cal-item-view.adp 2 Jul 2002 21:49:55 -0000 1.10 +++ openacs-4/packages/calendar/www/cal-item-view.adp 10 Jul 2002 14:58:25 -0000 1.11 @@ -37,7 +37,7 @@ edit | delete @attachment_options@

-sync with Outlook +sync with Outlook: single event | all events 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.1 -r1.2 --- openacs-4/packages/calendar/www/ics/index.vuh 2 Jul 2002 21:17:08 -0000 1.1 +++ openacs-4/packages/calendar/www/ics/index.vuh 10 Jul 2002 14:58:25 -0000 1.2 @@ -7,6 +7,8 @@ @author Ben Adida (ben@openforce) @creation-date June 20, 2002 @cvs-id $Id$ +} { + {all_occurences_p 0} } set path [ad_conn path_info] @@ -20,6 +22,9 @@ # Permission (FIXME: ben) # ad_require_permission $cal_item_id read -set ics_stuff [calendar::outlook::format_item -cal_item_id $cal_item_id] +set ics_stuff [calendar::outlook::format_item -cal_item_id $cal_item_id -all_occurences_p $all_occurences_p] ns_return 200 application/x-msoutlook $ics_stuff + +# This is for testing +# ns_return 200 text/plain $ics_stuff