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 -N -r1.5 -r1.6 --- openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 1 Feb 2004 03:08:11 -0000 1.5 +++ openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 12 Feb 2004 21:31:19 -0000 1.6 @@ -102,7 +102,7 @@ v_page.name, v_portal_id, v_page.layout_id, - null, + ''portal_page'', p_creation_date, p_creation_user, p_creation_ip, @@ -121,8 +121,8 @@ insert into portal_elements - (element_id, name, page_id, datasource_id, region, sort_key, state, shadeable_p, hideable_p) - select v_new_element_id, name, v_page_id, datasource_id, region, sort_key, state, shadeable_p, hideable_p + (element_id, application_id, name, page_id, datasource_id, region, sort_key, state, shadeable_p, hideable_p) + select v_new_element_id, application_id, name, v_page_id, datasource_id, region, sort_key, state, shadeable_p, hideable_p from portal_elements where element_id = v_element.element_id; Index: openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql 27 Jan 2004 03:33:46 -0000 1.4 +++ openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql 12 Feb 2004 21:31:20 -0000 1.5 @@ -7,13 +7,14 @@ insert into portal_elements (element_id, datasource_id, name, application_id, - page_id, region, sort_key, shadeable_p, hideable_p) + page_id, region, state, sort_key, shadeable_p, hideable_p) select :element_id, :datasource_id, :name, :application_id, :page_id, :region, + :state, nvl((select max(portal_elements.sort_key) + 1 from portal_elements where page_id = :page_id Index: openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql 27 Jan 2004 03:33:46 -0000 1.4 +++ openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql 12 Feb 2004 21:31:20 -0000 1.5 @@ -7,13 +7,14 @@ insert into portal_elements (element_id, datasource_id, name, application_id, - page_id, region, sort_key, shadeable_p, hideable_p) + page_id, region, state, sort_key, shadeable_p, hideable_p) select :element_id, :datasource_id, :name, :application_id, :page_id, :region, + :state, coalesce((select max(portal_elements.sort_key) + 1 from portal_elements where page_id = :page_id Index: openacs-4/contrib/packages/portal/tcl/element-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/contrib/packages/portal/tcl/element-procs.tcl 27 Jan 2004 03:33:46 -0000 1.8 +++ openacs-4/contrib/packages/portal/tcl/element-procs.tcl 12 Feb 2004 21:31:20 -0000 1.9 @@ -32,6 +32,7 @@ {-page_name ""} {-pretty_name ""} {-region ""} + {-state full} {-datasource_name:required} {-application_id:required} {-name ""} 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 -N -r1.12 -r1.13 --- openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 12 Feb 2004 14:59:05 -0000 1.12 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 12 Feb 2004 21:31:20 -0000 1.13 @@ -67,6 +67,7 @@ {-context_id ""} {-page_list {{{Page 1} 2_column}}} {-party_privileges {read write admin}} + {-configure_params:boolean} } { Create a new portal for the passed in party_id. create pages passed in the page_list. @@ -84,15 +85,9 @@ would make sense to only grant read to the party directly. } { + db_transaction { -# 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} @@ -115,6 +110,15 @@ } } + if { $configure_params_p && ![string equal $template_id ""] } { + foreach {datasource element_id} [db_list_of_lists get_elements {}] { + portal::datasource::call \ + -name $name \ + -op ConfigureParams \ + -list_args [list $element_id] + } + } + } return $portal_id @@ -222,7 +226,11 @@ @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] + if { [db_0or1row get_master_template_id {}] } { + return $master_template_id + } else { + return "" + } } ad_proc -public get_page_count { @@ -370,19 +378,6 @@ append theme_chunk "" append template "$theme_chunk" - set datasource_html "\n" - append template " -
- - - $datasource_chunk - \n -
\n" - # # Per-page template chunks # 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 -N -r1.6 -r1.7 --- openacs-4/contrib/packages/portal/tcl/portal-procs.xql 12 Feb 2004 14:59:05 -0000 1.6 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.xql 12 Feb 2004 21:31:20 -0000 1.7 @@ -2,6 +2,16 @@ + + + select pd.name, pe.element_id + from portal_datasources pd, portal_elements pe, portal_pages pp + where pp.portal_id = :portal_id + and pe.page_id = pp.page_id + and pd.datasource_id = pe.datasource_id + + + delete @@ -165,6 +175,15 @@ + + + select portal_id as master_template_id + from portals + where package_id = :package_id + and party_id is null + + + select count(*) 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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 12 Feb 2004 21:31:21 -0000 1.2 @@ -13,6 +13,7 @@ set package_id [ad_conn package_id] set node_id [site_node::get_node_id_from_object_id -object_id $package_id] +set portals [db_list get_portals {}] db_transaction { foreach one_application $application { @@ -26,10 +27,23 @@ 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 + set application_id [site_node::instantiate_and_mount \ + -package_key $one_application \ + -parent_node_id $node_id] + set datasources [db_list get_datasources {}] + + foreach portal $portals { + foreach datasource $datasources { + portal::element::new \ + -portal_id $portal \ + -state hidden \ + -application_id $application_id \ + -datasource_name $datasource \ + -configure_params + } + } + } } 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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql 12 Feb 2004 21:31:21 -0000 1.2 @@ -2,6 +2,16 @@ + + + + select portal_id, party_id + from portals + where package_id = :package_id + + + + @@ -28,4 +38,14 @@ + + + + select name + from portal_datasources + where 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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/add-applications.adp 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/add-applications.adp 12 Feb 2004 21:31:21 -0000 1.2 @@ -1,11 +1,9 @@ Add portalled applications - - -

There are no portalled applications available that haven't already been - added to this instance of the portal package. -

-
- -

-
+ @context;noquote@ + +The portlets for the applications you select will be automatically added to the +@portal_count@ portals that belong to this instance of the portals package. This may +take a fairly long time, so be patient. +

+

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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/add-applications.tcl 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/add-applications.tcl 12 Feb 2004 21:31:21 -0000 1.2 @@ -9,7 +9,10 @@ set package_id [ad_conn package_id] set return_url [ad_conn url] +set context [list "Add Applications"] +db_1row get_portal_count {} + db_multirow -extend {add_url} applications get_applications {} { set add_url [export_vars -base add-applications-2 { application return_url }] } 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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/add-applications.xql 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/add-applications.xql 12 Feb 2004 21:31:21 -0000 1.2 @@ -2,6 +2,16 @@ + + + + select count(*) as portal_count + from portals + where package_id = :package_id + + + + 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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/configure.adp 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/configure.adp 12 Feb 2004 21:31:21 -0000 1.2 @@ -1,3 +1,5 @@ Configuration Add a new application and its associated portlets +
+Add the test portal Index: openacs-4/contrib/packages/portal/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/index.adp,v diff -u -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/index.adp 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/index.adp 12 Feb 2004 21:31:21 -0000 1.2 @@ -1,40 +1,10 @@ -<% - - # - # Copyright (C) 2001, 2002 MIT - # - # 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 - # version. - # - # dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY - # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - # details. - # - -%> - -Welcome to Portals +Configuration +@context;noquote@ -

- -Portals in the system: - -

- - - You have not configured any portals. - - -

- + 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 -N -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/www/admin/index.tcl 1 Feb 2004 03:08:11 -0000 1.4 +++ openacs-4/contrib/packages/portal/www/admin/index.tcl 12 Feb 2004 21:31:21 -0000 1.5 @@ -15,18 +15,32 @@ # ad_page_contract { - Page that displays a system-wide list of portals and gives - the option to view or edit them - @author Arjun Sanyal (arjun@openforce.net) + Main administration page for the portals package + + @author Don Baccus (dhogaza@pacifier.com) @creation-date @cvs-id $Id$ } { } -db_multirow portals get_portals {} +set context [list admin] +set package_id [ad_conn package_id] +set master_template_id [portal::get_master_template_id -package_id $package_id] -if { ${portals:rowcount} == 0 } { - ad_returnredirect configure +if { [string equal $master_template_id ""] } { + + # The master template for this instance is defined as the portal with no + # party owner. + + set master_template_id [portal::new \ + -party_id "" \ + -party_privileges {} \ + -package_id $package_id] + } +set edit_portal_template_url \ + [export_vars -base portal-config {{referer index} {portal_id $master_template_id}}] +db_1row count_uninstalled_applications {} + 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 -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/index.xql 1 Feb 2004 03:08:11 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/index.xql 12 Feb 2004 21:31:21 -0000 1.2 @@ -2,11 +2,19 @@ - + - select portal_id, name, template_id - from portals + + select count(*) as unmounted_application_count + 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) + + +ad_return_template Index: openacs-4/contrib/packages/portal/www/admin/portal-config.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/Attic/portal-config.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/admin/portal-config.tcl 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/admin/portal-config.tcl 12 Feb 2004 21:31:21 -0000 1.2 @@ -32,7 +32,9 @@ set rendered_page [portal::configure \ -referer $referer \ -template_p f \ - $portal_id "" + [ad_conn package_id] \ + $portal_id \ + "" ] set name [portal::get_name -portal_id $portal_id] set return_url "$page_url?portal_id=$portal_id"