Index: openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql,v
diff -u -r1.6 -r1.7
--- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 29 Jan 2004 03:50:59 -0000 1.6
+++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 1 Feb 2004 03:08:10 -0000 1.7
@@ -257,6 +257,11 @@
party_id integer
constraint p_party_id_fk
references parties (party_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 p_name_nn
@@ -272,30 +277,41 @@
);
create index portals_party_id_idx on portals(party_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.
';
+comment on column portals.package_id is '
+ The portal instance that ownns this portal
+';
+
comment on column portals.template_id is '
- a portal may have a template (another portal)
+ A portal may have a template (another portal)
';
comment on column portals.theme_id is '
- portals one theme for all its contained pages
+ 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),
+ 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),
+ 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
Index: openacs-4/contrib/packages/portal/sql/postgresql/portal-core-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/portal-core-drop.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-drop.sql 25 Oct 2002 21:29:17 -0000 1.1
+++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-drop.sql 1 Feb 2004 03:08:11 -0000 1.2
@@ -33,4 +33,5 @@
drop table portal_layout_regions;
drop table portal_layouts;
drop table portal_datasource_parameters;
+drop table portal_datasource_map;
drop table portal_datasources;
Index: openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 15 Jan 2004 02:58:52 -0000 1.4
+++ openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 1 Feb 2004 03:08:11 -0000 1.5
@@ -23,21 +23,22 @@
-- @version $Id$
--
-select define_function_args('portal__new', 'portal_id,party_id,name,theme_id,template_id,object_type;portal,creation_date,creation_user,creation_ip,context_id');
+select define_function_args('portal__new', 'portal_id,party_id,package_id,name,theme_id,template_id,object_type;portal,creation_date,creation_user,creation_ip,context_id');
-create or replace function portal__new (integer,integer, varchar,integer,integer,varchar,timestamptz,integer,varchar,integer)
+create or replace function portal__new (integer,integer, integer, varchar, integer, integer, varchar, timestamptz, integer, varchar, integer)
returns integer as '
declare
p_portal_id alias for $1;
p_party_id alias for $2;
- p_name alias for $3;
- p_theme_id alias for $4;
- p_template_id alias for $5;
- p_object_type alias for $6;
- p_creation_date alias for $7;
- p_creation_user alias for $8;
- p_creation_ip alias for $9;
- p_context_id alias for $10;
+ p_package_id alias for $3;
+ p_name alias for $4;
+ p_theme_id alias for $5;
+ p_template_id alias for $6;
+ p_object_type alias for $7;
+ p_creation_date alias for $8;
+ p_creation_user alias for $9;
+ p_creation_ip alias for $10;
+ p_context_id alias for $11;
v_portal_id portals.portal_id%TYPE;
v_theme_id portals.theme_id%TYPE;
v_layout_id portal_layouts.layout_id%TYPE;
@@ -71,9 +72,9 @@
insert
into portals
- (portal_id, party_id, name, theme_id)
+ (portal_id, party_id, package_id, name, theme_id)
values
- (v_portal_id, p_party_id, p_name, v_theme_id);
+ (v_portal_id, p_party_id, p_package_id, p_name, v_theme_id);
else
@@ -86,9 +87,9 @@
insert
into portals
- (portal_id, party_id, name, theme_id, template_id)
+ (portal_id, party_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_party_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 *
Index: openacs-4/contrib/packages/portal/tcl/portal-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/portal-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 29 Jan 2004 03:50:59 -0000 1.10
+++ openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 1 Feb 2004 03:08:11 -0000 1.11
@@ -61,6 +61,7 @@
ad_proc -public new {
{-party_id:required}
+ {-package_id:required}
{-name Untitled}
{-template_id ""}
{-context_id ""}
@@ -71,6 +72,7 @@
the page_list.
@party_id The party which owns the new portal
+ @package_id The package_id of this portal package instance
@name The name of the portal
@template_id The template used to render the portal if the default is not to
be used
@@ -84,12 +86,20 @@
} {
db_transaction {
- set var_list [list \
- [list name $name] \
- [list template_id $template_id] \
- [list context_id $context_id] \
- [list party_id $party_id]]
+# set var_list [list \
+# [list name $name] \
+# [list template_id $template_id] \
+# [list context_id $context_id] \
+# [list party_id $party_id] \
+# [list package_id $package_id]]
+ set var_list [subst {
+ {name $name}
+ {template_id $template_id}
+ {context_id $context_id}
+ {party_id $party_id}
+ {package_id $package_id}}]
+
set portal_id [package_instantiate_object -var_list $var_list portal]
foreach privilege $party_privileges {
@@ -138,6 +148,7 @@
ad_proc -public get_portal_id {
{-party_id:required}
+ {-package_id:required}
} {
Get the portal_id for a party. I (DRB) am not going to bother caching this
for the time being ...
@@ -202,6 +213,18 @@
return $portal(template_id)
}
+ ad_proc -public get_master_template_id {
+ -package_id:required
+ } {
+ Get the master template id, i.e. the portal used to create all other
+ portals, for the given portal instance.
+
+ @param package_id The package_id of the portal instance we're interested in
+ @return The portal_id of the master portal template for the given portal instance
+ } {
+ return [get_portal_id -party_id "" -package_id $package_id]
+ }
+
ad_proc -public get_page_count {
{-portal_id:required}
} {
Index: openacs-4/contrib/packages/portal/tcl/portal-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/portal-procs.xql,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/portal/tcl/portal-procs.xql 24 Jan 2004 01:22:48 -0000 1.4
+++ openacs-4/contrib/packages/portal/tcl/portal-procs.xql 1 Feb 2004 03:08:11 -0000 1.5
@@ -23,6 +23,7 @@
select portal_id
from portals
where party_id = :party_id
+ and package_id = :package_id
Index: openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,38 @@
+ad_page_contract {
+
+ Add one or more applications to this instance of the portals package
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: add-applications-2.tcl,v 1.1 2004/02/01 03:08:11 donb Exp $
+
+} {
+ application:multiple
+ return_url
+}
+
+set package_id [ad_conn package_id]
+set node_id [site_node::get_node_id_from_object_id -object_id $package_id]
+
+db_transaction {
+ foreach one_application $application {
+
+ # For some reason I'm getting dupes in my application list from the checkboxes
+ # set up by the list widget on the previous page.
+
+ if { [db_string check_application {}] == 0 } {
+
+ # First add the datasources associated with the application to our map
+ db_dml insert_application {}
+
+ # Now mount the application under our URL
+ site_node::instantiate_and_mount \
+ -package_key $one_application \
+ -parent_node_id $node_id
+
+ }
+
+ }
+}
+
+ad_returnredirect $return_url
Index: openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+ select count(*)
+ from portal_datasources pd
+ where pd.application = :one_application
+ and exists (select 1
+ from portal_datasource_map pdm
+ where pdm.package_id = :package_id
+ and pdm.datasource_id = pd.datasource_id)
+
+
+
+
+
+
+
+ insert into portal_datasource_map
+ (datasource_id, package_id)
+ select pd.datasource_id, :package_id
+ from portal_datasources pd
+ where pd.application = :one_application
+
+
+
+
+
Index: openacs-4/contrib/packages/portal/www/admin/add-applications.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/add-applications.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/add-applications.adp 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,11 @@
+
+ Add portalled applications
+
+
+
There are no portalled applications available that haven't already been
+ added to this instance of the portal package.
+
+
+
+
+
Index: openacs-4/contrib/packages/portal/www/admin/add-applications.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/add-applications.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/add-applications.tcl 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,40 @@
+ad_page_contract {
+ Generate a list of applications that have supporting portlets that have not
+ yet been added to this portal package instance.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date
+ @cvs-id $Id: add-applications.tcl,v 1.1 2004/02/01 03:08:11 donb Exp $
+} { }
+
+set package_id [ad_conn package_id]
+set return_url [ad_conn url]
+
+db_multirow -extend {add_url} applications get_applications {} {
+ set add_url [export_vars -base add-applications-2 { application return_url }]
+}
+
+# Build the list-builder list
+template::list::create \
+ -name applications \
+ -multirow applications \
+ -key application \
+ -bulk_actions {
+ "Add checked applications" "add-applications-2" "Add checked applications"
+ } \
+ -bulk_action_export_vars {
+ application return_url
+ } \
+ -elements {
+ application {
+ label "Application"
+ }
+ add {
+ label Add
+ link_url_col add_url
+ link_html { title "Add single application" }
+ display_template {Add}
+ }
+ }
+
+ad_return_template
Index: openacs-4/contrib/packages/portal/www/admin/add-applications.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/add-applications.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/add-applications.xql 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ select pd.application
+ from portal_datasources pd
+ where not exists (select 1
+ from portal_datasource_map pdm
+ where pdm.package_id = :package_id
+ and pdm.datasource_id = pd.datasource_id)
+ group by pd.application
+
+
+
+
+
Index: openacs-4/contrib/packages/portal/www/admin/configure.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/configure.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/configure.adp 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,3 @@
+
+Configuration
+Add a new application and its associated portlets
Index: openacs-4/contrib/packages/portal/www/admin/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/index.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/portal/www/admin/index.tcl 11 Jan 2004 01:08:00 -0000 1.3
+++ openacs-4/contrib/packages/portal/www/admin/index.tcl 1 Feb 2004 03:08:11 -0000 1.4
@@ -23,9 +23,10 @@
@cvs-id $Id$
} { }
-
-permission::require_permission -object_id [ad_conn package_id] -privilege admin
-
db_multirow portals get_portals {}
+if { ${portals:rowcount} == 0 } {
+ ad_returnredirect configure
+}
+
ad_return_template
Index: openacs-4/contrib/packages/portal/www/admin/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/Attic/index.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/contrib/packages/portal/www/admin/index.xql 1 Feb 2004 03:08:11 -0000 1.1
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ select portal_id, name, template_id
+ from portals
+
+
+
+