Index: openacs-4/contrib/packages/portal/sql/oracle/datasource-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/datasource-package-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/sql/oracle/datasource-package-create.sql 15 Jan 2004 02:58:52 -0000 1.3 +++ openacs-4/contrib/packages/portal/sql/oracle/datasource-package-create.sql 2 Jun 2004 23:38:07 -0000 1.4 @@ -28,8 +28,13 @@ function new ( p_name in portal_datasources.name%TYPE, - p_shadeable_p in portal_datasources.shadeable_p%TYPE default 't' - p_hideable_p in portal_datasources.hideable_p%TYPE default 't' + p_pretty_name in portal_datasources.pretty_name%TYPE, + p_application in portal_datasources.application%TYPE, + p_owner in portal_datasources.owner%TYPE, + p_template in portal_datasources.template%TYPE, + p_admin_p in portal_datasources.admin_p%TYPE default 'f', + p_shadeable_p in portal_datasources.shadeable_p%TYPE default 't', + p_hideable_p in portal_datasources.hideable_p%TYPE default 't', p_description in portal_datasources.description%TYPE default null ) return portal_datasources.datasource_id%TYPE; @@ -54,22 +59,29 @@ function new ( p_name in portal_datasources.name%TYPE, - p_shadeable_p in portal_datasources.shadeable_p%TYPE default 't' - p_hideable_p in portal_datasources.hideable_p%TYPE default 't' + p_pretty_name in portal_datasources.pretty_name%TYPE, + p_application in portal_datasources.application%TYPE, + p_owner in portal_datasources.owner%TYPE, + p_template in portal_datasources.template%TYPE, + p_admin_p in portal_datasources.admin_p%TYPE default 'f', + p_shadeable_p in portal_datasources.shadeable_p%TYPE default 't', + p_hideable_p in portal_datasources.hideable_p%TYPE default 't', p_description in portal_datasources.description%TYPE default null ) return portal_datasources.datasource_id%TYPE is v_datasource_id portal_datasources.datasource_id%TYPE; begin - insert into portal_datasources - (datasource_id, name, shadeable_p, hideable_p, description) - values - (portal_seq.nextval, p_name, p_shadeable_p, p_hideable_p, p_description) - returning datasource_id - into v_datasource_id; + insert into portal_datasources + (datasource_id, name, pretty_name, application, owner, template, admin_p, + shadeable_p, hideable_p, description) + values + (portal_seq.nextval, p_name, p_pretty_name, p_application, p_owner, p_template, + p_admin_p, p_shadeable_p, p_hideable_p, p_description) + returning datasource_id + into v_datasource_id; - return v_datasource_id; + return v_datasource_id; end new; Index: openacs-4/contrib/packages/portal/sql/oracle/datasource-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/datasource-package-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/datasource-package-drop.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/datasource-package-drop.sql 2 Jun 2004 23:38:07 -0000 1.2 @@ -23,5 +23,4 @@ -- @version $Id$ -- -drop package body portal_datasource; drop package portal_datasource; Index: openacs-4/contrib/packages/portal/sql/oracle/layout-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/layout-package-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/layout-package-drop.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/layout-package-drop.sql 2 Jun 2004 23:38:07 -0000 1.2 @@ -23,5 +23,4 @@ -- @version $Id$ -- -drop package body portal_layout; drop package portal_layout; Index: openacs-4/contrib/packages/portal/sql/oracle/page-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/page-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/sql/oracle/page-package-create.sql 15 Jan 2004 02:58:52 -0000 1.2 +++ openacs-4/contrib/packages/portal/sql/oracle/page-package-create.sql 2 Jun 2004 23:38:07 -0000 1.3 @@ -141,7 +141,7 @@ end loop; - acs_object.del(page_id); + acs_object.del(p_page_id); end del; Index: openacs-4/contrib/packages/portal/sql/oracle/page-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/page-package-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/page-package-drop.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/page-package-drop.sql 2 Jun 2004 23:38:07 -0000 1.2 @@ -23,5 +23,4 @@ -- @version $Id$ -- -drop package body portal_page; drop package portal_page; Index: openacs-4/contrib/packages/portal/sql/oracle/portal-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/portal-core-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/sql/oracle/portal-core-create.sql 27 Feb 2004 01:13:15 -0000 1.3 +++ openacs-4/contrib/packages/portal/sql/oracle/portal-core-create.sql 2 Jun 2004 23:38:07 -0000 1.4 @@ -32,6 +32,28 @@ name varchar(200) constraint p_datasources_name_nn not null, + pretty_name varchar(200) + constraint p_datasources_pretty_name_nn + not null, + application varchar(100) + constraint p_datasources_application_fk + references apm_package_types (package_key) + on delete cascade, + owner varchar(100) + constraint p_datasources_owner_fk + references apm_package_types (package_key) + on delete cascade + constraint p_datasources_owner_nn + not null, + template varchar(200) + constraint p_datasources_template_nn + not null, + admin_p char(1) + default 't' + constraint p_datasources_admin_p_nn + not null + constraint p_datasources_admin_p_ck + check (admin_p in ('t', 'f')), shadeable_p char(1) default 't' constraint p_datasources_shadeable_p_nn @@ -47,11 +69,62 @@ description varchar(200) ); +-- indexes for referential integrity checking + +create index p_datasources_application_idx on portal_datasources(application); +create index p_datasources_owner_idx on portal_datasources(owner); + comment on table portal_datasources is ' - a portal datasource is the package of code that generates the content + a portal datasource is the package of code that generates the content of a portal element. the foo-portlet packages create datasources. '; +comment on column portal_datasources.name is ' + The name of this portal datasource. We can''t arbitrarily use portlet_key because many + portlet packages will support at least two portlets, one user portlet and one admin + portlet. +'; + +comment on column portal_datasources.pretty_name is ' + The default pretty name to use for an instance of this portlet. This should be a + message key for internationalized portlets. +'; + +comment on column portal_datasources.application is ' + The package key of the application that this portlet works with. For instance the + forums portlet works with the forums package. +'; + +comment on column portal_datasources.owner is ' + The package key of the package that implements this portlet. +'; + +comment on column portal_datasources.template is ' + The name of template that displays the portlet content. Note this is not a full + path, portlet templates go in the standard package template library directory. +'; + +comment on column portal_datasources.admin_p is ' + If true, this is a package admin datasource that should only be made available + to admins. This only determines how the portal package code chooses to handle + a portal datasource when it creates portal pages and creates portlets. An + admin portlet is responsible for ensuring that a user actually has the proper + privileges to admin its related application. And applications that create their + own portal page structure (.LRN, in particular) may or may not honor this flag. +'; + +comment on column portal_datasources.shadeable_p is ' + If true, this datasource implements the shade operator. DRB: This is only + being kept around for .LRN, shading is something the portal page manager + should have absolute control over. +'; + +comment on column portal_datasources.hideable_p is ' + If true, this datasource implements the hide operator. DRB: This is only + being kept around for .LRN, shading is something the portal page manager + should have absolute control over. +'; + create table portal_datasource_parameters ( datasource_id constraint p_ds_params_datasource_id_fk references portal_datasources (datasource_id) @@ -81,9 +154,7 @@ comment on table portal_datasource_parameters is ' maintains a set of default parameters for portal datsources. these are copied to a portal element when it is created. - configuration semantics: - config_required_p | configured_p | ----------------- | ----------------- | ---------------------------------- t | t | static configuration is provided @@ -200,9 +271,14 @@ references acs_objects (object_id) constraint portals_pk primary key, - party_id integer - constraint p_party_id_fk - references parties (party_id), + owner_id integer + constraint p_owner_id_fk + references acs_objects (object_id), + package_id integer + constraint p_package_id_fk + references apm_packages(package_id) + constraint p_package_id_nn + not null, name varchar(200) default 'Untitled' constraint portal_name_nn @@ -215,7 +291,8 @@ not null ); -create index portals_party_id_idx on portals(party_id); +create index portals_owner_id_idx on portals(owner_id); +create index portals_package_id_idx on portals(package_id); comment on table portals is ' portals are containers of one or more portal pages mapped to a party. @@ -229,7 +306,38 @@ portals one theme for all its contained pages '; +create table portal_datasource_map ( + package_id integer + constraint pdm_package_id_fk + references apm_packages (package_id) + constraint pdm_package_id_nn + not null, + datasource_id integer + constraint pdm_datasource_id_fk + references portal_datasources (datasource_id) + constraint pdm_datasource_id_nn + not null, + constraint pdm_pk + primary key (package_id, datasource_id) +); +create index pdm_datasource_idx on portal_datasource_map (datasource_id); + +comment on table portal_datasource_map is ' + Maps datasources to portal instances. This is used by the portal admin UI to track + which datasources have had their applications mounted under the instance''s mount + point. Independent applications like .LRN that use the portal package as a service + do not need to maintain this map. +'; + +comment on column portal_datasource_map.package_id is ' + The package id of the portal instance the datasource is mapped to. +'; + +comment on column portal_datasource_map.datasource_id is ' + The package id of the portal instance the datasource is mapped to. +'; + create table portal_pages ( page_id constraint p_pages_page_id_fk references acs_objects (object_id) Index: openacs-4/contrib/packages/portal/sql/oracle/portal-core-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/portal-core-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/portal-core-drop.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/portal-core-drop.sql 2 Jun 2004 23:38:07 -0000 1.2 @@ -32,5 +32,6 @@ drop table portal_themes; drop table portal_layout_regions; drop table portal_layouts; -drop table portal_datasource_def_params; +drop table portal_datasource_map; +drop table portal_datasource_parameters; drop table portal_datasources; Index: openacs-4/contrib/packages/portal/sql/oracle/portal-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/portal-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/sql/oracle/portal-create.sql 15 Jan 2004 00:34:40 -0000 1.2 +++ openacs-4/contrib/packages/portal/sql/oracle/portal-create.sql 2 Jun 2004 23:38:07 -0000 1.3 @@ -30,4 +30,3 @@ @@ theme-package-create.sql; @@ layout-package-create.sql; @@ datasource-package-create.sql; -@@ defaults.sql; Index: openacs-4/contrib/packages/portal/sql/oracle/portal-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/oracle/portal-package-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/sql/oracle/portal-package-create.sql 15 Jan 2004 02:58:52 -0000 1.3 +++ openacs-4/contrib/packages/portal/sql/oracle/portal-package-create.sql 2 Jun 2004 23:38:07 -0000 1.4 @@ -28,7 +28,8 @@ function new ( p_portal_id in portals.portal_id%TYPE default null, - p_party_id in parties.party_id%TYPE, + p_owner_id in acs_objects.object_id%TYPE, + p_package_id in apm_packages.package_id%TYPE, p_name in portals.name%TYPE default 'Untitled', p_theme_id in portals.theme_id%TYPE default null, p_template_id in portals.template_id%TYPE default null, @@ -52,7 +53,8 @@ function new ( p_portal_id in portals.portal_id%TYPE default null, - p_party_id in parties.party_id%TYPE, + p_owner_id in acs_objects.object_id%TYPE, + p_package_id in apm_packages.package_id%TYPE, p_name in portals.name%TYPE default 'Untitled', p_theme_id in portals.theme_id%TYPE default null, p_template_id in portals.template_id%TYPE default null, @@ -79,7 +81,7 @@ context_id => p_context_id ); - if template_id is null then + if p_template_id is null then if p_theme_id is null then select max(theme_id) @@ -91,24 +93,25 @@ insert into portals - (portal_id, party_id, name, theme_id) + (portal_id, owner_id, package_id, name, theme_id) values - (v_portal_id, p_party_id, p_name, v_theme_id); + (v_portal_id, p_owner_id, p_package_id, p_name, v_theme_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 = p_template_id; insert into portals - (portal_id, party_id, name, theme_id, template_id) + (portal_id, owner_id, package_id, name, theme_id, template_id) values - (v_portal_id, p_party_id, p_name, v_theme_id, p_template_id); + (v_portal_id, p_owner_id, p_package_id, p_name, v_theme_id, p_template_id); -- now insert the pages from the portal template for v_page in (select * @@ -117,13 +120,13 @@ loop v_page_id := portal_page.new( - name => v_page.name, - portal_id => v_portal_id, - layout_id => v_page.layout_id - creation_date => p_creation_date, - creation_user => p_creation_user, - creation_ip => p_creation_ip, - context_id => v_portal_id + p_name => v_page.name, + p_portal_id => v_portal_id, + p_layout_id => v_page.layout_id, + p_creation_date => p_creation_date, + p_creation_user => p_creation_user, + p_creation_ip => p_creation_ip, + p_context_id => v_portal_id ); -- now get the elements on the template's page and put them on the new page