Index: openacs-4/packages/calendar/calendar.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/calendar.info,v diff -u -r1.27 -r1.28 --- openacs-4/packages/calendar/calendar.info 12 Mar 2004 13:45:34 -0000 1.27 +++ openacs-4/packages/calendar/calendar.info 1 Apr 2004 21:00:48 -0000 1.28 @@ -7,22 +7,26 @@ f f - + Dirk Gomez Personal and shared event calendars. 2004-03-04 OpenACS Manage group and shared calendars with download. - + - + + + + + Index: openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql 26 Mar 2004 15:03:09 -0000 1.9 +++ openacs-4/packages/calendar/tcl/cal-item-procs-oracle.xql 1 Apr 2004 21:00:49 -0000 1.10 @@ -29,7 +29,8 @@ cal_item_types.type as item_type, on_which_calendar as calendar_id, c.calendar_name, - o.creation_user + o.creation_user, + c.package_id as calendar_package_id from acs_activities a, acs_events e, timespans s, @@ -63,7 +64,8 @@ cal_item_types.type as item_type, on_which_calendar as calendar_id, c.calendar_name, - o.creation_user + o.creation_user, + c.package_id as calendar_package_id from acs_activities a, acs_events e, timespans s, Index: openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql 26 Mar 2004 15:03:09 -0000 1.17 +++ openacs-4/packages/calendar/tcl/cal-item-procs-postgresql.xql 1 Apr 2004 21:00:49 -0000 1.18 @@ -25,7 +25,8 @@ it.type as item_type, on_which_calendar as calendar_id, c.calendar_name, - o.creation_user + o.creation_user, + c.package_id as calendar_package_id from acs_events e join timespans s on (e.timespan_id = s.timespan_id) @@ -60,7 +61,8 @@ it.type as item_type, on_which_calendar as calendar_id, c.calendar_name, - o.creation_user + o.creation_user, + c.package_id as calendar_package_id from acs_events e join timespans s on (e.timespan_id = s.timespan_id) Index: openacs-4/packages/calendar/tcl/calendar-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-install-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/tcl/calendar-install-procs.tcl 1 Apr 2004 21:00:49 -0000 1.1 @@ -0,0 +1,38 @@ +ad_library { + Calendar install callbacks + + @creation-date 2004-04-01 + @author Jeff Davis davis@xarg.net + @cvs-id $Id: calendar-install-procs.tcl,v 1.1 2004/04/01 21:00:49 jeffd Exp $ +} + +namespace eval calendar::install {} + +ad_proc -private calendar::install::package_install {} { + package install callback +} { + calendar::sc::register_implementations +} + +ad_proc -private calendar::install::package_uninstall {} { + package uninstall callback +} { + calendar::sc::unregister_implementations +} + +ad_proc -private calendar::install::package_upgrade {} { + {-from_version_name:required} + {-to_version_name:required} +} { + Package before-upgrade callback +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 2.1.0d1 2.1.0d2 { + # just need to install the cal_item callback + calendar::sc::register_cal_item_fts_impl + } + } +} Index: openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/calendar/tcl/calendar-sc-procs.tcl 1 Apr 2004 21:00:49 -0000 1.1 @@ -0,0 +1,80 @@ +ad_library { + Calendar service contract bindings + + @creation-date 2004-04-01 + @author Jeff Davis davis@xarg.net + @cvs-id $Id: calendar-sc-procs.tcl,v 1.1 2004/04/01 21:00:49 jeffd Exp $ +} + +namespace eval calendar::fts {} + +ad_proc -private calendar::fts::datasource { cal_item_id } { + returns a datasource for a calendar event to + be indexed by the full text search engine. + + @param cal_item_id + + @author davis@xarg.net + @creation_date 2004-04-01 +} { + calendar::item::get -cal_item_id $cal_item_id -array row + + # build a text content + foreach key {description pretty_day_of_week start_time end_time full_start_date start_date_ansi} { + if {[string eq $key start_time]} { + append content "from " + } + if {[string eq $key end_time]} { + append content "to " + } + append content "$row($key) " + + } + + return [list object_id $cal_item_id \ + title $row(name) \ + content $content \ + keywords {} \ + storage_type text \ + mime_type text/plain ] +} + +ad_proc -private calendar::fts::url { cal_item_id } { + returns a url for an event to the search package + + @author davis@xarg.net + @creation_date 2004-04-01 +} { + calendar::item::get -cal_item_id $cal_item_id -array row + return "[ad_url][apm_package_url_from_id $row(calendar_package_id)]cal-item-view?cal_item_id=$cal_item_id" +} + +namespace eval calendar::sc {} + +ad_proc -private calendar::sc::register_implementations {} { + Register the cal_item content type fts contract +} { + db_transaction { + calendar::sc::register_cal_item_fts_impl + } +} + +ad_proc -private calendar::sc::unregister_implementations {} { + db_transaction { + acs_sc::impl::delete -contract_name FtsContentProvider -impl_name cal_item + } +} + +ad_proc -private calendar::sc::register_cal_item_fts_impl {} { + set spec { + name "cal_item" + aliases { + datasource calendar::fts::datasource + url calendar::fts::url + } + contract_name FtsContentProvider + owner calendar + } + + acs_sc::impl::new_from_spec -spec $spec +}