Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -r1.25 -r1.26 --- openacs-4/packages/forums/forums.info 11 Dec 2003 21:40:04 -0000 1.25 +++ openacs-4/packages/forums/forums.info 25 Mar 2004 15:59:28 -0000 1.26 @@ -7,14 +7,15 @@ 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/oracle/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql 3 Oct 2003 19:38:15 -0000 1.6 +++ openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql 25 Mar 2004 15:59:29 -0000 1.7 @@ -80,18 +80,22 @@ ) return forums_messages.message_id%TYPE is v_message_id acs_objects.object_id%TYPE; + v_package_id acs_objects.package_id%TYPE; v_sortkey forums_messages.tree_sortkey%TYPE; v_forum_policy forums_forums.posting_policy%TYPE; v_state forums_messages.state%TYPE; begin + select package_id into v_package_id from forums_forums where forum_id = new.forum_id; v_message_id := acs_object.new( object_id => message_id, object_type => object_type, creation_date => creation_date, creation_user => creation_user, creation_ip => creation_ip, - context_id => nvl(context_id, forum_id) + context_id => nvl(context_id, forum_id), + title => subject, + package_id => v_package_id ); if state is null Index: openacs-4/packages/forums/sql/oracle/upgrade/upgrade-1.1d1-1.1d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/upgrade/upgrade-1.1d1-1.1d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/oracle/upgrade/upgrade-1.1d1-1.1d2.sql 25 Mar 2004 15:59:29 -0000 1.1 @@ -0,0 +1 @@ +@@ ../forums-messages-package-create.sql Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 11 Dec 2003 21:40:04 -0000 1.13 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 25 Mar 2004 15:59:29 -0000 1.14 @@ -14,7 +14,7 @@ select define_function_args ('forums_message__new', 'message_id,object_type;forums_message,forum_id,subject,content,html_p,user_id,posting_date,state,parent_id,creation_date,creation_user,creation_ip,context_id'); -create function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer) +create or replace function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamptz,varchar,integer,timestamptz,integer,varchar,integer) returns integer as ' declare p_message_id alias for $1; @@ -35,14 +35,25 @@ v_forum_policy forums_forums.posting_policy%TYPE; v_state forums_messages.state%TYPE; v_posting_date forums_messages.posting_date%TYPE; + v_package_id acs_objects.package_id%TYPE; begin + + select package_id into v_package_id from forums_forums where forum_id = p_forum_id; + + if v_package_id is null then + raise exception ''forums_message__new: forum_id % not found'', p_forum_id; + end if; + v_message_id := acs_object__new( p_message_id, p_object_type, p_creation_date, p_creation_user, p_creation_ip, - coalesce(p_context_id, p_forum_id) + coalesce(p_context_id, p_forum_id), + ''t'', + p_subject, + v_package_id ); if p_state is null then @@ -85,7 +96,7 @@ select define_function_args ('forums_message__root_message_id', 'message_id'); -create function forums_message__root_message_id (integer) +create or replace function forums_message__root_message_id (integer) returns integer as ' declare p_message_id alias for $1; @@ -110,7 +121,7 @@ select define_function_args ('forums_message__thread_open', 'message_id'); -create function forums_message__thread_open (integer) +create or replace function forums_message__thread_open (integer) returns integer as ' declare p_message_id alias for $1; @@ -137,7 +148,7 @@ select define_function_args ('forums_message__thread_close', 'message_id'); -create function forums_message__thread_close (integer) +create or replace function forums_message__thread_close (integer) returns integer as ' declare p_message_id alias for $1; @@ -164,7 +175,7 @@ select define_function_args ('forums_message__delete', 'message_id'); -create function forums_message__delete (integer) +create or replace function forums_message__delete (integer) returns integer as ' declare p_message_id alias for $1; @@ -176,7 +187,7 @@ select define_function_args ('forums_message__delete_thread', 'message_id'); -create function forums_message__delete_thread (integer) +create or replace function forums_message__delete_thread (integer) returns integer as ' declare p_message_id alias for $1; @@ -216,7 +227,7 @@ select define_function_args('forums_message__name','message_id'); -create function forums_message__name (integer) +create or replace function forums_message__name (integer) returns varchar as ' declare p_message_id alias for $1; Index: openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1d1-1.1d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1d1-1.1d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1d1-1.1d2.sql 25 Mar 2004 15:59:30 -0000 1.1 @@ -0,0 +1,73 @@ +-- propigate title and package_id to acs_objects. +create or replace function bookshelf_book__new ( + integer, -- book_id + varchar, -- object_type + integer, -- package_id + varchar, -- isbn + text, -- book_author + text, -- book_title + text, -- main_entry + text, -- additional_entry + text, -- excerpt + varchar, -- publish_status + varchar, -- read_status + date, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer -- context_id +) +returns integer as ' +declare + p_book_id alias for $1; + p_object_type alias for $2; + p_package_id alias for $3; + p_isbn alias for $4; + p_book_author alias for $5; + p_book_title alias for $6; + p_main_entry alias for $7; + p_additional_entry alias for $8; + p_excerpt alias for $9; + p_publish_status alias for $10; + p_read_status alias for $11; + p_creation_date alias for $12; + p_creation_user alias for $13; + p_creation_ip alias for $14; + p_context_id alias for $15; + v_book_id integer; + v_book_no integer; + v_creation_date date; +begin + if p_creation_date is null then + v_creation_date := now(); + else + v_creation_date := p_creation_date; + end if; + + v_book_id := acs_object__new( + p_book_id, + p_object_type, + v_creation_date, + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id), + ''t'', + p_book_title, + p_package_id + ); + + select coalesce(max(book_no),0) + 1 + into v_book_no + from bookshelf_books + where package_id = p_package_id; + + insert into bookshelf_books + (book_id, book_no, isbn, book_author, book_title, main_entry, additional_entry, excerpt, + publish_status, read_status, package_id) + values + (v_book_id, v_book_no, p_isbn, p_book_author, p_book_title, p_main_entry, p_additional_entry, p_excerpt, + p_publish_status, p_read_status, p_package_id); + + return v_book_id; +end; +' language 'plpgsql'; +