Index: openacs-4/packages/dotlrn-faq/dotlrn-faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-faq/dotlrn-faq.info,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-faq/dotlrn-faq.info 10 Jul 2002 18:55:55 -0000 1.8 +++ openacs-4/packages/dotlrn-faq/dotlrn-faq.info 17 Jul 2002 20:20:45 -0000 1.9 @@ -24,6 +24,7 @@ + Index: openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-faq/tcl/dotlrn-faq-procs-postgresql.xql 17 Jul 2002 20:20:45 -0000 1.1 @@ -0,0 +1,16 @@ + + + +postgresql7.1 + + + + select faq__clone ( + :old_package_id, + :new_package_id + ); + + + + + Index: openacs-4/packages/dotlrn-news/dotlrn-news.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news/dotlrn-news.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn-news/dotlrn-news.info 10 Jul 2002 18:55:55 -0000 1.4 +++ openacs-4/packages/dotlrn-news/dotlrn-news.info 17 Jul 2002 20:22:37 -0000 1.5 @@ -25,6 +25,7 @@ + Index: openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-news/tcl/dotlrn-news-procs-postgresql.xql 17 Jul 2002 20:22:37 -0000 1.1 @@ -0,0 +1,16 @@ + + + +postgresql7.1 + + + + select news__clone ( + :old_package_id, + :new_package_id + ); + + + + + Index: openacs-4/packages/faq/faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/faq.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/faq/faq.info 10 Jul 2002 18:55:49 -0000 1.4 +++ openacs-4/packages/faq/faq.info 17 Jul 2002 20:20:17 -0000 1.5 @@ -29,10 +29,12 @@ + + @@ -43,10 +45,12 @@ + + Index: openacs-4/packages/faq/sql/postgresql/faq-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/postgresql/faq-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/faq/sql/postgresql/faq-create.sql 10 Jul 2002 16:54:17 -0000 1.1 +++ openacs-4/packages/faq/sql/postgresql/faq-create.sql 17 Jul 2002 20:20:17 -0000 1.2 @@ -191,9 +191,48 @@ end; ' language 'plpgsql'; +create function faq__clone (integer,integer) +returns integer as ' +declare + p_new_package_id alias for $1; --default null, + p_old_package_id alias for $2; --default null + v_faq_id faqs.faq_id%TYPE; + one_faq record; + entry record; +begin + -- get all the faqs belonging to the old package, + -- and create new faqs for the new package + for one_faq in select * + from acs_objects o, faqs f + where o.object_id = f.faq_id + and o.context_id = p_old_package_id + loop + v_faq_id := faq__new_faq ( + one_faq.faq_name, + one_faq.separate_p, + p_new_package_id + ); + for entry in select * from faq_q_and_as + where faq_id = one_faq.faq_id + loop + perform faq__new_q_and_a ( + entry.faq_id, + v_faq_id, + entry.question, + entry.answer, + entry.sort_key + ); + end loop; + end loop; + return 0; + end; +' language 'plpgsql'; + + + select acs_privilege__create_privilege('faq_view_faq'); select acs_privilege__create_privilege('faq_create_faq'); select acs_privilege__create_privilege('faq_delete_faq'); Index: openacs-4/packages/faq/sql/postgresql/faq-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/postgresql/faq-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/faq/sql/postgresql/faq-drop.sql 10 Jul 2002 16:54:17 -0000 1.1 +++ openacs-4/packages/faq/sql/postgresql/faq-drop.sql 17 Jul 2002 20:20:17 -0000 1.2 @@ -8,6 +8,7 @@ drop function faq__new_faq (integer, varchar, boolean,varchar,timestamp,integer,varchar,integer ); drop function faq__delete_faq (integer); drop function faq__name (integer); +drop function faq__clone (integer,integer); --drop permissions delete from acs_permissions where object_id in (select entry_id from faq_q_and_as); Index: openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql 17 Jul 2002 20:20:17 -0000 1.1 @@ -0,0 +1,13 @@ + + + + postgresql7.1 + + + + select faq__delete_faq (:faq_id); + + + + + Index: openacs-4/packages/faq/www/admin/faq-new-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/Attic/faq-new-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/admin/faq-new-2-postgresql.xql 17 Jul 2002 20:20:17 -0000 1.1 @@ -0,0 +1,13 @@ + + + + postgresql7.1 + + + + select faq__new_faq (:faq_id, :faq_name,:separate_p,'faq', now(), :user_id,:creation_ip,:package_id); + + + + + Index: openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql 17 Jul 2002 20:20:17 -0000 1.1 @@ -0,0 +1,12 @@ + + + + postgresql7.1 + + + + select faq__delete_q_and_a (:entry_id ); + + + + Index: openacs-4/packages/faq/www/admin/q_and_a-new-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/Attic/q_and_a-new-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/www/admin/q_and_a-new-2-postgresql.xql 17 Jul 2002 20:20:17 -0000 1.1 @@ -0,0 +1,24 @@ + + + + postgresql7.1 + + + + select faq__new_q_and_a ( + :entry_id, + :faq_id, + :question, + :answer, + :sort_key, + 'faq_q_and_a', + now(), + :user_id, + :creation_ip, + :faq_id + ); + + + + + Index: openacs-4/packages/faq-portlet/faq-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/faq-portlet.info,v diff -u -r1.11 -r1.12 --- openacs-4/packages/faq-portlet/faq-portlet.info 10 Jul 2002 18:55:55 -0000 1.11 +++ openacs-4/packages/faq-portlet/faq-portlet.info 17 Jul 2002 20:20:31 -0000 1.12 @@ -33,6 +33,7 @@ + Index: openacs-4/packages/faq-portlet/www/faq-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/www/Attic/faq-portlet-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq-portlet/www/faq-portlet-postgresql.xql 17 Jul 2002 20:20:31 -0000 1.1 @@ -0,0 +1,23 @@ + + + + postgresql7.1 + + + + select acs_objects.context_id as package_id, + acs_object__name(acs_objects.context_id) as parent_name, + (select site_node__url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = acs_objects.context_id) as url, + faqs.faq_id, + faqs.faq_name + from faqs, + acs_objects + where faqs.faq_id = acs_objects.object_id + and acs_objects.context_id in ([join $list_of_package_ids ", "]) + order by parent_name + + + + \ No newline at end of file Index: openacs-4/packages/news/sql/postgresql/news-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/news-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/news/sql/postgresql/news-create.sql 2 Apr 2002 06:08:54 -0000 1.8 +++ openacs-4/packages/news/sql/postgresql/news-create.sql 17 Jul 2002 20:21:20 -0000 1.9 @@ -649,6 +649,72 @@ ' language 'plpgsql'; + +-- Incomplete for want of blob_to_string() in postgres 16 july 2000 + +create function news__clone (integer, integer) +returns integer as ' +declare + p_new_package_id alias for $1; --default null, + p_old_package_id alias for $2; --default null + one_news record; +begin + for one_news in select + publish_date, + cr.content as text, + cr.nls_language, + cr.title as title, + cr.mime_type, + cn.package_id, + archive_date, + approval_user, + approval_date, + approval_ip, + ao.creation_date, + ao.creation_ip, + ao.creation_user + from + cr_items ci, + cr_revisions cr, + cr_news cn, + acs_objects ao + where + (ci.item_id = cr.item_id + and ci.live_revision = cr.revision_id + and cr.revision_id = cn.news_id + and cr.revision_id = ao.object_id) + or (ci.live_revision is null + and ci.item_id = cr.item_id + and cr.revision_id = content_item__get_latest_revision(ci.item_id) + and cr.revision_id = cn.news_id + and cr.revision_id = ao.object_id) + + loop + perform news__new( + one_news.publish_date, + one_news.text, + one_news.nls_language, + one_news.title, + one_news.mime_type, + new_package_id, + one_news.archive_date, + one_news.approval_user, + one_news.approval_date, + one_news.approval_ip, + one_news.creation_date, + one_news.creation_ip, + one_news.creation_user + ); + + end loop; + return 0; +end; +' language 'plpgsql'; + + + + + -- currently not used, because we want to audit revisions create function news__revision_delete (integer) returns integer as ' Index: openacs-4/packages/news/sql/postgresql/news-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/news-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/news/sql/postgresql/news-drop.sql 25 Oct 2001 11:39:29 -0000 1.2 +++ openacs-4/packages/news/sql/postgresql/news-drop.sql 17 Jul 2002 20:21:20 -0000 1.3 @@ -73,6 +73,7 @@ integer,boolean); drop function news__revision_set_active (integer); drop function news__revision_delete (integer); +drop function news__clone (integer,integer); -- delete news views Index: openacs-4/packages/news-portlet/news-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-portlet/news-portlet.info,v diff -u -r1.7 -r1.8 --- openacs-4/packages/news-portlet/news-portlet.info 10 Jul 2002 18:55:55 -0000 1.7 +++ openacs-4/packages/news-portlet/news-portlet.info 17 Jul 2002 20:22:30 -0000 1.8 @@ -33,6 +33,7 @@ + Index: openacs-4/packages/news-portlet/www/news-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-portlet/www/Attic/news-portlet-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-portlet/www/news-portlet-postgresql.xql 17 Jul 2002 20:22:30 -0000 1.1 @@ -0,0 +1,25 @@ + + + +postgresql7.1 + + + + select news_items_approved.package_id, + acs_object__name(apm_package__parent_id(news_items_approved.package_id)) as parent_name, + (select site_node__url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = news_items_approved.package_id) as url, + news_items_approved.item_id, + news_items_approved.publish_title, + news_items_approved.publish_date + from news_items_approved + where news_items_approved.publish_date < current_timestamp + and (news_items_approved.archive_date >= current_timestamp or news_items_approved.archive_date is null) + and news_items_approved.package_id in ([join $list_of_package_ids ", "]) + order by parent_name, + news_items_approved.publish_title + + + +