Index: openacs-4/contrib/packages/portal/portal.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/portal.info,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/portal/portal.info 11 Dec 2003 21:39:44 -0000 1.3 +++ openacs-4/contrib/packages/portal/portal.info 3 Jan 2004 01:42:57 -0000 1.4 @@ -6,12 +6,8 @@ Portals f t - + - - oracle - postgresql - Arjun Sanyal yon Portals @@ -22,132 +18,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + + - - + + + 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.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/datasource-package-create.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/datasource-package-create.sql 3 Jan 2004 01:42:57 -0000 1.2 @@ -96,9 +96,9 @@ begin insert into portal_datasource_parameters - (parameter_id, datasource_id, config_required_p, configured_p, key, value) + (datasource_id, config_required_p, configured_p, key, value) values - (portal_seq.nextval, p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + (p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); end set_def_param; 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.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/portal-core-create.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/portal-core-create.sql 3 Jan 2004 01:42:57 -0000 1.2 @@ -47,7 +47,7 @@ description varchar(200) ); -comment on table portal_datasources ' +comment on table portal_datasources is ' a portal datasource is the package of code that generates the content of a portal element. the foo-portlet packages create datasources. '; @@ -78,7 +78,7 @@ primary key (datasource_id, key) ); -comment on table portal_datasource_parameters ' +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. @@ -100,15 +100,15 @@ | | default is provided. '; -comment on column portal_datasource_parameters.config_required_p ' +comment on column portal_datasource_parameters.config_required_p is ' this parameter requires configuration. if configured_p is true then no action is needed at portal element creation since the portal element can simply use the default value provided. if configured_p is false then the portal element must provide a value for this parameter at creation time. '; -comment on column portal_datasource_parameters.configured_p ' +comment on column portal_datasource_parameters.configured_p is ' if true then a default value is provided for this parameter. '; @@ -127,18 +127,18 @@ resource_dir varchar(200) ); -comment on table portal_layouts ' +comment on table portal_layouts is ' a portal layout is a template that defines regions for portal elements to "fill in". Examples of layouts are two column and three column '; -comment on column portal_layouts.filename ' +comment on column portal_layouts.filename is ' the relative path to the layout template from the "portal/www/" directory without the ending ".adp" extension. Example: "layouts/simple2" '; -comment on column portal_layouts.resource_dir ' +comment on column portal_layouts.resource_dir is ' XXX remove me '; @@ -155,13 +155,13 @@ primary key (layout_id, region) ); -comment on table portal_layout_regions ' +comment on table portal_layout_regions is ' this table describes each of the regions in each of the layouts. for example a two column layout would have two entries in this table: region = 1 and region = 2. '; -comment on column portal_layout_regions.region ' +comment on column portal_layout_regions.region is ' an ordering of regions in a layout starting from 1 '; @@ -180,17 +180,17 @@ resource_dir varchar(200) ); -comment on table portal_themes ' +comment on table portal_themes is ' decoration templates for portal elements '; -comment on column portal_themes.filename ' +comment on column portal_themes.filename is ' the relative path to the theme template from the "portal/www/" directory without the ending ".adp" extension. Example: "themes/deco-theme" '; -comment on column portal_themes.resource_dir ' - the relative path to the theme's resource directory from the "portal/www/" +comment on column portal_themes.resource_dir is ' + the relative path to the theme''s resource directory from the "portal/www/" directory. The resource directory typically contains graphics files. Example: "themes/deco-theme" '; @@ -200,6 +200,9 @@ references acs_objects (object_id) constraint portals_pk primary key, + party_id integer + constraint p_party_id_fk + references parties (party_id), name varchar(200) default 'Untitled' constraint portal_name_nn @@ -212,16 +215,18 @@ not null ); -comment on table portals ' - portals are containers of one or more portal pages. +create index portals_party_id_idx on portals(party_id); + +comment on table portals is ' + portals are containers of one or more portal pages mapped to a party. '; -comment on column portals.template_id ' +comment on column portals.template_id is ' a portal may have a template (another portal) '; -comment on column portals.theme_id ' - portals one theme for all it's contained pages +comment on column portals.theme_id is ' + portals one theme for all its contained pages '; @@ -251,12 +256,12 @@ create index p_pages_prtl_page_idx on portal_pages (portal_id, page_id); -comment on table portal_pages ' +comment on table portal_pages is ' portal pages are containers for portal elements. can be thought of as the "tabs" on a portal '; -comment on column portal_pages.sort_key ' +comment on column portal_pages.sort_key is ' an ordering of the pages contained in the same portal starting from 0 for the first page and increasing in an gapless integer sequence '; @@ -305,16 +310,16 @@ unique (page_id, name) ); -comment on table portal_elements ' +comment on table portal_elements is ' the user-visible "box" on a portal page that displays the content of a datasource '; -comment on column portal_elements.sort_key ' +comment on column portal_elements.sort_key is ' an ordering of elements contained in the same region on a page starting from 0 for the first element and increasing in an gapless integer sequence '; -comment on column portal_elements.state ' +comment on column portal_elements.state is ' one of the set "full" (normal), "shaded" (title bar only), "hidden" (not shown), or "pinned" (like full, but without state change links). portal themes impliment these different behaviors based on a given elements state @@ -349,13 +354,13 @@ create index p_element_params_elem_key_idx on portal_element_parameters (element_id, key); -comment on table portal_element_parameters ' +comment on table portal_element_parameters is ' parameters on a per-element basis. the data structure is that of a multiset (aka bag) where multiple entries with the same key (for the same element) are allowed ?? XXXX. '; -comment on column portal_element_parameters.config_required_p ' +comment on column portal_element_parameters.config_required_p is ' '; -comment on column portal_element_parameters.configured_p ' +comment on column portal_element_parameters.configured_p is ' '; 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.1 -r1.2 --- openacs-4/contrib/packages/portal/sql/oracle/portal-package-create.sql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/sql/oracle/portal-package-create.sql 3 Jan 2004 01:42:57 -0000 1.2 @@ -28,6 +28,7 @@ function new ( p_portal_id in portals.portal_id%TYPE default null, + p_party_id in parties.party_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, @@ -51,6 +52,7 @@ function new ( p_portal_id in portals.portal_id%TYPE default null, + p_party_id in parties.party_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, @@ -89,9 +91,9 @@ insert into portals - (portal_id, name, theme_id) + (portal_id, party_id, name, theme_id) values - (v_portal_id, p_name, v_theme_id); + (v_portal_id, p_party_id, p_name, v_theme_id); else @@ -104,9 +106,9 @@ insert into portals - (portal_id, name, theme_id, template_id) + (portal_id, party_id, name, theme_id, template_id) values - (v_portal_id, p_name, v_theme_id, p_template_id); + (v_portal_id, p_party_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/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.2 -r1.3 --- openacs-4/contrib/packages/portal/sql/postgresql/datasource-package-create.sql 25 Sep 2003 02:12:16 -0000 1.2 +++ openacs-4/contrib/packages/portal/sql/postgresql/datasource-package-create.sql 3 Jan 2004 01:42:57 -0000 1.3 @@ -94,9 +94,9 @@ begin insert into portal_datasource_parameters - (parameter_id, datasource_id, config_required_p, configured_p, key, value) + (datasource_id, config_required_p, configured_p, key, value) values - (nextval(''portal_seq''), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + (p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); return 0; 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.2 -r1.3 --- openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 25 Sep 2003 02:12:16 -0000 1.2 +++ openacs-4/contrib/packages/portal/sql/postgresql/portal-core-create.sql 3 Jan 2004 01:42:57 -0000 1.3 @@ -48,6 +48,8 @@ ); comment on table portal_datasources is ' + a portal datasource is the package of code that generates the content + of a portal element. the foo-portlet packages create datasources. '; create table portal_datasource_parameters ( @@ -101,9 +103,9 @@ '; comment on column portal_datasource_parameters.config_required_p is ' - this parameter requires configuration. if configured_p is true then no + This parameter requires configuration. If configured_p is true then no action is needed at portal element creation since the portal element - can simply use the default value provided. if configured_p is false then + can simply use the default value provided. If configured_p is false then the portal element must provide a value for this parameter at creation time. '; @@ -129,12 +131,18 @@ ); comment on table portal_layouts is ' + a portal layout is a template that defines regions for portal + elements to "fill in". Examples of layouts are two column and + three column '; comment on column portal_layouts.filename is ' + the relative path to the layout template from the "portal/www/" + directory without the ending ".adp" extension. Example: "layouts/simple2" '; comment on column portal_layouts.resource_dir is ' + XXX remove me '; create table portal_layout_regions ( @@ -152,13 +160,15 @@ ); comment on table portal_layout_regions is ' + this table describes each of the regions in each of the layouts. + for example a two column layout would have two entries in this + table: region = 1 and region = 2. '; comment on column portal_layout_regions.region is ' + an ordering of regions in a layout starting from 1 '; --- Themes are templates with decoration for PEs, nothing more. --- At this point they will just be bits of ADPs in the filesystem create table portal_themes ( theme_id integer constraint p_themes_theme_id_fk @@ -176,24 +186,29 @@ ); comment on table portal_themes is ' + decoration templates for portal elements '; comment on column portal_themes.filename is ' + the relative path to the theme template from the "portal/www/" + directory without the ending ".adp" extension. Example: "themes/deco-theme" '; comment on column portal_themes.resource_dir is ' + the relative path to the theme''s resource directory from the "portal/www/" + directory. The resource directory typically contains graphics files. + Example: "themes/deco-theme" '; --- Portals are essentially "containers" for PEs that bind to DSs. --- Parties have, optionally have portals --- Restrict to party check? --- Roles and perms issues? create table portals ( portal_id integer constraint p_portal_id_fk references acs_objects (object_id) constraint portals_pk primary key, + party_id integer + constraint p_party_id_fk + references parties (party_id), name varchar(200) default 'Untitled' constraint p_name_nn @@ -208,12 +223,20 @@ references portals (portal_id) ); +create index portals_party_id_idx on portals(party_id); + comment on table portals is ' + portals are containers of one or more portal pages mapped to a party. '; comment on column portals.template_id is ' + a portal may have a template (another portal) '; +comment on column portals.theme_id is ' + portals one theme for all its contained pages +'; + create table portal_pages ( page_id integer constraint p_pages_page_id_fk @@ -244,20 +267,15 @@ create index portal_pages_prtl_page_idx on portal_pages (portal_id, page_id); comment on table portal_pages is ' + portal pages are containers for portal elements. can be thought of + as the "tabs" on a portal '; comment on column portal_pages.sort_key is ' + an ordering of the pages contained in the same portal starting from + 0 for the first page and increasing in an gapless integer sequence '; --- Support for multi-page portals (think my.yahoo.com) --- 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. --- --- No securtiy checks are done here. If you can view and bind to a DS you have --- a PE for it. - create table portal_elements ( element_id integer constraint portal_elements_pk @@ -306,12 +324,18 @@ ); comment on table portal_elements is ' + the user-visible "box" on a portal page that displays the content of a datasource '; comment on column portal_elements.sort_key is ' + an ordering of elements contained in the same region on a page starting from + 0 for the first element and increasing in an gapless integer sequence '; comment on column portal_elements.state is ' + one of the set "full" (normal), "shaded" (title bar only), "hidden" (not shown), + or "pinned" (like full, but without state change links). portal themes impliment these + different behaviors based on a given elements state '; create table portal_element_parameters ( @@ -345,10 +369,6 @@ create index p_element_params_element_key_idx on portal_element_parameters (element_id, key); comment on table portal_element_parameters is ' + parameters on a per-element basis. the data structure is that of a multiset (aka bag) + where multiple entries with the same key (for the same element) are allowed ?? XXXX. '; - -comment on column portal_element_parameters.config_required_p is ' -'; - -comment on column portal_element_parameters.configured_p is ' -'; 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.2 -r1.3 --- openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 25 Sep 2003 02:12:16 -0000 1.2 +++ openacs-4/contrib/packages/portal/sql/postgresql/portal-package-create.sql 3 Jan 2004 01:42:57 -0000 1.3 @@ -23,20 +23,21 @@ -- @version $Id$ -- -select define_function_args('portal__new', 'portal_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,name,theme_id,template_id,object_type;portal,creation_date,creation_user,creation_ip,context_id'); -create or replace function portal__new (integer,varchar,integer,integer,varchar,timestamptz,integer,varchar,integer) +create or replace function portal__new (integer,integer, varchar,integer,integer,varchar,timestamptz,integer,varchar,integer) returns integer as ' declare p_portal_id alias for $1; - p_name alias for $2; - p_theme_id alias for $3; - p_template_id alias for $4; - p_object_type alias for $5; - p_creation_date alias for $6; - p_creation_user alias for $7; - p_creation_ip alias for $8; - p_context_id alias for $9; + 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; v_portal_id portals.portal_id%TYPE; v_theme_id portals.theme_id%TYPE; v_layout_id portal_layouts.layout_id%TYPE; @@ -70,9 +71,9 @@ insert into portals - (portal_id, name, theme_id) + (portal_id, party_id, name, theme_id) values - (v_portal_id, p_name, v_theme_id); + (v_portal_id, p_party_id, p_name, v_theme_id); else @@ -85,9 +86,9 @@ insert into portals - (portal_id, name, theme_id, template_id) + (portal_id, party_id, name, theme_id, template_id) values - (v_portal_id, p_name, v_theme_id, p_template_id); + (v_portal_id, p_party_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/datasource-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/tcl/datasource-procs.tcl 3 Jan 2004 01:42:57 -0000 1.2 @@ -27,6 +27,148 @@ namespace eval portal::datasource { + ad_proc new_from_spec { + -spec:required + } { + + Create a new portal datasource from a specification. Why use this to define + your portal datasources? Because calling this procedure from your package's + post-install procedure is easier than writing PL/SQL for Oracle and PL/pgSQL + for Oracle. + + @param spec The specification (format described below) + + @author Don Baccus (dhogaza@pacifier.com) + @see acs_sc::impl::new_from_spec + + The specification is a list of name-value pairs. Possible names are + + name The name of the new datasource + owner The package that owns this portlet (defaults to name) + description A human-readable description (defaults to name) + params A list of param key/attributes and their values + aliases Service contract aliases clause for acs_sc::impl::new_from_spec + + Each parameter key can be followed by a comma-separated list of attributes + in the familiar style of ad_page_contract or ad_form. Do not include spaces + in the list of attributes. Only two attributes are allowed - "config_required_p" + and "configured_p". + + See the portal package documentation for the meaning of these two attributes. + + } { + + array set datasource $spec + + # Default datasource description to its name + if { ![info exists datasource(description)] } { + set datasource(description) $datasource(name) + } + + # Default datasource owner to its name + if { ![info exists datasource(owner)] } { + set datasource(owner) $datasource(name) + } + + db_transaction { + + set datasource_id [new -name $datasource(name) -description $datasource(description)] + + foreach {param value} $datasource(params) { + + if { ![regexp {^([^ \t:]+)(?::([a-zA-Z0-9_,(|)]*))} \ + $param match param_name flags] } { + ad_return -code error "Parameter name '$param' doesn't have the right format. It must be var\[:flag\[,flag ...\]\]" + } + + # set defaults for attributes + set config_required_p f + set configured_p f + + # now set the parameter flags + foreach flag [split [string tolower $flags] ","] { + switch -exact $flag { + configured { set configured_p t } + config_required { set config_required_p t} + default { ad_return -code error "\"$flag\" is not a legal portal datasource attribute" } + } + } + + # and define the parameter + set_def_param -datasource_id $datasource_id \ + -config_required_p $config_required_p \ + -configured_p $configured_p \ + -key $param_name \ + -value $value + + } + + acs_sc::impl::new_from_spec \ + -spec [list name $datasource(name) \ + contract_name portal_datasource \ + owner $datasource(owner) \ + aliases $datasource(aliases)] + + } + } + + ad_proc -private new { + {-name:required} + {-description:required} + } { + + @author Simon Carstensen (simon@bcuni.net) + + } { + + set var_list [list \ + [list name $name] \ + [list description $description]] + + return [package_exec_plsql -var_list $var_list portal_datasource new] + } + + ad_proc -private set_def_param { + {-datasource_id:required} + {-config_required_p:required} + {-configured_p:required} + {-key:required} + {-value:required} + } { + + @author Simon Carstensen (simon@bcuni.net) + + } { + set var_list [list \ + [list datasource_id $datasource_id] \ + [list config_required_p $config_required_p] \ + [list configured_p $configured_p] \ + [list key $key] \ + [list value $value]] + + package_exec_plsql -var_list $var_list portal_datasource set_def_param + } + + ad_proc -private delete { + {-name:required} + } { + + @author Don Baccus (dhogaza@pacifier.com) + + } { + + if { ![db_0or1row get_datasource_id {}] } { + # Returning an error here is a PITA developing, so we'll just log an error + ns_log Error "Datasource \"$name\" does not exist" + return + } + + acs_sc::impl::delete -contract_name portal_datasource -impl_name $name + set var_list [list [list datasource_id $datasource_id]] + return [package_exec_plsql -var_list $var_list portal_datasource del] + } + + ad_proc -public get { {-datasource_id:required} } { Index: openacs-4/contrib/packages/portal/tcl/page-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/page-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/tcl/page-procs.tcl 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/tcl/page-procs.tcl 3 Jan 2004 01:42:57 -0000 1.2 @@ -130,7 +130,7 @@ set page_id [db_string get_page_id_from_name {} -default ""] if {[empty_string_p $page_id]} { # there is no page by that name in the portal, return page 0 - return [get_page_id -portal_id $portal_id] + return [get_id -portal_id $portal_id] } else { return $page_id } @@ -145,7 +145,7 @@ } { returns 1 if the given page_id is the first page in the given portal, otherwise 0. } { - if {$page_id == [portal::get_page_id -portal_id $portal_id -sort_key 0]} { + if {$page_id == [get_id -portal_id $portal_id -sort_key 0]} { return 1 } else { return 0 Index: openacs-4/contrib/packages/portal/tcl/page-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/page-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/tcl/page-procs.xql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/tcl/page-procs.xql 3 Jan 2004 01:42:57 -0000 1.2 @@ -30,4 +30,33 @@ + + + select page_id + from portal_pages + where portal_id = :portal_id + and sort_key = :sort_key + + + + + + select page_id + from portal_pages + where portal_id = :portal_id + and name = :page_name + + + + + + select 1 + from dual + where exists (select 1 + from portal_elements + where page_id = :page_id + and state != 'hidden') + + + 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.1 -r1.2 --- openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 3 Jan 2004 01:42:57 -0000 1.2 @@ -65,22 +65,36 @@ {-template_id ""} {-context_id ""} {-page_list {{{Page 1} 2_column}}} + {-party_privileges {read write admin}} } { - create a new portal for the passed in party_id. create pages passed in + Create a new portal for the passed in party_id. create pages passed in the page_list. + + @party_id The 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 + @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. + 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. + } { db_transaction { - set extra_vars [ns_set create] - ns_set put $extra_vars name $name - ns_set put $extra_vars template_id $template_id - ns_set put $extra_vars context_id $context_id + set var_list [list \ + [list name $name] \ + [list template_id $template_id] \ + [list context_id $context_id] \ + [list party_id $party_id]] - set portal_id [package_instantiate_object -extra_vars $extra_vars portal] + set portal_id [package_instantiate_object -var_list $var_list portal] - permission::grant -party_id $party_id -object_id $portal_id -privilege read - permission::grant -party_id $party_id -object_id $portal_id -privilege write - permission::grant -party_id $party_id -object_id $portal_id -privilege admin + foreach privilege $party_privileges { + permission::grant -party_id $party_id -object_id $portal_id -privilege $privilege + } if {[empty_string_p $template_id]} { foreach page $page_list { @@ -122,6 +136,19 @@ return [array get portal] } + ad_proc -public get_portal_id { + {-party_id:required} + } { + Get the portal_id for a party. I (DRB) am not going to bother caching this + for the time being ... + } { + if {[db_0or1row select_portal_id {}]} { + return $portal_id + } else { + return "" + } + } + ad_proc -public set_values { {-portal:required} } { @@ -196,7 +223,7 @@ } { returns a chunk of html that is a fully rendered portal } { - permission::require -privilege read -object_id $portal_id + permission::require_permission -privilege read -object_id $portal_id set edit_p [permission::permission_p -object_id $portal_id -privilege write] set master_template [parameter::get -parameter master_template] @@ -286,7 +313,7 @@ set edit_p [permission::permission_p -object_id $portal_id -privilege write] if {!$edit_p} { - permission::require -privilege admin -object_id $portal_id + permission::require_permission -privilege admin -object_id $portal_id set edit_p 1 } @@ -354,7 +381,7 @@ foreach page_id $list_of_page_ids { - set first_page_p [portal::first_page_p -portal_id $portal_id -page_id $page_id] + set first_page_p [portal::page::first_page_p -portal_id $portal_id -page_id $page_id] set page_name [portal::page::get_name -page_id $page_id] set page_layout_id [portal::page::get_layout_id -page_id $page_id] @@ -408,7 +435,7 @@ array unset fake_element_ids } - if {![portal::has_visible_elements -page_id $page_id]} { + if {![portal::page::has_visible_elements -page_id $page_id]} { # # Non first page with all hidden elements @@ -543,7 +570,7 @@ set edit_p [permission::permission_p -object_id $portal_id -privilege write] if {!$edit_p} { - permission::require -privilege admin -object_id $portal_id + permission::require_permission -privilege admin -object_id $portal_id set edit_p 1 } 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.1 -r1.2 --- openacs-4/contrib/packages/portal/tcl/portal-procs.xql 25 Oct 2002 21:29:17 -0000 1.1 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.xql 3 Jan 2004 01:42:57 -0000 1.2 @@ -18,6 +18,14 @@ + + + select portal_id + from portals + where party_id = :party_id + + + update portals @@ -185,15 +193,6 @@ - - - select page_id - from portal_pages - where portal_id = :portal_id - and sort_key = :sort_key - - - select count(*) @@ -229,13 +228,4 @@ - - - select page_id - from portal_pages - where portal_id = :portal_id - and name = :page_name - - -