Index: openacs-4/packages/new-portal/sql/oracle/api-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/api-create.sql,v diff -u -r1.37 -r1.38 --- openacs-4/packages/new-portal/sql/oracle/api-create.sql 24 May 2002 01:58:46 -0000 1.37 +++ openacs-4/packages/new-portal/sql/oracle/api-create.sql 1 Jul 2002 20:03:49 -0000 1.38 @@ -19,550 +19,575 @@ -- copyright 2001, OpenForce, Inc. -- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- create or replace package portal_page as - function new ( - page_id in portal_pages.page_id%TYPE default null, - pretty_name in portal_pages.pretty_name%TYPE default 'Untitled Page', - portal_id in portal_pages.portal_id%TYPE default null, - layout_id in portal_pages.layout_id%TYPE default null, - sort_key in portal_pages.sort_key%TYPE default 0, - object_type in acs_object_types.object_type%TYPE default 'portal_page', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_pages.page_id%TYPE; - procedure delete ( - page_id in portal_pages.page_id%TYPE - ); + function new ( + page_id in portal_pages.page_id%TYPE default null, + pretty_name in portal_pages.pretty_name%TYPE default 'Untitled Page', + portal_id in portal_pages.portal_id%TYPE, + layout_id in portal_pages.layout_id%TYPE default null, + object_type in acs_object_types.object_type%TYPE default 'portal_page', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_pages.page_id%TYPE; + + procedure delete ( + page_id in portal_pages.page_id%TYPE + ); + end portal_page; / show errors create or replace package body portal_page as - function new ( - page_id in portal_pages.page_id%TYPE default null, - pretty_name in portal_pages.pretty_name%TYPE default 'Untitled Page', - portal_id in portal_pages.portal_id%TYPE default null, - layout_id in portal_pages.layout_id%TYPE default null, - sort_key in portal_pages.sort_key%TYPE default 0, - object_type in acs_object_types.object_type%TYPE default 'portal_page', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_pages.page_id%TYPE - is - v_page_id portal_pages.page_id%TYPE; - v_layout_id portal_pages.layout_id%TYPE; - v_sort_key portal_pages.sort_key%TYPE; - begin - v_page_id := acs_object.new ( - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); - if layout_id is null then - select min(layout_id) into v_layout_id from portal_layouts; - else - v_layout_id := layout_id; - end if; + function new ( + page_id in portal_pages.page_id%TYPE default null, + pretty_name in portal_pages.pretty_name%TYPE default 'Untitled Page', + portal_id in portal_pages.portal_id%TYPE, + layout_id in portal_pages.layout_id%TYPE default null, + object_type in acs_object_types.object_type%TYPE default 'portal_page', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_pages.page_id%TYPE + is + v_page_id portal_pages.page_id%TYPE; + v_layout_id portal_pages.layout_id%TYPE; + v_sort_key portal_pages.sort_key%TYPE; + begin - if portal_id is not null then - select max(sort_key) + 1 into v_sort_key - from portal_pages - where portal_id = portal_page.new.portal_id; - if v_sort_key is null then - v_sort_key := 0; - end if; - else - raise_application_error(-20000, 'NULL portal_id sent to portal_page.new!'); - end if; + v_page_id := acs_object.new( + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - insert into portal_pages - (page_id, pretty_name, portal_id, layout_id, sort_key) - values (v_page_id, pretty_name, portal_id, v_layout_id, v_sort_key); + if layout_id is null then + select min(layout_id) + into v_layout_id + from portal_layouts; + else + v_layout_id := layout_id; + end if; - return v_page_id; - end new; + select nvl(max(sort_key) + 1, 0) + into v_sort_key + from portal_pages + where portal_id = portal_page.new.portal_id; - procedure delete ( - page_id in portal_pages.page_id%TYPE - ) - is - v_portal_id portal_pages.portal_id%TYPE; - v_sort_key portal_pages.sort_key%TYPE; - v_curr_sort_key portal_pages.sort_key%TYPE; - v_page_count_from_0 integer; - begin - -- sort keys MUST be an unbroken sequece from 0 to max(sort_key) - select portal_id into v_portal_id - from portal_pages - where page_id = portal_page.delete.page_id; + insert into portal_pages + (page_id, pretty_name, portal_id, layout_id, sort_key) + values + (v_page_id, pretty_name, portal_id, v_layout_id, v_sort_key); - select sort_key into v_sort_key + return v_page_id; + + end new; + + procedure delete ( + page_id in portal_pages.page_id%TYPE + ) + is + v_portal_id portal_pages.portal_id%TYPE; + v_sort_key portal_pages.sort_key%TYPE; + v_curr_sort_key portal_pages.sort_key%TYPE; + v_page_count_from_0 integer; + begin + + -- IMPORTANT: sort keys MUST be an unbroken sequence from 0 to max(sort_key) + + select portal_id, sort_key + into v_portal_id, v_sort_key + from portal_pages + where page_id = portal_page.delete.page_id; + + select (count(*) - 1) + into v_page_count_from_0 + from portal_pages + where portal_id = v_portal_id; + + for i in 0 .. v_page_count_from_0 loop + + if i = v_sort_key then + + delete from portal_pages where page_id = portal_page.delete.page_id; - select (count(*) - 1) into v_page_count_from_0 - from portal_pages - where portal_id = v_portal_id; - - for i in 0..v_page_count_from_0 loop - if i = v_sort_key then - delete from portal_pages where page_id = portal_page.delete.page_id; - elsif i > v_sort_key then - -- raise_application_error(-20000, 'del ' || i || ' ' || v_sort_key ); - update portal_pages set sort_key = -1 where sort_key = i; - update portal_pages set sort_key = i - 1 where sort_key = -1; - end if; - end loop; + elsif i > v_sort_key then - acs_object.delete(page_id); - end delete; + update portal_pages + set sort_key = -1 + where sort_key = i; + update portal_pages + set sort_key = i - 1 + where sort_key = -1; + + end if; + + end loop; + + acs_object.delete(page_id); + + end delete; + end portal_page; / show errors create or replace package portal as + function new ( - portal_id in portals.portal_id%TYPE default null, - name in portals.name%TYPE default 'Untitled', - theme_id in portals.theme_id%TYPE default null, - layout_id in portal_layouts.layout_id%TYPE default null, - template_id in portals.template_id%TYPE default null, - default_page_name in portal_pages.pretty_name%TYPE default 'Main Page', - object_type in acs_object_types.object_type%TYPE default 'portal', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null + portal_id in portals.portal_id%TYPE default null, + name in portals.name%TYPE default 'Untitled', + theme_id in portals.theme_id%TYPE default null, + layout_id in portal_layouts.layout_id%TYPE default null, + template_id in portals.template_id%TYPE default null, + default_page_name in portal_pages.pretty_name%TYPE default 'Main Page', + object_type in acs_object_types.object_type%TYPE default 'portal', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null ) return portals.portal_id%TYPE; - procedure delete ( - portal_id in portals.portal_id%TYPE - ); + procedure delete ( + portal_id in portals.portal_id%TYPE + ); end portal; / show errors create or replace package body portal as - function new ( - portal_id in portals.portal_id%TYPE default null, - name in portals.name%TYPE default 'Untitled', - theme_id in portals.theme_id%TYPE default null, - layout_id in portal_layouts.layout_id%TYPE default null, - template_id in portals.template_id%TYPE default null, - default_page_name in portal_pages.pretty_name%TYPE default 'Main Page', - object_type in acs_object_types.object_type%TYPE default 'portal', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portals.portal_id%TYPE - is - 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_new_element_id portal_element_map.element_id%TYPE; - v_new_parameter_id portal_element_parameters.parameter_id%TYPE; - begin + function new ( + portal_id in portals.portal_id%TYPE default null, + name in portals.name%TYPE default 'Untitled', + theme_id in portals.theme_id%TYPE default null, + layout_id in portal_layouts.layout_id%TYPE default null, + template_id in portals.template_id%TYPE default null, + default_page_name in portal_pages.pretty_name%TYPE default 'Main Page', + object_type in acs_object_types.object_type%TYPE default 'portal', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portals.portal_id%TYPE + is + 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_new_element_id portal_element_map.element_id%TYPE; + v_new_parameter_id portal_element_parameters.parameter_id%TYPE; + begin - -- we must create at least one page for this portal - v_portal_id := acs_object.new ( - object_id => portal_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + v_portal_id := acs_object.new( + object_id => portal_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - if template_id is null then + if template_id is null then - if portal.new.theme_id is null then - select max(theme_id) into v_theme_id from portal_element_themes; - else - v_theme_id := portal.new.theme_id; - end if; - - if layout_id is null then - select min(layout_id) into v_layout_id from portal_layouts; - else - v_layout_id := portal.new.layout_id; - end if; + if portal.new.theme_id is null then + select max(theme_id) + into v_theme_id + from portal_element_themes; + else + v_theme_id := portal.new.theme_id; + end if; - insert into portals - (portal_id, name, theme_id) - values (v_portal_id, name, v_theme_id); + if layout_id is null then + select min(layout_id) + into v_layout_id + from portal_layouts; + else + v_layout_id := portal.new.layout_id; + end if; - -- now insert the default page - v_page_id := portal_page.new ( - portal_id => v_portal_id, - pretty_name => default_page_name, - layout_id => v_layout_id, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); - else - -- we have a portal as our template. Copy it's theme, pages, layouts, - -- elements, and element params. - select theme_id into v_theme_id - from portals - where portal_id = portal.new.template_id; + insert + into portals + (portal_id, name, theme_id) + values + (v_portal_id, name, v_theme_id); - insert into portals - (portal_id, name, theme_id, template_id) - values - (v_portal_id, name, v_theme_id, portal.new.template_id); + -- now insert the default page + v_page_id := portal_page.new ( + portal_id => v_portal_id, + pretty_name => default_page_name, + layout_id => v_layout_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - for page in (select * from portal_pages where portal_id = portal.new.template_id) loop - -- now insert the pages from the portal template - v_page_id := portal_page.new ( - portal_id => v_portal_id, - pretty_name => page.pretty_name, - layout_id => page.layout_id, - sort_key => page.sort_key - ); - - for element in (select * from portal_element_map where page_id = page.page_id) loop - -- now get the elements on the template's page and put them on the new page - select acs_object_id_seq.nextval 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 = element.element_id; - - for param in (select * from portal_element_parameters where element_id = element.element_id) loop - -- now for the element's params - select acs_object_id_seq.nextval 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 = param.parameter_id; + else - end loop; - end loop; - end loop; - end if; + -- we have a portal as our template. copy it's theme, pages, layouts, + -- elements, and element params. + select theme_id + into v_theme_id + from portals + where portal_id = portal.new.template_id; + insert + into portals + (portal_id, name, theme_id, template_id) + values + (v_portal_id, name, v_theme_id, portal.new.template_id); - return v_portal_id; - end new; + -- now insert the pages from the portal template + for page in (select * + from portal_pages + where portal_id = portal.new.template_id) + loop - procedure delete ( - portal_id in portals.portal_id%TYPE - ) - is - begin - for page in (select page_id - from portal_pages - where portal_id = portal.delete.portal_id - order by sort_key desc) - loop - -- delete this portal's pages - portal_page.delete ( - page_id => page.page_id - ); - end loop; + v_page_id := portal_page.new( + portal_id => v_portal_id, + pretty_name => page.pretty_name, + layout_id => page.layout_id + ); - acs_object.delete(portal_id); - end delete; + -- now get the elements on the template's page and put them on the new page + for element in (select * + from portal_element_map + where page_id = page.page_id) + loop + select acs_object_id_seq.nextval + 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 = element.element_id; + + -- now for the element's params + for param in (select * + from portal_element_parameters + where element_id = element.element_id) + loop + + select acs_object_id_seq.nextval + 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 = param.parameter_id; + + end loop; + + end loop; + + end loop; + + end if; + + return v_portal_id; + + end new; + + procedure delete ( + portal_id in portals.portal_id%TYPE + ) + is + begin + + for page in (select page_id + from portal_pages + where portal_id = portal.delete.portal_id + order by sort_key desc) + loop + portal_page.delete(page_id => page.page_id); + end loop; + + acs_object.delete(portal_id); + + end delete; + end portal; / show errors - --- Portal element themes create or replace package portal_element_theme as - function new ( - theme_id in portal_element_themes.theme_id%TYPE default null, - name in portal_element_themes.name%TYPE, - description in portal_element_themes.description%TYPE default null, - filename in portal_element_themes.filename%TYPE, - resource_dir in portal_element_themes.resource_dir%TYPE, - object_type in acs_object_types.object_type%TYPE default 'portal_element_theme', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_element_themes.theme_id%TYPE; + function new ( + theme_id in portal_element_themes.theme_id%TYPE default null, + name in portal_element_themes.name%TYPE, + description in portal_element_themes.description%TYPE default null, + filename in portal_element_themes.filename%TYPE, + resource_dir in portal_element_themes.resource_dir%TYPE, + object_type in acs_object_types.object_type%TYPE default 'portal_element_theme', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_element_themes.theme_id%TYPE; - procedure delete ( - theme_id in portal_element_themes.theme_id%TYPE - ); + procedure delete ( + theme_id in portal_element_themes.theme_id%TYPE + ); end portal_element_theme; / show errors create or replace package body portal_element_theme as - function new ( - theme_id in portal_element_themes.theme_id%TYPE default null, - name in portal_element_themes.name%TYPE, - description in portal_element_themes.description%TYPE default null, - filename in portal_element_themes.filename%TYPE, - resource_dir in portal_element_themes.resource_dir%TYPE, - object_type in acs_object_types.object_type%TYPE default 'portal_element_theme', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_element_themes.theme_id%TYPE - is - v_theme_id portal_element_themes.theme_id%TYPE; - begin - v_theme_id := acs_object.new ( - object_id => theme_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + function new ( + theme_id in portal_element_themes.theme_id%TYPE default null, + name in portal_element_themes.name%TYPE, + description in portal_element_themes.description%TYPE default null, + filename in portal_element_themes.filename%TYPE, + resource_dir in portal_element_themes.resource_dir%TYPE, + object_type in acs_object_types.object_type%TYPE default 'portal_element_theme', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_element_themes.theme_id%TYPE + is + v_theme_id portal_element_themes.theme_id%TYPE; + begin - insert into portal_element_themes - (theme_id, name, description, filename, resource_dir) - values - (v_theme_id, name, description, filename, resource_dir); + v_theme_id := acs_object.new( + object_id => theme_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - return v_theme_id; - end new; + insert + into portal_element_themes + (theme_id, name, description, filename, resource_dir) + values + (v_theme_id, name, description, filename, resource_dir); - procedure delete ( - theme_id in portal_element_themes.theme_id%TYPE - ) - is - begin - acs_object.delete(theme_id); - end delete; + return v_theme_id; + end new; + + procedure delete ( + theme_id in portal_element_themes.theme_id%TYPE + ) + is + begin + acs_object.delete(theme_id); + end delete; + end portal_element_theme; / show errors --- Portal layouts create or replace package portal_layout as - function new ( - layout_id in portal_layouts.layout_id%TYPE default null, - name in portal_layouts.name%TYPE, - description in portal_layouts.description%TYPE default null, - filename in portal_layouts.filename%TYPE, - resource_dir in portal_layouts.resource_dir%TYPE, - object_type in acs_object_types.object_type%TYPE default 'portal_layout', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_layouts.layout_id%TYPE; - procedure delete ( - layout_id in portal_layouts.layout_id%TYPE - ); + function new ( + layout_id in portal_layouts.layout_id%TYPE default null, + name in portal_layouts.name%TYPE, + description in portal_layouts.description%TYPE default null, + filename in portal_layouts.filename%TYPE, + resource_dir in portal_layouts.resource_dir%TYPE, + object_type in acs_object_types.object_type%TYPE default 'portal_layout', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_layouts.layout_id%TYPE; - procedure add_region ( - layout_id in portal_supported_regions.layout_id%TYPE, - region in portal_supported_regions.region%TYPE, - immutable_p in portal_supported_regions.immutable_p%TYPE default 'f' - ); + procedure delete ( + layout_id in portal_layouts.layout_id%TYPE + ); + procedure add_region ( + layout_id in portal_supported_regions.layout_id%TYPE, + region in portal_supported_regions.region%TYPE, + immutable_p in portal_supported_regions.immutable_p%TYPE default 'f' + ); + end portal_layout; / show errors create or replace package body portal_layout as - function new ( - layout_id in portal_layouts.layout_id%TYPE default null, - name in portal_layouts.name%TYPE, - description in portal_layouts.description%TYPE default null, - filename in portal_layouts.filename%TYPE, - resource_dir in portal_layouts.resource_dir%TYPE, - object_type in acs_object_types.object_type%TYPE default 'portal_layout', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_layouts.layout_id%TYPE - is - v_layout_id portal_layouts.layout_id%TYPE; - begin - v_layout_id := acs_object.new ( - object_id => layout_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + function new ( + layout_id in portal_layouts.layout_id%TYPE default null, + name in portal_layouts.name%TYPE, + description in portal_layouts.description%TYPE default null, + filename in portal_layouts.filename%TYPE, + resource_dir in portal_layouts.resource_dir%TYPE, + object_type in acs_object_types.object_type%TYPE default 'portal_layout', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_layouts.layout_id%TYPE + is + v_layout_id portal_layouts.layout_id%TYPE; + begin - insert into portal_layouts - (layout_id, name, description, filename, resource_dir) - values - (v_layout_id, name, description,filename, resource_dir); + v_layout_id := acs_object.new( + object_id => layout_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - return v_layout_id; - end new; + insert into portal_layouts + (layout_id, name, description, filename, resource_dir) + values + (v_layout_id, name, description, filename, resource_dir); - procedure delete ( - layout_id in portal_layouts.layout_id%TYPE - ) - is - begin - acs_object.delete(layout_id); - end delete; + return v_layout_id; - procedure add_region ( - layout_id in portal_supported_regions.layout_id%TYPE, - region in portal_supported_regions.region%TYPE, - immutable_p in portal_supported_regions.immutable_p%TYPE default 'f' - ) - is - begin - insert into portal_supported_regions (layout_id, region, immutable_p) - values (layout_id, region, immutable_p); - end add_region; + end new; + procedure delete ( + layout_id in portal_layouts.layout_id%TYPE + ) + is + begin + acs_object.delete(layout_id); + end delete; + + procedure add_region ( + layout_id in portal_supported_regions.layout_id%TYPE, + region in portal_supported_regions.region%TYPE, + immutable_p in portal_supported_regions.immutable_p%TYPE default 'f' + ) + is + begin + insert + into portal_supported_regions + (layout_id, region, immutable_p) + values (layout_id, region, immutable_p); + end add_region; + end portal_layout; / show errors --- datasources create or replace package portal_datasource as - function new ( - datasource_id in portal_datasources.datasource_id%TYPE default null, - name in portal_datasources.name%TYPE default null, - description in portal_datasources.description%TYPE default null, - object_type in acs_object_types.object_type%TYPE default 'portal_datasource', - creation_date in acs_objects.creation_date%TYPE - default sysdate, - creation_user in acs_objects.creation_user%TYPE - default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_datasources.datasource_id%TYPE; - procedure delete ( - datasource_id in portal_datasources.datasource_id%TYPE - ); + function new ( + datasource_id in portal_datasources.datasource_id%TYPE default null, + name in portal_datasources.name%TYPE default null, + description in portal_datasources.description%TYPE default null, + object_type in acs_object_types.object_type%TYPE default 'portal_datasource', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_datasources.datasource_id%TYPE; - procedure set_def_param ( - datasource_id in portal_datasource_def_params.datasource_id%TYPE, - config_required_p in portal_datasource_def_params.config_required_p%TYPE default null, - configured_p in portal_datasource_def_params.configured_p%TYPE default null, - key in portal_datasource_def_params.key%TYPE, - value in portal_datasource_def_params.value%TYPE default null - ); + procedure delete ( + datasource_id in portal_datasources.datasource_id%TYPE + ); + procedure set_def_param ( + datasource_id in portal_datasource_def_params.datasource_id%TYPE, + config_required_p in portal_datasource_def_params.config_required_p%TYPE default null, + configured_p in portal_datasource_def_params.configured_p%TYPE default null, + key in portal_datasource_def_params.key%TYPE, + value in portal_datasource_def_params.value%TYPE default null + ); end portal_datasource; / show errors create or replace package body portal_datasource as - function new ( - datasource_id in portal_datasources.datasource_id%TYPE default null, - name in portal_datasources.name%TYPE default null, - description in portal_datasources.description%TYPE default null, - object_type in acs_object_types.object_type%TYPE default 'portal_datasource', - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return portal_datasources.datasource_id%TYPE - is - v_datasource_id portal_datasources.datasource_id%TYPE; - begin - v_datasource_id := acs_object.new ( - object_id => datasource_id, - object_type => object_type, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - context_id => context_id - ); + function new ( + datasource_id in portal_datasources.datasource_id%TYPE default null, + name in portal_datasources.name%TYPE default null, + description in portal_datasources.description%TYPE default null, + object_type in acs_object_types.object_type%TYPE default 'portal_datasource', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return portal_datasources.datasource_id%TYPE + is + v_datasource_id portal_datasources.datasource_id%TYPE; + begin + v_datasource_id := acs_object.new( + object_id => datasource_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); - insert into portal_datasources - (datasource_id, name, description) - values - (v_datasource_id, name, description); + insert into portal_datasources + (datasource_id, name, description) + values + (v_datasource_id, name, description); - return v_datasource_id; - end new; + return v_datasource_id; - procedure delete ( - datasource_id in portal_datasources.datasource_id%TYPE - ) - is - begin - acs_object.delete(datasource_id); - end delete; + end new; - procedure set_def_param ( - datasource_id in portal_datasource_def_params.datasource_id%TYPE, - config_required_p in portal_datasource_def_params.config_required_p%TYPE default null, - configured_p in portal_datasource_def_params.configured_p%TYPE default null, - key in portal_datasource_def_params.key%TYPE, - value in portal_datasource_def_params.value%TYPE default null - ) - is - v_parameter_id portal_datasource_def_params.parameter_id%TYPE; - begin + procedure delete ( + datasource_id in portal_datasources.datasource_id%TYPE + ) + is + begin + acs_object.delete(datasource_id); + end delete; - select acs_object_id_seq.nextval into v_parameter_id from dual; - - insert into portal_datasource_def_params - (parameter_id, datasource_id, config_required_p, configured_p, key, value) - values - (v_parameter_id, datasource_id, config_required_p, configured_p, key, value); + procedure set_def_param ( + datasource_id in portal_datasource_def_params.datasource_id%TYPE, + config_required_p in portal_datasource_def_params.config_required_p%TYPE default null, + configured_p in portal_datasource_def_params.configured_p%TYPE default null, + key in portal_datasource_def_params.key%TYPE, + value in portal_datasource_def_params.value%TYPE default null + ) + is + begin - end set_def_param; + insert into portal_datasource_def_params + (parameter_id, datasource_id, config_required_p, configured_p, key, value) + values + (acs_object_id_seq.nextval, datasource_id, config_required_p, configured_p, key, value); + end set_def_param; + end portal_datasource; / show errors Index: openacs-4/packages/new-portal/sql/oracle/api-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/api-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/oracle/api-drop.sql 29 Mar 2002 18:48:28 -0000 1.2 +++ openacs-4/packages/new-portal/sql/oracle/api-drop.sql 1 Jul 2002 20:03:49 -0000 1.3 @@ -19,10 +19,11 @@ -- copyright 2001, OpenForce, Inc. -- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- +drop package portal_page; drop package portal; drop package portal_element_theme; drop package portal_layout; Index: openacs-4/packages/new-portal/sql/oracle/datasource-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/datasource-sc-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/new-portal/sql/oracle/datasource-sc-create.sql 9 May 2002 04:04:05 -0000 1.6 +++ openacs-4/packages/new-portal/sql/oracle/datasource-sc-create.sql 1 Jul 2002 20:03:49 -0000 1.7 @@ -1,11 +1,11 @@ -- --- Copyright (C) 2001, 2002 OpenForce, Inc. +-- Copyright(C) 2001, 2002 OpenForce, Inc. -- -- This file is part of dotLRN. -- -- dotLRN is free software; you can redistribute it and/or modify it under the -- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 2 of the License, or (at your option) any later +-- Foundation; either version 2 of the License, or(at your option) any later -- version. -- -- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY @@ -14,173 +14,172 @@ -- details. -- --- The data source (portlet) contract --- -- +-- The data source(portlet) contract -- --- arjun@openforce.net --- started November, 2001 +-- @author arjun@openforce.net +-- @version $Id$ -- --- $Id$ declare sc_dotlrn_contract integer; foo integer; begin - sc_dotlrn_contract := acs_sc_contract.new ( - contract_name => 'portal_datasource', - contract_desc => 'Portal Datasource interface' + + sc_dotlrn_contract := acs_sc_contract.new( + contract_name => 'portal_datasource', + contract_desc => 'Portal Datasource interface' ); - + -- Get my name - not to be confused with the pretty_name - foo := acs_sc_msg_type.new ( - msg_type_name => 'portal_datasource.GetMyName.InputType', - msg_type_spec => '' + foo := acs_sc_msg_type.new( + msg_type_name => 'portal_datasource.GetMyName.InputType', + msg_type_spec => '' ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'portal_datasource.GetMyName.OutputType', - msg_type_spec => 'my_name:string' + + foo := acs_sc_msg_type.new( + msg_type_name => 'portal_datasource.GetMyName.OutputType', + msg_type_spec => 'my_name:string' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'GetMyName', - 'Get the name', - 't', -- not cacheable - 0, -- n_args - 'portal_datasource.GetMyName.InputType', - 'portal_datasource.GetMyName.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'GetMyName', + 'Get the name', + 't', -- not cacheable + 0, -- n_args + 'portal_datasource.GetMyName.InputType', + 'portal_datasource.GetMyName.OutputType' ); - + -- Get a pretty name - foo := acs_sc_msg_type.new ( - msg_type_name => 'portal_datasource.GetPrettyName.InputType', - msg_type_spec => '' + foo := acs_sc_msg_type.new( + msg_type_name => 'portal_datasource.GetPrettyName.InputType', + msg_type_spec => '' ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'portal_datasource.GetPrettyName.OutputType', - msg_type_spec => 'pretty_name:string' + + foo := acs_sc_msg_type.new( + msg_type_name => 'portal_datasource.GetPrettyName.OutputType', + msg_type_spec => 'pretty_name:string' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'GetPrettyName', - 'Get the pretty name', - 't', -- not cacheable - 0, -- n_args - 'portal_datasource.GetPrettyName.InputType', - 'portal_datasource.GetPrettyName.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'GetPrettyName', + 'Get the pretty name', + 't', -- not cacheable + 0, -- n_args + 'portal_datasource.GetPrettyName.InputType', + 'portal_datasource.GetPrettyName.OutputType' ); - + -- Link: Where is the href target for this PE? -- ** not currently implimented *** - foo := acs_sc_msg_type.new ( - msg_type_name => 'portal_datasource.Link.InputType', - msg_type_spec => '' + foo := acs_sc_msg_type.new( + msg_type_name => 'portal_datasource.Link.InputType', + msg_type_spec => '' ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'portal_datasource.Link.OutputType', - msg_type_spec => 'pretty_name:string' + + foo := acs_sc_msg_type.new( + msg_type_name => 'portal_datasource.Link.OutputType', + msg_type_spec => 'pretty_name:string' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'Link', - 'Get the link ie the href target for this datasource', - 't', -- not cacheable - 0, -- n_args - 'portal_datasource.Link.InputType', - 'portal_datasource.Link.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'Link', + 'Get the link ie the href target for this datasource', + 't', -- not cacheable + 0, -- n_args + 'portal_datasource.Link.InputType', + 'portal_datasource.Link.OutputType' ); - -- AddSelfToPage: Tell the datasource to add itself to a portal - -- The "args" string is an ns_set of extra arguments + -- AddSelfToPage: Tell the datasource to add itself to a portal + -- The "args" string is an ns_set of extra arguments foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.AddSelfToPage.InputType', - msg_type_spec => 'page_id:integer,args:string' + msg_type_name => 'portal_datasource.AddSelfToPage.InputType', + msg_type_spec => 'page_id:integer,args:string' ); - + foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.AddSelfToPage.OutputType', - msg_type_spec => 'element_id:integer' + msg_type_name => 'portal_datasource.AddSelfToPage.OutputType', + msg_type_spec => 'element_id:integer' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'AddSelfToPage', - 'Adds itself to the given page returns an element_id', - 'f', -- not cacheable - 2, -- n_args - 'portal_datasource.AddSelfToPage.InputType', - 'portal_datasource.AddSelfToPage.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'AddSelfToPage', + 'Adds itself to the given page returns an element_id', + 'f', -- not cacheable + 2, -- n_args + 'portal_datasource.AddSelfToPage.InputType', + 'portal_datasource.AddSelfToPage.OutputType' ); -- RemoveSelfFromPage: Tell the PE to remove itself from a page - -- The "args" string is an ns_set of extra arguments + -- The "args" string is an ns_set of extra arguments foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.RemoveSelfFromPage.InputType', - msg_type_spec => 'page_id:integer,args:string' + msg_type_name => 'portal_datasource.RemoveSelfFromPage.InputType', + msg_type_spec => 'page_id:integer,args:string' ); - + foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.RemoveSelfFromPage.OutputType', - msg_type_spec => '' + msg_type_name => 'portal_datasource.RemoveSelfFromPage.OutputType', + msg_type_spec => '' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'RemoveSelfFromPage', - ' remove itself from the given page', - 'f', -- not cacheable - 2, -- n_args - 'portal_datasource.RemoveSelfFromPage.InputType', - 'portal_datasource.RemoveSelfFromPage.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'RemoveSelfFromPage', + ' remove itself from the given page', + 'f', -- not cacheable + 2, -- n_args + 'portal_datasource.RemoveSelfFromPage.InputType', + 'portal_datasource.RemoveSelfFromPage.OutputType' ); -- Show: the portal element's display proc foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.Show.InputType', - msg_type_spec => 'cf:string' + msg_type_name => 'portal_datasource.Show.InputType', + msg_type_spec => 'cf:string' ); - + foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.Show.OutputType', - msg_type_spec => 'output:string' + msg_type_name => 'portal_datasource.Show.OutputType', + msg_type_spec => 'output:string' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'Show', - 'Render the portal element returning a chunk of HTML', - 'f', -- not cacheable - 1, -- n_args - 'portal_datasource.Show.InputType', - 'portal_datasource.Show.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'Show', + 'Render the portal element returning a chunk of HTML', + 'f', -- not cacheable + 1, -- n_args + 'portal_datasource.Show.InputType', + 'portal_datasource.Show.OutputType' ); -- Edit: the datasources' edit html -- ** not currently implimented ** foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.Edit.InputType', - msg_type_spec => 'element_id:integer' + msg_type_name => 'portal_datasource.Edit.InputType', + msg_type_spec => 'element_id:integer' ); - + foo := acs_sc_msg_type.new( - msg_type_name => 'portal_datasource.Edit.OutputType', - msg_type_spec => 'output:string' + msg_type_name => 'portal_datasource.Edit.OutputType', + msg_type_spec => 'output:string' ); - - foo := acs_sc_operation.new ( - 'portal_datasource', - 'Edit', - 'Returns the edit html', - 'f', -- not cacheable - 1, -- n_args - 'portal_datasource.Edit.InputType', - 'portal_datasource.Edit.OutputType' + + foo := acs_sc_operation.new( + 'portal_datasource', + 'Edit', + 'Returns the edit html', + 'f', -- not cacheable + 1, -- n_args + 'portal_datasource.Edit.InputType', + 'portal_datasource.Edit.OutputType' ); end; Index: openacs-4/packages/new-portal/sql/oracle/datasource-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/datasource-sc-drop.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/new-portal/sql/oracle/datasource-sc-drop.sql 9 May 2002 23:59:53 -0000 1.7 +++ openacs-4/packages/new-portal/sql/oracle/datasource-sc-drop.sql 1 Jul 2002 20:03:49 -0000 1.8 @@ -14,247 +14,239 @@ -- details. -- +-- -- The data source (portlet) contract --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- for Oracle 8/8i. (We're guessing 9i works, too). +-- @author arjun@openforce.net +-- @version $Id$ -- --- arjun@openforce.net --- started November, 2001 --- --- $Id$ declare - contract_id integer; - msg_type_id integer; - op_id integer; + contract_id integer; + msg_type_id integer; + op_id integer; begin - - -- drop GetMyName - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'GetMyName' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'GetMyName' - ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.GetMyName.InputType' - ); + -- drop GetMyName + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'GetMyName' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.GetMyName.InputType', - msg_type_id => msg_type_id - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'GetMyName' + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.GetMyName.OutputType' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.GetMyName.InputType' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.GetMyName.OutputType', - msg_type_id => msg_type_id - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.GetMyName.InputType', + msg_type_id => msg_type_id + ); - -- drop GetPrettyName - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'GetPrettyName' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'GetPrettyName' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.GetMyName.OutputType' + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.GetPrettyName.InputType' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.GetMyName.OutputType', + msg_type_id => msg_type_id + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.GetPrettyName.InputType', - msg_type_id => msg_type_id - ); + -- drop GetPrettyName + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'GetPrettyName' + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.GetPrettyName.OutputType' - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'GetPrettyName' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.GetPrettyName.OutputType', - msg_type_id => msg_type_id - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.GetPrettyName.InputType' + ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.GetPrettyName.InputType', + msg_type_id => msg_type_id + ); - -- drop Link - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'Link' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'Link' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.GetPrettyName.OutputType' + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.Link.InputType' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.GetPrettyName.OutputType', + msg_type_id => msg_type_id + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.Link.InputType', - msg_type_id => msg_type_id - ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.Link.OutputType' - ); + -- drop Link + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'Link' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.Link.OutputType', - msg_type_id => msg_type_id - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'Link' + ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.Link.InputType' + ); - -- Drop add_self_to_page - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'AddSelfToPage' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'AddSelfToPage' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.Link.InputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.AddSelfToPage.InputType' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.Link.OutputType' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.AddSelfToPage.InputType', - msg_type_id => msg_type_id - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.Link.OutputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.AddSelfToPage.OutputType' - ); + -- Drop add_self_to_page + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'AddSelfToPage' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.AddSelfToPage.OutputType', - msg_type_id => msg_type_id - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'AddSelfToPage' + ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.AddSelfToPage.InputType' + ); - -- Delete Show - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'Show' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'Show' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.AddSelfToPage.InputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.Show.InputType' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.AddSelfToPage.OutputType' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.Show.InputType', - msg_type_id => msg_type_id - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.AddSelfToPage.OutputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.Show.OutputType' - ); + -- Delete Show + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'Show' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.Show.OutputType', - msg_type_id => msg_type_id - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'Show' + ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.Show.InputType' + ); - -- Delete Edit - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'Edit' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'Edit' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.Show.InputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.Edit.InputType' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.Show.OutputType' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.Edit.InputType', - msg_type_id => msg_type_id - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.Show.OutputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.Edit.OutputType' - ); + -- Delete Edit + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'Edit' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.Edit.OutputType', - msg_type_id => msg_type_id - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'Edit' + ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.Edit.InputType' + ); - -- rem RemoveSelfFromPage - op_id := acs_sc_operation.get_id ( - contract_name => 'portal_datasource', - operation_name => 'RemoveSelfFromPage' - ); - - acs_sc_operation.delete ( - operation_id => op_id, - contract_name => 'portal_datasource', - operation_name => 'RemoveSelfFromPage' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.Edit.InputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.RemoveSelfFromPage.InputType' - ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.Edit.OutputType' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.RemoveSelfFromPage.InputType', - msg_type_id => msg_type_id - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.Edit.OutputType', + msg_type_id => msg_type_id + ); - msg_type_id := acs_sc_msg_type.get_id ( - msg_type_name => 'portal_datasource.RemoveSelfFromPage.OutputType' - ); + -- RemoveSelfFromPage + op_id := acs_sc_operation.get_id ( + contract_name => 'portal_datasource', + operation_name => 'RemoveSelfFromPage' + ); - acs_sc_msg_type.delete ( - msg_type_name => 'portal_datasource.RemoveSelfFromPage.OutputType', - msg_type_id => msg_type_id - ); + acs_sc_operation.delete ( + operation_id => op_id, + contract_name => 'portal_datasource', + operation_name => 'RemoveSelfFromPage' + ); + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.RemoveSelfFromPage.InputType' + ); - -- drop the contract - contract_id := acs_sc_contract.get_id ('portal_datasource'); - acs_sc_contract.delete ( - contract_id => contract_id, - contract_name => 'portal_datasource' - ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.RemoveSelfFromPage.InputType', + msg_type_id => msg_type_id + ); + acs_sc_msg_type.delete ( + msg_type_id := acs_sc_msg_type.get_id ( + msg_type_name => 'portal_datasource.RemoveSelfFromPage.OutputType' + ); + acs_sc_msg_type.delete ( + msg_type_name => 'portal_datasource.RemoveSelfFromPage.OutputType', + msg_type_id => msg_type_id + ); + + -- drop the contract + contract_id := acs_sc_contract.get_id ('portal_datasource'); + + acs_sc_contract.delete ( + contract_id => contract_id, + contract_name => 'portal_datasource' + ); + end; / show errors Index: openacs-4/packages/new-portal/sql/oracle/defaults.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/defaults.sql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/new-portal/sql/oracle/defaults.sql 11 Jun 2002 04:17:54 -0000 1.18 +++ openacs-4/packages/new-portal/sql/oracle/defaults.sql 1 Jul 2002 20:03:49 -0000 1.19 @@ -1,11 +1,11 @@ -- --- Copyright (C) 2001, 2002 OpenForce, Inc. +-- Copyright(C) 2001, 2002 OpenForce, Inc. -- -- This file is part of dotLRN. -- -- dotLRN is free software; you can redistribute it and/or modify it under the -- terms of the GNU General Public License as published by the Free Software --- Foundation; either version 2 of the License, or (at your option) any later +-- Foundation; either version 2 of the License, or(at your option) any later -- version. -- -- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY @@ -16,77 +16,76 @@ -- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal(arjun@openforce.net) +-- @version $Id$ -- - -- ampersands break if I don't do this. set scan off --- Insert some default templates. declare - layout_id portal_layouts.layout_id%TYPE; - theme_id portal_element_themes.theme_id%TYPE; + layout_id portal_layouts.layout_id%TYPE; + theme_id portal_element_themes.theme_id%TYPE; begin + -- two-column layout, without a header. + layout_id := portal_layout.new( + name => 'Simple 2-Column', + description => 'A simple 2-column layout', + filename => 'layouts/simple2', + resource_dir => 'layouts/components/simple2' + ); --- two-column layout, without a header. - layout_id := portal_layout.new ( - name => 'Simple 2-Column', - description => 'A simple 2-column layout', - filename => 'layouts/simple2', - resource_dir => 'layouts/components/simple2'); + -- the supported regions for that layout. + portal_layout.add_region(layout_id => layout_id, region => '1'); + portal_layout.add_region(layout_id => layout_id, region => '2'); --- the supported regions for that layout. - portal_layout.add_region (layout_id => layout_id, region => '1'); - portal_layout.add_region (layout_id => layout_id, region => '2'); + -- one-column layout, without a header. + layout_id := portal_layout.new( + name => 'Simple 1-Column', + description => 'A simple 1-column layout', + filename => 'layouts/simple1', + resource_dir => 'layouts/components/simple1' + ); --- one-column layout, without a header. - layout_id := portal_layout.new ( - name => 'Simple 1-Column', - description => 'A simple 1-column layout', - filename => 'layouts/simple1', - resource_dir => 'layouts/components/simple1'); + -- the supported regions for that layout. + portal_layout.add_region(layout_id => layout_id, region => '1'); --- the supported regions for that layout. - portal_layout.add_region (layout_id => layout_id, region => '1'); + -- same as above, only, three columns. + layout_id := portal_layout.new( + name => 'Simple 3-Column', + description => 'A simple 3-column layout', + filename => 'layouts/simple3', + resource_dir => 'layouts/components/simple3' + ); --- same as above, only, three columns. - layout_id := portal_layout.new ( - name => 'Simple 3-Column', - description => 'A simple 3-column layout', - filename => 'layouts/simple3', - resource_dir => 'layouts/components/simple3'); + portal_layout.add_region(layout_id => layout_id, region => '1'); + portal_layout.add_region(layout_id => layout_id, region => '2'); + portal_layout.add_region(layout_id => layout_id, region => '3'); - portal_layout.add_region (layout_id => layout_id, region => '1'); - portal_layout.add_region (layout_id => layout_id, region => '2'); - portal_layout.add_region (layout_id => layout_id, region => '3'); + -- Now, some element themes. + theme_id := portal_element_theme.new( + name => 'simple', + description => 'A simple red table-based theme', + filename => 'themes/simple-theme', + resource_dir => 'themes/simple-theme' + ); --- Now, some element themes. + theme_id := portal_element_theme.new( + name => 'nada', + description => 'The un-theme. No graphics.', + filename => 'themes/nada-theme', + resource_dir => 'themes/nada-theme' + ); - theme_id := portal_element_theme.new ( - name => 'simple', - description => 'A simple red table-based theme', - filename => 'themes/simple-theme', - resource_dir => 'themes/simple-theme'); + theme_id := portal_element_theme.new( + name => 'deco', + description => 'An Art Deco theme', + filename => 'themes/deco-theme', + resource_dir => 'themes/deco-theme' + ); - theme_id := portal_element_theme.new ( - name => 'nada', - description => 'The un-theme. No graphics.', - filename => 'themes/nada-theme', - resource_dir => 'themes/nada-theme'); - - theme_id := portal_element_theme.new ( - name => 'deco', - description => 'An Art Deco theme', - filename => 'themes/deco-theme', - resource_dir => 'themes/deco-theme'); - - end; / - +show errors Index: openacs-4/packages/new-portal/sql/oracle/objects-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/objects-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/new-portal/sql/oracle/objects-create.sql 29 Mar 2002 18:48:28 -0000 1.5 +++ openacs-4/packages/new-portal/sql/oracle/objects-create.sql 1 Jul 2002 20:03:49 -0000 1.6 @@ -14,227 +14,229 @@ -- details. -- +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- arjun@openforce.net --- $Id$ +-- @author arjun@openforce.net +-- @version $Id$ +-- -- datasources begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'portal_datasource', - pretty_name => 'Portal Data Source', - pretty_plural => 'Portal Data Sources', - table_name => 'PORTAL_DATASOURCES', - id_column => 'DATASOURCE_ID', - package_name => 'portal_datasource' - ); + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'portal_datasource', + pretty_name => 'Portal Data Source', + pretty_plural => 'Portal Data Sources', + table_name => 'PORTAL_DATASOURCES', + id_column => 'DATASOURCE_ID', + package_name => 'portal_datasource' + ); end; / show errors; -- datasource attributes declare - attr_id acs_attributes.attribute_id%TYPE; + attr_id acs_attributes.attribute_id%TYPE; begin - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_datasource', - attribute_name => 'NAME', - pretty_name => 'Name', - pretty_plural => 'Names', - datatype => 'string' - ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_datasource', - attribute_name => 'DESCRIPTION', - pretty_name => 'Description', - pretty_plural => 'Descriptions', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_datasource', + attribute_name => 'NAME', + pretty_name => 'Name', + pretty_plural => 'Names', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_datasource', - attribute_name => 'CONTENT', - pretty_name => 'Content', - pretty_plural => 'Contents', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_datasource', + attribute_name => 'DESCRIPTION', + pretty_name => 'Description', + pretty_plural => 'Descriptions', + datatype => 'string' + ); + + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_datasource', + attribute_name => 'CONTENT', + pretty_name => 'Content', + pretty_plural => 'Contents', + datatype => 'string' + ); + end; / show errors; - - -- portal_layouts begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'portal_layout', - pretty_name => 'Portal Layout', - pretty_plural => 'Portal Layouts', - table_name => 'PORTAL_LAYOUTS', - id_column => 'LAYOUT_ID', - package_name => 'portal_layout' - ); + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'portal_layout', + pretty_name => 'Portal Layout', + pretty_plural => 'Portal Layouts', + table_name => 'PORTAL_LAYOUTS', + id_column => 'LAYOUT_ID', + package_name => 'portal_layout' + ); end; / show errors; -- and its attributes declare - attr_id acs_attributes.attribute_id%TYPE; + attr_id acs_attributes.attribute_id%TYPE; begin - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_layout', - attribute_name => 'NAME', - pretty_name => 'Name', - pretty_plural => 'Names', - datatype => 'string' - ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_layout', - attribute_name => 'DESCRIPTION', - pretty_name => 'Description', - pretty_plural => 'Descriptions', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_layout', + attribute_name => 'NAME', + pretty_name => 'Name', + pretty_plural => 'Names', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_layout', - attribute_name => 'TYPE', - pretty_name => 'Type', - pretty_plural => 'Types', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_layout', + attribute_name => 'DESCRIPTION', + pretty_name => 'Description', + pretty_plural => 'Descriptions', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_layout', - attribute_name => 'FILENAME', - pretty_name => 'Filename', - pretty_plural => 'Filenames', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_layout', + attribute_name => 'TYPE', + pretty_name => 'Type', + pretty_plural => 'Types', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_layout', - attribute_name => 'resource_dir', - pretty_name => 'Resource Directory', - pretty_plural => 'Resource Directory', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_layout', + attribute_name => 'FILENAME', + pretty_name => 'Filename', + pretty_plural => 'Filenames', + datatype => 'string' + ); + + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_layout', + attribute_name => 'resource_dir', + pretty_name => 'Resource Directory', + pretty_plural => 'Resource Directory', + datatype => 'string' + ); + end; / show errors; -- poratal_element_themes begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'portal_element_theme', - pretty_name => 'Portal Element Theme', - pretty_plural => 'Portal Element Themes', - table_name => 'PORTAL_THEMES', - id_column => 'THEME_ID', - package_name => 'portal_themes' - ); + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'portal_element_theme', + pretty_name => 'Portal Element Theme', + pretty_plural => 'Portal Element Themes', + table_name => 'PORTAL_THEMES', + id_column => 'THEME_ID', + package_name => 'portal_themes' + ); end; / show errors; -- and its attributes declare - attr_id acs_attributes.attribute_id%TYPE; + attr_id acs_attributes.attribute_id%TYPE; begin - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_element_theme', - attribute_name => 'NAME', - pretty_name => 'Name', - pretty_plural => 'Names', - datatype => 'string' - ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_element_theme', - attribute_name => 'DESCRIPTION', - pretty_name => 'Description', - pretty_plural => 'Descriptions', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_element_theme', + attribute_name => 'NAME', + pretty_name => 'Name', + pretty_plural => 'Names', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_element_theme', - attribute_name => 'TYPE', - pretty_name => 'Type', - pretty_plural => 'Types', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_element_theme', + attribute_name => 'DESCRIPTION', + pretty_name => 'Description', + pretty_plural => 'Descriptions', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_element_theme', - attribute_name => 'FILENAME', - pretty_name => 'Filename', - pretty_plural => 'Filenames', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_element_theme', + attribute_name => 'TYPE', + pretty_name => 'Type', + pretty_plural => 'Types', + datatype => 'string' + ); - attr_id := acs_attribute.create_attribute ( - object_type => 'portal_element_theme', - attribute_name => 'resource_dir', - pretty_name => 'Resource Directory', - pretty_plural => 'Resource Directory', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_element_theme', + attribute_name => 'FILENAME', + pretty_name => 'Filename', + pretty_plural => 'Filenames', + datatype => 'string' + ); + + attr_id := acs_attribute.create_attribute ( + object_type => 'portal_element_theme', + attribute_name => 'resource_dir', + pretty_name => 'Resource Directory', + pretty_plural => 'Resource Directory', + datatype => 'string' + ); + end; / show errors; - -- portal begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'portal', - pretty_name => 'Portal', - pretty_plural => 'Portals', - table_name => 'PORTALS', - id_column => 'PORTAL_ID', - package_name => 'portal' - ); + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'portal', + pretty_name => 'Portal', + pretty_plural => 'Portals', + table_name => 'PORTALS', + id_column => 'PORTAL_ID', + package_name => 'portal' + ); end; / show errors; declare - attr_id acs_attributes.attribute_id%TYPE; + attr_id acs_attributes.attribute_id%TYPE; begin - attr_id := acs_attribute.create_attribute ( - object_type => 'portal', - attribute_name => 'NAME', - pretty_name => 'Name', - pretty_plural => 'Names', - datatype => 'string' - ); + attr_id := acs_attribute.create_attribute ( + object_type => 'portal', + attribute_name => 'NAME', + pretty_name => 'Name', + pretty_plural => 'Names', + datatype => 'string' + ); end; / show errors; - -- portal_page begin - acs_object_type.create_type ( - supertype => 'acs_object', - object_type => 'portal_page', - pretty_name => 'Portal Page', - pretty_plural => 'Portal Pages', - table_name => 'PORTAL_PAGES', - id_column => 'page_id', - package_name => 'portal_page' - ); + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'portal_page', + pretty_name => 'Portal Page', + pretty_plural => 'Portal Pages', + table_name => 'PORTAL_PAGES', + id_column => 'page_id', + package_name => 'portal_page' + ); end; / show errors; Index: openacs-4/packages/new-portal/sql/oracle/objects-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/objects-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/oracle/objects-drop.sql 29 Mar 2002 18:48:28 -0000 1.2 +++ openacs-4/packages/new-portal/sql/oracle/objects-drop.sql 1 Jul 2002 20:03:49 -0000 1.3 @@ -16,34 +16,35 @@ -- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- -- XXX - FIX ME Do this the "right way" -delete from acs_permissions where object_id in ( - (select object_id from acs_objects where object_type in ( - 'portal', 'portal_element_theme','portal_layout', 'portal_datasource' - )) -); +delete +from acs_permissions +where object_id in (select object_id + from acs_objects + where object_type in ('portal_page', 'portal', 'portal_element_theme','portal_layout', 'portal_datasource')); -delete from acs_permissions where object_id in ( - (select package_id from apm_packages where package_key = 'portal') -); +delete +from acs_permissions +where object_id in (select package_id + from apm_packages + where package_key = 'portal'); -delete from acs_objects where object_type in ( - 'portal', 'portal_element_theme','portal_layout', 'portal_datasource' -); +delete +from acs_objects +where object_type in ('portal_page', 'portal', 'portal_element_theme','portal_layout', 'portal_datasource'); begin - acs_object_type.drop_type('portal'); - acs_object_type.drop_type('portal_element_theme'); - acs_object_type.drop_type('portal_layout'); - acs_object_type.drop_type('portal_datasource'); + acs_object_type.drop_type('portal'); + acs_object_type.drop_type('portal_page'); + acs_object_type.drop_type('portal_element_theme'); + acs_object_type.drop_type('portal_layout'); + acs_object_type.drop_type('portal_datasource'); end; / show errors Index: openacs-4/packages/new-portal/sql/oracle/portal-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/portal-core-create.sql,v diff -u -r1.42 -r1.43 --- openacs-4/packages/new-portal/sql/oracle/portal-core-create.sql 25 Jun 2002 21:47:15 -0000 1.42 +++ openacs-4/packages/new-portal/sql/oracle/portal-core-create.sql 1 Jul 2002 20:03:49 -0000 1.43 @@ -14,239 +14,247 @@ -- details. -- +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- arjun@openforce.net --- $Id$ +-- @author arjun@openforce.net +-- @version $Id$ +-- --- **** PRIVILEGES **** begin - -- multi portal admin privs acs_privilege.create_privilege('portal_create_portal'); acs_privilege.create_privilege('portal_delete_portal'); - - -- privs on a single portal acs_privilege.create_privilege('portal_read_portal'); - acs_privilege.create_privilege('portal_edit_portal'); - acs_privilege.create_privilege('portal_admin_portal'); - - -- set up the portal perms hierarchy - -- and root privs to global priv names acs_privilege.add_child('read','portal_read_portal'); acs_privilege.add_child('portal_edit_portal','portal_read_portal'); acs_privilege.add_child('portal_admin_portal','portal_edit_portal'); acs_privilege.add_child('create','portal_create_portal'); acs_privilege.add_child('delete','portal_delete_portal'); acs_privilege.add_child('admin','portal_admin_portal'); - - - end; / show errors --- **** DATASOURCES **** - create table portal_datasources ( - datasource_id constraint p_datasources_datasource_id_fk - references acs_objects(object_id) - constraint p_datasources_datasource_id_pk - primary key, - description varchar(200), - name varchar(200) not null, - pretty_name varchar(200) + datasource_id constraint p_datasources_datasource_id_fk + references acs_objects (object_id) + constraint p_datasources_datasource_id_pk + primary key, + description varchar(200), + name varchar(200) + constraint p_datasources_name_nn + not null, + pretty_name varchar(200) ); - -- A default configuration for a ds will be stored here, to be copied -- to the portal_element_parameters table at PE creation (DS binding) time --- +-- -- Config semantics: -- true: cfg_req, cfg_p - A static config is given for all PEs, can --- be changed later +-- be changed later -- true: cfg_req false: cfg_p - PE must be configured before use -- false: cfg_req true: cfg_p - An optional default cfg given -- both false: Configuration optional w. no default suggested create table portal_datasource_def_params ( - parameter_id integer - constraint p_ds_def_prms_prm_id_pk - primary key, - datasource_id constraint p_ds_def_prms_element_id_fk - references portal_datasources on delete cascade - not null, - config_required_p char(1) default 'f' - constraint p_ds_def_prms_cfg_req_p_ck - check(config_required_p in ('t', 'f')), - configured_p char(1) default 'f' - constraint p_ds_def_prms_configured_p_ck - check(configured_p in ('t', 'f')), - key varchar(200) not null, - value varchar(200) + parameter_id integer + constraint p_ds_def_prms_prm_id_pk + primary key, + datasource_id constraint p_ds_def_prms_element_id_fk + references portal_datasources (datasource_id) + on delete cascade + constraint p_ds_def_prms_element_id_nn + not null, + config_required_p char(1) + default 'f' + constraint p_ds_def_prms_cfg_req_p_nn + not null + constraint p_ds_def_prms_cfg_req_p_ck + check (config_required_p in ('t', 'f')), + configured_p char(1) + default 'f' + constraint p_ds_def_prms_configured_p_nn + not null + constraint p_ds_def_prms_configured_p_ck + check (configured_p in ('t', 'f')), + key varchar(200) + constraint p_ds_def_prms_key_nn + not null, + value varchar(200) ); - --- **** Portal Layouts **** - -- Layouts are ADP templates for the portal page. i.e. 2 cols, 3 cols, -- etc. They are globally available. No secret layouts! create table portal_layouts ( - layout_id constraint p_layouts_layout_id_fk - references acs_objects(object_id) - constraint p_layouts_layout_id_pk - primary key, - name varchar(200) - constraint p_layouts_name_un - unique - not null, - description varchar(200), - filename varchar(200), - resource_dir varchar(200) + layout_id constraint p_layouts_layout_id_fk + references acs_objects (object_id) + constraint p_layouts_layout_id_pk + primary key, + name varchar(200) + constraint p_layouts_name_un + unique + constraint p_layouts_name_nn + not null, + description varchar(200), + filename varchar(200), + resource_dir varchar(200) ); create table portal_supported_regions ( - layout_id constraint p_spprtd_rgns_layout_id_fk - references portal_layouts - on delete cascade - not null, - region varchar(20) not null, - immutable_p char(1) not null - constraint p_spprtd_rgns_immtble_p_ck - check(immutable_p in ('t', 'f')), - constraint p_spprtd_rgns_tmpl_id_rgn_pk - primary key (layout_id,region) + layout_id constraint p_spprtd_rgns_layout_id_fk + references portal_layouts (layout_id) + on delete cascade + constraint p_spprtd_rgns_layout_id_nn + not null, + region varchar(20) + constraint p_spprtd_rgns_region_nn + not null, + immutable_p char(1) + constraint p_spprtd_rgns_immtble_p_nn + not null + constraint p_spprtd_rgns_immtble_p_ck + check(immutable_p in ('t', 'f')), + constraint portal_supported_regions_pk + primary key (layout_id, region) ); - --- **** Portal Element Themes **** - -- Themes are ADP templates with decoration for PEs, nothing more. -- At this point they will just be bits of ADPs in the filesystem create table portal_element_themes ( - theme_id constraint p_e_themes_theme_id_fk - references acs_objects(object_id) - constraint p_e_themes_theme_id_pk - primary key, - name varchar(200) - constraint p_e_themes_name_un - unique - not null, - description varchar(200), - filename varchar(200), - resource_dir varchar(200) + theme_id constraint p_e_themes_theme_id_fk + references acs_objects(object_id) + constraint p_e_themes_theme_id_pk + primary key, + name varchar(200) + constraint p_e_themes_name_un + unique + constraint p_e_themes_name_nn + not null, + description varchar(200), + filename varchar(200), + resource_dir varchar(200) ); - --- **** Portals **** - -- Portals are essentially "containers" for PEs that bind to DSs. --- Parties have, optionally have portals --- Restrict to party check? --- Roles and perms issues? +-- Parties have, optionally have portals +-- Restrict to party check? +-- Roles and perms issues? create table portals ( - portal_id constraint portal_portal_id_fk - references acs_objects(object_id) - constraint p_portal_id_pk - primary key, - name varchar(200) default 'Untitled' not null, - theme_id constraint portal_theme_id_fk - references portal_element_themes - not null, - -- Not null, if I have a portal I'm using as a template - template_id constraint template_id_fk - references portals + portal_id constraint portal_portal_id_fk + references acs_objects(object_id) + constraint p_portal_id_pk + primary key, + name varchar(200) + default 'Untitled' + constraint portal_name_nn + not null, + theme_id constraint portal_theme_id_fk + references portal_element_themes (theme_id) + portal_theme_id_nn + not null, + template_id constraint template_id_fk + references portals (portal_id) ); --- **** (Portal) Pages **** -- Support for multi-page portals (think my.yahoo.com) create table portal_pages ( - page_id constraint portal_pages_page_id_fk - references acs_objects(object_id) - constraint portal_pages_page_id_pk - primary key, - pretty_name varchar(200) default 'Untitled Page' not null, - portal_id constraint portal_pages_portal_id_fk - references portals - not null, - layout_id constraint portal_pages_layout_id_fk - references portal_layouts - not null, - sort_key integer not null, - -- Two pages on one portal canot have the same sort key - constraint portal_pages_srt_key_un - unique(portal_id,sort_key) + page_id constraint portal_pages_page_id_fk + references acs_objects (object_id) + constraint portal_pages_page_id_pk + primary key, + pretty_name varchar(200) + default 'Untitled Page' + constraint portal_pages_pretty_name_nn + not null, + portal_id constraint portal_pages_portal_id_fk + references portals (portal_id) + constraint portal_pages_portal_id_nn + not null, + layout_id constraint portal_pages_layout_id_fk + references portal_layouts (layout_id) + constraint portal_pages_layout_id_nn + not null, + sort_key integer + constraint portal_pages_sort_key_nn + not null, + -- Two pages on one portal canot have the same sort key + constraint portal_pages_sort_key_un + unique (portal_id, sort_key) ); create index portal_pages_prtl_page_idx on portal_pages (portal_id, page_id); --- **** Portal Elements (PEs) **** - - -- PE are fully owned by one and only one portal. They are not -- "objects" that live on after their portal is gone. One way to think -- of them is a map b/w a portal and a DS, with satellite data of a --- theme, a config, a region, etc. +-- theme, a config, a region, etc. -- -- No securtiy checks are done here. If you can view and bind to a DS you have -- a PE for it. --- this sequence is only used for swapping sort keys so that we --- don't abuse the acs_object_id_seq - create sequence portal_element_map_sk_seq start with 1000; - create table portal_element_map ( - element_id integer - constraint p_element_map_element_id_pk - primary key, - name varchar(200) not null, - pretty_name varchar(200) not null, - page_id constraint p_element_map_page_id_fk - references portal_pages - on delete cascade - not null, - datasource_id constraint p_element_map_datasource_id_fk - references portal_datasources - on delete cascade - not null, - region varchar(20) not null, - sort_key integer not null, - state varchar(6) default 'full' - constraint p_element_map_state - check(state in ('full', 'shaded', 'hidden', - 'pinned')), - -- Two elements may not exist in the same place on a portal. - -- constraint p_element_map_pid_rgn_srt_un - -- FIXME: we want a constraint _like_ this, but it makes - -- reverting very complicated. XXX - -- unique(page_id,region,sort_key), - -- Two elements may not have the same pretty name on a portal. - constraint p_element_map_pid_name_un - unique(page_id,pretty_name) + element_id integer + constraint portal_element_map_pk + primary key, + name varchar(200) + constraint p_element_map_name_nn + not null, + pretty_name varchar(200) + constraint p_element_map_pretty_name_nn + not null, + page_id constraint p_element_map_page_id_fk + references portal_pages (page_id) + on delete cascade + not null, + datasource_id constraint p_element_map_datasource_id_fk + references portal_datasources (datasource_id) + on delete cascade + constraint p_element_map_datasource_id_nn + not null, + region varchar(20) + constraint p_element_map_region_nn + not null, + sort_key integer + constraint p_element_map_sort_key_nn + not null, + state varchar(6) default 'full' + constraint p_element_map_state_ck + check (state in ('full', 'shaded', 'hidden', 'pinned')), + constraint p_element_map_pid_name_un + unique (page_id, pretty_name) ); create table portal_element_parameters ( - parameter_id integer - constraint p_element_prms_prm_id_pk - primary key, - element_id constraint p_element_prms_element_id_fk - references portal_element_map on delete cascade - not null, - config_required_p char(1) default 'f' - constraint p_element_prms_cfg_req_p_ck - check(config_required_p in ('t', 'f')), - configured_p char(1) default 'f' - constraint p_element_prms_configured_p_ck - check(configured_p in ('t', 'f')), - key varchar(50) not null, - value varchar(200) + parameter_id integer + constraint portal_element_parameters_pk + primary key, + element_id constraint p_element_prms_element_id_fk + references portal_element_map (element_id) + on delete cascade + constraint p_element_prms_element_id_nn + not null, + config_required_p char(1) + default 'f' + constraint p_element_prms_cfg_req_p_nn + not null + constraint p_element_prms_cfg_req_p_ck + check (config_required_p in ('t', 'f')), + configured_p char(1) + default 'f' + constraint p_element_prms_configured_p_nn + not null + constraint p_element_prms_configured_p_ck + check(configured_p in ('t', 'f')), + key varchar(50) + constraint p_element_prms_key_nn + not null, + value varchar(200) ); -create index p_element_prms_elem_id_idx on portal_element_parameters (element_id); create index p_element_prms_elem_key_idx on portal_element_parameters (element_id, key); -- This table maps the datasources that are available for portals to @@ -255,21 +263,19 @@ -- sense for every portal, but a bboard DS may not, and we don't want -- to confuse everyone with DSs that don't make sense for the given -- portal - create table portal_datasource_avail_map ( - portal_datasource_id integer - constraint p_ds_a_map_p_ds_id_pk - primary key, - portal_id constraint p_ds_a_map_portal_id_fk - references portals on delete cascade - not null, - datasource_id constraint p_ds_a_map_datasource_id_fk - references portal_datasources - on delete cascade - not null, - -- DSs are unique per-portal - constraint p_ds_a_map_pid_ds_un - unique(portal_id,datasource_id) + portal_datasource_id integer + constraint portal_datasource_avail_map_pk + primary key, + portal_id constraint p_ds_a_map_portal_id_fk + references portals (portal_id) + on delete cascade + constraint p_ds_a_map_portal_id_nn + not null, + datasource_id constraint p_ds_a_map_datasource_id_fk + references portal_datasources (datasource_id) + on delete cascade + constraint p_ds_a_map_datasource_id_nn + not null, + constraint p_ds_a_map_pid_ds_un unique (portal_id, datasource_id) ); - - Index: openacs-4/packages/new-portal/sql/oracle/portal-core-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/portal-core-drop.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/new-portal/sql/oracle/portal-core-drop.sql 29 Mar 2002 18:48:28 -0000 1.5 +++ openacs-4/packages/new-portal/sql/oracle/portal-core-drop.sql 1 Jul 2002 20:03:49 -0000 1.6 @@ -14,23 +14,37 @@ -- details. -- +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- arjun@openforce.net +-- @author arjun@openforce.net +-- @version $Id$ -- --- $Id$ --- Reverse order from the creation script +drop sequence portal_element_map_sk_seq; - drop table portal_datasource_avail_map; drop table portal_element_parameters; drop table portal_element_map; +drop table portal_pages; drop table portals; drop table portal_element_themes; drop table portal_supported_regions; drop table portal_layouts; drop table portal_datasource_def_params; drop table portal_datasources; + +declare +begin + acs_privilege.remove_child('read','portal_read_portal'); + acs_privilege.remove_child('portal_edit_portal','portal_read_portal'); + acs_privilege.remove_child('portal_admin_portal','portal_edit_portal'); + acs_privilege.remove_child('create','portal_create_portal'); + acs_privilege.remove_child('delete','portal_delete_portal'); + acs_privilege.remove_child('admin','portal_admin_portal'); + acs_privilege.drop_privilege('portal_create_portal'); + acs_privilege.drop_privilege('portal_delete_portal'); + acs_privilege.drop_privilege('portal_read_portal'); + acs_privilege.drop_privilege('portal_edit_portal'); + acs_privilege.drop_privilege('portal_admin_portal'); +end; Index: openacs-4/packages/new-portal/sql/oracle/portal-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/Attic/portal-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/new-portal/sql/oracle/portal-create.sql 16 Apr 2002 05:17:03 -0000 1.7 +++ openacs-4/packages/new-portal/sql/oracle/portal-create.sql 1 Jul 2002 20:03:49 -0000 1.8 @@ -16,17 +16,13 @@ -- -- The "New" Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- +-- @author arjun@openforce.net +-- @version $Id$ -- --- arjun@openforce.net --- $Id$ --- @@ portal-core-create.sql @@ objects-create.sql @@ api-create.sql @@ datasource-sc-create.sql @@ defaults.sql -@@ portal-node-mapping-create.sql Index: openacs-4/packages/new-portal/sql/oracle/portal-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/Attic/portal-drop.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/new-portal/sql/oracle/portal-drop.sql 29 Mar 2002 18:48:28 -0000 1.4 +++ openacs-4/packages/new-portal/sql/oracle/portal-drop.sql 1 Jul 2002 20:03:49 -0000 1.5 @@ -16,12 +16,11 @@ -- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- + @@ datasource-sc-drop.sql @@ api-drop.sql @@ portal-core-drop.sql