Index: openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql 30 Sep 2003 12:10:08 -0000 1.3 +++ openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql 8 Dec 2003 05:10:23 -0000 1.4 @@ -12,7 +12,7 @@ begin for row in (select type_id from notification_types - where short_name in ('lars_blogger_notif_type')) + where short_name in ('lars_blogger_notif_type','lars_blogger_notif')) loop notification_type.del(row.type_id); end loop; Index: openacs-4/packages/lars-blogger/sql/oracle/rss-unregister.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/rss-unregister.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/sql/oracle/rss-unregister.sql 30 Sep 2003 12:10:08 -0000 1.3 +++ openacs-4/packages/lars-blogger/sql/oracle/rss-unregister.sql 8 Dec 2003 05:10:23 -0000 1.4 @@ -11,6 +11,10 @@ begin + for channel in (select channel_id from weblogger_channels) loop + weblogger_channel.del(channel.channel_id); + end loop; + acs_sc_impl.del( impl_contract_name => 'RssGenerationSubscriber', impl_name => 'pinds_blog_entries' Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-create.sql 17 Oct 2003 00:39:22 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-create.sql 8 Dec 2003 05:10:23 -0000 1.3 @@ -33,74 +33,4 @@ short_name varchar(4000) not null ); -create or replace function pinds_blog_category__name (integer) -returns varchar as ' -declare - p_category_id alias for $1; - v_name varchar; -begin - select title into v_name - from pinds_blog_categories - where category_id = p_category_id; - return v_name; -end; -' language 'plpgsql'; - -create or replace function pinds_blog_category__new ( - integer, -- category_id - integer, -- package_id - varchar, -- name - varchar, -- short_name - integer, -- creation_user - varchar -- creation_ip -) returns integer as ' -declare - p_category_id alias for $1; - p_package_id alias for $2; - p_name alias for $3; - p_short_name alias for $4; - p_creation_user alias for $5; - p_creation_ip alias for $6; - v_category_id integer; -begin - v_category_id := acs_object__new ( - p_category_id, - ''pinds_blog_category'', - current_timestamp, - p_creation_user, - p_creation_ip, - p_package_id - ); - - insert into pinds_blog_categories ( - category_id, - package_id, - name, - short_name - ) values ( - v_category_id, - p_package_id, - p_name, - p_short_name - ); - - return v_category_id; -end; -' language 'plpgsql'; - -create or replace function pinds_blog_category__delete (integer) -returns integer as ' -declare - p_category_id alias for $1; -begin - update pinds_blog_entries - set category_id = null - where category_id = p_category_id; - - delete from pinds_blog_categories - where category_id = p_category_id; - - PERFORM acs_object__delete(p_category_id); - return 0; -end; -' language 'plpgsql'; +\i lars-blogger-categories-pb.sql Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-pb.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-pb.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-categories-pb.sql 8 Dec 2003 05:10:23 -0000 1.1 @@ -0,0 +1,79 @@ +-- +-- lars-blogger-categories-pb.sql +-- +-- @author Steffen Tiedemann Christensen +-- +-- @cvs-id $Id: lars-blogger-categories-pb.sql,v 1.1 2003/12/08 05:10:23 vinodk Exp $ +-- + +create or replace function pinds_blog_category__name (integer) +returns varchar as ' +declare + p_category_id alias for $1; + v_name varchar; +begin + select title into v_name + from pinds_blog_categories + where category_id = p_category_id; + return v_name; +end; +' language 'plpgsql'; + +create or replace function pinds_blog_category__new ( + integer, -- category_id + integer, -- package_id + varchar, -- name + varchar, -- short_name + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_category_id alias for $1; + p_package_id alias for $2; + p_name alias for $3; + p_short_name alias for $4; + p_creation_user alias for $5; + p_creation_ip alias for $6; + v_category_id integer; +begin + v_category_id := acs_object__new ( + p_category_id, + ''pinds_blog_category'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into pinds_blog_categories ( + category_id, + package_id, + name, + short_name + ) values ( + v_category_id, + p_package_id, + p_name, + p_short_name + ); + + return v_category_id; +end; +' language 'plpgsql'; + +create or replace function pinds_blog_category__delete (integer) +returns integer as ' +declare + p_category_id alias for $1; +begin + update pinds_blog_entries + set category_id = null + where category_id = p_category_id; + + delete from pinds_blog_categories + where category_id = p_category_id; + + PERFORM acs_object__delete(p_category_id); + return 0; +end; +' language 'plpgsql'; Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql 17 Oct 2003 00:39:22 -0000 1.8 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql 8 Dec 2003 05:10:23 -0000 1.9 @@ -52,106 +52,6 @@ create index pinds_blog_entry_pck_entr_idx on pinds_blog_entries (package_id, entry_date); -create or replace function pinds_blog_entry__title (integer) -returns varchar as ' -declare - p_entry_id alias for $1; - v_title varchar; -begin - select title into v_title - from pinds_blog_entries - where entry_id = p_entry_id; - return v_title; -end; -' language 'plpgsql'; - - -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, - posted_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, - current_timestamp, - p_draft_p, - ''f'' - ); - - PERFORM acs_permission__grant_permission( - v_entry_id, - p_creation_user, - ''admin'' - ); - - return v_entry_id; -end; -' language 'plpgsql'; - - -create or replace function pinds_blog_entry__delete (integer) -returns integer as ' -declare - p_entry_id alias for $1; -begin - delete from pinds_blog_entries - where entry_id = p_entry_id; - PERFORM acs_object__delete(p_entry_id); - return 0; -end; -' language 'plpgsql'; - - select acs_object_type__create_type ( 'weblogger_channel', -- object_type 'Weblogger Channel', -- pretty_name @@ -179,57 +79,7 @@ unique (package_id, user_id) ); +\i lars-blogger-pb.sql - -create or replace function weblogger_channel__new ( - integer, -- channel_id - integer, -- package_id - integer, -- user_id - integer, -- creation_user - varchar -- creation_ip -) returns integer as ' -declare - p_channel_id alias for $1; - p_package_id alias for $2; - p_user_id alias for $3; - p_creation_user alias for $4; - p_creation_ip alias for $5; - v_channel_id integer; -begin - v_channel_id := acs_object__new ( - p_channel_id, - ''weblogger_channel'', - current_timestamp, - p_creation_user, - p_creation_ip, - p_package_id - ); - - insert into weblogger_channels ( - channel_id, - package_id, - user_id - ) values ( - v_channel_id, - p_package_id, - p_user_id - ); - - return v_channel_id; -end; -' language 'plpgsql'; - -create or replace function weblogger_channel__delete (integer) -returns integer as ' -declare - p_channel_id alias for $1; -begin - delete from weblogger_channels - where channel_id = p_channel_id; - PERFORM acs_object__delete(p_channel_id); - return 0; -end; -' language 'plpgsql'; - \i rss-register.sql \i notifications-init.sql Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql 29 Sep 2003 08:05:42 -0000 1.5 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql 8 Dec 2003 05:10:23 -0000 1.6 @@ -12,17 +12,8 @@ create function inline_0 () returns integer as ' declare - comment_rec record; entry_rec record; begin - -- iterate through all comments on entries - for comment_rec in select gc.comment_id - from general_comments gc, - pinds_blog_entries e - where gc.object_id = e.entry_id loop - perform acs_message__delete(comment_rec.comment_id); - end loop; - -- iterate through all entries for entry_rec in select entry_id from pinds_blog_entries loop perform pinds_blog_entry__delete( entry_rec.entry_id ); @@ -49,16 +40,17 @@ drop function pinds_blog_entry__title (integer); drop function pinds_blog_entry__new( - integer, -- entry_id - integer, -- package_id - varchar, -- title - varchar, -- title_url - varchar, -- content - varchar, -- content_format - timestamptz, -- entry_date - char, -- draft_p - integer, -- creation_user - varchar -- creation_ip + 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 ); drop function pinds_blog_entry__delete (integer); 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-pb.sql 8 Dec 2003 05:10:23 -0000 1.1 @@ -0,0 +1,174 @@ +-- +-- lars-blogger-create.sql +-- +-- @author Lars Pind +-- +-- @cvs-id $Id: lars-blogger-pb.sql,v 1.1 2003/12/08 05:10:23 vinodk Exp $ +-- + +create or replace function pinds_blog_entry__title (integer) +returns varchar as ' +declare + p_entry_id alias for $1; + v_title varchar; +begin + select title into v_title + from pinds_blog_entries + where entry_id = p_entry_id; + return v_title; +end; +' language 'plpgsql'; + + +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, + posted_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, + current_timestamp, + p_draft_p, + ''f'' + ); + + PERFORM acs_permission__grant_permission( + v_entry_id, + p_creation_user, + ''admin'' + ); + + return v_entry_id; +end; +' language 'plpgsql'; + + +create or replace function pinds_blog_entry__delete (integer) +returns integer as ' +declare + p_entry_id alias for $1; + comment_rec record; +begin + -- delete comments associated with this entry + for comment_rec in select gc.comment_id + from general_comments gc + where gc.object_id = p_entry_id loop + perform acs_message__delete(comment_rec.comment_id); + end loop; + + delete from pinds_blog_entries + where entry_id = p_entry_id; + PERFORM acs_object__delete(p_entry_id); + return 0; +end; +' language 'plpgsql'; + + +create or replace function weblogger_channel__new ( + integer, -- channel_id + integer, -- package_id + integer, -- user_id + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_channel_id alias for $1; + p_package_id alias for $2; + p_user_id alias for $3; + p_creation_user alias for $4; + p_creation_ip alias for $5; + v_channel_id integer; +begin + v_channel_id := acs_object__new ( + p_channel_id, + ''weblogger_channel'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into weblogger_channels ( + channel_id, + package_id, + user_id + ) values ( + v_channel_id, + p_package_id, + p_user_id + ); + + return v_channel_id; +end; +' language 'plpgsql'; + +create or replace function weblogger_channel__delete (integer) +returns integer as ' +declare + p_channel_id alias for $1; + subscr_rec record; +begin + -- delete rss_gen_subscrs which relate to this channel + for subscr_rec in select subscr_id + from rss_gen_subscrs + where summary_context_id = p_channel_id loop + perform rss_gen_subscr__delete(subscr_rec.subscr_id); + end loop; + + delete from weblogger_channels + where channel_id = p_channel_id; + PERFORM acs_object__delete(p_channel_id); + return 0; +end; +' language 'plpgsql'; + Index: openacs-4/packages/lars-blogger/sql/postgresql/notifications-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/notifications-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/sql/postgresql/notifications-drop.sql 14 Sep 2002 21:43:34 -0000 1.1 +++ openacs-4/packages/lars-blogger/sql/postgresql/notifications-drop.sql 8 Dec 2003 05:10:23 -0000 1.2 @@ -15,7 +15,7 @@ begin for row in select nt.type_id from notification_types nt - where nt.short_name in (''lars_blogger_notif_type'') + where nt.short_name in (''lars_blogger_notif_type'',''lars_blogger_notif'') loop perform notification_type__delete(row.type_id); end loop; Index: openacs-4/packages/lars-blogger/sql/postgresql/rss-unregister.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/rss-unregister.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/postgresql/rss-unregister.sql 28 Aug 2003 09:41:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/postgresql/rss-unregister.sql 8 Dec 2003 05:10:23 -0000 1.3 @@ -6,6 +6,25 @@ -- @cvs-id $Id$ -- +-- need to delete our channels and rss feeds or else +-- the SC can't be dropped + +create or replace function inline_0() +returns integer as ' +declare + channel_rec record; +begin + -- delete weblogger_channels + for channel_rec in select channel_id from weblogger_channels loop + perform weblogger_channel__delete(channel_rec.channel_id); + end loop; + + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + select acs_sc_impl__delete( 'RssGenerationSubscriber', -- impl_contract_name 'pinds_blog_entries' -- impl_name