Index: openacs-4/contrib/packages/portal/portal.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/portal.info,v diff -u -r1.7 -r1.8 --- openacs-4/contrib/packages/portal/portal.info 28 Feb 2004 22:03:52 -0000 1.7 +++ openacs-4/contrib/packages/portal/portal.info 12 Mar 2004 04:54:02 -0000 1.8 @@ -23,21 +23,17 @@ - - - + - - + - - + + + + Index: openacs-4/contrib/packages/portal/lib/add-applications.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/add-applications.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/add-applications.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,4 @@ +

+ + + Index: openacs-4/contrib/packages/portal/lib/add-applications.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/add-applications.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/add-applications.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,66 @@ +ad_page_contract { + + Generate a list of applications that have supporting portlets that have not + yet been added to this portal package instance. The user's returned to the + current page after installing the select application(s). + + @author Don Baccus (dhogaza@pacifier.com) + @creation-date + @cvs-id $Id: add-applications.tcl,v 1.1 2004/03/12 04:54:03 donb Exp $ + +} { } + +set package_id [ad_conn package_id] +set return_url [ad_conn url]?[ad_conn query] + +db_multirow -extend {add_url} applications get_applications {} { + set add_url [export_vars -base add-applications-2 { application return_url }] +} + +set wizard_p [template::wizard::exists] + +# If we're in the wizard and have no applications just skip to the next step. + +if { $wizard_p && ${applications:rowcount} == 0 } { + rp_form_put wizard_submit_next wizard_submit_next + template::wizard::forward +} + +# 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} + } + } + +# Now, if we're in the template wizard, generate the wizard form. + +if { $wizard_p } { + + ad_form -name add-applications -form { + foo:text(hidden),optional + } -on_submit { + template::wizard::forward + } + + template::wizard::submit add-applications -buttons {back next} +} + +ad_return_template Index: openacs-4/contrib/packages/portal/lib/add-applications.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/add-applications.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/add-applications.xql 12 Mar 2004 04:54:03 -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/lib/configure-configurability.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-configurability.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-configurability.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,3 @@ +The following parameters offer the administrator some control over the degree to which +a user can configure their own personal portal. + Index: openacs-4/contrib/packages/portal/lib/configure-configurability.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-configurability.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-configurability.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,36 @@ +ad_page_contract { + Let the admin configure whether or not to present shade and hide buttons on portlets. +} { +} + +if { ![parameter::get -boolean -parameter create_private_portals_p] } { + rp_form_put wizard_submit_next wizard_submit_next + template::wizard::forward +} + +ad_form -name configure-configurability -form { + {title_noshade_p:boolean(radio) + {options {{Yes 1} {No 0}}} + {help_text "\"Yes\" will supress the display of \"shade\" widgets in portlet title bars"} + } + {title_nohide_p:boolean(radio) + {options {{Yes 1} {No 0}}} + {help_text "\"Yes\" will supress the display of \"hide\" widgets in portlet title bars"} + } + {theme_changeable_p:boolean(radio) + {options {{Yes 1} {No 0}}} + {help_text "\"Yes\" will allow the user to change the theme used to display their portal"} + } +} -on_request { + set title_noshade_p [parameter::get -boolean -parameter title_noshade_p] + set title_nohide_p [parameter::get -boolean -parameter title_nohide_p] + set theme_changeable_p [parameter::get -boolean -parameter title_changeable_p] + ad_set_form_values title_noshade_p title_nohide_p +} -on_submit { + parameter::set_value -parameter title_noshade_p -value $title_noshade_p + parameter::set_value -parameter title_nohide_p -value $title_nohide_p + parameter::set_value -parameter theme_changeable_p -value $theme_changeable_p + template::wizard::forward +} + +template::wizard::submit configure-configurability -buttons {back next} Index: openacs-4/contrib/packages/portal/lib/configure-extra-user-pages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/Attic/configure-extra-user-pages.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-extra-user-pages.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,5 @@ +The portal package can optionally add two special pages to personal portals. The "My Account" +page includes information about a user's OpenACS account and links to the standard OpenACS +user workspace page. The "Configure" page allows the user to move portlets around, add new pages, +and similar things. + Index: openacs-4/contrib/packages/portal/lib/configure-extra-user-pages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/Attic/configure-extra-user-pages.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-extra-user-pages.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,30 @@ +ad_page_contract { + Let the admin configure whether or not to present shade and hide buttons on portlets. +} { +} + +if { ![parameter::get -boolean -parameter create_private_portals_p] } { + rp_form_put wizard_submit_next wizard_submit_next + template::wizard::forward +} + +ad_form -name configure-extra-user-pages -form { + {show_my_account_page_p:boolean(radio) + {options {{Yes 1} {No 0}}} + {help_text "\"Yes\" will supress the display of \"shade\" widgets in portlet title bars"} + } + {show_configure_page_p:boolean(radio) + {options {{Yes 1} {No 0}}} + {help_text "\"Yes\" will supress the display of \"hide\" widgets in portlet title bars"} + } +} -on_request { + set show_my_account_page_p [parameter::get -boolean -parameter show_my_account_page_p] + set show_configure_page_p [parameter::get -boolean -parameter show_configure_page_p] + ad_set_form_values show_my_account_page_p show_configure_page_p +} -on_submit { + parameter::set_value -parameter show_my_account_page_p -value $show_my_account_page_p + parameter::set_value -parameter show_configure_page_p -value $show_configure_page_p + template::wizard::forward +} + +template::wizard::submit configure-extra-user-pages -buttons {back next} Index: openacs-4/contrib/packages/portal/lib/configure-finish.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-finish.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-finish.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/contrib/packages/portal/lib/configure-finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-finish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-finish.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,11 @@ +# ad_form doesn't like an empty -form block so we've got to provide a dummy +# field ... + +ad_form -name configure-finish -form { + foo:text(hidden),optional +} -on_submit { + ad_returnredirect index + ad_script_abort +} + +template::wizard::submit configure-finish -buttons {finish} Index: openacs-4/contrib/packages/portal/lib/configure-help.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-help.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-help.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,15 @@ +

+This wizard will take you through the steps necessary to configure the portal package. Before configuring you should: +

+ + Index: openacs-4/contrib/packages/portal/lib/configure-help.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-help.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-help.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,10 @@ +# ad_form doesn't like an empty -form block so we've got to provide a dummy +# field ... + +ad_form -name configure-help -form { + foo:text(hidden),optional +} -on_submit { + template::wizard::forward +} + +template::wizard::submit configure-help -buttons {back next} Index: openacs-4/contrib/packages/portal/lib/configure-private-portals.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-private-portals.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-private-portals.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,8 @@ +Check "Yes" if you'd like the portal package to create each user their own custom portal. +This will allow users to to move portlets from column to column or page to page, to +hide portlets, etc. +

+Check "no" if you want users to share a single portal. +This is more efficient of system resources but only administrators will be able to reconfigure +the shared portal. + Index: openacs-4/contrib/packages/portal/lib/configure-private-portals.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-private-portals.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-private-portals.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + Let the admin configure whether or not we should create a portal for every visitor. +} { +} + +ad_form -name configure-private-portals -form { + {create_private_portals_p:boolean(radio) + {label "Create a portal for every user?"} + {options {{Yes 1} {No 0}}} + } +} -on_request { + set create_private_portals_p [parameter::get -boolean -parameter create_private_portals_p] + ad_set_form_values create_private_portals_p +} -on_submit { + parameter::set_value -parameter create_private_portals_p -value $create_private_portals_p + template::wizard::forward +} + +template::wizard::submit configure-private-portals -buttons {back next} Index: openacs-4/contrib/packages/portal/lib/portal-configure.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/portal-configure.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/portal-configure.adp 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,50 @@ +

