Index: openacs-4/packages/forums/sql/oracle/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-forums-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/oracle/forums-forums-create.sql 30 May 2002 06:25:52 -0000 1.2 +++ openacs-4/packages/forums/sql/oracle/forums-forums-create.sql 24 Jun 2002 22:37:52 -0000 1.3 @@ -12,80 +12,83 @@ -- privileges declare begin - -- moderate and post are new privileges - -- the rest are obvious inheritance - -- forum creation on a package allows a user to create forums - -- forum creation on a forum allows a user to create new threads - acs_privilege.create_privilege('forum_create',null,null); - acs_privilege.create_privilege('forum_write',null,null); - acs_privilege.create_privilege('forum_delete',null,null); - acs_privilege.create_privilege('forum_read',null,null); - acs_privilege.create_privilege('forum_post',null,null); - acs_privilege.create_privilege('forum_moderate',null,null); + -- moderate and post are new privileges + -- the rest are obvious inheritance + -- forum creation on a package allows a user to create forums + -- forum creation on a forum allows a user to create new threads + acs_privilege.create_privilege('forum_create',null,null); + acs_privilege.create_privilege('forum_write',null,null); + acs_privilege.create_privilege('forum_delete',null,null); + acs_privilege.create_privilege('forum_read',null,null); + acs_privilege.create_privilege('forum_post',null,null); + acs_privilege.create_privilege('forum_moderate',null,null); - -- add children - acs_privilege.add_child('create','forum_create'); - acs_privilege.add_child('write','forum_write'); - acs_privilege.add_child('delete','forum_delete'); - acs_privilege.add_child('admin','forum_moderate'); - acs_privilege.add_child('forum_moderate','forum_read'); - acs_privilege.add_child('forum_moderate','forum_post'); - acs_privilege.add_child('forum_write','forum_read'); - acs_privilege.add_child('forum_write','forum_post'); + -- add children + acs_privilege.add_child('create','forum_create'); + acs_privilege.add_child('write','forum_write'); + acs_privilege.add_child('delete','forum_delete'); + acs_privilege.add_child('admin','forum_moderate'); + acs_privilege.add_child('forum_moderate','forum_read'); + acs_privilege.add_child('forum_moderate','forum_post'); + acs_privilege.add_child('forum_write','forum_read'); + acs_privilege.add_child('forum_write','forum_post'); - -- the last one that will cause all the updates - acs_privilege.add_child('read','forum_read'); + -- the last one that will cause all the updates + acs_privilege.add_child('read','forum_read'); end; / show errors - --- --- The Data Model --- - create table forums_forums ( - forum_id integer not null - constraint forums_forum_id_fk - references acs_objects(object_id) - constraint forums_forum_id_pk - primary key, - name varchar(200) constraint forum_name_nn not null, - charter varchar(2000), - presentation_type varchar(100) - constraint forum_type_nn not null - constraint forum_type_ch - check (presentation_type in ('flat','threaded')), - posting_policy varchar(100) - constraint forum_policy_nn not null - constraint forum_policy_ch - check (posting_policy in ('open','moderated','closed')), - max_child_sortkey raw(100), - enabled_p char(1) default 't' not null - constraint forum_enabled_p_ch check - (enabled_p in ('t','f')), - package_id integer constraint forum_package_id_nn not null + forum_id integer + constraint forums_forum_id_fk + references acs_objects (object_id) + constraint forums_forums_pk + primary key, + name varchar(200) + constraint forums_name_nn + not null, + charter varchar(2000), + presentation_type varchar(100) + constraint forums_presentation_type_nn + not null + constraint forums_presentation_type_ck + check (presentation_type in ('flat','threaded')), + posting_policy varchar(100) + constraint forums_posting_policy_nn + not null + constraint forums_posting_policy_ck + check (posting_policy in ('open','moderated','closed')), + max_child_sortkey raw(100), + enabled_p char(1) + default 't' + constraint forums_enabled_p_nn + not null + constraint forums_enabled_p_ck + check (enabled_p in ('t','f')), + package_id integer + constraint forums_package_id_nn + not null ); create view forums_forums_enabled -as select * from forums_forums where enabled_p='t'; +as + select * + from forums_forums + where enabled_p = 't'; --- --- Object Type --- - declare begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'forums_forum', - pretty_name => 'Forums Forum', - pretty_plural => 'Forums Forums', - table_name => 'forums_forums', - id_column => 'forum_id', - package_name => 'forums_forum', - name_method => 'forums_forum.name' - ); + acs_object_type.create_type( + supertype => 'acs_object', + object_type => 'forums_forum', + pretty_name => 'Forums Forum', + pretty_plural => 'Forums Forums', + table_name => 'forums_forums', + id_column => 'forum_id', + package_name => 'forums_forum', + name_method => 'forums_forum.name' + ); end; / show errors Index: openacs-4/packages/forums/sql/oracle/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 3 Jun 2002 23:58:45 -0000 1.2 +++ openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 24 Jun 2002 22:37:52 -0000 1.3 @@ -1,4 +1,3 @@ - -- -- The Forums Package -- @@ -9,75 +8,74 @@ -- lifted from Gilbert. Thanks Orchard Labs! -- --- privileges --- NO PRIVILEGES FOR MESSAGES --- we don't individually permission messages - --- --- The Data Model --- - create table forums_messages ( - message_id integer not null - constraint forums_message_id_fk - references acs_objects(object_id) - constraint forums_message_id_pk - primary key, - forum_id integer - constraint forums_mess_forum_id_fk - references forums_forums(forum_id), - subject varchar(200), - content clob, - -- html_p only applies to the body. The subject is plaintext. - html_p char(1) default 'f' - constraint forums_mess_html_p_ch - check (html_p in ('t','f')) - constraint forums_mess_html_p_nn not null, - user_id integer - constraint forums_mess_user_id_fk - references users(user_id) - constraint forums_mess_user_id_nn - not null, - posting_date date - constraint forum_mess_post_date_nn not null, - state varchar(100) - constraint forum_mess_state_ch check (state in ('pending','approved','rejected')), - -- Hierarchy of messages - parent_id integer - constraint forum_mess_parent_id_fk - references forums_messages(message_id), - open_p char(1) default 't' not null - constraint forum_mess_open_p_ch check (open_p in ('t','f')), - tree_sortkey raw(240), - max_child_sortkey raw(100), - constraint forums_mess_sk_forum_un - unique (tree_sortkey,forum_id) + message_id integer + constraint forums_message_id_fk + references acs_objects (object_id) + constraint forums_messages_pk + primary key, + forum_id integer + constraint forums_mess_forum_id_fk + references forums_forums (forum_id), + subject varchar(200), + content clob, + -- html_p only applies to the body. The subject is plaintext. + html_p char(1) + default 'f' + constraint forums_mess_html_p_ck + check (html_p in ('t','f')) + constraint forums_mess_html_p_nn + not null, + user_id integer + constraint forums_mess_user_id_fk + references users(user_id) + constraint forums_mess_user_id_nn + not null, + posting_date date + default sysdate + constraint forum_mess_post_date_nn + not null, + state varchar(100) + constraint forum_mess_state_ck + check (state in ('pending','approved','rejected')), + -- Hierarchy of messages + parent_id integer + constraint forum_mess_parent_id_fk + references forums_messages (message_id), + open_p char(1) + default 't' + constraint forum_mess_open_p_nn + not null + constraint forum_mess_open_p_ck + check (open_p in ('t','f')), + tree_sortkey raw(240), + max_child_sortkey raw(100), + constraint forums_mess_sk_forum_un + unique (tree_sortkey, forum_id) ); --- views - create view forums_messages_approved as -select * from forums_messages where state='approved'; + select * + from forums_messages + where state = 'approved'; create view forums_messages_pending as -select * from forums_messages where state='pending'; + select * + from forums_messages + where state = 'pending'; --- --- Object Type --- - declare begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'forums_message', - pretty_name => 'Forums Message', - pretty_plural => 'Forums Messages', - table_name => 'forums_messages', - id_column => 'message_id', - package_name => 'forums_message', - name_method => 'forums_message.name' - ); + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'forums_message', + pretty_name => 'Forums Message', + pretty_plural => 'Forums Messages', + table_name => 'forums_messages', + id_column => 'message_id', + package_name => 'forums_message', + name_method => 'forums_message.name' + ); end; / show errors Index: openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 12 Jun 2002 15:24:02 -0000 1.2 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 24 Jun 2002 22:37:52 -0000 1.3 @@ -13,7 +13,6 @@ create function inline_0 () returns integer as ' begin - -- moderate and post are new privileges -- the rest are obvious inheritance -- forum creation on a package allows a user to create forums @@ -58,34 +57,35 @@ create table forums_forums ( forum_id integer + constraint forums_forum_id_nn + not null constraint forums_forum_id_fk - references acs_objects(object_id) + references acs_objects (object_id) constraint forums_forum_id_pk primary key, name varchar(200) - constraint forum_name_nn + constraint forums_name_nn not null, charter varchar(2000), presentation_type varchar(100) - constraint forum_type_nn + constraint forums_presentation_type_nn not null - constraint forum_type_ck + constraint forums_presentation_type_ck check (presentation_type in ('flat','threaded')), posting_policy varchar(100) - constraint forum_policy_nn + constraint forums_posting_policy_nn not null - constraint forum_policy_ck + constraint forums_posting_policy_ck check (posting_policy in ('open','moderated','closed')), max_child_sortkey varbit, - enabled_p char(1) default 't' - constraint forum_enabled_p_nn + enabled_p char(1) + default 't' + constraint forums_enabled_p_nn not null - constraint forum_enabled_p_ck - check (enabled_p in ('t', 'f')), + constraint forums_enabled_p_ck + check (enabled_p in ('t','f')), package_id integer - constraint forum_package_id_fk - references apm_packages (package_id) - constraint forum_package_id_nn + constraint forums_package_id_nn not null ); Index: openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 24 Jun 2002 21:40:16 -0000 1.4 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 24 Jun 2002 22:37:52 -0000 1.5 @@ -1,4 +1,3 @@ - -- -- The Forums Package -- @@ -9,19 +8,11 @@ -- lifted from Gilbert. Thanks Orchard Labs! -- --- privileges --- NO PRIVILEGES FOR MESSAGES --- we don't individually permission messages - --- --- The Data Model --- - create table forums_messages ( message_id integer constraint forums_message_id_fk references acs_objects (object_id) - constraint forums_message_id_pk + constraint forums_messages_pk primary key, forum_id integer constraint forums_mess_forum_id_fk @@ -37,7 +28,7 @@ not null, user_id integer constraint forums_mess_user_id_fk - references users (user_id) + references users(user_id) constraint forums_mess_user_id_nn not null, posting_date timestamp @@ -51,7 +42,8 @@ parent_id integer constraint forum_mess_parent_id_fk references forums_messages (message_id), - open_p char(1) default 't' + open_p char(1) + default 't' constraint forum_mess_open_p_nn not null constraint forum_mess_open_p_ck Index: openacs-4/packages/forums/sql/postgresql/forums-tree-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-tree-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/forums/sql/postgresql/forums-tree-create.sql 24 Jun 2002 21:40:16 -0000 1.3 +++ openacs-4/packages/forums/sql/postgresql/forums-tree-create.sql 24 Jun 2002 22:37:52 -0000 1.4 @@ -58,7 +58,6 @@ new.tree_sortkey := v_parent_sortkey || v_max_child_sortkey; return new; - end;' language 'plpgsql'; create trigger forums_mess_insert_tr