--TODO: port to oracle!! -- plpgsql functions for general-comments -- Dave Bauer dave@thedesignexperience.org -- 2003-05-04 create or replace package general_comment as end; show errors / create functions general_comment__new( ) returns integer as ' declare p_comment_id alias for $1; p_object_id alias for $2; p_package_id alias for $3; p_parent_id alias for $4; p_context_id alias for $5; p_title alias for $6; p_description alias for $7 p_content alias for $8; p_creation_user alias for $9; p_creation_date alias for $10; p_creation_ip alias for $11; p_mime_type alias for $12; v_item_id cr_items.item_id%TYPE; begin v_item_id := select nextval(acs_object_id_seq); PERFORM content_item__new( ''general_comment_'' || p_parent_id || ''_'' || v_item_id, p_parent_id, v_item_id, NULL, p_creation_date, p_creation_user, p_context_id, p_creation_ip, ''content_item'', ''general_comment'', p_title, p_description, p_mime_type, p_content, ''text'' ); v_revision_id := select latest_revision from cr_items where item_id=v_item_id PERFORM content_revision__new( ); insert into general_comments ( comment_id, object_id ) values ( p_comment_id, p_object_id ); perform acs_permission__grant_permission(p_comment_id, p_creation_user, ''read''); perform acs_permission__grant_permission(p_comment_id, p_creation_user, ''write''); return p_comment_id; end;' language 'plpgsql'; create or replace function general_comment__del( integer ) returns integer as ' declare p_comment_id alias for $1; begin -- remove permssions from the object delete from acs_permissions where object_id=:p_comment_id; -- handle attachments and child comments for threaded comments? -- do we need to remove live_revision and latest_revision first? perform content_item__delete(p_comment_id); delete from general_comments where comment_id=:p_comment_id; return NULL; end;' language 'plpgsql'; create or replace function general_comment__revise( integer ) returns integer as ' declare p_comment_id alias for $1 begin -- create a new revision of a comment -- does the UI even offer this option? return NULL; end;' language 'plpgsql';