Index: openacs-4/contrib/packages/general-comments/sql/postgresql/general-comments-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/general-comments/sql/postgresql/Attic/general-comments-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/general-comments/sql/postgresql/general-comments-create.sql 2 May 2003 15:49:31 -0000 1.1 +++ openacs-4/contrib/packages/general-comments/sql/postgresql/general-comments-create.sql 5 May 2003 01:14:18 -0000 1.2 @@ -13,23 +13,19 @@ -- create a table to extend cr_items create table general_comments ( comment_id integer constraint general_comments_comment_id_fk - references acs_messages (message_id) on delete cascade + references cr_revision (revision_id) on delete cascade constraint general_comments_pk primary key, object_id integer constraint general_comments_object_id_fk references acs_objects (object_id) on delete cascade, - category varchar(1000) ); comment on table general_comments is ' - Extends the acs_messages table to hold item level data. + Extends the cr_revisions table to hold item level data. '; comment on column general_comments.object_id is ' The id of the object to associate message with '; -comment on column general_comments.category is ' - This feature is not complete. The purpose is to allow separation of - comments into categories. -'; +-- unused catergory feature removed. Should be new categories package. DaveB -- create an index on foreign key constraint create index general_comments_object_id_idx on general_comments (object_id); @@ -53,11 +49,14 @@ PERFORM acs_privilege__add_child(''create'',''general_comments_create''); -- allow registered users to create comments - PERFORM acs_permission__grant_permission ( - default_context, - registered_users, - ''general_comments_create'' - ); +-- This is questionable. If we allow seperate gc instances per subsite this +-- will not work. DaveB + +-- PERFORM acs_permission__grant_permission ( +-- default_context, +-- registered_users, +-- ''general_comments_create'' +-- ); return 0; end;' language 'plpgsql'; @@ -68,34 +67,50 @@ -- show errors + +-- Do we need this or anything like it? DaveB + -- NOTE: this is only temporary until we figure out how -- packages will register child types to an acs-message -create function inline_1 () -returns integer as ' -begin +-- create function inline_1 () +-- returns integer as ' +-- begin - PERFORM content_type__register_child_type ( - /* parent_type => */ ''acs_message_revision'', - /* child_type => */ ''content_revision'', - ''generic'', 0, null - ); - PERFORM content_type__register_child_type ( - /* parent_type => */ ''acs_message_revision'', - /* child_type => */ ''image'', - ''generic'', 0, null - ); - PERFORM content_type__register_child_type ( - /* parent_type => */ ''acs_message_revision'', - /* child_type => */ ''content_extlink'', - ''generic'', 0, null - ); - return 0; -end;' language 'plpgsql'; +-- PERFORM content_type__register_child_type ( +-- /* parent_type => */ ''acs_message_revision'', +-- /* child_type => */ ''content_revision'', +-- ''generic'', 0, null +-- ); +-- PERFORM content_type__register_child_type ( +-- /* parent_type => */ ''acs_message_revision'', +-- /* child_type => */ ''image'', +-- ''generic'', 0, null +-- ); +-- PERFORM content_type__register_child_type ( +-- /* parent_type => */ ''acs_message_revision'', +-- /* child_type => */ ''content_extlink'', +-- ''generic'', 0, null +-- ); +-- return 0; +-- end;' language 'plpgsql'; -select inline_1 (); +-- select inline_1 (); -drop function inline_1 (); +-- drop function inline_1 (); --- show errors +-- create general comment type as subtype or cr_revision +select content_type__create_type ( + 'general_comment', -- content_type + 'content_revision', -- supertype + 'General Comment', -- pretty_name + 'General Comments', -- pretty_plural + 'general_comments', -- table_name + 'comment_id', -- id_column + 'content_revision__revision_name' -- name_method +); + +-- source plpgsql functions + +\i general-comments-plsql-create.sql \ No newline at end of file Index: openacs-4/contrib/packages/general-comments/sql/postgresql/general-comments-plsql-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/general-comments/sql/postgresql/Attic/general-comments-plsql-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/general-comments/sql/postgresql/general-comments-plsql-create.sql 5 May 2003 01:14:18 -0000 1.1 @@ -0,0 +1,55 @@ +-- plpgsql functions for general-comments +-- Dave Bauer dave@thedesignexperience.org +-- 2003-05-04 + +create functions general_comment__new( + ) returns integer as ' +declare + p_comment_id alias for $1; + p_object_id alias for $2; + p_parent_id alias for $3; + p_context_id alias for $4; + p_title alias for $5; + p_content alias for $6; + p_creation_user alias for $7; + p_creation_date alias for $8; + p_creation_ip alias for $9; + v_item_id cr_items.item_id%TYPE; +begin + v_item_id := content_item__new( + ); + + p_revision_id := content_revision__new( + ); + + insert into general_comments + ( + comment_id, + object_id + ) + values + ( + p_comment_id, + p_object_id + ); + +return p_comment_id; +end;' language 'plpgsql'; + +create or replace function general_comment__del(integer) returns integer as ' +declare + p_item_id alias for $1; +begin + +return NULL; +end;' language 'plpgsql'; + +create or replace function general_comment__set() returns integer as ' +declare + +begin + +return NULL; +end;' language 'plpgsql'; + +