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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/api-create.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,444 @@ +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: api-create.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ +-- +-- + +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'); + +create function portal_page__new (integer,varchar,integer,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; +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; + + 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; + + 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) +returns integer as ' +declare + p_page_id integer; +begin + delete from portal_pages where page_id = p_page_id; + 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,portal_template_p,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_portal_template_p alias for $5; + p_template_id alias for $6; + p_default_page_name alias for $7; + p_object_type alias for $8; + p_creation_date alias for $9; + p_creation_user alias for $10; + p_creation_ip alias for $11; + p_context_id alias for $12; + 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 + ); + + 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; + + insert into portals + (portal_id, name, theme_id, portal_template_p) + values (v_portal_id, p_name, v_theme_id, p_portal_template_p); + + -- 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 + -- we have to copy things like the template, theme form the + -- templateportal_template_p is false. no chained templates + select theme_id into v_theme_id + from portals + where portal_id = p_template_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); + + 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; + + + 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; +begin + for v_page in select page_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 + ); + end loop; + + perform acs_object__delete(p_portal_id); + + return 0; + +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; +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); + + 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; +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 + ); + + 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; +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; +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); + + 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; +begin + + 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; +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; +begin + 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; +begin + 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; +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 + ); + + + insert into portal_datasources + (datasource_id, name, description) + values + (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; +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; +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) + values + (v_parameter_id, p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + + return v_parameter_id; + +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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/api-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,16 @@ +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: api-drop.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ +-- +-- +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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,233 @@ +-- 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). +-- +-- arjun@openforce.net +-- started November, 2001 +-- +-- $Id: datasource-sc-create.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ + + select acs_sc_contract__new ( + /* contract_name */ 'portal_datasource', + /* contract_desc */ 'Portal Datasource interface' + ); + + -- Get my name - not to be confused with the pretty_name + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_datasource.MyName.InputType', + /* msg_type_spec */ '' + ); + + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_datasource.MyName.OutputType', + /* msg_type_spec */ 'my_name:string' + ); + + select acs_sc_operation__new ( + 'portal_datasource', + 'MyName', + 'Get the name', + 't', -- not cacheable + 0, -- n_args + 'portal_datasource.MyName.InputType', + 'portal_datasource.MyName.OutputType' + ); + + + + + -- Get a pretty name + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_datasource.GetPrettyName.InputType', + /* msg_type_spec */ '' + ); + + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_datasource.GetPrettyName.OutputType', + /* msg_type_spec */ 'pretty_name:string' + ); + + 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? + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_datasource.Link.InputType', + /* msg_type_spec */ '' + ); + + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_datasource.Link.OutputType', + /* msg_type_spec */ 'pretty_name:string' + ); + + 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' + ); + + + + -- 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' + ); + + 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' + ); + + + + -- Edit: the datasources' edit html + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_datasource.Edit.InputType', + /* msg_type_spec */ 'element_id:integer' + ); + + 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' + ); + + + + + -- 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' + ); + + + + + + -- Make self available + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_datasource.MakeSelfAvailable.InputType', + /* msg_type_spec */ 'portal_id:integer' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_datasource.MakeSelfAvailable.OutputType', + /* msg_type_spec */ '' + ); + + select acs_sc_operation__new ( + 'portal_datasource', + 'MakeSelfAvailable', + 'Makes this PE available to this portal page', + 'f', -- not cacheable + 1, -- n_args + 'portal_datasource.MakeSelfAvailable.InputType', + 'portal_datasource.MakeSelfAvailable.OutputType' + ); + + + + + + + -- Make self unavailable + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_datasource.MakeSelfUnavailable.InputType', + /* msg_type_spec */ 'portal_id:integer' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_datasource.MakeSelfUnavailable.OutputType', + /* msg_type_spec */ '' + ); + + select acs_sc_operation__new ( + 'portal_datasource', + 'MakeSelfUnavailable', + 'Makes this PE UNavailable to this portal page', + 'f', -- not cacheable + 1, -- n_args + 'portal_datasource.MakeSelfUnavailable.InputType', + 'portal_datasource.MakeSelfUnavailable.OutputType' + ); 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,153 @@ +-- 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). +-- +-- arjun@openforce.net +-- started November, 2001 +-- +-- $Id: datasource-sc-drop.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ + + -- drop MyName + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'MyName' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.MyName.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.MyName.OutputType' + ); + + -- drop GetPrettyName + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'GetPrettyName' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.GetPrettyName.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.GetPrettyName.OutputType' + ); + + + -- drop Link + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'Link' + ); + + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.Link.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.Link.OutputType' + ); + + + -- 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' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.AddSelfToPage.OutputType' + ); + + + -- Delete Show + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'Show' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.Show.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.Show.OutputType' + ); + + + -- Delete Edit + + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'Edit' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.Edit.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.Edit.OutputType' + ); + + + -- rem RemoveSelfFromPage + + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'RemoveSelfFromPage' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.RemoveSelfFromPage.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.RemoveSelfFromPage.OutputType' + ); + + + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'MakeSelfAvailable' + ); + + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.MakeSelfAvailable.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.MakeSelfAvailable.OutputType' + ); + + + -- rem MakeSelfUnavailable + + select acs_sc_operation__delete ( + /* contract_name */ 'portal_datasource', + /* operation_name */ 'MakeSelfUnavailable' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.MakeSelfUnavailable.InputType' + ); + + select acs_sc_msg_type__delete ( + /* msg_type_name */ 'portal_datasource.MakeSelfUnavailable.OutputType' + ); + + + -- drop the contract + select acs_sc_contract__delete ( + /* contract_name */ 'portal_datasource' + ); + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/defaults.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,92 @@ +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: defaults.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ +-- + + +-- 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; +begin + + +-- 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 */ 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 ( + /* 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 */ layout_id, /* region */ ''1''); + +-- 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 */ 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''); + +-- three columns with a header. + layout_id := portal_layout__new ( + /* name */ ''3-column w/ Header'', + /* description */ ''A 3-column layout with a header area.'', + /* filename */ ''layouts/header3'', + /* resource_dir */ ''layouts/components/header3''); + + 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''); + perform portal_layout__add_region (/* layout_id */ layout_id, /* region */ ''i1'', /* immutable_p */ ''t''); + +-- Now, some element themes. + + 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 ( + /* 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 (); 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/objects-create.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,311 @@ +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- arjun@openforce.net +-- $Id: objects-create.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ + +-- datasources + +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 ( + /* 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 ( + /* 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 ( + /* 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 + ); + + +-- 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 ( + /* 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 ( + /* 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 ( + /* 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' + ); + +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_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 + ); + +-- 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 ( + /* 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 ( + /* 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 ( + /* 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' + ); + +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 +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 ( + /* 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 + ); 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/objects-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,32 @@ +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: objects-drop.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ +-- + +-- 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 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' +); + + +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'); + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/portal-core-create.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,269 @@ +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- arjun@openforce.net +-- $Id: portal-core-create.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ + +-- **** PRIVILEGES **** + + -- 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) +); + + +-- 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 +-- 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) +); + + +-- **** 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) +); + +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) +); + + +-- **** 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) +); + + +-- **** Portals **** + +-- 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 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, + -- 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) 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) +); + +-- **** Portal Elements (PEs) **** + + +-- 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. + +-- 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) +); + +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) +); + + +-- 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) +); + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/portal-core-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,38 @@ +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- arjun@openforce.net +-- +-- $Id: portal-core-drop.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ + +-- Reverse order from the creation script + +drop sequence portal_element_map_sk_seq; + +drop table portal_datasource_avail_map; +drop table portal_element_parameters; +drop table portal_element_map; +drop table portal_pages; +drop table portals; +drop table portal_element_themes; +drop table portal_supported_regions; +drop table portal_layouts; +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'); + + + 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/portal-create.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,15 @@ +-- +-- The "New" Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- port to PG by Neophytos and Ben +-- arjun@openforce.net +-- $Id: portal-create.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ +-- + +\i portal-core-create.sql +\i objects-create.sql +\i api-create.sql +\i datasource-sc-create.sql +\i defaults.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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/portal-drop.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,12 @@ +-- +-- The New Portal Package +-- copyright 2001, OpenForce, Inc. +-- distributed under the GNU GPL v2 +-- +-- Arjun Sanyal (arjun@openforce.net) +-- $Id: portal-drop.sql,v 1.1 2002/03/29 17:02:45 ben Exp $ +-- +\i datasource-sc-drop.sql +\i api-drop.sql +\i portal-core-drop.sql +\i objects-drop.sql Index: openacs-4/packages/new-portal/sql/postgresql/portal-element-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/Attic/portal-element-sc-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/sql/postgresql/portal-element-sc-create.sql 29 Mar 2002 17:02:45 -0000 1.1 @@ -0,0 +1,167 @@ +-- 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). +-- +-- arjun@openforce.net +-- started November, 2001 +-- + + select acs_sc_contract__new ( + /* contract_name */ 'portal_datasource', + /* contract_desc */ 'Portal Datasource interface' + ); + + -- Get my name - not to be confused with the pretty_name + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_element.MyName.InputType', + /* msg_type_spec */ '' + ); + + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_element.MyName.OutputType', + /* msg_type_spec */ 'my_name:string' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'MyName', + 'Get the name', + 't', -- not cacheable + 0, -- n_args + 'portal_element.MyName.InputType', + 'portal_element.MyName.OutputType' + ); + + -- Get a pretty name + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_element.GetPrettyName.InputType', + /* msg_type_spec */ '' + ); + + select acs_sc_msg_type__new ( + /* msg_type_name */ 'portal_element.GetPrettyName.OutputType', + /* msg_type_spec */ 'pretty_name:string' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'GetPrettyName', + 'Get the pretty name', + 't', -- not cacheable + 0, -- n_args + 'portal_element.GetPrettyName.InputType', + 'portal_element.GetPrettyName.OutputType' + ); + + + -- Tell the portal element 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_element.AddSelfToPage.InputType', + /* msg_type_spec */ 'page_id:integer,instance_id:integer,args:string' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.AddSelfToPage.OutputType', + /* msg_type_spec */ 'element_id:integer' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'AddSelfToPage', + 'Tells the given portal element to add itself to the given page', + 'f', -- not cacheable + 3, -- n_args + 'portal_element.AddSelfToPage.InputType', + 'portal_element.AddSelfToPage.OutputType' + ); + + -- Show: the portal element's display proc + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.Show.InputType', + /* msg_type_spec */ 'cf:string' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.Show.OutputType', + /* msg_type_spec */ 'output:string' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'Show', + 'Render the portal element returning a chunk of HTML', + 'f', -- not cacheable + 1, -- n_args + 'portal_element.Show.InputType', + 'portal_element.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_element.RemoveSelfFromPage.InputType', + /* msg_type_spec */ 'page_id:integer,instance_id:integer' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.RemoveSelfFromPage.OutputType', + /* msg_type_spec */ '' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'RemoveSelfFromPage', + 'Tells the given portal element to remove itself from the given page', + 'f', -- not cacheable + 2, -- n_args + 'portal_element.RemoveSelfFromPage.InputType', + 'portal_element.RemoveSelfFromPage.OutputType' + ); + + + + -- Make self available + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.MakeSelfAvailable.InputType', + /* msg_type_spec */ 'portal_id:integer' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.MakeSelfAvailable.OutputType', + /* msg_type_spec */ '' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'MakeSelfAvailable', + 'Makes this PE available to this portal page', + 'f', -- not cacheable + 1, -- n_args + 'portal_element.MakeSelfAvailable.InputType', + 'portal_element.MakeSelfAvailable.OutputType' + ); + + -- Make self unavailable + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.MakeSelfUnavailable.InputType', + /* msg_type_spec */ 'portal_id:integer' + ); + + select acs_sc_msg_type__new( + /* msg_type_name */ 'portal_element.MakeSelfUnavailable.OutputType', + /* msg_type_spec */ '' + ); + + select acs_sc_operation__new ( + 'portal_element', + 'MakeSelfUnavailable', + 'Makes this PE UNavailable to this portal page', + 'f', -- not cacheable + 1, -- n_args + 'portal_element.MakeSelfAvailable.InputType', + 'portal_element.MakeSelfAvailable.OutputType' + ); Index: openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql 18 Feb 2002 20:53:42 -0000 1.10 +++ openacs-4/packages/new-portal/tcl/portal-procs-oracle.xql 29 Mar 2002 17:04:38 -0000 1.11 @@ -94,14 +94,6 @@ - - - select page_id as my_page_id - from portal_element_map - where element_id = :element_id - - - update portal_element_map Index: openacs-4/packages/new-portal/tcl/portal-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/new-portal/tcl/portal-procs-postgresql.xql 29 Mar 2002 17:04:38 -0000 1.1 @@ -0,0 +1,123 @@ + + + +oracle8.1.6 + + + + + begin + + :1 := portal__new ( + /* name */ :name, + /* layout_id */ :layout_id, + /* template_id */ :template_id, + /* portal_template_p */ :portal_template_p, + /* default_page_name */ :default_page_name, + /* theme_id */ :theme_id, + /* context_id */ :context_id + ); + + perform acs_permission__grant_permission ( + /* object_id */ :1, + /* grantee_id */ :user_id, + /* privilege */ 'portal_read_portal' + ); + + perform acs_permission__grant_permission ( + /* object_id */ :1, + /* grantee_id */ :user_id, + /* privilege */ 'portal_edit_portal' + ); + + if :portal_template_p = 't' then + acs_permission__grant_permission ( + /* object_id */ :1, + /* grantee_id */ :user_id, + /* privilege */ 'portal_admin_portal' + ); + end if; + + end; + + + + + + + select portal__delete (/* portal_id */ :portal_id); + + + + + + update portal_element_map + set region = :region, + page_id = :page_id, + sort_key = (select coalesce((select max(pem.sort_key) + 1 + from portal_element_map pem, portal_pages pp + where pp.portal_id = :portal_id + and pp.page_id = pem.page_id + and region = :region), + 1) + from dual) + where element_id = :element_id + + + + + + update portal_element_map + set page_id = :page_id, + region = :region, + sort_key = (select coalesce((select max(sort_key) + 1 + from portal_element_map + where page_id = :page_id + and region = :region), + 1) + from dual) + where element_id = :element_id + + + + + + insert into portal_element_map + (element_id, name, pretty_name, page_id, datasource_id, region, sort_key) + values + (:new_element_id, :ds_name, :ds_name, :page_id, :ds_id, :region, + coalesce((select max(sort_key) + 1 + from portal_element_map + where region = :region), 1)) + + + + + + update portal_element_map + set region = :target_region, + sort_key = (select coalesce((select max(pem.sort_key) + 1 + from portal_element_map pem, portal_pages pp + where pp.portal_id = :portal_id + and pp.page_id = pem.page_id + and region = :target_region), + 1) + from dual) + where element_id = :element_id + + + + + + + select portal_page__new ( + /* pretty_name */ :pretty_name, + /* portal_id */ :portal_id, + /* layout_id */ :layout_id + ); + + + + + + Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v diff -u -r1.121 -r1.122 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 12 Mar 2002 05:18:21 -0000 1.121 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 29 Mar 2002 17:04:38 -0000 1.122 @@ -764,11 +764,7 @@ } { set ad_dim_struct [list] - db_foreach list_page_nums_select { - select pretty_name, sort_key as page_num from portal_pages where - portal_id = :portal_id - order by sort_key - } { + db_foreach list_page_nums_select {} { lappend ad_dim_struct [list $page_num $pretty_name [list]] } @@ -1128,7 +1124,7 @@ # If user has no permissions to edit this portal, cancel out # some of the config parameters - set portal_id [db_string select_portal_id "select portal_id from portal_pages where page_id = (select page_id from portal_element_map where element_id= :element_id)"] + set portal_id [db_string select_portal_id {}] if {![ad_permission_p $portal_id portal_edit_portal]} { set config(shadeable_p) "f" Index: openacs-4/packages/new-portal/tcl/portal-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.xql,v diff -u -r1.18 -r1.19 --- openacs-4/packages/new-portal/tcl/portal-procs.xql 18 Feb 2002 21:21:06 -0000 1.18 +++ openacs-4/packages/new-portal/tcl/portal-procs.xql 29 Mar 2002 17:04:39 -0000 1.19 @@ -216,6 +216,14 @@ + + +select pretty_name, sort_key as page_num from portal_pages where +portal_id = :portal_id +order by sort_key + + + select region @@ -367,6 +375,14 @@ + + + select page_id as my_page_id + from portal_element_map + where element_id = :element_id + + + select value @@ -443,6 +459,12 @@ + + +select portal_id from portal_pages where page_id = (select page_id from portal_element_map where element_id= :element_id) + + + select pem.element_id,