Index: openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql 8 Dec 2003 05:15:04 -0000 1.6 +++ openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql 14 Dec 2003 12:32:27 -0000 1.7 @@ -71,7 +71,6 @@ content, content_format, entry_date, - posted_date, draft_p, deleted_p ) values ( @@ -82,7 +81,6 @@ pinds_blog_entry.new.content, pinds_blog_entry.new.content_format, pinds_blog_entry.new.entry_date, - sysdate, pinds_blog_entry.new.draft_p, 'f' ); Index: openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-1.0a3-1.0a4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-1.0a3-1.0a4.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-1.0a3-1.0a4.sql 14 Dec 2003 11:10:44 -0000 1.1 +++ openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-1.0a3-1.0a4.sql 14 Dec 2003 12:32:27 -0000 1.2 @@ -20,3 +20,98 @@ alter table pinds_blog_entries drop column posted_date; +create or replace package body pinds_blog_entry +as + + function new ( + entry_id in pinds_blog_entries.entry_id%TYPE default null, + package_id in pinds_blog_entries.package_id%TYPE, + title in pinds_blog_entries.title%TYPE default null, + title_url in pinds_blog_entries.title_url%TYPE default null, + content in varchar default null, + content_format in varchar default 'text/html', + entry_date in pinds_blog_entries.entry_date%TYPE default null, + draft_p in pinds_blog_entries.draft_p%TYPE default 'f', + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return pinds_blog_entries.entry_id%TYPE + is + v_entry_id pinds_blog_entries.entry_id%TYPE; + begin + + v_entry_id := acs_object.new( + object_id => pinds_blog_entry.new.entry_id, + object_type => 'pinds_blog_entry', + creation_date => sysdate, + creation_user => pinds_blog_entry.new.creation_user, + creation_ip => pinds_blog_entry.new.creation_ip, + context_id => pinds_blog_entry.new.package_id + ); + + insert into pinds_blog_entries ( + entry_id, + package_id, + title, + title_url, + content, + content_format, + entry_date, + draft_p, + deleted_p + ) values ( + v_entry_id, + pinds_blog_entry.new.package_id, + pinds_blog_entry.new.title, + pinds_blog_entry.new.title_url, + pinds_blog_entry.new.content, + pinds_blog_entry.new.content_format, + pinds_blog_entry.new.entry_date, + pinds_blog_entry.new.draft_p, + 'f' + ); + + return v_entry_id; + + end new; + + procedure del ( + entry_id in pinds_blog_entries.entry_id%TYPE + ) + is + begin + -- delete comments associated with this entry + for comment in (select comment_id from general_comments + where object_id = pinds_blog_entry.del.entry_id) loop + acs_message.del(comment.comment_id); + end loop; + + delete + from pinds_blog_entries + where entry_id = pinds_blog_entry.del.entry_id; + + acs_object.del(pinds_blog_entry.del.entry_id); + + end del; + + function title ( + entry_id in pinds_blog_entries.entry_id%TYPE + ) return pinds_blog_entries.title%TYPE + is + v_title pinds_blog_entries.title%TYPE; + begin + + select title + into v_title + from pinds_blog_entries + where entry_id = pinds_blog_entry.title.entry_id; + + return v_title; + + exception when no_data_found then + return ''; + + end title; + +end pinds_blog_entry; +/ +show errors Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-pb.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-pb.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-pb.sql 8 Dec 2003 05:10:23 -0000 1.1 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-pb.sql 14 Dec 2003 12:32:27 -0000 1.2 @@ -65,7 +65,6 @@ content, content_format, entry_date, - posted_date, draft_p, deleted_p ) values ( @@ -77,7 +76,6 @@ p_content, p_content_format, p_entry_date, - current_timestamp, p_draft_p, ''f'' ); Index: openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-1.0a3-1.0a4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/upgrade/Attic/upgrade-1.0a3-1.0a4.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-1.0a3-1.0a4.sql 14 Dec 2003 11:10:44 -0000 1.3 +++ openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-1.0a3-1.0a4.sql 14 Dec 2003 12:32:27 -0000 1.4 @@ -21,3 +21,73 @@ alter table pinds_blog_entries drop column posted_date; + +create or replace function pinds_blog_entry__new ( + integer, -- entry_id + integer, -- package_id + varchar, -- title + varchar, -- title_url + integer, -- category_id + varchar, -- content + varchar, -- content_format + timestamptz, -- entry_date + char, -- draft_p + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_entry_id alias for $1; + p_package_id alias for $2; + p_title alias for $3; + p_title_url alias for $4; + p_category_id alias for $5; + p_content alias for $6; + p_content_format alias for $7; + p_entry_date alias for $8; + p_draft_p alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + v_entry_id integer; +begin + v_entry_id := acs_object__new ( + p_entry_id, + ''pinds_blog_entry'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into pinds_blog_entries ( + entry_id, + package_id, + title, + title_url, + category_id, + content, + content_format, + entry_date, + draft_p, + deleted_p + ) values ( + v_entry_id, + p_package_id, + p_title, + p_title_url, + p_category_id, + p_content, + p_content_format, + p_entry_date, + p_draft_p, + ''f'' + ); + + PERFORM acs_permission__grant_permission( + v_entry_id, + p_creation_user, + ''admin'' + ); + + return v_entry_id; +end; +' language 'plpgsql';