+ + + + + +
+ + +
+ + + + + + +
+
+ + +

+ +

+ + +

+ + + Add a new page: + + + +
+ + +
+ + + Revert to the default arrangement: + +
+
Index: openacs-4/contrib/packages/portal/lib/portal-configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/portal-configure.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/portal-configure.tcl 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + + Configure a portal + + @author Don Baccus (dhogaza@pacifier.com) + +} { + portal_id:integer,notnull +} + +permission::require_permission -object_id $portal_id -privilege write + +set title "Configure" +set context [list $title] +set return_url [ad_conn url]?[ad_conn query] + +# Get a bunch of data for various configuration options we'll offer the user. + +set current_theme_id [portal::get_theme_id -portal_id $portal_id] +set first_page_id [lindex [portal::get_page_list -portal_id $portal_id] 0] +db_multirow themes select_themes {} +db_multirow hidden_elements select_hidden_elements {} +db_multirow page_ids select_page_ids {} +set page_count [portal::get_page_count -portal_id $portal_id] +set new_page_num [expr {$page_count + 1}] +set template_id [portal::get_template_id -portal_id $portal_id] + +ad_return_template Index: openacs-4/contrib/packages/portal/lib/portal-configure.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/portal-configure.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/portal-configure.xql 12 Mar 2004 04:54:03 -0000 1.1 @@ -0,0 +1,34 @@ + + + + + + + select theme_id, name || ' - ' || description as name + from portal_themes + order by name + + + + + + select element_id, + pe.name + from portal_elements pe, portal_pages pp + where pp.portal_id = :portal_id + and pp.page_id = pe.page_id + and pe.state = 'hidden' + order by pe.name + + + + + + select page_id + from portal_pages + where portal_id = :portal_id + order by sort_key + + + + Index: openacs-4/contrib/packages/portal/sql/postgresql/datasource-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/sql/postgresql/datasource-package-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/contrib/packages/portal/sql/postgresql/datasource-package-create.sql 22 Jan 2004 02:50:11 -0000 1.5 +++ openacs-4/contrib/packages/portal/sql/postgresql/datasource-package-create.sql 12 Mar 2004 04:54:04 -0000 1.6 @@ -23,28 +23,29 @@ -- @version $Id$ -- -select define_function_args('portal_datasource__new', 'name,pretty_name,application,owner,template,shadeable_p;t,hideable_p;t,description'); +select define_function_args('portal_datasource__new', 'name,pretty_name,application,owner,template,admin_p;f,shadeable_p;t,hideable_p;t,description'); -create or replace function portal_datasource__new (varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar) +create or replace function portal_datasource__new (varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar) returns integer as ' declare p_name alias for $1; p_pretty_name alias for $2; p_application alias for $3; p_owner alias for $4; p_template alias for $5; - p_shadeable_p alias for $6; - p_hideable_p alias for $7; - p_description alias for $8; + p_admin_p alias for $6; + p_shadeable_p alias for $7; + p_hideable_p alias for $8; + p_description alias for $9; v_datasource_id portal_datasources.datasource_id%TYPE; begin v_datasource_id := nextval(''portal_seq''); insert into portal_datasources - (datasource_id, name, pretty_name, application, owner, template, shadeable_p, hideable_p, description) + (datasource_id, name, pretty_name, application, owner, template, admin_p, shadeable_p, hideable_p, description) values - (v_datasource_id, p_name, p_pretty_name, p_application, p_owner, p_template, p_shadeable_p, p_hideable_p, p_description); + (v_datasource_id, p_name, p_pretty_name, p_application, p_owner, p_template, p_admin_p, p_shadeable_p, p_hideable_p, p_description); return v_datasource_id; 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.8 -r1.9 --- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 27 Feb 2004 01:13:15 -0000 1.8 +++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 12 Mar 2004 04:54:04 -0000 1.9 @@ -38,9 +38,7 @@ application varchar(100) constraint p_datasources_application_fk references apm_package_types (package_key) - on delete cascade - constraint p_datasources_application_nn - not null, + on delete cascade, owner varchar(100) constraint p_datasources_owner_fk references apm_package_types (package_key) @@ -50,6 +48,12 @@ 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 @@ -100,6 +104,15 @@ 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. +'; + create table portal_datasource_parameters ( datasource_id integer constraint p_ds_params_datasource_id_fk @@ -254,9 +267,11 @@ 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) + constraint p_owner_id_nn + not null, package_id integer constraint p_package_id_fk references apm_packages (package_id) @@ -276,7 +291,7 @@ references portals (portal_id) ); -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 ' @@ -407,12 +422,6 @@ not null constraint p_elements_hideable_p_ck check (hideable_p in ('t', 'f')), - application_id integer - constraint p_elements_application_id_fk - references apm_packages (package_id) - on delete cascade - constraint p_elements_application_id_nn - not null, constraint p_elements_page_id_name_un unique (page_id, name) ); @@ -432,11 +441,6 @@ different behaviors based on a given elements state '; -comment on column portal_elements.application_id is ' - The package_id of the OpenACS application package instance this element interacts - with. -'; - create table portal_element_parameters ( parameter_id integer constraint portal_element_parameters_pk 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.6 -r1.7 --- openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 12 Feb 2004 21:31:19 -0000 1.6 +++ openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 12 Mar 2004 04:54:04 -0000 1.7 @@ -23,13 +23,13 @@ -- @version $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'); +select define_function_args('portal__new', 'portal_id,owner_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, 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_owner_id alias for $2; p_package_id alias for $3; p_name alias for $4; p_theme_id alias for $5; @@ -72,9 +72,9 @@ insert into portals - (portal_id, party_id, package_id, name, theme_id) + (portal_id, owner_id, package_id, name, theme_id) values - (v_portal_id, p_party_id, p_package_id, p_name, v_theme_id); + (v_portal_id, p_owner_id, p_package_id, p_name, v_theme_id); else @@ -87,9 +87,9 @@ insert into portals - (portal_id, party_id, package_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_package_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 * @@ -121,8 +121,8 @@ insert into portal_elements - (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 + (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 from portal_elements where element_id = v_element.element_id; Index: openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl 27 Jan 2004 03:33:46 -0000 1.4 +++ openacs-4/contrib/packages/portal/tcl/apm-callback-procs.tcl 12 Mar 2004 04:54:04 -0000 1.5 @@ -8,7 +8,7 @@ name portal_datasource description "Portal datasource interface." operations { - ConfigureParams { + Initialize { description { Configure datasource-specific parameters to reasonable values. } Index: openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl 12 Feb 2004 14:59:05 -0000 1.4 +++ openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl 12 Mar 2004 04:54:04 -0000 1.5 @@ -46,10 +46,11 @@ name The name of the new datasource pretty_name The pretty name (or message key) of the datasource owner The package that owns this portlet - application The package the portlet works with + application The package the portlet works with, if any template The template the displays the portlet content - shadeable_p If true the user can shade (i.e. close) the portlet - hideable_p If true, the user can hide the portlet entirely + admin_p If true, this datasource is only available to admins (default is false) + shadeable_p If true (default) the user can shade (i.e. close) the portlet + hideable_p If true (default), the user can hide the portlet entirely description A human-readable description (defaults to name) params A list of portlet-specific param key/attributes and their values aliases Service contract aliases clause for acs_sc::impl::new_from_spec @@ -63,7 +64,14 @@ } { + # Set some default values + + set datasource(admin_p) f + set datasource(shadeable_p) t + set datasource(hideable_p) t + array set datasource $spec +ns_log Notice "Huh? setting admin_p: $datasource(admin_p)" # Default datasource description to its name if { ![info exists datasource(description)] } { @@ -78,6 +86,7 @@ [list owner $datasource(owner)] \ [list application $datasource(application)] \ [list template $datasource(template)] \ + [list admin_p $datasource(admin_p)] \ [list shadeable_p $datasource(shadeable_p)] \ [list hideable_p $datasource(hideable_p)] \ [list description $datasource(description)]] Index: openacs-4/contrib/packages/portal/tcl/element-parameter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-parameter-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/tcl/element-parameter-procs.tcl 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/tcl/element-parameter-procs.tcl 12 Mar 2004 04:54:04 -0000 1.2 @@ -34,6 +34,7 @@ } { new parameter value } { + set parameter_id [db_nextval portal_seq] db_dml insert_parameter {} } Index: openacs-4/contrib/packages/portal/tcl/element-parameter-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/element-parameter-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/tcl/element-parameter-procs.xql 8 Jan 2004 02:12:19 -0000 1.2 +++ openacs-4/contrib/packages/portal/tcl/element-parameter-procs.xql 12 Mar 2004 04:54:04 -0000 1.3 @@ -6,7 +6,7 @@ insert into portal_element_parameters (parameter_id, element_id, configured_p, key, value) - select portal_seq.nextval, :element_id, 't', :key, :value + select :parameter_id, :element_id, 't', :key, :value from dual where not exists (select parameter_id from portal_element_parameters 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 -r1.5 -r1.6 --- openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql 12 Feb 2004 21:31:20 -0000 1.5 +++ openacs-4/contrib/packages/portal/tcl/element-procs-oracle.xql 12 Mar 2004 04:54:04 -0000 1.6 @@ -6,12 +6,11 @@ insert into portal_elements - (element_id, datasource_id, name, application_id, - page_id, region, state, sort_key, shadeable_p, hideable_p) + (element_id, datasource_id, name, page_id, region, state, sort_key, + shadeable_p, hideable_p) select :element_id, :datasource_id, :name, - :application_id, :page_id, :region, :state, 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 -r1.5 -r1.6 --- openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql 12 Feb 2004 21:31:20 -0000 1.5 +++ openacs-4/contrib/packages/portal/tcl/element-procs-postgresql.xql 12 Mar 2004 04:54:04 -0000 1.6 @@ -6,12 +6,11 @@ insert into portal_elements - (element_id, datasource_id, name, application_id, - page_id, region, state, sort_key, shadeable_p, hideable_p) + (element_id, datasource_id, name, page_id, region, state, sort_key, + shadeable_p, hideable_p) select :element_id, :datasource_id, :name, - :application_id, :page_id, :region, :state, 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 -r1.10 -r1.11 --- openacs-4/contrib/packages/portal/tcl/element-procs.tcl 28 Feb 2004 02:23:30 -0000 1.10 +++ openacs-4/contrib/packages/portal/tcl/element-procs.tcl 12 Mar 2004 04:54:04 -0000 1.11 @@ -33,9 +33,7 @@ {-region ""} {-state full} {-datasource_name:required} - {-application_id:required} {-name ""} - {-configure_params:boolean} } { Create a new portal element of type datasource_name on the given portal. @@ -44,9 +42,7 @@ @param pretty_name The pretty name or message resource for this element. @param region The page region to placer the element on. @param datasource_name The portal datasource name - @param application_id The package_id of the application this portlet interfaces to. @param name The name of the element - @param configure_params If set true, call the datasource's ConfigureParams operation @return The element_id of the new portlet @@ -75,19 +71,22 @@ db_dml insert_element {} db_dml insert_element_parameters {} } - - if { $configure_params_p } { - portal::datasource::call \ - -name $datasource_name \ - -op ConfigureParams \ - -list_args [list $element_id] - } } return $element_id } + ad_proc -public initialize { + {-datasource_name:required} + {-element_id:required} + } { + portal::datasource::call \ + -name $datasource_name \ + -op Initialize \ + -list_args [list $element_id] + } + ad_proc -public delete { {-element_id:required} } { @@ -431,7 +430,6 @@ shaded_p $element(shaded_p) \ shadeable_p $element(shadeable_p) \ hideable_p $element(hideable_p) \ - application_id $element(application_id) \ ] set config [concat $config [portal::element::parameter::get_all -element_id $element_id]] @@ -525,7 +523,6 @@ -page_id $page_id \ -region $force_region \ -datasource_name $portlet_name \ - -application_id $value \ -name $pretty_name] portal::element::parameter::set_value -element_id $element_id -key $key -value $value 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.16 -r1.17 --- openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 27 Feb 2004 01:13:15 -0000 1.16 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 12 Mar 2004 04:54:04 -0000 1.17 @@ -27,30 +27,18 @@ namespace eval portal { - ad_proc -private package_key {} { - returns the package_key - } { - return "portal" - } - - ad_proc -public get_package_id {} { - returns the package_id - } { - return [apm_package_id_from_key [package_key]] - } - # work around for template::util::url_to_file ad_proc -private www_path {} { returns the path of the www dir of the portal package. we need this for stupid template tricks. } { - return "/packages/[package_key]/www" + return "/packages/portal/www" } ad_proc -public mount_point {} { caches the mount point } { - return [lindex [site_node::get_url_from_object_id -object_id [get_package_id]] 0] + return [lindex [site_node::get_url_from_object_id -object_id [ad_conn package_id]] 0] } ad_proc -public automount_point {} { @@ -60,29 +48,28 @@ } ad_proc -public new { - {-party_id:required} - {-package_id:required} + {-owner_id:required} {-name Untitled} {-template_id ""} {-context_id ""} {-page_list {{{Page 1} 2_column}}} - {-party_privileges {read write admin}} - {-configure_params:boolean} + {-owner_privileges {read write admin}} + {-initialize_elements:boolean} } { - Create a new portal for the passed in party_id. create pages passed in + Create a new portal for the passed in owner_id. create pages passed in the page_list. - @party_id The party which owns the new portal - @package_id The package_id of this portal package instance + @owner_id The object (usually a party) which owns the new portal @name The name of the portal - @template_id The template used to render the portal if the default is not to - be used + @template_id If set, copy this portal's elements into the new portal @context_id The new portal object's context_id @page_list The list of pages to create within the portal - @party_privileges A list of privileges to grant the party on the new portal. + @owner_privileges A list of privileges to grant the party on the new portal. Normally the default list (read, write, admin) will be correct if the party is a user but if the party is a group (say, members of a subsite) then it would make sense to only grant read to the party directly. + @initialize_elements_p If true and template_id is set, initialize elements after + copying. } { @@ -92,13 +79,13 @@ {name $name} {template_id $template_id} {context_id $context_id} - {party_id $party_id} - {package_id $package_id}}] + {owner_id $owner_id} + {package_id [ad_conn package_id]}}] set portal_id [package_instantiate_object -var_list $var_list portal] - foreach privilege $party_privileges { - permission::grant -party_id $party_id -object_id $portal_id -privilege $privilege + foreach privilege $owner_privileges { + permission::grant -owner_id $owner_id -object_id $portal_id -privilege $privilege } if {[empty_string_p $template_id]} { @@ -110,11 +97,11 @@ } } - if { $configure_params_p && ![string equal $template_id ""] } { + if { $initialize_elements_p && ![string equal $template_id ""] } { foreach row [db_list_of_lists get_elements {}] { portal::datasource::call \ -name [lindex $row 0] \ - -op ConfigureParams \ + -op Initialize \ -list_args [list [lindex $row 1]] } } @@ -151,12 +138,12 @@ } ad_proc -public get_portal_id { - {-party_id:required} - {-package_id:required} + {-owner_id:required} } { Get the portal_id for a party. I (DRB) am not going to bother caching this for the time being ... } { + set package_id [ad_conn package_id] if {[db_0or1row select_portal_id {}]} { return $portal_id } else { @@ -218,21 +205,33 @@ } 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. + Get the master template id, i.e. the portal used to create all other portals. - @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 The portal_id of the master portal template. } { + set package_id [ad_conn package_id] if { [db_0or1row get_master_template_id {}] } { return $master_template_id } else { return "" } } + ad_proc -public get_admin_portal_id { + } { + Get the admin portal id. + + @return The portal_id of the admin portal. + } { + set package_id [ad_conn package_id] + if { [db_0or1row get_admin_portal_id {}] } { + return $admin_portal_id + } else { + return "" + } + } + ad_proc -public get_page_count { {-portal_id:required} } { @@ -532,6 +531,9 @@ } { wraps portal::dimensional to create a dotlrn navbar + DRB: I'm only keeping this POS around for .LRN ... the portal package itself + builds a multirow navbar suitable for use with the templating system. + @return the id of the page @param portal_id @param link the relative link to set for hrefs @@ -583,6 +585,7 @@ {optionstype url} } { An enhanced ad_dimensional. see that proc for usage details + } { if {[empty_string_p $option_list]} { return @@ -658,12 +661,41 @@ } ad_proc datasource_list { - -package_id:required } { Returns a list of portal datasources which have been mapped to the given portal package instance. } { + set package_id [ad_conn package_id] return [db_list_of_lists select_datasources {}] } + ad_proc -public initialized { + } { + @return True if we've already initialized this instance of the portal package. + } { + return [expr {![string equal [get_master_template_id] ""]}] + } + + ad_proc -public initialize { + } { + Initialize this instance of the portal package if we've not already done so. This + consists of creating the master template, which is assigned to party 0 and will be + the portal returned to users who aren't logged in, or all users if the portal package + is configured to disallow personal portals. + + The admin portal is created with our package_id as the owner. + } { + if { ![initialized] } { + + # create the master template + + portal::new -owner_id 0 -owner_privileges {} + + # create the admin template + + portal::new -owner_id [ad_conn package_id] -owner_privileges {} + + } + } + } 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.8 -r1.9 --- openacs-4/contrib/packages/portal/tcl/portal-procs.xql 27 Feb 2004 01:13:15 -0000 1.8 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.xql 12 Mar 2004 04:54:04 -0000 1.9 @@ -32,7 +32,7 @@ select portal_id from portals - where party_id = :party_id + where owner_id = :owner_id and package_id = :package_id @@ -180,10 +180,19 @@ select portal_id as master_template_id from portals where package_id = :package_id - and party_id is null + and owner_id = 0 + + + select portal_id as admin_portal_id + from portals + where package_id = :package_id + and owner_id = :package_id + + + 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 -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 11 Mar 2004 23:37:41 -0000 1.3 +++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.tcl 12 Mar 2004 04:54:04 -0000 1.4 @@ -13,11 +13,9 @@ 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 {}] +set non_admin_portals [db_list get_non_admin_portals {}] +set admin_portal_id [portal::get_admin_portal_id] -# This needs rewriting!!!! Drive by portal datasources ... and have them mount -# the package if needed ... - db_transaction { foreach one_application $application { @@ -34,28 +32,45 @@ -package_key $one_application \ -parent_node_id $node_id] - set datasources [db_list get_datasources {}] + set user_datasources [db_list get_user_datasources {}] - foreach portal $portals { - foreach datasource $datasources { + foreach non_admin_portal $non_admin_portals { + foreach user_datasource $user_datasources { db_transaction { set element_id [portal::element::new \ - -portal_id $portal \ + -portal_id $non_admin_portal \ -state hidden \ - -datasource_name $datasource] + -datasource_name $user_datasource] portal::element::parameter::set_value \ -element_id $element_id \ -key package_id \ -value $application_id portal::element::initialize \ - -datasource_name $datasource \ + -datasource_name $user_datasource \ -element_id $element_id } } } + set admin_datasources [db_list get_admin_datasources {}] + foreach admin_datasource $admin_datasources { + db_transaction { + set element_id [portal::element::new \ + -portal_id $admin_portal_id \ + -datasource_name $admin_datasource] + + portal::element::parameter::set_value \ + -element_id $element_id \ + -key package_id \ + -value $application_id + + portal::element::initialize \ + -datasource_name $admin_datasource \ + -element_id $element_id + } + } } } 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 -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql 12 Feb 2004 21:31:21 -0000 1.2 +++ openacs-4/contrib/packages/portal/www/admin/add-applications-2.xql 12 Mar 2004 04:54:04 -0000 1.3 @@ -2,12 +2,13 @@ - + - select portal_id, party_id + select portal_id from portals where package_id = :package_id + and owner_id <> :package_id @@ -38,14 +39,27 @@ - + select name from portal_datasources where application = :one_application + and admin_p = 'f' + + + + + select name + from portal_datasources + where application = :one_application + and admin_p = 't' + + + + 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 -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/www/admin/add-applications.adp 11 Mar 2004 23:37:41 -0000 1.3 +++ openacs-4/contrib/packages/portal/www/admin/add-applications.adp 12 Mar 2004 04:54:04 -0000 1.4 @@ -1,11 +1,6 @@ Add portalled applications @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 -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/www/admin/add-applications.tcl 11 Mar 2004 23:37:41 -0000 1.3 +++ openacs-4/contrib/packages/portal/www/admin/add-applications.tcl 12 Mar 2004 04:54:04 -0000 1.4 @@ -9,5 +9,8 @@ } { } set context [list "Add Applications"] +set package_id [ad_conn package_id] +db_1row get_portal_count {} + ad_return_template Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/contrib/packages/portal/www/admin/add-applications.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/portal/www/admin/configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/configure.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/admin/configure.tcl 12 Mar 2004 04:54:04 -0000 1.1 @@ -0,0 +1,34 @@ +ad_page_contract { + + Main configuration page for the portal package. Defines the configuration + wizard and tracks state. + + @author Don Baccus (dhogaza@pacifier.com) + @creation-date + @cvs-id $Id: configure.tcl,v 1.1 2004/03/12 04:54:04 donb Exp $ +} { +} + +portal::initialize + +# Now set up the wizard and off we go into configuration ecstasy! + +template::wizard::create -action configure -name configure -params {} -steps { + 1 -label "Welcome to the Portal Configuration Wizard" -url /packages/portal/lib/configure-help + 2 -label "Configure Private Portals" -url /packages/portal/lib/configure-private-portals + 3 -label "Configure User Control Over Appearance" -url /packages/portal/lib/configure-configurability + 4 -label "Configure User \"My Account\" and \"Configure\" Pages" -url /packages/portal/lib/configure-extra-user-pages + 5 -label "Add Applications" -url /packages/portal/lib/add-applications + 6 -label "Configure Portal Layout" -url /packages/portal/lib/portal-configure + 100 -label "Congratulations! Configuration Is Complete" -url /packages/portal/lib/configure-finish +} + +template::wizard::get_current_step + +# Beautify the context bar and title with the current wizard step's label. + +array set current_info [array get wizard:${wizard:current_id}]] +set title $current_info(label) +set context [list $title] + +ad_return_template 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.6 -r1.7 --- openacs-4/contrib/packages/portal/www/admin/index.tcl 27 Feb 2004 01:13:17 -0000 1.6 +++ openacs-4/contrib/packages/portal/www/admin/index.tcl 12 Mar 2004 04:54:04 -0000 1.7 @@ -23,22 +23,14 @@ @cvs-id $Id$ } { } +if { ![portal::initialized] } { + ad_returnredirect configure + ad_script_abort +} + 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 { [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-configure {{referer index} {portal_id $master_template_id}}] db_1row count_uninstalled_applications {} Index: openacs-4/contrib/packages/portal/www/admin/user-portals.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/user-portals.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/admin/user-portals.adp 12 Mar 2004 04:54:04 -0000 1.1 @@ -0,0 +1,40 @@ +<% + + # + # 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 + +

+ +Portals in the system: + +

+ + + You have not configured any portals. + + +

+ Index: openacs-4/contrib/packages/portal/www/admin/user-portals.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/user-portals.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/admin/user-portals.tcl 12 Mar 2004 04:54:04 -0000 1.1 @@ -0,0 +1,33 @@ +# +# 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. +# + +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) + @creation-date + @cvs-id $Id: user-portals.tcl,v 1.1 2004/03/12 04:54:04 donb Exp $ +} { } + +set package_id [ad_conn package_id] +db_multirow portals get_portals {} + +if { ${portals:rowcount} == 0 } { + ad_returnredirect configure +} + +ad_return_template Index: openacs-4/contrib/packages/portal/www/admin/user-portals.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/user-portals.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/www/admin/user-portals.xql 12 Mar 2004 04:54:04 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + + select portal_id, name, template_id + from portals + where package_id = :package_id + + + +