Index: openacs-4/packages/new-portal/sql/postgresql/api-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/api-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/api-create.sql 24 May 2002 01:58:46 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/api-create.sql 1 Jul 2002 20:03:25 -0000 1.3 @@ -1,186 +1,283 @@ -- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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. +-- + +-- -- The New Portal Package -- copyright 2001, OpenForce, Inc. -- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- --- -select define_function_args ('portal_page__new','page_id,pretty_name,portal_id,layout_id,sort_key,object_type;portal_page,creation_date,creation_user,creation_ip,context_id'); +select define_function_args('portal_page__new','page_id,pretty_name,portal_id,layout_id,object_type;portal_page,creation_date,creation_user,creation_ip,context_id'); -create function portal_page__new (integer,varchar,integer,integer,integer,varchar,timestamp,integer,varchar,integer) +create function portal_page__new (integer,varchar,integer,integer,varchar,timestamp,integer,varchar,integer) returns integer as ' declare - p_page_id alias for $1; - p_pretty_name alias for $2; - p_portal_id alias for $3; - p_layout_id alias for $4; - p_sort_key alias for $5; - p_object_type alias for $6; - p_creation_date alias for $7; - p_create_user alias for $8; - p_creation_ip alias for $9; - p_context_id alias for $10; - v_page_id portal_pages.page_id%TYPE; - v_layout_id portal_pages.layout_id%TYPE; - v_sort_key portal_pages.sort_key%TYPE; + p_page_id alias for $1; + p_pretty_name alias for $2; + p_portal_id alias for $3; + p_layout_id alias for $4; + p_object_type alias for $6; + p_creation_date alias for $7; + p_create_user alias for $8; + p_creation_ip alias for $9; + p_context_id alias for $10; + v_page_id portal_pages.page_id%TYPE; + v_layout_id portal_pages.layout_id%TYPE; + v_sort_key portal_pages.sort_key%TYPE; begin - v_page_id := acs_object__new ( - /* object_type */ p_object_type, - /* creation_date */ p_creation_date, - /* creation_user */ p_creation_user, - /* creation_ip */ p_creation_ip, - /* context_id */ p_context_id - ); - if p_layout_id is null then - select min(layout_id) into v_layout_id from portal_layouts; - else - v_layout_id := p_layout_id; - end if; + v_page_id := acs_object__new( + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); - if p_portal_id is not null then - select max(sort_key) + 1 into v_sort_key - from portal_pages - where portal_id = p_portal_id; - if v_sort_key is null then - v_sort_key := 0; - end if; - else - raise exception ''-20000, NULL portal_id sent to portal_page__new!''; - end if; + if p_layout_id is null then + select min(layout_id) + into v_layout_id + from portal_layouts; + else + v_layout_id := p_layout_id; + end if; - insert into portal_pages - (page_id, pretty_name, portal_id, layout_id, sort_key) - values (v_page_id, p_pretty_name, p_portal_id, v_layout_id, v_sort_key); + select coalesce(max(sort_key) + 1, 0) + into v_sort_key + from portal_pages + where portal_id = p_portal_id; - return v_page_id; -end;' language 'plpgsql'; + insert into portal_pages + (page_id, pretty_name, portal_id, layout_id, sort_key) + values + (v_page_id, p_pretty_name, p_portal_id, v_layout_id, v_sort_key); + return v_page_id; +end;' language 'plpgsql'; + select define_function_args('portal_page__delete','page_id'); -create function portal_page__delete (integer) +create function portal_page__delete(integer) returns integer as ' declare - p_page_id integer; + p_page_id integer; + v_portal_id portal_pages.portal_id%TYPE; + v_sort_key portal_pages.sort_key%TYPE; + v_curr_sort_key portal_pages.sort_key%TYPE; + v_page_count_from_0 integer; begin - delete from portal_pages where page_id = p_page_id; + + -- IMPORTANT: sort keys MUST be an unbroken sequence from 0 to max(sort_key) + + select portal_id, sort_key + into v_portal_id, v_sort_key + from portal_pages + where page_id = p_page_id; + + select (count(*) - 1) + into v_page_count_from_0 + from portal_pages + where portal_id = v_portal_id; + + for i in 0 .. v_page_count_from_0 loop + + if i = v_sort_key then + + delete + from portal_pages + where page_id = p_page_id; + + elsif i > v_sort_key then + + update portal_pages + set sort_key = -1 + where sort_key = i; + + update portal_pages + set sort_key = i - 1 + where sort_key = -1; + + end if; + + end loop; + perform acs_object__delete(p_page_id); return 0; + end;' language 'plpgsql'; - select define_function_args('portal__new','portal_id,name,theme_id,layout_id,template_id,default_page_name,object_type;portal,creation_date,creation_user,creation_ip,context_id'); create function portal__new (integer,varchar,integer,integer,integer,boolean,integer,varchar,varchar,timestamp,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_layout_id alias for $4; - p_template_id alias for $5; - p_default_page_name 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; - v_page_id portal_pages.page_id%TYPE; - v_page record; + p_portal_id alias for $1; + p_name alias for $2; + p_theme_id alias for $3; + p_layout_id alias for $4; + p_template_id alias for $5; + p_default_page_name 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; + v_page_id portal_pages.page_id%TYPE; + v_page record; begin - -- we must create at least one page for this portal - v_portal_id := acs_object__new ( - /* object_id */ p_portal_id, - /* object_type */ p_object_type, - /* creation_date */ p_creation_date, - /* creation_user */ p_creation_user, - /* creation_ip */ p_creation_ip, - /* context_id */ p_context_id - ); + v_portal_id := acs_object__new( + p_portal_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); - if p_template_id is null then + if p_template_id is null then - if p_theme_id is null then - select max(theme_id) into v_theme_id from portal_element_themes; - else - v_theme_id := p_theme_id; - end if; - - if p_layout_id is null then - select min(layout_id) into v_layout_id from portal_layouts; - else - v_layout_id := p_layout_id; - end if; + if p_theme_id is null then + select max(theme_id) + into v_theme_id + from portal_element_themes; + else + v_theme_id := p_theme_id; + end if; - insert into portals - (portal_id, name, theme_id) - values (v_portal_id, p_name, v_theme_id); + if p_layout_id is null then + select min(layout_id) + into v_layout_id + from portal_layouts; + else + v_layout_id := p_layout_id; + end if; - -- now insert the default page - v_page_id := portal_page__new ( - /* portal_id */ v_portal_id, - /* pretty_name */ p_default_page_name, - /* layout_id */ v_layout_id, - /* creation_date */ p_creation_date, - /* creation_user */ p_creation_user, - /* creation_ip */ p_creation_ip, - /* context_id */ p_context_id - ); - else - -- AKS this is out of date!!! - select theme_id into v_theme_id - from portals - where portal_id = p_template_id; + insert + into portals + (portal_id, name, theme_id) + values + (v_portal_id, p_name, v_theme_id); - insert into portals - (portal_id, name, theme_id, portal_template_p, template_id) - values - (v_portal_id, p_name, v_theme_id, ''f'', p_template_id); + -- now insert the default page + v_page_id := portal_page__new( + v_portal_id, + p_default_page_name, + v_layout_id, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); - for v_page in select * - from portal_pages - where portal_id = p_template_id - loop - -- now insert the pages from the portal template - v_page_id := portal_page__new ( - /* portal_id */ v_portal_id, - /* pretty_name */ v_page.pretty_name, - /* layout_id */ v_page.layout_id, - /* sort_key */ v_page.sort_key - ); - end loop; - end if; + else + -- we have a portal as our template. copy its theme, pages, layouts, + -- elements, and element params. + select theme_id + into v_theme_id + from portals + where portal_id = p_template_id; - return v_portal_id; -end;' language 'plpgsql'; + insert + into portals + (portal_id, name, theme_id, template_id) + values + (v_portal_id, p_name, v_theme_id, p_template_id); + -- now insert the pages from the portal template + for v_page in select * + from portal_pages + where portal_id = p_template_id + loop + v_page_id := portal_page__new( + v_portal_id, + v_page.pretty_name, + v_page.layout_id + ); + + -- now get the elements on the templates page and put them on the new page + for element in select * + from portal_element_map + where page_id = page.page_id + loop + + select acs_object_id_seq.nextval + into v_new_element_id + from dual; + + insert + into portal_element_map + (element_id, name, pretty_name, page_id, datasource_id, region, state, sort_key) + select v_new_element_id, name, pretty_name, v_page_id, datasource_id, region, state, sort_key + from portal_element_map pem + where pem.element_id = element.element_id; + + -- now for the elements params + for param in select * + from portal_element_parameters + where element_id = element.element_id + loop + + select acs_object_id_seq.nextval + into v_new_parameter_id + from dual; + + insert + into portal_element_parameters + (parameter_id, element_id, config_required_p, configured_p, key, value) + select v_new_parameter_id, v_new_element_id, config_required_p, configured_p, key, value + from portal_element_parameters + where parameter_id = param.parameter_id; + + end loop; + + end loop; + + end loop; + + end if; + + return v_portal_id; + +end;' language 'plpgsql'; + select define_function_args('portal__delete','portal_id'); create function portal__delete (integer) returns integer as ' declare - p_portal_id alias for $1; - v_page record; + p_portal_id alias for $1; + v_page record; begin + for v_page in select page_id - from portal_pages - where portal_id = p_portal_id) + from portal_pages + where portal_id = p_portal_id loop - -- delete this portal''s pages - perform portal_page__delete ( - /* page_id */ v_page.page_id - ); + perform portal_page__delete(v_page.page_id); end loop; perform acs_object__delete(p_portal_id); @@ -189,254 +286,248 @@ end;' language 'plpgsql'; --- Portal element themes - select define_function_args('portal_element_theme__new','theme_id,name,description,filename,resource_dir,object_type;portal_element_theme,creation_date,creation_user,creation_ip,context_id'); create function portal_element_theme__new (integer,varchar,varchar,varchar,varchar,varchar,timestamp,integer,varchar,integer) returns integer as ' declare - p_theme_id alias for $1; - p_name alias for $2; - p_description alias for $3; - p_filename alias for $4; - p_resource_dir 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_theme_id portal_element_themes.theme_id%TYPE; + p_theme_id alias for $1; + p_name alias for $2; + p_description alias for $3; + p_filename alias for $4; + p_resource_dir 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_theme_id portal_element_themes.theme_id%TYPE; begin - v_theme_id := acs_object__new ( - /* object_id */ p_theme_id, - /* object_type */ p_object_type, - /* creation_date */ p_creation_date, - /* creation_user */ p_creation_user, - /* creation_ip */ p_creation_ip, - /* context_id */ p_context_id - ); - insert into portal_element_themes - (theme_id, name, description, filename, resource_dir) - values - (v_theme_id, p_name, p_description, p_filename, p_resource_dir); + v_theme_id := acs_object__new( + p_theme_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); - return v_theme_id; -end;' language 'plpgsql'; + insert + into portal_element_themes + (theme_id, name, description, filename, resource_dir) + values + (v_theme_id, p_name, p_description, p_filename, p_resource_dir); + return v_theme_id; +end;' language 'plpgsql'; + create function portal_element_theme__new (varchar,varchar,varchar,varchar) returns integer as ' declare - p_name alias for $1; - p_description alias for $2; - p_filename alias for $3; - p_resource_dir alias for $4; - v_theme_id portal_element_themes.theme_id%TYPE; + p_name alias for $1; + p_description alias for $2; + p_filename alias for $3; + p_resource_dir alias for $4; + v_theme_id portal_element_themes.theme_id%TYPE; begin - v_theme_id := portal_element_theme__new ( - null, - p_name, - p_description, - p_filename, - p_resource_dir, - ''portal_element_theme'', - now(), - null, - null, - null - ); + v_theme_id := portal_element_theme__new( + null, + p_name, + p_description, + p_filename, + p_resource_dir, + ''portal_element_theme'', + now(), + null, + null, + null + ); + return v_theme_id; + end;' language 'plpgsql'; - select define_function_args('portal_element_theme__delete','theme_id'); create function portal_element_theme__delete (integer) returns integer as ' - p_theme_id alias for $1; + p_theme_id alias for $1; begin perform acs_object__delete(p_theme_id); return (0); end;' language 'plpgsql'; - --- Portal layouts - select define_function_args('portal_layout__new','layout_id,name,description,filename,resource_dir,object_type;portal_layout,creation_date,creation_user,creation_ip,context_id'); create function portal_layout__new (integer,varchar,varchar,varchar,varchar,varchar,timestamp,integer,varchar,integer) returns integer as ' declare - p_layout_id alias for $1; - p_name alias for $2; - p_description alias for $3; - p_filename alias for $4; - p_resource_dir 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_layout_id portal_layouts.layout_id%TYPE; + p_layout_id alias for $1; + p_name alias for $2; + p_description alias for $3; + p_filename alias for $4; + p_resource_dir 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_layout_id portal_layouts.layout_id%TYPE; begin - v_layout_id := acs_object__new ( - /* object_id */ p_layout_id, - /* object_type */ p_object_type, - /* creation_date */ p_creation_date, - /* creation_user */ p_creation_user, - /* creation_ip */ p_creation_ip, - /* context_id */ p_context_id - ); - insert into portal_layouts - (layout_id, name, description, filename, resource_dir) - values - (v_layout_id, p_name, p_description,p_filename, p_resource_dir); + v_layout_id := acs_object__new( + p_layout_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); - return v_layout_id; -end;' language 'plpgsql'; + insert into portal_layouts + (layout_id, name, description, filename, resource_dir) + values + (v_layout_id, p_name, p_description, p_filename, p_resource_dir); + return v_layout_id; +end;' language 'plpgsql'; + create function portal_layout__new (varchar,varchar,varchar,varchar) returns integer as ' declare - p_name alias for $1; - p_description alias for $2; - p_filename alias for $3; - p_resource_dir alias for $4; - v_layout_id portal_layouts.layout_id%TYPE; + p_name alias for $1; + p_description alias for $2; + p_filename alias for $3; + p_resource_dir alias for $4; + v_layout_id portal_layouts.layout_id%TYPE; begin - v_layout_id := portal_layout__new ( - null, - p_name, - p_description, - p_filename, - p_resource_dir, - ''portal_layout'', - now(), - null, - null, - null - ); + v_layout_id := portal_layout__new( + null, + p_name, + p_description, + p_filename, + p_resource_dir, + ''portal_layout'', + now(), + null, + null, + null + ); return v_layout_id; + end;' language 'plpgsql'; - select define_function_args('portal_layout__delete','layout_id'); create function portal_layout__delete(integer) returns integer as ' - p_layout_id alias for $1; + p_layout_id alias for $1; begin perform acs_object__delete(layout_id); return 0; end;' language 'plpgsql'; - select define_function_args('portal_layout__add_region','layout_id,region,immutable_p;f'); create function portal_layout__add_region (integer,varchar,char) returns integer as ' declare - p_layout_id alias for $1; - p_region alias for $2; - p_immutable_p alias for $3; + p_layout_id alias for $1; + p_region alias for $2; + p_immutable_p alias for $3; begin - insert into portal_supported_regions (layout_id, region, immutable_p) - values (p_layout_id, p_region, p_immutable_p); + insert + into portal_supported_regions + (layout_id, region, immutable_p) + values + (p_layout_id, p_region, p_immutable_p); return 0; end;' language 'plpgsql'; - --- for the default to f, okay. create function portal_layout__add_region (integer,varchar) returns integer as ' declare - p_layout_id alias for $1; - p_region alias for $2; + p_layout_id alias for $1; + p_region alias for $2; begin - insert into portal_supported_regions (layout_id, region, immutable_p) - values (p_layout_id, p_region, ''f''); + insert + into portal_supported_regions + (layout_id, region, immutable_p) + values + (p_layout_id, p_region, ''f''); return 0; end;' language 'plpgsql'; - - --- datasources - select define_function_args('portal_datasource__new','datasource_id,name,description,object_type;portal_datasource,creation_date,creation_user,creation_ip,context_id'); create function portal_datasource__new (integer,varchar,varchar,varchar,timestamp,integer,integer,integer) returns integer as ' declare - p_datasource_id alias for $1; - p_name alias for $2; - p_description alias for $3; - p_object_type alias for $4; - p_creation_date alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; - p_context_id alias for $8; - v_datasource_id portal_datasources.datasource_id%TYPE; + p_datasource_id alias for $1; + p_name alias for $2; + p_description alias for $3; + p_object_type alias for $4; + p_creation_date alias for $5; + p_creation_user alias for $6; + p_creation_ip alias for $7; + p_context_id alias for $8; + v_datasource_id portal_datasources.datasource_id%TYPE; begin - v_datasource_id := acs_object__new ( - /* object_id */ p_datasource_id, - /* object_type */ p_object_type, - /* creation_date */ p_creation_date, - /* creation_user */ p_creation_user, - /* creation_ip */ p_creation_ip, - /* context_id */ p_context_id + + v_datasource_id := acs_object__new( + p_datasource_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id ); - insert into portal_datasources - (datasource_id, name, description) + (datasource_id, name, description) values - (v_datasource_id, p_name, p_description); + (v_datasource_id, p_name, p_description); return v_datasource_id; + end;' language 'plpgsql'; - select define_function_args('portal_datasource__delete','datasource_id'); create function portal_datasource__delete (integer) returns integer as ' declare - p_datasource_id alias for $1; + p_datasource_id alias for $1; begin perform acs_object__delete(datasource_id); return 0; end;' language 'plpgsql'; - select define_function_args('portal_datasource__set_def_param','datasource_id,config_required_p,configured_p,key,value'); create function portal_datasource__set_def_param (integer,boolean,boolean,varchar) returns integer as ' declare - p_datasource_id alias for $1; - p_config_required_p alias for $2; - p_configured_p alias for $3; - p_key alias for $4; - p_value alias for $5; - v_parameter_id portal_datasource_def_params.parameter_id%TYPE; + p_datasource_id alias for $1; + p_config_required_p alias for $2; + p_configured_p alias for $3; + p_key alias for $4; + p_value alias for $5; begin - select acs_object_id_seq.nextval into v_parameter_id from dual; - insert into portal_datasource_def_params - (parameter_id, datasource_id, config_required_p, configured_p, key, value) + (parameter_id, datasource_id, config_required_p, configured_p, key, value) values - (v_parameter_id, p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + (acs_object_id_seq.nextval, p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); - return v_parameter_id; + return 0; end;' language 'plpgsql'; Index: openacs-4/packages/new-portal/sql/postgresql/api-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/api-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/api-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/api-drop.sql 1 Jul 2002 20:03:25 -0000 1.2 @@ -1,16 +1,30 @@ -- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + +-- -- The New Portal Package -- copyright 2001, OpenForce, Inc. -- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- --- -select drop_package ('portal_page'); -select drop_package ('portal'); -select drop_package ('portal_element_theme'); -select drop_package ('portal_layout'); -select drop_package ('portal_datasource'); - +select drop_package('portal_page'); +select drop_package('portal'); +select drop_package('portal_element_theme'); +select drop_package('portal_layout'); +select drop_package('portal_datasource'); Index: openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql 9 May 2002 23:59:53 -0000 1.3 +++ openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql 1 Jul 2002 20:03:25 -0000 1.4 @@ -1,182 +1,187 @@ --- The data source (portlet) contract --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- for Oracle 8/8i. (We're guessing 9i works, too). +-- Copyright (C) 2001, 2002 OpenForce, Inc. -- --- arjun@openforce.net --- started November, 2001 +-- This file is part of dotLRN. -- --- $Id$ +-- 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 foreign key more +-- details. +-- - select acs_sc_contract__new ( - /* contract_name */ 'portal_datasource', - /* contract_desc */ 'Portal Datasource interface' - ); +-- +-- The data source (portlet) contract +-- +-- @author arjun@openforce.net +-- @version $Id$ +-- - -- Get my name - not to be confused with the pretty_name - select acs_sc_msg_type__new ( - /* msg_type_name */ 'portal_datasource.GetMyName.InputType', - /* msg_type_spec */ '' - ); +create function inline_0 () +returns integer as ' +begin - select acs_sc_msg_type__new ( - /* msg_type_name */ 'portal_datasource.GetMyName.OutputType', - /* msg_type_spec */ 'get_my_name:string' - ); + perform acs_sc_contract__new( + ''portal_datasource'', + ''Portal Datasource interface'' + ); - select acs_sc_operation__new ( - 'portal_datasource', - 'GetMyName', - 'Get the name', - 't', -- not cacheable - 0, -- n_args - 'portal_datasource.GetMyName.InputType', - 'portal_datasource.GetMyName.OutputType' - ); + -- Get my name - not to be confused with the pretty_name + perform acs_sc_msg_type__new( + ''portal_datasource.GetMyName.InputType'', + '''' + ); + perform acs_sc_msg_type__new( + ''portal_datasource.GetMyName.OutputType'', + ''get_my_name:string'' + ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''GetMyName'', + ''Get the name'', + ''t'', + 0, + ''portal_datasource.GetMyName.InputType'', + ''portal_datasource.GetMyName.OutputType'' + ); + -- Get a pretty name + perform acs_sc_msg_type__new( + ''portal_datasource.GetPrettyName.InputType'', + '''' + ); - -- Get a pretty name - select acs_sc_msg_type__new ( - /* msg_type_name */ 'portal_datasource.GetPrettyName.InputType', - /* msg_type_spec */ '' - ); + perform acs_sc_msg_type__new( + ''portal_datasource.GetPrettyName.OutputType'', + ''pretty_name:string'' + ); - select acs_sc_msg_type__new ( - /* msg_type_name */ 'portal_datasource.GetPrettyName.OutputType', - /* msg_type_spec */ 'pretty_name:string' - ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''GetPrettyName'', + ''Get the pretty name'', + ''t'', + 0, + ''portal_datasource.GetPrettyName.InputType'', + ''portal_datasource.GetPrettyName.OutputType'' + ); - select acs_sc_operation__new ( - 'portal_datasource', - 'GetPrettyName', - 'Get the pretty name', - 't', -- not cacheable - 0, -- n_args - 'portal_datasource.GetPrettyName.InputType', - 'portal_datasource.GetPrettyName.OutputType' - ); + -- Link: Where is the href target for this PE? + perform acs_sc_msg_type__new( + ''portal_datasource.Link.InputType'', + '''' + ); + perform acs_sc_msg_type__new( + ''portal_datasource.Link.OutputType'', + ''pretty_name:string'' + ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''Link'', + ''Get the link ie the href target for this datasource'', + ''t'', + 0, + ''portal_datasource.Link.InputType'', + ''portal_datasource.Link.OutputType'' + ); + -- Tell the datasource to add itself to a portal page + -- add_self_to_page + -- The "args" string is an ns_set of extra arguments + perform acs_sc_msg_type__new( + ''portal_datasource.AddSelfToPage.InputType'', + ''page_id:integer,instance_id:integer,args:string'' + ); - -- Link: Where is the href target for this PE? - select acs_sc_msg_type__new ( - /* msg_type_name */ 'portal_datasource.Link.InputType', - /* msg_type_spec */ '' - ); + perform acs_sc_msg_type__new( + ''portal_datasource.AddSelfToPage.OutputType'', + ''element_id:integer'' + ); - select acs_sc_msg_type__new ( - /* msg_type_name */ 'portal_datasource.Link.OutputType', - /* msg_type_spec */ 'pretty_name:string' - ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''AddSelfToPage'', + ''Adds itself to the given page returns an element_id'', + ''f'', + 3, + ''portal_datasource.AddSelfToPage.InputType'', + ''portal_datasource.AddSelfToPage.OutputType'' + ); - select acs_sc_operation__new ( - 'portal_datasource', - 'Link', - 'Get the link ie the href target for this datasource', - 't', -- not cacheable - 0, -- n_args - 'portal_datasource.Link.InputType', - 'portal_datasource.Link.OutputType' - ); + perform acs_sc_msg_type__new( + ''portal_datasource.Edit.InputType'', + ''element_id:integer'' + ); + perform acs_sc_msg_type__new( + ''portal_datasource.Edit.OutputType'', + ''output:string'' + ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''Edit'', + ''Returns the edit html'', + ''f'', + 1, + ''portal_datasource.Edit.InputType'', + ''portal_datasource.Edit.OutputType'' + ); - -- Tell the datasource to add itself to a portal page - -- add_self_to_page - -- The "args" string is an ns_set of extra arguments - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.AddSelfToPage.InputType', - /* msg_type_spec */ 'page_id:integer,instance_id:integer,args:string' - ); + perform acs_sc_msg_type__new( + ''portal_datasource.Show.InputType'', + ''cf:string'' + ); - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.AddSelfToPage.OutputType', - /* msg_type_spec */ 'element_id:integer' - ); - - select acs_sc_operation__new ( - 'portal_datasource', - 'AddSelfToPage', - 'Adds itself to the given page returns an element_id', - 'f', -- not cacheable - 3, -- n_args - 'portal_datasource.AddSelfToPage.InputType', - 'portal_datasource.AddSelfToPage.OutputType' - ); + perform acs_sc_msg_type__new( + ''portal_datasource.Show.OutputType'', + ''output:string'' + ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''Show'', + ''Render the portal element returning a chunk of HTML'', + ''f'', + 1, + ''portal_datasource.Show.InputType'', + ''portal_datasource.Show.OutputType'' + ); + -- Tell the PE to remove itself from a page + -- remove_self_from_page + perform acs_sc_msg_type__new( + ''portal_datasource.RemoveSelfFromPage.InputType'', + ''page_id:integer,instance_id:integer'' + ); - -- Edit: the datasources' edit html - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.Edit.InputType', - /* msg_type_spec */ 'element_id:integer' - ); + perform acs_sc_msg_type__new( + ''portal_datasource.RemoveSelfFromPage.OutputType'', + '''' + ); - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.Edit.OutputType', - /* msg_type_spec */ 'output:string' - ); - - select acs_sc_operation__new ( - 'portal_datasource', - 'Edit', - 'Returns the edit html', - 'f', -- not cacheable - 1, -- n_args - 'portal_datasource.Edit.InputType', - 'portal_datasource.Edit.OutputType' - ); + perform acs_sc_operation__new( + ''portal_datasource'', + ''RemoveSelfFromPage'', + '' remove itself from the given page'', + ''f'', + 2, + ''portal_datasource.RemoveSelfFromPage.InputType'', + ''portal_datasource.RemoveSelfFromPage.OutputType'' + ); + return 0; +end;' language 'plpgsql'; +select inline_0(); - -- Show: the portal element's display proc - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.Show.InputType', - /* msg_type_spec */ 'cf:string' - ); - - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.Show.OutputType', - /* msg_type_spec */ 'output:string' - ); - - select acs_sc_operation__new ( - 'portal_datasource', - 'Show', - 'Render the portal element returning a chunk of HTML', - 'f', -- not cacheable - 1, -- n_args - 'portal_datasource.Show.InputType', - 'portal_datasource.Show.OutputType' - ); - - - - - - -- Tell the PE to remove itself from a page - -- remove_self_from_page - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.RemoveSelfFromPage.InputType', - /* msg_type_spec */ 'page_id:integer,instance_id:integer' - ); - - select acs_sc_msg_type__new( - /* msg_type_name */ 'portal_datasource.RemoveSelfFromPage.OutputType', - /* msg_type_spec */ '' - ); - - select acs_sc_operation__new ( - 'portal_datasource', - 'RemoveSelfFromPage', - ' remove itself from the given page', - 'f', -- not cacheable - 2, -- n_args - 'portal_datasource.RemoveSelfFromPage.InputType', - 'portal_datasource.RemoveSelfFromPage.OutputType' - ); +drop function inline_0(); Index: openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql 9 May 2002 23:59:53 -0000 1.3 +++ openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql 1 Jul 2002 20:03:25 -0000 1.4 @@ -1,122 +1,137 @@ --- The data source (portlet) contract --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 +-- +-- Copyright(C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + -- --- for Oracle 8/8i. (We're guessing 9i works, too). +-- The data source(portlet) contract -- --- arjun@openforce.net --- started November, 2001 +-- @author arjun@openforce.net +-- @version $Id$ -- --- $Id$ - -- drop GetMyName - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'GetMyName' - ); +create function inline_0 () +returns integer as ' +begin - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.GetMyName.InputType' - ); + -- drop GetMyName + perform acs_sc_operation__delete( + ''portal_datasource'', + ''GetMyName'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.GetMyName.OutputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.GetMyName.InputType'' + ); - -- drop GetPrettyName - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'GetPrettyName' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.GetMyName.OutputType'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.GetPrettyName.InputType' - ); + -- drop GetPrettyName + perform acs_sc_operation__delete( + ''portal_datasource'', + ''GetPrettyName'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.GetPrettyName.OutputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.GetPrettyName.InputType'' + ); + perform acs_sc_msg_type__delete( + ''portal_datasource.GetPrettyName.OutputType'' + ); - -- drop Link - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'Link' - ); + -- drop Link + perform acs_sc_operation__delete( + ''portal_datasource'', + ''Link'' + ); + perform acs_sc_msg_type__delete( + ''portal_datasource.Link.InputType'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.Link.InputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.Link.OutputType'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.Link.OutputType' - ); + -- Drop add_self_to_page + perform acs_sc_operation__delete( + ''portal_datasource'', + ''AddSelfToPage'' + ); + perform acs_sc_msg_type__delete( + ''portal_datasource.AddSelfToPage.InputType'' + ); - -- Drop add_self_to_page - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'AddSelfToPage' - ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.AddSelfToPage.InputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.AddSelfToPage.OutputType'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.AddSelfToPage.OutputType' - ); + -- Delete Show + perform acs_sc_operation__delete( + ''portal_datasource'', + ''Show'' + ); + perform acs_sc_msg_type__delete( + ''portal_datasource.Show.InputType'' + ); - -- Delete Show - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'Show' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.Show.OutputType'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.Show.InputType' - ); + -- Delete Edit + perform acs_sc_operation__delete( + ''portal_datasource'', + ''Edit'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.Show.OutputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.Edit.InputType'' + ); + perform acs_sc_msg_type__delete( + ''portal_datasource.Edit.OutputType'' + ); - -- Delete Edit - - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'Edit' - ); + -- RemoveSelfFromPage + perform acs_sc_operation__delete( + ''portal_datasource'', + ''RemoveSelfFromPage'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.Edit.InputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.RemoveSelfFromPage.InputType'' + ); - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.Edit.OutputType' - ); + perform acs_sc_msg_type__delete( + ''portal_datasource.RemoveSelfFromPage.OutputType'' + ); + -- drop the contract + perform acs_sc_contract__delete( + ''portal_datasource'' + ); - -- rem RemoveSelfFromPage - - select acs_sc_operation__delete ( - /* contract_name */ 'portal_datasource', - /* operation_name */ 'RemoveSelfFromPage' - ); + return 0; - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.RemoveSelfFromPage.InputType' - ); +end;' language 'plpgsql'; - select acs_sc_msg_type__delete ( - /* msg_type_name */ 'portal_datasource.RemoveSelfFromPage.OutputType' - ); +select inline_0(); - - -- drop the contract - select acs_sc_contract__delete ( - /* contract_name */ 'portal_datasource' - ); - +drop function inline_0(); Index: openacs-4/packages/new-portal/sql/postgresql/defaults.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/defaults.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/defaults.sql 11 Jun 2002 04:18:08 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/defaults.sql 1 Jul 2002 20:03:25 -0000 1.3 @@ -1,80 +1,94 @@ -- +-- Copyright(C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal(arjun@openforce.net) +-- @version $Id$ -- - --- ampersands break if I don't do this. --- set scan off - --- Insert some default templates. create function inline_0 () returns integer as ' declare - layout_id portal_layouts.layout_id%TYPE; - theme_id portal_element_themes.theme_id%TYPE; + layout_id portal_layouts.layout_id%TYPE; + theme_id portal_element_themes.theme_id%TYPE; begin + -- two-column layout, without a header. + layout_id := portal_layout__new( + ''Simple 2-Column'', + ''A simple 2-column layout'', + ''layouts/simple2'', + ''layouts/components/simple2'' + ); --- two-column layout, without a header. - layout_id := portal_layout__new ( - /* name */ ''Simple 2-Column'', - /* description */ ''A simple 2-column layout'', - /* filename */ ''layouts/simple2'', - /* resource_dir */ ''layouts/components/simple2''); + -- the supported regions for that layout. + perform portal_layout__add_region(layout_id, ''1''); + perform portal_layout__add_region(layout_id, ''2''); --- the supported regions for that layout. - perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''1''); - perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''2''); + -- one-column layout, without a header. + layout_id := portal_layout__new( + ''Simple 1-Column'', + ''A simple 1-column layout'', + ''layouts/simple1'', + ''layouts/components/simple1'' + ); --- one-column layout, without a header. - layout_id := portal_layout__new ( - /* name */ ''Simple 1-Column'', - /* description */ ''A simple 1-column layout'', - /* filename */ ''layouts/simple1'', - /* resource_dir */ ''layouts/components/simple1''); + -- the supported regions for that layout. + perform portal_layout__add_region(layout_id, ''1''); --- the supported regions for that layout. - perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''1''); + -- same as above, only, three columns. + layout_id := portal_layout__new( + ''Simple 3-Column'', + ''A simple 3-column layout'', + ''layouts/simple3'', + ''layouts/components/simple3'' + ); --- same as above, only, three columns. - layout_id := portal_layout__new ( - /* name */ ''Simple 3-Column'', - /* description */ ''A simple 3-column layout'', - /* filename */ ''layouts/simple3'', - /* resource_dir */ ''layouts/components/simple3''); + perform portal_layout__add_region(layout_id, ''1''); + perform portal_layout__add_region(layout_id, ''2''); + perform portal_layout__add_region(layout_id, ''3''); - perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''1''); - perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''2''); - perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''3''); + -- Now, some element themes. + theme_id := portal_element_theme__new( + ''simple'', + ''A simple red table-based theme'', + ''themes/simple-theme'', + ''themes/simple-theme'' + ); --- Now, some element themes. + theme_id := portal_element_theme__new( + ''nada'', + ''The un-theme. No graphics.'', + ''themes/nada-theme'', + ''themes/nada-theme'' + ); - theme_id := portal_element_theme__new ( - /* name */ ''simple'', - /* description */ ''A simple red table-based theme'', - /* filename */ ''themes/simple-theme'', - /* resource_dir */ ''themes/simple-theme''); + theme_id := portal_element_theme__new( + ''deco'', + ''An Art Deco theme'', + ''themes/deco-theme'', + ''themes/deco-theme'' + ); - theme_id := portal_element_theme__new ( - /* name */ ''nada'', - /* description */ ''The un-theme. No graphics.'', - /* filename */ ''themes/nada-theme'', - /* resource_dir */ ''themes/nada-theme''); - - theme_id := portal_element_theme__new ( - /* name */ ''deco'', - /* description */ ''An Art Deco theme'', - /* filename */ ''themes/deco-theme'', - /* resource_dir */ ''themes/deco-theme''); - return 0; end;' language 'plpgsql'; -select inline_0 (); -drop function inline_0 (); +select inline_0(); + +drop function inline_0(); Index: openacs-4/packages/new-portal/sql/postgresql/objects-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/objects-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/objects-create.sql 29 Mar 2002 17:02:45 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/objects-create.sql 1 Jul 2002 20:03:25 -0000 1.2 @@ -1,311 +1,318 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- arjun@openforce.net --- $Id$ +-- @author arjun@openforce.net +-- @version $Id$ -- datasources +select acs_object_type__create_type ( + 'portal_datasource', + 'Portal Data Source', + 'Portal Data Sources', + 'acs_object', + 'PORTAL_DATASOURCES', + 'DATASOURCE_ID', + 'portal_datasource', + 'f', + null, + null +); -select acs_object_type__create_type ( - /* object_type */ 'portal_datasource', - /* pretty_name */ 'Portal Data Source', - /* pretty_plural */ 'Portal Data Sources', - /* supertype */ 'acs_object', - /* table_name */ 'PORTAL_DATASOURCES', - /* id_column */ 'DATASOURCE_ID', - /* package_name */ 'portal_datasource', - /* abstract_p */ 'f', - /* type_extension_table */ null, - /* name_method */ null - ); - -- datasource attributes +select acs_attribute__create_attribute ( + 'portal_datasource', + 'NAME', + 'string', + 'Name', + 'Names', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_datasource', - /* attribute_name */ 'NAME', - /* datatype */ 'string', - /* pretty_name */ 'Name', - /* pretty_plural */ 'Names', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_datasource', + 'DESCRIPTION', + 'string', + 'Description', + 'Descriptions', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_datasource', - /* attribute_name */ 'DESCRIPTION', - /* datatype */ 'string', - /* pretty_name */ 'Description', - /* pretty_plural */ 'Descriptions', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_datasource', + 'CONTENT', + 'string', + 'Content', + 'Contents', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_datasource', - /* attribute_name */ 'CONTENT', - /* datatype */ 'string', - /* pretty_name */ 'Content', - /* pretty_plural */ 'Contents', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); - - - -- portal_layouts - select acs_object_type__create_type ( - /* object_type */ 'portal_layout', - /* pretty_name */ 'Portal Layout', - /* pretty_plural */ 'Portal Layouts', - /* supertype */ 'acs_object', - /* table_name */ 'PORTAL_LAYOUTS', - /* id_column */ 'LAYOUT_ID', - /* package_name */ 'portal_layout', - /* abstract_p */ 'f', - /* type_extension_table */ null, - /* name_method */ null - ); + 'portal_layout', + 'Portal Layout', + 'Portal Layouts', + 'acs_object', + 'PORTAL_LAYOUTS', + 'LAYOUT_ID', + 'portal_layout', + 'f', + null, + null +); - -- and its attributes -select acs_attribute__create_attribute ( - /* object_type */ 'portal_layout', - /* attribute_name */ 'NAME', - /* datatype */ 'string', - /* pretty_name */ 'Name', - /* pretty_plural */ 'Names', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_layout', + 'NAME', + 'string', + 'Name', + 'Names', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_layout', - /* attribute_name */ 'DESCRIPTION', - /* datatype */ 'string', - /* pretty_name */ 'Description', - /* pretty_plural */ 'Descriptions', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_layout', + 'DESCRIPTION', + 'string', + 'Description', + 'Descriptions', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_layout', - /* attribute_name */ 'TYPE', - /* datatype */ 'string', - /* pretty_name */ 'Type', - /* pretty_plural */ 'Types', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_layout', + 'TYPE', + 'string', + 'Type', + 'Types', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); select acs_attribute__create_attribute ( - /* object_type */ 'portal_layout', - /* attribute_name */ 'FILENAME', - /* datatype */ 'string', - /* pretty_name */ 'Filename', - /* pretty_plural */ 'Filenames', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); + 'portal_layout', + 'FILENAME', + 'string', + 'Filename', + 'Filenames', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); select acs_attribute__create_attribute ( - /* object_type */ 'portal_layout', - /* attribute_name */ 'resource_dir', - /* datatype */ 'string', - /* pretty_name */ 'Resource Directory', - /* pretty_plural */ 'Resource Directory', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); + 'portal_layout', + 'resource_dir', + 'string', + 'Resource Directory', + 'Resource Directory', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); --- portal_element_themes +-- portal_element_themes select acs_object_type__create_type ( - /* object_type */ 'portal_element_theme', - /* pretty_name */ 'Portal Element Theme', - /* pretty_plural */ 'Portal Element Themes', - /* supertype */ 'acs_object', - /* table_name */ 'PORTAL_THEMES', - /* id_column */ 'THEME_ID', - /* package_name */ 'portal_themes', - /* abstract_p */ 'f', - /* type_extension_table */ null, - /* name_method */ null - ); + 'portal_element_theme', + 'Portal Element Theme', + 'Portal Element Themes', + 'acs_object', + 'PORTAL_THEMES', + 'THEME_ID', + 'portal_themes', + 'f', + null, + null +); -- and its attributes -select acs_attribute__create_attribute ( - /* object_type */ 'portal_element_theme', - /* attribute_name */ 'NAME', - /* datatype */ 'string', - /* pretty_name */ 'Name', - /* pretty_plural */ 'Names', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_element_theme', + 'NAME', + 'string', + 'Name', + 'Names', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_element_theme', - /* attribute_name */ 'DESCRIPTION', - /* datatype */ 'string', - /* pretty_name */ 'Description', - /* pretty_plural */ 'Descriptions', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_element_theme', + 'DESCRIPTION', + 'string', + 'Description', + 'Descriptions', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal_element_theme', - /* attribute_name */ 'TYPE', - /* datatype */ 'string', - /* pretty_name */ 'Type', - /* pretty_plural */ 'Types', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); +select acs_attribute__create_attribute ( + 'portal_element_theme', + 'TYPE', + 'string', + 'Type', + 'Types', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); select acs_attribute__create_attribute ( - /* object_type */ 'portal_element_theme', - /* attribute_name */ 'FILENAME', - /* datatype */ 'string', - /* pretty_name */ 'Filename', - /* pretty_plural */ 'Filenames', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); + 'portal_element_theme', + 'FILENAME', + 'string', + 'Filename', + 'Filenames', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); select acs_attribute__create_attribute ( - /* object_type */ 'portal_element_theme', - /* attribute_name */ 'resource_dir', - /* datatype */ 'string', - /* pretty_name */ 'Resource Directory', - /* pretty_plural */ 'Resource Directory', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); + 'portal_element_theme', + 'resource_dir', + 'string', + 'Resource Directory', + 'Resource Directory', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); +-- portal +select acs_object_type__create_type ( + 'portal', + 'Portal', + 'Portals', + 'acs_object', + 'PORTALS', + 'PORTAL_ID', + 'portal', + 'f', + null, + null +); --- portal -select acs_object_type__create_type ( - /* object_type */ 'portal', - /* pretty_name */ 'Portal', - /* pretty_plural */ 'Portals', - /* supertype */ 'acs_object', - /* table_name */ 'PORTALS', - /* id_column */ 'PORTAL_ID', - /* package_name */ 'portal', - /* abstract_p */ 'f', - /* type_extension_table */ null, - /* name_method */ null - ); +select acs_attribute__create_attribute ( + 'portal', + 'NAME', + 'string', + 'Name', + 'Names', + null, + null, + null, + 1, + 1, + null, + 'type_specific', + 'f' +); -select acs_attribute__create_attribute ( - /* object_type */ 'portal', - /* attribute_name */ 'NAME', - /* datatype */ 'string', - /* pretty_name */ 'Name', - /* pretty_plural */ 'Names', - /* table_name */ null, - /* column_name */ null, - /* default_value */ null, - /* mix_n_values */ 1, - /* max_n_values */ 1, - /* sort_order */ null, - /* storage */ 'type_specific', - /* static_p */ 'f' - ); - - --- portal_page -select acs_object_type__create_type ( - /* object_type */ 'portal_page', - /* pretty_name */ 'Portal Page', - /* pretty_plural */ 'Portal Pages', - /* supertype */ 'acs_object', - /* table_name */ 'PORTAL_PAGES', - /* id_column */ 'page_id', - /* package_name */ 'portal_page', - /* abstract_p */ 'f', - /* type_extension_table */ null, - /* name_method */ null - ); +-- portal_page +select acs_object_type__create_type ( + 'portal_page', + 'Portal Page', + 'Portal Pages', + 'acs_object', + 'PORTAL_PAGES', + 'page_id', + 'portal_page', + 'f', + null, + null +); Index: openacs-4/packages/new-portal/sql/postgresql/objects-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/objects-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/objects-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/objects-drop.sql 1 Jul 2002 20:03:25 -0000 1.2 @@ -1,32 +1,46 @@ -- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- @author Arjun Sanyal (arjun@openforce.net) +-- @version $Id$ -- -- XXX - FIX ME Do this the "right way" -delete from acs_permissions where object_id in ( - (select object_id from acs_objects where object_type in ( - 'portal', 'portal_element_theme','portal_layout', 'portal_datasource' - )) -); +delete +from acs_permissions +where object_id in (select object_id + from acs_objects + where object_type in ('portal_page', 'portal', 'portal_element_theme','portal_layout', 'portal_datasource')); -delete from acs_permissions where object_id in ( - (select package_id from apm_packages where package_key = 'portal') -); +delete +from acs_permissions +where object_id in (select package_id + from apm_packages + where package_key = 'portal'); -delete from acs_objects where object_type in ( - 'portal', 'portal_element_theme','portal_layout', 'portal_datasource' -); +delete +from acs_objects +where object_type in ('portal_page', 'portal', 'portal_element_theme','portal_layout', 'portal_datasource'); - -select acs_object_type__drop_type('portal_page','f'); select acs_object_type__drop_type('portal','f'); -select acs_object_type__drop_type('portal_element_theme','f'); -select acs_object_type__drop_type('portal_layout','f'); -select acs_object_type__drop_type('portal_datasource','f'); - +select acs_object_type__drop_type('portal_page','f'); +select acs_object_type__drop_type('portal_element_theme','f'); +select acs_object_type__drop_type('portal_layout','f'); +select acs_object_type__drop_type('portal_datasource','f'); Index: openacs-4/packages/new-portal/sql/postgresql/portal-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/portal-core-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/portal-core-create.sql 24 May 2002 01:58:46 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/portal-core-create.sql 1 Jul 2002 20:03:25 -0000 1.3 @@ -1,269 +1,293 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + +-- -- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- arjun@openforce.net --- $Id$ +-- @author arjun@openforce.net +-- @version $Id$ +-- --- **** PRIVILEGES **** +select acs_privilege__create_privilege('portal_create_portal'); +select acs_privilege__create_privilege('portal_delete_portal'); +select acs_privilege__create_privilege('portal_read_portal'); +select acs_privilege__create_privilege('portal_edit_portal'); +select acs_privilege__create_privilege('portal_admin_portal'); +select acs_privilege__add_child('read','portal_read_portal'); +select acs_privilege__add_child('portal_edit_portal','portal_read_portal'); +select acs_privilege__add_child('portal_admin_portal','portal_edit_portal'); +select acs_privilege__add_child('create','portal_create_portal'); +select acs_privilege__add_child('delete','portal_delete_portal'); +select acs_privilege__add_child('admin','portal_admin_portal'); - -- multi portal admin privs - select acs_privilege__create_privilege('portal_create_portal'); - select acs_privilege__create_privilege('portal_delete_portal'); - - -- privs on a single portal - select acs_privilege__create_privilege('portal_read_portal'); - - select acs_privilege__create_privilege('portal_edit_portal'); - - select acs_privilege__create_privilege('portal_admin_portal'); - - -- set up the portal perms hierarchy - -- and root privs to global priv names - select acs_privilege__add_child('read','portal_read_portal'); - select acs_privilege__add_child('portal_edit_portal','portal_read_portal'); - select acs_privilege__add_child('portal_admin_portal','portal_edit_portal'); - select acs_privilege__add_child('create','portal_create_portal'); - select acs_privilege__add_child('delete','portal_delete_portal'); - select acs_privilege__add_child('admin','portal_admin_portal'); - - - --- **** DATASOURCES **** - create table portal_datasources ( - datasource_id integer - constraint p_datasources_datasource_id_fk - references acs_objects(object_id) - constraint p_datasources_datasource_id_pk - primary key, - description varchar(200), - name varchar(200) not null, - pretty_name varchar(200) + datasource_id integer + constraint p_datasources_datasource_id_fk + references acs_objects (object_id) + constraint p_datasources_datasource_id_pk + primary key, + description varchar(200), + name varchar(200) + constraint p_datasources_name_nn + not null, + pretty_name varchar(200) ); - -- A default configuration for a ds will be stored here, to be copied -- to the portal_element_parameters table at PE creation (DS binding) time --- +-- -- Config semantics: -- true: cfg_req, cfg_p - A static config is given for all PEs, can --- be changed later +-- be changed later -- true: cfg_req false: cfg_p - PE must be configured before use -- false: cfg_req true: cfg_p - An optional default cfg given -- both false: Configuration optional w. no default suggested create table portal_datasource_def_params ( - parameter_id integer - constraint p_ds_def_prms_prm_id_pk - primary key, - datasource_id integer - constraint p_ds_def_prms_element_id_fk - references portal_datasources on delete cascade - not null, - config_required_p char(1) default 'f' - constraint p_ds_def_prms_cfg_req_p_ck - check(config_required_p in ('t', 'f')), - configured_p char(1) default 'f' - constraint p_ds_def_prms_configured_p_ck - check(configured_p in ('t', 'f')), - key varchar(200) not null, - value varchar(200) + parameter_id integer + constraint p_ds_def_prms_prm_id_pk + primary key, + datasource_id integer + constraint p_ds_def_prms_element_id_fk + references portal_datasources (datasource_id) + on delete cascade + constraint p_ds_def_prms_element_id_nn + not null, + config_required_p char(1) + default 'f' + constraint p_ds_def_prms_cfg_req_p_nn + not null + constraint p_ds_def_prms_cfg_req_p_ck + check (config_required_p in ('t', 'f')), + configured_p char(1) + default 'f' + constraint p_ds_def_prms_configured_p_nn + not null + constraint p_ds_def_prms_configured_p_ck + check (configured_p in ('t', 'f')), + key varchar(200) + not null, + value varchar(200) ); - --- **** Portal Layouts **** - -- Layouts are the template for the portal page. i.e. 2 cols, 3 cols, -- etc. They are globally available. No secret layouts! create table portal_layouts ( - layout_id integer - constraint p_layouts_layout_id_fk - references acs_objects(object_id) - constraint p_layouts_layout_id_pk - primary key, - name varchar(200) - constraint p_layouts_name_un - unique - not null, - description varchar(200), - filename varchar(200), - resource_dir varchar(200) + layout_id integer + constraint p_layouts_layout_id_fk + references acs_objects (object_id) + constraint p_layouts_layout_id_pk + primary key, + name varchar(200) + constraint p_layouts_name_un + unique + constraint p_layouts_name_nn + not null, + description varchar(200), + filename varchar(200), + resource_dir varchar(200) ); create table portal_supported_regions ( - layout_id integer - constraint p_spprtd_rgns_layout_id_fk - references portal_layouts - on delete cascade - not null, - region varchar(20) not null, - immutable_p char(1) not null - constraint p_spprtd_rgns_immtble_p_ck - check(immutable_p in ('t', 'f')), - constraint p_spprtd_rgns_tmpl_id_rgn_pk - primary key (layout_id,region) + layout_id integer + constraint p_spprtd_rgns_layout_id_fk + references portal_layouts (layout_id) + on delete cascade + constraint p_spprtd_rgns_layout_id_nn + not null, + region varchar(20) + constraint p_spprtd_rgns_immtble_p_nn + not null, + immutable_p char(1) + constraint p_spprtd_rgns_immtble_p_nn + not null + constraint p_spprtd_rgns_immtble_p_ck + check (immutable_p in ('t', 'f')), + constraint portal_supported_regions_pk + primary key (layout_id, region) ); - --- **** Portal Element Themes **** - -- 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_element_themes ( - theme_id integer - constraint p_e_themes_theme_id_fk - references acs_objects(object_id) - constraint p_e_themes_theme_id_pk - primary key, - name varchar(200) - constraint p_e_themes_name_un - unique - not null, - description varchar(200), - filename varchar(200), - resource_dir varchar(200) + theme_id integer + constraint p_e_themes_theme_id_fk + references acs_objects (object_id) + constraint p_e_themes_theme_id_pk + primary key, + name varchar(200) + constraint p_e_themes_name_un + unique + constraint p_e_themes_name_nn + not null, + description varchar(200), + filename varchar(200), + resource_dir varchar(200) ); - --- **** Portals **** - -- Portals are essentially "containers" for PEs that bind to DSs. --- Parties have, optionally have portals --- Restrict to party check? --- Roles and perms issues? +-- Parties have, optionally have portals +-- Restrict to party check? +-- Roles and perms issues? create table portals ( - portal_id integer - constraint portal_portal_id_fk - references acs_objects(object_id) - constraint p_portal_id_pk - primary key, - name varchar(200) default 'Untitled' not null, - theme_id integer - constraint portal_theme_id_fk - references portal_element_themes - not null, - -- AKS this is out of date!! is this portal a portal template? - portal_template_p char(1) default 'f' - constraint p_portal_template_p_ck - check(portal_template_p in ('f', 't')), - -- Not null, if I have a template - template_id integer - constraint portal_template_id_fk - references portals + portal_id integer + constraint portal_portal_id_fk + references acs_objects (object_id) + constraint p_portal_id_pk + primary key, + name varchar(200) + default 'Untitled' + constraint portal_name_nn + not null, + theme_id integer + constraint portal_theme_id_fk + references portal_element_themes (theme_id) + constraint portal_theme_id_nn + not null, + template_id integer + constraint portal_template_id_fk + references portals (portal_id) ); --- **** (Portal) Pages **** -- Support for multi-page portals (think my.yahoo.com) create table portal_pages ( - page_id integer - constraint portal_pages_page_id_fk - references acs_objects(object_id) - constraint portal_pages_page_id_pk - primary key, - pretty_name varchar(200) default 'Untitled Page' not null, - portal_id integer - constraint portal_pages_portal_id_fk - references portals - not null, - layout_id integer - constraint portal_pages_layout_id_fk - references portal_layouts - not null, - sort_key integer not null, - -- Two pages on one portal canot have the same sort key - constraint portal_pages_srt_key_un - unique(portal_id,sort_key) + page_id integer + constraint portal_pages_page_id_fk + references acs_objects (object_id) + constraint portal_pages_page_id_pk + primary key, + pretty_name varchar(200) + default 'Untitled Page' + constraint portal_pages_pretty_name_nn + not null, + portal_id integer + constraint portal_pages_portal_id_fk + references portals (portal_id) + constraint portal_pages_portal_id_nn + not null, + layout_id integer + constraint portal_pages_layout_id_fk + references portal_layouts (layout_id) + constraint portal_pages_layout_id_nn + not null, + sort_key integer + constraint portal_pages_sort_key_nn + not null, + constraint portal_pages_srt_key_un + unique (portal_id, sort_key) ); --- **** Portal Elements (PEs) **** +create index portal_pages_prtl_page_idx on portal_pages (portal_id, page_id); - -- 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. +-- 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. --- this sequence is only used for swapping sort keys so that we --- don't abuse the acs_object_id_seq - create sequence portal_element_map_sk_seq; - create table portal_element_map ( - element_id integer - constraint p_element_map_element_id_pk - primary key, - name varchar(200) not null, - pretty_name varchar(200) not null, - page_id integer - constraint p_element_map_page_id_fk - references portal_pages - on delete cascade - not null, - datasource_id integer - constraint p_element_map_datasource_id_fk - references portal_datasources - on delete cascade - not null, - region varchar(20) not null, - sort_key integer not null, - state varchar(6) default 'full' - constraint p_element_map_state - check(state in ('full', 'shaded', 'hidden', - 'pinned')), - -- Two elements may not exist in the same place on a portal. - constraint p_element_map_pid_rgn_srt_un - unique(page_id,region,sort_key), - -- Two elements may not have the same pretty name on a portal. - constraint p_element_map_pid_name_un - unique(page_id,pretty_name) + element_id integer + constraint portal_element_map_pk + primary key, + name varchar(200) + constraint p_element_map_name_nn + not null, + pretty_name varchar(200) + constraint p_element_map_pretty_name_nn + not null, + page_id integer + constraint p_element_map_page_id_fk + references portal_pages + on delete cascade + constraint p_element_map_page_id_nn + not null, + datasource_id integer + constraint p_element_map_datasource_id_fk + references portal_datasources (datasource_id) + on delete cascade + constraint p_element_map_datasource_id_nn + not null, + region varchar(20) + constraint p_element_map_region_nn + not null, + sort_key integer + constraint p_element_map_sort_key_nn + not null, + state varchar(6) + default 'full' + constraint p_element_map_state_ck + check (state in ('full', 'shaded', 'hidden', 'pinned')), + constraint p_element_map_pid_name_un + unique (page_id, pretty_name) ); create table portal_element_parameters ( - parameter_id integer - constraint p_element_prms_prm_id_pk - primary key, - element_id integer - constraint p_element_prms_element_id_fk - references portal_element_map on delete cascade - not null, - config_required_p char(1) default 'f' - constraint p_element_prms_cfg_req_p_ck - check(config_required_p in ('t', 'f')), - configured_p char(1) default 'f' - constraint p_element_prms_configured_p_ck - check(configured_p in ('t', 'f')), - key varchar(50) not null, - value varchar(200) + parameter_id integer + constraint portal_element_parameters_pk + primary key, + element_id integer + constraint p_element_prms_element_id_fk + references portal_element_map (element_id) + on delete cascade + constraint p_element_prms_element_id_nn + not null, + config_required_p char(1) + default 'f' + constraint p_element_prms_cfg_req_p_nn + not null + constraint p_element_prms_cfg_req_p_ck + check (config_required_p in ('t', 'f')), + configured_p char(1) + default 'f' + constraint p_element_prms_configured_p_nn + not null + constraint p_element_prms_configured_p_ck + check (configured_p in ('t', 'f')), + key varchar(50) + constraint p_element_prms_key_nn + not null, + value varchar(200) ); +create index p_element_prms_element_key_idx on portal_element_parameters (element_id, key); -- This table maps the datasources that are available for portals to -- bind to (i.e. creating a PE). This table is required since some DSs -- will not make sense for every portal. A "current time" DS will make -- sense for every portal, but a bboard DS may not, and we don't want -- to confuse everyone with DSs that don't make sense for the given -- portal - create table portal_datasource_avail_map ( - portal_datasource_id integer - constraint p_ds_a_map_p_ds_id_pk - primary key, - portal_id integer - constraint p_ds_a_map_portal_id_fk - references portals on delete cascade - not null, - datasource_id integer - constraint p_ds_a_map_datasource_id_fk - references portal_datasources - on delete cascade - not null, - -- DSs are unique per-portal - constraint p_ds_a_map_pid_ds_un - unique(portal_id,datasource_id) + portal_datasource_id integer + constraint portal_datasource_avail_map_pk + primary key, + portal_id integer + constraint p_ds_a_map_portal_id_fk + references portals (portal_id) + on delete cascade + constraint p_ds_a_map_portal_id_nn + not null, + datasource_id integer + constraint p_ds_a_map_datasource_id_fk + references portal_datasources (datasource_id) + on delete cascade + constraint p_ds_a_map_datasource_id_nn + not null, + constraint p_ds_a_map_pid_ds_un unique (portal_id, datasource_id) ); - - Index: openacs-4/packages/new-portal/sql/postgresql/portal-core-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/portal-core-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/portal-core-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/portal-core-drop.sql 1 Jul 2002 20:03:25 -0000 1.2 @@ -1,13 +1,26 @@ --- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 -- --- arjun@openforce.net +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- 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 foreign key more +-- details. +-- + -- --- $Id$ +-- The New Portal Package +-- +-- @author arjun@openforce.net +-- @version $Id$ +-- --- Reverse order from the creation script - drop sequence portal_element_map_sk_seq; drop table portal_datasource_avail_map; @@ -21,18 +34,14 @@ drop table portal_datasource_def_params; drop table portal_datasources; - select acs_privilege__remove_child('read','portal_read_portal'); - select acs_privilege__remove_child('portal_edit_portal','portal_read_portal'); - select acs_privilege__remove_child('portal_admin_portal','portal_edit_portal'); - select acs_privilege__remove_child('create','portal_create_portal'); - select acs_privilege__remove_child('delete','portal_delete_portal'); - select acs_privilege__remove_child('admin','portal_admin_portal'); - - select acs_privilege__drop_privilege('portal_create_portal'); - select acs_privilege__drop_privilege('portal_delete_portal'); - select acs_privilege__drop_privilege('portal_read_portal'); - select acs_privilege__drop_privilege('portal_edit_portal'); - select acs_privilege__drop_privilege('portal_admin_portal'); - - - +select acs_privilege__remove_child('read','portal_read_portal'); +select acs_privilege__remove_child('portal_edit_portal','portal_read_portal'); +select acs_privilege__remove_child('portal_admin_portal','portal_edit_portal'); +select acs_privilege__remove_child('create','portal_create_portal'); +select acs_privilege__remove_child('delete','portal_delete_portal'); +select acs_privilege__remove_child('admin','portal_admin_portal'); +select acs_privilege__drop_privilege('portal_create_portal'); +select acs_privilege__drop_privilege('portal_delete_portal'); +select acs_privilege__drop_privilege('portal_read_portal'); +select acs_privilege__drop_privilege('portal_edit_portal'); +select acs_privilege__drop_privilege('portal_admin_portal'); Index: openacs-4/packages/new-portal/sql/postgresql/portal-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/Attic/portal-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/portal-create.sql 16 Apr 2002 05:17:03 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/portal-create.sql 1 Jul 2002 20:03:25 -0000 1.3 @@ -1,16 +1,28 @@ -- --- The "New" Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 +-- Copyright (C) 2001, 2002 OpenForce, Inc. -- --- port to PG by Neophytos and Ben --- arjun@openforce.net --- $Id$ +-- 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 foreign key more +-- details. +-- + +-- +-- The "New" Portal Package +-- +-- @author arjun@openforce.net +-- @version $Id$ +-- \i portal-core-create.sql \i objects-create.sql \i api-create.sql \i datasource-sc-create.sql \i defaults.sql -\i portal-node-mapping-create.sql Index: openacs-4/packages/new-portal/sql/postgresql/portal-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/Attic/portal-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/portal-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/portal-drop.sql 1 Jul 2002 20:03:25 -0000 1.2 @@ -1,11 +1,26 @@ -- --- The New Portal Package --- copyright 2001, OpenForce, Inc. --- distributed under the GNU GPL v2 +-- Copyright (C) 2001, 2002 OpenForce, Inc. -- --- Arjun Sanyal (arjun@openforce.net) --- $Id$ +-- 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 foreign key more +-- details. +-- + +-- +-- The "New" Portal Package +-- +-- @author arjun@openforce.net +-- @version $Id$ +-- + \i datasource-sc-drop.sql \i api-drop.sql \i portal-core-drop.sql