Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -N -r1.27 -r1.28 --- openacs-4/packages/forums/forums.info 1 Apr 2004 16:14:28 -0000 1.27 +++ openacs-4/packages/forums/forums.info 1 Apr 2004 20:03:49 -0000 1.28 @@ -7,19 +7,22 @@ f f - + OpenACS Online discussion forums. 2003-11-10 OpenACS This online discussion board software is the successor of the original bboard package. The biggest improvement is a scalable datamodel. Forums supports threaded and flat view, moderation, a stand alone search function as well as integration with the OpenACS search package and integration with the notifications package for email alerts. It also supports reply via email. - + - + + + + Index: openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql 28 Aug 2003 09:41:54 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql 1 Apr 2004 20:03:52 -0000 1.3 @@ -2,28 +2,9 @@ -- dave bauer -- August 7, 2002 -select acs_sc_impl__new( - 'FtsContentProvider', -- impl_contract_name - 'forums_message', -- impl_name - 'forums' -- impl_owner.name -); +-- jcd: 2004-04-01 moved the sc create to the tcl callbacks, and added one for forum_forum objtype +-- TODO-JCD: trigger for forums_forums -select acs_sc_impl_alias__new( - 'FtsContentProvider', -- impl_contract_name - 'forums_message', -- impl_name - 'datasource', -- impl_operation_name - 'forum::message::datasource', -- impl_alias - 'TCL' -- impl_pl -); - -select acs_sc_impl_alias__new( - 'FtsContentProvider', -- impl_contract_name - 'forums_message', -- impl_name - 'url', -- impl_operation_name - 'forum::message::url', -- impl_alias - 'TCL' -- impl_pl -); - -- til: only indexing full threads. changes to child messages will be treated as -- change to the thread. Index: openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql 28 Aug 2003 09:41:54 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql 1 Apr 2004 20:03:53 -0000 1.3 @@ -7,13 +7,6 @@ -- Removes search support from news module. -- -select acs_sc_impl__delete( - 'FtsContentProvider', -- impl_contract_name - 'forums_message' -- impl_name -); - - - drop trigger forums_message_search__itrg on forums_messages; drop trigger forums_message_search__dtrg on forums_messages; drop trigger forums_message_search__utrg on forums_messages; Index: openacs-4/packages/forums/tcl/forums-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-install-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/tcl/forums-install-procs.tcl 1 Apr 2004 20:03:53 -0000 1.1 @@ -0,0 +1,38 @@ +ad_library { + Forums install callbacks + + @creation-date 2004-04-01 + @author Jeff Davis davis@xarg.net + @cvs-id $Id: forums-install-procs.tcl,v 1.1 2004/04/01 20:03:53 jeffd Exp $ +} + +namespace eval forum::install {} + +ad_proc -private forum::install::package_install {} { + package install callback +} { + forum::sc::register_implementations +} + +ad_proc -private forum::install::package_uninstall {} { + package uninstall callback +} { + forum::sc::unregister_implementations +} + +ad_proc -private forum::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 { + 1.1d3 1.1d4 { + # just need to install the forum_forum callback + forum::sc::register_forum_fts_impl + } + } +} Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/forums/tcl/forums-procs.tcl 30 Mar 2004 21:00:31 -0000 1.12 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 1 Apr 2004 20:03:53 -0000 1.13 @@ -61,6 +61,8 @@ {-array:required} } { get the fields for a forum + + @return } { # Select the info into the upvar'ed Tcl Array upvar $array row Index: openacs-4/packages/forums/tcl/forums-sc-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-sc-procs-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/forums/tcl/forums-sc-procs-postgresql.xql 1 Sep 2003 22:22:14 -0000 1.1 +++ openacs-4/packages/forums/tcl/forums-sc-procs-postgresql.xql 1 Apr 2004 20:03:53 -0000 1.2 @@ -15,14 +15,24 @@ - select site_node__url(node_id) + select site_node__url(min(node_id)) from site_nodes where object_id = (select package_id from forums_forums where forums_forums.forum_id = :forum_id) + + + select site_node__url(min(node_id)) + from site_nodes + where object_id = (select package_id + from forums_forums + where forums_forums.forum_id = :forum_id) + + + select subject, content, html_p Index: openacs-4/packages/forums/tcl/forums-sc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-sc-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/tcl/forums-sc-procs.tcl 7 Nov 2003 17:43:33 -0000 1.3 +++ openacs-4/packages/forums/tcl/forums-sc-procs.tcl 1 Apr 2004 20:03:53 -0000 1.4 @@ -4,13 +4,12 @@ @creation-date 2002-08-07 @author Dave Bauer - @cvs-id $Id: - + @cvs-id $Id$ } -namespace eval forum::message { +namespace eval forum::message {} -ad_proc datasource { message_id } { +ad_proc -private forum::message::datasource { message_id } { @param message_id @author dave@thedesignexperience.org @creation_date 2002-08-07 @@ -36,13 +35,7 @@ if { ![empty_string_p $message(parent_id)] } { ns_log Notice "forum::message::datasource was called with a message_id that has a parent - skipping: $message_id" - set empty(object_id) $message_id - set empty(title) "" - set empty(content) "" - set empty(keywords) "" - set empty(storage_type) "" - set empty(mime) "" - return [array get empty] + return {object_id {} name {} charter {} mime {} storage_type {}} } set tree_sortkey $message(tree_sortkey) @@ -72,16 +65,15 @@ append combined_content "\n\n" } - set datasource(object_id) $message(message_id) - set datasource(title) $message(subject) - set datasource(content) $combined_content - set datasource(keywords) "" - set datasource(storage_type) text - set datasource(mime) "text/plain" - return [array get datasource] + return [list object_id $message(message_id) \ + title $message(subject) \ + content $combined_content \ + keywords {} \ + storage_type text \ + mime_type text/plain ] } -ad_proc url { message_id } { +ad_proc -private forum::message::url { message_id } { @param message_id @author dave@thedesignexperience.org @creation_date 2002-08-07 @@ -96,3 +88,94 @@ } } + + +namespace eval forum::forum {} + +ad_proc -private forum::forum::datasource { + forum_id +} { + Datasource for the FtsContentProvider contract. + + @param forum_id + + @author Jeff Davis davis@xarg.net + @creation_date 2004-04-01 +} { + if {![db_0or1row datasource { + select + forum_id as object_id, + name as title, + charter as content, + 'text/plain' as mime, + 'text' as storage_type + from forums_forums + where forum_id = :forum_id + } -column_array datasource]} { + return {object_id {} name {} charter {} mime {} storage_type {}} + } + + return [array get datasource] +} + +ad_proc -private forum::forum::url { + forum_id +} { + url method for the FtsContentProvider contract + + @param forum_id + + @author Jeff Davis davis@xarg.net + @creation_date 2004-04-01 +} { + return "[ad_url][db_string select_forums_package_url {}]forum-view?forum_id=$forum_id" +} + + +namespace eval forum::sc {} + +ad_proc -private forum::sc::register_implementations {} { + Register the forum_forum and forum_message content type fts contract +} { + db_transaction { + forum::sc::register_forum_fts_impl + forum::sc::register_message_fts_impl + } +} + +ad_proc -private forum::sc::unregister_implementations {} { + db_transaction { + acs_sc::impl::delete -contract_name FtsContentProvider -impl_name forum_message + acs_sc::impl::delete -contract_name FtsContentProvider -impl_name forum_forum + } +} + +ad_proc -private forum::sc::register_forum_fts_impl {} { + set spec { + name "forums_forum" + aliases { + datasource forum::forum::datasource + url forum::forum::url + } + contract_name FtsContentProvider + owner forums + } + + acs_sc::impl::new_from_spec -spec $spec +} + + +ad_proc -private forum::sc::register_message_fts_impl {} { + set spec { + name "forums_message" + aliases { + datasource forum::message::datasource + url forum::message::url + } + contract_name FtsContentProvider + owner forums + } + + acs_sc::impl::new_from_spec -spec $spec +} + Index: openacs-4/packages/forums/tcl/messages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/forums/tcl/messages-procs.tcl 25 Mar 2004 16:16:58 -0000 1.25 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 1 Apr 2004 20:03:53 -0000 1.26 @@ -255,7 +255,7 @@ (the creation date of the subjects) or the last one. @author Peter Marklund -} { +} { set subject_label "[_ forums.lt_First_post_in_subject]" set child_label "[_ forums.Last_post_in_subject]" set new_order_by [ad_decode $order_by posting_date last_child_post posting_date]