Index: openacs-4/packages/acs-content-repository/acs-content-repository.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/acs-content-repository.info,v diff -u -r1.102 -r1.103 --- openacs-4/packages/acs-content-repository/acs-content-repository.info 4 Aug 2011 08:26:20 -0000 1.102 +++ openacs-4/packages/acs-content-repository/acs-content-repository.info 6 Sep 2011 13:20:15 -0000 1.103 @@ -7,7 +7,7 @@ t t - + OpenACS The canonical repository for OpenACS content. 2011-06-12 @@ -20,7 +20,7 @@ GPL 3 - + Index: openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.8.0d3-5.8.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.8.0d3-5.8.0d4.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-content-repository/sql/postgresql/upgrade/upgrade-5.8.0d3-5.8.0d4.sql 6 Sep 2011 13:20:15 -0000 1.1 @@ -0,0 +1,182 @@ +-- providing upgrade for content_extlink__new and content_revision__copy +-- in order to get next values of sequences using nextval() + +-- +-- procedure content_extlink__new/10 +-- +CREATE OR REPLACE FUNCTION content_extlink__new( + new__name varchar, -- default null + new__url varchar, + new__label varchar, -- default null + new__description varchar, -- default null + new__parent_id integer, + new__extlink_id integer, -- default null + new__creation_date timestamptz, -- default now() -- default 'now' + new__creation_user integer, -- default null + new__creation_ip varchar, -- default null + new__package_id integer -- default null + +) RETURNS integer AS $$ +DECLARE + v_extlink_id cr_extlinks.extlink_id%TYPE; + v_package_id acs_objects.package_id%TYPE; + v_label cr_extlinks.label%TYPE; + v_name cr_items.name%TYPE; +BEGIN + + if new__label is null then + v_label := new__url; + else + v_label := new__label; + end if; + + if new__name is null then + select nextval('t_acs_object_id_seq') into v_extlink_id from dual; + v_name := 'link' || v_extlink_id; + else + v_name := new__name; + end if; + + if new__package_id is null then + v_package_id := acs_object__package_id(new__parent_id); + else + v_package_id := new__package_id; + end if; + + v_extlink_id := content_item__new( + v_name, + new__parent_id, + new__extlink_id, + null, + new__creation_date, + new__creation_user, + null, + new__creation_ip, + 'content_item', + 'content_extlink', + null, + null, + 'text/plain', + null, + null, + 'text', + v_package_id + ); + + insert into cr_extlinks + (extlink_id, url, label, description) + values + (v_extlink_id, new__url, v_label, new__description); + + update acs_objects + set title = v_label + where object_id = v_extlink_id; + + return v_extlink_id; + +END; +$$ LANGUAGE plpgsql; + + + +-- +-- procedure content_revision__copy/5 +-- +CREATE OR REPLACE FUNCTION content_revision__copy( + copy__revision_id integer, + copy__copy_id integer, -- default null + copy__target_item_id integer, -- default null + copy__creation_user integer, -- default null + copy__creation_ip varchar -- default null + +) RETURNS integer AS $$ +DECLARE + v_copy_id cr_revisions.revision_id%TYPE; + v_target_item_id cr_items.item_id%TYPE; + type_rec record; +BEGIN + -- use the specified item_id or the item_id of the original revision + -- if none is specified + if copy__target_item_id is null then + select item_id into v_target_item_id from cr_revisions + where revision_id = copy__revision_id; + else + v_target_item_id := copy__target_item_id; + end if; + + -- use the copy_id or generate a new copy_id if none is specified + -- the copy_id is a revision_id + if copy__copy_id is null then + select nextval('t_acs_object_id_seq') into v_copy_id from dual; + else + v_copy_id := copy__copy_id; + end if; + + -- create the basic object + insert into acs_objects ( + object_id, + object_type, + context_id, + security_inherit_p, + creation_user, + creation_date, + creation_ip, + last_modified, + modifying_user, + modifying_ip, + title, + package_id) + select + v_copy_id as object_id, + object_type, + v_target_item_id, + security_inherit_p, + copy__creation_user as creation_user, + now() as creation_date, + copy__creation_ip as creation_ip, + now() as last_modified, + copy__creation_user as modifying_user, + copy__creation_ip as modifying_ip, + title, + package_id + from + acs_objects + where + object_id = copy__revision_id; + + -- create the basic revision (using v_target_item_id) + insert into cr_revisions + select + v_copy_id as revision_id, + v_target_item_id as item_id, + title, + description, + publish_date, + mime_type, + nls_language, + lob, + content, + content_length + from + cr_revisions + where + revision_id = copy__revision_id; + + -- iterate over the ancestor types and copy attributes + for type_rec in select ot2.object_type, tree_level(ot2.tree_sortkey) as level + from acs_object_types ot1, acs_object_types ot2, acs_objects o + where ot2.object_type <> 'acs_object' + and ot2.object_type <> 'content_revision' + and o.object_id = copy__revision_id + and ot1.object_type = o.object_type + and ot1.tree_sortkey between ot2.tree_sortkey and tree_right(ot2.tree_sortkey) + order by level desc + LOOP + PERFORM content_revision__copy_attributes(type_rec.object_type, + copy__revision_id, v_copy_id); + end loop; + + return v_copy_id; + +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/acs-kernel/acs-kernel.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v diff -u -r1.125 -r1.126 --- openacs-4/packages/acs-kernel/acs-kernel.info 31 Jul 2011 23:11:46 -0000 1.125 +++ openacs-4/packages/acs-kernel/acs-kernel.info 6 Sep 2011 13:20:15 -0000 1.126 @@ -7,15 +7,15 @@ t t - + OpenACS Core Team Routines and data models providing the foundation for OpenACS-based Web services. 2011-06-12 OpenACS The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, partiies and the supporting PL/SQL and PL/pgSQL procedures. 3 - + Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.8.0d2-5.8.0d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.8.0d2-5.8.0d3.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.8.0d2-5.8.0d3.sql 6 Sep 2011 13:20:15 -0000 1.1 @@ -0,0 +1,77 @@ +-- providing missing upgrade script in order to get rid of +-- syntax seq_foo.nextval + +-- +-- procedure acs_log__notice/2 +-- +CREATE OR REPLACE FUNCTION acs_log__notice( + notice__log_key varchar, + notice__message varchar +) RETURNS integer AS $$ +DECLARE +BEGIN + insert into acs_logs + (log_id, log_level, log_key, message) + values + (nextval('t_acs_log_id_seq'), 'notice', notice__log_key, notice__message); + + return 0; +END; +$$ LANGUAGE plpgsql; + + +-- +-- procedure acs_log__warn/2 +-- +CREATE OR REPLACE FUNCTION acs_log__warn( + warn__log_key varchar, + warn__message varchar +) RETURNS integer AS $$ +DECLARE +BEGIN + insert into acs_logs + (log_id, log_level, log_key, message) + values + (nextval('t_acs_log_id_seq'), 'warn', warn__log_key, warn__message); + + return 0; +END; +$$ LANGUAGE plpgsql; + + +-- +-- procedure acs_log__error/2 +-- +CREATE OR REPLACE FUNCTION acs_log__error( + error__log_key varchar, + error__message varchar +) RETURNS integer AS $$ +DECLARE +BEGIN + insert into acs_logs + (log_id, log_level, log_key, message) + values + (nextval('t_acs_log_id_seq'), 'error', error__log_key, error__message); + + return 0; +END; +$$ LANGUAGE plpgsql; + + +-- +-- procedure acs_log__debug/2 +-- +CREATE OR REPLACE FUNCTION acs_log__debug( + debug__log_key varchar, + debug__message varchar +) RETURNS integer AS $$ +DECLARE +BEGIN + insert into acs_logs + (log_id, log_level, log_key, message) + values + (nextval('t_acs_log_id_seq'), 'debug', debug__log_key, debug__message); + + return 0; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/acs-messaging/acs-messaging.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-messaging/acs-messaging.info,v diff -u -r1.35 -r1.36 --- openacs-4/packages/acs-messaging/acs-messaging.info 31 Jul 2011 23:11:46 -0000 1.35 +++ openacs-4/packages/acs-messaging/acs-messaging.info 6 Sep 2011 13:20:15 -0000 1.36 @@ -7,7 +7,7 @@ t t - + Anukul Kapoor John Prevost Vinod Kurup @@ -20,7 +20,7 @@ Provides generic message services, with email sending. acs-mail-lite and notifications are the prefered packages for delivering this functionality and it is anticipated that this package will ultimately be deprecated. - + Index: openacs-4/packages/acs-messaging/sql/postgresql/upgrade/upgrade-5.8.0d1-5.8.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-messaging/sql/postgresql/upgrade/upgrade-5.8.0d1-5.8.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-messaging/sql/postgresql/upgrade/upgrade-5.8.0d1-5.8.0d2.sql 6 Sep 2011 13:20:15 -0000 1.1 @@ -0,0 +1,98 @@ +-- providing upgrade script for function + +create or replace function acs_message__new (integer,integer,timestamptz,integer, +varchar,varchar,varchar,varchar,text,integer,integer,integer,integer, +varchar,varchar,boolean,integer) +returns integer as ' +declare + p_message_id alias for $1; --default null, + p_reply_to alias for $2; --default null, + p_sent_date alias for $3; --default sysdate, + p_sender alias for $4; --default null, + p_rfc822_id alias for $5; --default null, + p_title alias for $6; --default null, + p_description alias for $7; --default null, + p_mime_type alias for $8; --default ''text/plain'', + p_text alias for $9; --default null, + p_data alias for $10; --default null, + p_parent_id alias for $11; --default 0, + p_context_id alias for $12; + p_creation_date timestamptz := current_timestamp; -- alias for $13 --default sysdate, + p_creation_user alias for $13; --default null, + p_creation_ip alias for $14; --default null, + p_object_type alias for $15; --default ''acs_message'', + p_is_live alias for $16; --default ''t'' + p_package_id alias for $17; + v_message_id acs_messages.message_id%TYPE; + v_rfc822_id acs_messages.rfc822_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_system_url varchar; + v_domain_name varchar; + v_idx integer; + begin + -- generate a message id now so we can get an rfc822 message-id + if p_message_id is null then + select nextval(''t_acs_object_id_seq'') into v_message_id; + else + v_message_id := p_message_id; + end if; + + -- need to make this mandatory also - jg + -- this needs to be fixed up, but Oracle doesn''t give us a way + -- to get the FQDN + + -- vk: get SystemURL parameter and use it to extract domain name + select apm__get_value(package_id, ''SystemURL'') into v_system_url + from apm_packages where package_key=''acs-kernel''; + v_idx := position(''http://'' in v_system_url); + v_domain_name := trim (substr(v_system_url, v_idx + 7)); + + if p_rfc822_id is null then + v_rfc822_id := current_date || ''.'' || v_message_id || ''@'' || + v_domain_name || ''.hate''; + else + v_rfc822_id := p_rfc822_id; + end if; + + v_message_id := content_item__new ( + v_rfc822_id, -- name + p_parent_id, -- parent_id + p_message_id, -- item_id + null, -- locale + p_creation_date, -- creation_date + p_creation_user, -- creation_user + p_context_id, -- context_id + p_creation_ip, -- creation_ip + p_object_type, -- item_subtype + ''acs_message_revision'', -- content_type + null, -- title + null, -- description + ''text/plain'', -- mime_type + null, -- nls_language + null, -- text + ''text'', -- storage_type + p_package_id + ); + + insert into acs_messages + (message_id, reply_to, sent_date, sender, rfc822_id) + values + (v_message_id, p_reply_to, p_sent_date, p_sender, v_rfc822_id); + + -- create an initial revision for the new message + v_revision_id := acs_message__edit ( + v_message_id, -- message_id + p_title, -- title + p_description, -- description + p_mime_type, -- mime_type + p_text, -- text + p_data, -- data + p_creation_date, -- creation_date + p_creation_user, -- creation_user + p_creation_ip, -- creation_ip + p_is_live -- is_live + ); + + return v_message_id; +end;' language 'plpgsql'; + Index: openacs-4/packages/acs-subsite/acs-subsite.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/acs-subsite.info,v diff -u -r1.112 -r1.113 --- openacs-4/packages/acs-subsite/acs-subsite.info 31 Jul 2011 23:11:46 -0000 1.112 +++ openacs-4/packages/acs-subsite/acs-subsite.info 6 Sep 2011 13:20:15 -0000 1.113 @@ -8,7 +8,7 @@ f t - + OpenACS Subsite 2011-06-12 Index: openacs-4/packages/acs-subsite/sql/postgresql/upgrade/upgrade-5.8.0d1-5.8.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/sql/postgresql/upgrade/upgrade-5.8.0d1-5.8.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/sql/postgresql/upgrade/upgrade-5.8.0d1-5.8.0d2.sql 6 Sep 2011 13:20:15 -0000 1.1 @@ -0,0 +1,50 @@ +-- providing upgrade script for subsite_callback__new + +create or replace function subsite_callback__new(integer,varchar,varchar,varchar,varchar,integer) +returns integer as ' +declare + new__callback_id alias for $1; -- default null, + new__event_type alias for $2; + new__object_type alias for $3; + new__callback alias for $4; + new__callback_type alias for $5; + new__sort_order alias for $6; -- default null + v_callback_id subsite_callbacks.callback_id%TYPE; + v_sort_order subsite_callbacks.sort_order%TYPE; +begin + + if new__callback_id is null then + select nextval(''t_acs_object_id_seq'') into v_callback_id; + else + v_callback_id := new__callback_id; + end if; + + if new__sort_order is null then + -- Make this the next event for this object_type/event_type combination + select coalesce(max(sort_order),0) + 1 into v_sort_order + from subsite_callbacks + where object_type = new__object_type + and event_type = new__event_type; + else + v_sort_order := new__sort_order; + end if; + +-- begin + insert into subsite_callbacks + (callback_id, event_type, object_type, callback, callback_type, sort_order) + values + (v_callback_id, new__event_type, new__object_type, new__callback, new__callback_type, v_sort_order); + +-- TODO: Can we do this properly? +-- If not, could move select before insert +-- exception when dup_val_on_index then +-- select callback_id into v_callback_id +-- from subsite_callbacks +-- where event_type = new__event_type +-- and object_type = new__object_type +-- and callback_type = new__callback_type +-- and callback = new__callback; +-- end; + return v_callback_id; + +end;' language 'plpgsql';