Index: openacs-4/packages/new-portal/new-portal.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/new-portal.info,v diff -u -r1.35 -r1.36 --- openacs-4/packages/new-portal/new-portal.info 10 Oct 2009 22:38:10 -0000 1.35 +++ openacs-4/packages/new-portal/new-portal.info 8 Nov 2010 07:23:38 -0000 1.36 @@ -8,14 +8,14 @@ t portal - + OpenACS Portals. 2009-07-22 OpenACS New Portal Package aka NPP. Portals are used to aggregate content from different sources within a single page. Props to Ian Baker for "Portal". - + Index: openacs-4/packages/new-portal/sql/postgresql/api-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/api-create.sql,v diff -u -r1.16 -r1.17 --- openacs-4/packages/new-portal/sql/postgresql/api-create.sql 7 Oct 2007 22:37:03 -0000 1.16 +++ openacs-4/packages/new-portal/sql/postgresql/api-create.sql 8 Nov 2010 07:23:38 -0000 1.17 @@ -249,7 +249,7 @@ where page_id = v_page.page_id loop - select acs_object_id_seq.nextval + select nextval(''t_acs_object_id_seq'') into v_new_element_id from dual; @@ -266,7 +266,7 @@ where element_id = v_element.element_id loop - select acs_object_id_seq.nextval + select nextval(''t_acs_object_id_seq'') into v_new_parameter_id from dual; @@ -632,7 +632,7 @@ insert into portal_datasource_def_params (parameter_id, datasource_id, config_required_p, configured_p, key, value) values - (acs_object_id_seq.nextval, p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + (nextval(''t_acs_object_id_seq''), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); return 0; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql 8 Nov 2010 07:23:38 -0000 1.1 @@ -0,0 +1,185 @@ +-- +-- +-- +-- @author Victor Guerra (vguerra@gmail.com) +-- @creation-date 2010-11-05 +-- @cvs-id $Id: upgrade-2.6.0d1-2.6.0d2.sql,v 1.1 2010/11/08 07:23:38 victorg Exp $ +-- + +-- PG 9.x support - changes regarding usage of sequences + +create or replace function portal__new (integer,varchar,integer,integer,integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) +returns integer as ' +declare + p_portal_id alias for $1; + p_name alias for $2; + p_theme_id alias for $3; + p_layout_id alias for $4; + p_template_id alias for $5; + p_default_page_name alias for $6; + p_default_accesskey alias for $7; + p_object_type alias for $8; + p_creation_date alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + p_context_id alias for $12; + v_portal_id portals.portal_id%TYPE; + v_theme_id portals.theme_id%TYPE; + v_layout_id portal_layouts.layout_id%TYPE; + v_page_id portal_pages.page_id%TYPE; + v_page record; + v_element record; + v_param record; + v_new_element_id integer; + v_new_parameter_id integer; +begin + + v_portal_id := acs_object__new( + p_portal_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id, + ''t'' + ); + + if p_template_id is null then + + if p_theme_id is null then + select max(theme_id) + into v_theme_id + from portal_element_themes; + else + v_theme_id := p_theme_id; + end if; + + if p_layout_id is null then + select min(layout_id) + into v_layout_id + from portal_layouts; + else + v_layout_id := p_layout_id; + end if; + + insert + into portals + (portal_id, name, theme_id) + values + (v_portal_id, p_name, v_theme_id); + + -- now insert the default page + v_page_id := portal_page__new( + null, + p_default_page_name, + p_default_accesskey, + v_portal_id, + v_layout_id, + ''f'', + ''portal_page'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + else + + -- we have a portal as our template. copy its theme, pages, layouts, + -- elements, and element params. + select theme_id + into v_theme_id + from portals + where portal_id = p_template_id; + + insert + into portals + (portal_id, name, theme_id, template_id) + values + (v_portal_id, p_name, v_theme_id, p_template_id); + + -- now insert the pages from the portal template + for v_page in select * + from portal_pages + where portal_id = p_template_id + order by sort_key + loop + + v_page_id := portal_page__new( + null, + v_page.pretty_name, + v_page.accesskey, + v_portal_id, + v_page.layout_id, + ''f'', + ''portal_page'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + -- now get the elements on the templates page and put them on the new page + for v_element in select * + from portal_element_map + where page_id = v_page.page_id + loop + + select nextval(''t_acs_object_id_seq'') + into v_new_element_id + from dual; + + insert + into portal_element_map + (element_id, name, pretty_name, page_id, datasource_id, region, state, sort_key) + select v_new_element_id, name, pretty_name, v_page_id, datasource_id, region, state, sort_key + from portal_element_map pem + where pem.element_id = v_element.element_id; + + -- now for the elements params + for v_param in select * + from portal_element_parameters + where element_id = v_element.element_id + loop + + select nextval(''t_acs_object_id_seq'') + into v_new_parameter_id + from dual; + + insert + into portal_element_parameters + (parameter_id, element_id, config_required_p, configured_p, key, value) + select v_new_parameter_id, v_new_element_id, config_required_p, configured_p, key, value + from portal_element_parameters + where parameter_id = v_param.parameter_id; + + end loop; + + end loop; + + end loop; + + end if; + + return v_portal_id; + +end;' language 'plpgsql'; + +create or replace function portal_datasource__set_def_param (integer,varchar,varchar,varchar,varchar) +returns integer as ' +declare + p_datasource_id alias for $1; + p_config_required_p alias for $2; + p_configured_p alias for $3; + p_key alias for $4; + p_value alias for $5; +begin + + insert into portal_datasource_def_params + (parameter_id, datasource_id, config_required_p, configured_p, key, value) + values + (nextval(''t_acs_object_id_seq''), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + + return 0; + +end;' language 'plpgsql'; Index: openacs-4/packages/news/news.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/news.info,v diff -u -r1.29 -r1.30 --- openacs-4/packages/news/news.info 22 Dec 2009 22:24:02 -0000 1.29 +++ openacs-4/packages/news/news.info 8 Nov 2010 07:24:44 -0000 1.30 @@ -7,7 +7,7 @@ f f - + OpenACS Used for announcements and news items. 2007-06-15 @@ -16,7 +16,7 @@ 0 #news.News# - + Index: openacs-4/packages/news/sql/postgresql/news-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/news-package-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/news/sql/postgresql/news-package-create.sql 8 Aug 2006 21:27:04 -0000 1.4 +++ openacs-4/packages/news/sql/postgresql/news-package-create.sql 8 Nov 2010 07:24:44 -0000 1.5 @@ -55,7 +55,7 @@ -- -- this will be used for 2xClick protection if p_item_id is null then - select acs_object_id_seq.nextval + select nextval(''t_acs_object_id_seq'') into v_id from dual; else Index: openacs-4/packages/news/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news/sql/postgresql/upgrade/upgrade-5.6.0d1-5.6.0d2.sql 8 Nov 2010 07:24:44 -0000 1.1 @@ -0,0 +1,135 @@ +-- +-- +-- +-- @author Victor Guerra (vguerra@gmail.com) +-- @creation-date 2010-11-05 +-- @cvs-id $Id: upgrade-5.6.0d1-5.6.0d2.sql,v 1.1 2010/11/08 07:24:44 victorg Exp $ +-- + +-- PG 9.x - changing usage of sequences + +create or replace function news__new (integer,varchar,timestamptz,text,varchar,varchar, + varchar,integer,timestamptz,integer,timestamptz,varchar,varchar, + varchar,integer,boolean, varchar) +returns integer as ' +declare + p_item_id alias for $1; -- default null + -- + p_locale alias for $2; -- default null, + -- + p_publish_date alias for $3; -- default null + p_text alias for $4; -- default null + p_nls_language alias for $5; -- default null + p_title alias for $6; -- default null + p_mime_type alias for $7; -- default ''text/plain'' + -- + p_package_id alias for $8; -- default null, + p_archive_date alias for $9; -- default null + p_approval_user alias for $10; -- default null + p_approval_date alias for $11; -- default null + p_approval_ip alias for $12; -- default null, + -- + p_relation_tag alias for $13; -- default null + -- + -- REMOVED: p_item_subtype alias for $14; -- default ''content_revision'' + -- REMOVED: p_content_type alias for $15; -- default ''news'' + -- REMOVED: p_creation_date alias for $16; -- default current_timestamp + p_creation_ip alias for $14; -- default null + p_creation_user alias for $15; -- default null + -- + p_is_live_p alias for $16; -- default ''f'' + p_lead alias for $17; + + v_news_id integer; + v_item_id integer; + v_id integer; + v_revision_id integer; + v_parent_id integer; + v_name varchar; + v_log_string varchar; +begin + select content_item__get_id(''news'',null,''f'') + into v_parent_id + from dual; + -- + -- this will be used for 2xClick protection + if p_item_id is null then + select nextval(''t_acs_object_id_seq'') + into v_id + from dual; + else + v_id := p_item_id; + end if; + -- + v_name := ''news-'' || to_char(current_timestamp,''YYYYMMDD'') || ''-'' || v_id; + -- + v_log_string := ''initial submission''; + -- + v_item_id := content_item__new( + v_name, -- name + v_parent_id, -- parent_id + v_id, -- item_id + p_locale, -- locale + current_timestamp, -- creation_date + p_creation_user, -- creation_user + p_package_id, -- context_id + p_creation_ip, -- creation_ip + ''content_item'', -- item_subtype + ''news'', -- content_type + p_title, -- title + null, -- description + p_mime_type, -- mime_type + p_nls_language, -- nls_language + null, -- text + null, -- data + null, -- relation_tag + p_is_live_p, -- live_p + ''text'', -- storage_type + p_package_id -- package_id + ); + + v_revision_id := content_revision__new( + p_title, -- title + v_log_string, -- description + p_publish_date, -- publish_date + p_mime_type, -- mime_type + p_nls_language, -- nls_language + p_text, -- data + v_item_id, -- item_id + null, -- revision_id + current_timestamp, -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + insert into cr_news + (news_id, + lead, + package_id, + archive_date, + approval_user, + approval_date, + approval_ip) + values + (v_revision_id, + p_lead, + p_package_id, + p_archive_date, + p_approval_user, + p_approval_date, + p_approval_ip); + -- make this revision live when immediately approved + if p_is_live_p = ''t'' then + update + cr_items + set + live_revision = v_revision_id, + publish_status = ''ready'' + where + item_id = v_item_id; + end if; + v_news_id := v_revision_id; + + return v_news_id; +end; +' language 'plpgsql';