Index: openacs-4/packages/new-portal/new-portal.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/new-portal.info,v diff -u -r1.37 -r1.38 --- openacs-4/packages/new-portal/new-portal.info 31 Oct 2011 00:50:15 -0000 1.37 +++ openacs-4/packages/new-portal/new-portal.info 1 Nov 2013 21:45:33 -0000 1.38 @@ -8,14 +8,14 @@ t portal - + OpenACS Portals. 2011-10-30 OpenACS New Portal Package aka NPP. Portals are used to aggregate content from different sources within a single page. Props to Ian Baker for "Portal". - + 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 -r1.17 -r1.18 --- openacs-4/packages/new-portal/sql/postgresql/api-create.sql 8 Nov 2010 07:23:38 -0000 1.17 +++ openacs-4/packages/new-portal/sql/postgresql/api-create.sql 1 Nov 2013 21:45:33 -0000 1.18 @@ -25,24 +25,30 @@ select define_function_args('portal_page__new','page_id,pretty_name,accesskey,portal_id,layout_id,hidden_p,object_type;portal_page,creation_date,creation_user,creation_ip,context_id'); -create function portal_page__new (integer,varchar,varchar,integer,integer,char,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_page_id alias for $1; - p_pretty_name alias for $2; - p_accesskey alias for $3; - p_portal_id alias for $4; - p_layout_id alias for $5; - p_hidden_p 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; + + +-- +-- procedure portal_page__new/11 +-- +CREATE OR REPLACE FUNCTION portal_page__new( + p_page_id integer, + p_pretty_name varchar, + p_accesskey varchar, + p_portal_id integer, + p_layout_id integer, + p_hidden_p char, + p_object_type varchar, -- default 'portal_page' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE 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 +BEGIN v_page_id := acs_object__new( null, @@ -51,7 +57,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_layout_id is null then @@ -74,19 +80,25 @@ return v_page_id; -end;' language 'plpgsql'; +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 alias for $1; + + +-- +-- procedure portal_page__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_page__delete( + p_page_id integer +) RETURNS integer AS $$ +DECLARE 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 +BEGIN -- IMPORTANT: sort keys MUST be an unbroken sequence from 0 to max(sort_key) @@ -128,25 +140,32 @@ return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select define_function_args('portal__new','portal_id,name,theme_id,layout_id,template_id,default_page_name,default_accesskey,object_type;portal,creation_date,creation_user,creation_ip,context_id'); -create or replace function portal__new (integer,varchar,integer,integer,integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_portal_id alias for $1; - p_name alias for $2; - p_theme_id alias for $3; - p_layout_id alias for $4; - p_template_id alias for $5; - p_default_page_name alias for $6; - p_default_accesskey 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; + + +-- +-- procedure portal__new/12 +-- +CREATE OR REPLACE FUNCTION portal__new( + p_portal_id integer, + p_name varchar, + p_theme_id integer, + p_layout_id integer, + p_template_id integer, + p_default_page_name varchar, + p_default_accesskey varchar, + p_object_type varchar, -- default 'portal' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE v_portal_id portals.portal_id%TYPE; v_theme_id portals.theme_id%TYPE; v_layout_id portal_layouts.layout_id%TYPE; @@ -156,7 +175,7 @@ v_param record; v_new_element_id integer; v_new_parameter_id integer; -begin +BEGIN v_portal_id := acs_object__new( p_portal_id, @@ -165,7 +184,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_template_id is null then @@ -199,8 +218,8 @@ p_default_accesskey, v_portal_id, v_layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -235,8 +254,8 @@ v_page.accesskey, v_portal_id, v_page.layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -249,7 +268,7 @@ where page_id = v_page.page_id loop - select nextval(''t_acs_object_id_seq'') + select nextval('t_acs_object_id_seq') into v_new_element_id from dual; @@ -266,7 +285,7 @@ where element_id = v_element.element_id loop - select nextval(''t_acs_object_id_seq'') + select nextval('t_acs_object_id_seq') into v_new_parameter_id from dual; @@ -287,16 +306,22 @@ return v_portal_id; -end;' language 'plpgsql'; +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; + + +-- +-- procedure portal__delete/1 +-- +CREATE OR REPLACE FUNCTION portal__delete( + p_portal_id integer +) RETURNS integer AS $$ +DECLARE v_page record; -begin +BEGIN for v_page in select page_id from portal_pages @@ -309,25 +334,32 @@ return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; 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,timestamptz,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; + + +-- +-- procedure portal_element_theme__new/10 +-- +CREATE OR REPLACE FUNCTION portal_element_theme__new( + p_theme_id integer, + p_name varchar, + p_description varchar, + p_filename varchar, + p_resource_dir varchar, + p_object_type varchar, -- default 'portal_element_theme' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE v_theme_id portal_element_themes.theme_id%TYPE; -begin +BEGIN v_theme_id := acs_object__new( p_theme_id, @@ -336,7 +368,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); insert @@ -347,25 +379,34 @@ return v_theme_id; -end;' language 'plpgsql'; +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; + + +-- +-- procedure portal_element_theme__new/4 +-- +CREATE OR REPLACE FUNCTION portal_element_theme__new( + p_name varchar, + p_description varchar, + p_filename varchar, + p_resource_dir varchar +) RETURNS integer AS $$ +-- +-- portal_element_theme__new/4 maybe obsolete, when we define proper defaults for /10 +-- +DECLARE v_theme_id portal_element_themes.theme_id%TYPE; -begin +BEGIN v_theme_id := portal_element_theme__new( null, p_name, p_description, p_filename, p_resource_dir, - ''portal_element_theme'', + 'portal_element_theme', now(), null, null, @@ -374,37 +415,50 @@ return v_theme_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select define_function_args('portal_element_theme__delete','theme_id'); -create or replace function portal_element_theme__delete (integer) -returns integer as ' -declare - p_theme_id alias for $1; -begin + + +-- +-- procedure portal_element_theme__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_element_theme__delete( + p_theme_id integer +) RETURNS integer AS $$ +DECLARE +BEGIN PERFORM acs_object__delete(p_theme_id); return (0); -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; 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,timestamptz,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; + + +-- +-- procedure portal_layout__new/10 +-- +CREATE OR REPLACE FUNCTION portal_layout__new( + p_layout_id integer, + p_name varchar, + p_description varchar, + p_filename varchar, + p_resource_dir varchar, + p_object_type varchar, -- default 'portal_layout' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE v_layout_id portal_layouts.layout_id%TYPE; -begin +BEGIN v_layout_id := acs_object__new( p_layout_id, @@ -413,7 +467,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); insert into portal_layouts @@ -423,25 +477,34 @@ return v_layout_id; -end;' language 'plpgsql'; +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; + + +-- +-- procedure portal_layout__new/4 +-- +CREATE OR REPLACE FUNCTION portal_layout__new( + p_name varchar, + p_description varchar, + p_filename varchar, + p_resource_dir varchar +) RETURNS integer AS $$ +-- +-- portal_layout__new/4 maybe obsolete, when we define proper defaults for /10 +-- +DECLARE v_layout_id portal_layouts.layout_id%TYPE; -begin +BEGIN v_layout_id := portal_layout__new( null, p_name, p_description, p_filename, p_resource_dir, - ''portal_layout'', + 'portal_layout', now(), null, null, @@ -450,68 +513,101 @@ return v_layout_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select define_function_args('portal_layout__delete','layout_id'); -create or replace function portal_layout__delete(integer) -returns integer as ' -declare - p_layout_id alias for $1; -begin + + +-- +-- procedure portal_layout__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_layout__delete( + p_layout_id integer +) RETURNS integer AS $$ +DECLARE +BEGIN perform acs_object__delete(layout_id); return 0; -end;' language 'plpgsql'; +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 + + +-- +-- procedure portal_layout__add_region/3 +-- +CREATE OR REPLACE FUNCTION portal_layout__add_region( + p_layout_id integer, + p_region varchar, + p_immutable_p char -- default 'f' + +) RETURNS integer AS $$ +DECLARE +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'; +END; +$$ LANGUAGE plpgsql; -create function portal_layout__add_region (integer,varchar) -returns integer as ' -declare - p_layout_id alias for $1; - p_region alias for $2; -begin + + +-- +-- procedure portal_layout__add_region/2 +-- +CREATE OR REPLACE FUNCTION portal_layout__add_region( + p_layout_id integer, + p_region varchar +) RETURNS integer AS $$ +-- +-- portal_layout__add_region/2 maybe obsolete, when we define proper defaults for /3 +-- +DECLARE +BEGIN insert into portal_supported_regions (layout_id, region, immutable_p) values - (p_layout_id, p_region, ''f''); + (p_layout_id, p_region, 'f'); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -select define_function_args('portal_datasource__new','datasource_id,name,description,css_dir,object_type;portal_datasource,creation_date,creation_user,creation_ip,context_id'); -create function portal_datasource__new (integer,varchar,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_datasource_id alias for $1; -- default null - p_name alias for $2; -- default null - p_description alias for $3; -- default null - p_css_dir alias for $4; - p_object_type alias for $5; -- default ''portal_datasource'' - p_creation_date alias for $6; -- default now() - p_creation_user alias for $7; -- default null - p_creation_ip alias for $8; -- default null - p_context_id alias for $9; -- default null +-- old define_function_args('portal_datasource__new','datasource_id,name,description,css_dir,object_type;portal_datasource,creation_date,creation_user,creation_ip,context_id') +-- new +select define_function_args('portal_datasource__new','datasource_id;null,name;null,description;null,css_dir,object_type;portal_datasource,creation_date;now(),creation_user;null,creation_ip;null,context_id;null'); + + + + +-- +-- procedure portal_datasource__new/9 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_datasource_id integer, -- default null + p_name varchar, -- default null + p_description varchar, -- default null + p_css_dir varchar, + p_object_type varchar, -- default 'portal_datasource' + p_creation_date timestamptz, -- default now() + p_creation_user integer, -- default null + p_creation_ip varchar, -- default null + p_context_id integer -- default null + +) RETURNS integer AS $$ +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := acs_object__new( p_datasource_id, @@ -520,7 +616,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); insert into portal_datasources @@ -530,21 +626,31 @@ return v_datasource_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create function portal_datasource__new (integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_datasource_id alias for $1; -- default null - p_name alias for $2; -- default null - p_description alias for $3; -- default null - p_object_type alias for $4; -- default ''portal_datasource'' - p_creation_date alias for $5; -- default now() - p_creation_user alias for $6; -- default null - p_creation_ip alias for $7; -- default null - p_context_id alias for $8; -- default null + + +-- +-- procedure portal_datasource__new/8 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_datasource_id integer, -- default null + p_name varchar, -- default null + p_description varchar, -- default null + p_object_type varchar, -- default 'portal_datasource' + p_creation_date timestamptz, -- default now() + p_creation_user integer, -- default null + p_creation_ip varchar, -- default null + p_context_id integer -- default null + +) RETURNS integer AS $$ +-- +-- portal_datasource__new/8 maybe obsolete, when we define proper defaults for /9 +-- +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := portal_datasource__new(null, p_name, @@ -558,82 +664,115 @@ return v_datasource_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create function portal_datasource__new (varchar,varchar) -returns integer as ' -declare - p_name alias for $1; -- default null - p_description alias for $2; -- default null + + +-- +-- procedure portal_datasource__new/2 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_name varchar, -- default null + p_description varchar -- default null + +) RETURNS integer AS $$ +-- +-- portal_datasource__new/2 maybe obsolete, when we define proper defaults for /9 +-- +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := portal_datasource__new(null, p_name, p_description, null, - ''portal_datasource'', + 'portal_datasource', now(), null, null, null); return v_datasource_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create function portal_datasource__new (varchar,varchar,varchar) -returns integer as ' -declare - p_name alias for $1; -- default null - p_description alias for $2; -- default null - p_css_dir alias for $3; + + +-- +-- procedure portal_datasource__new/3 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_name varchar, -- default null + p_description varchar, -- default null + p_css_dir varchar + +) RETURNS integer AS $$ +-- +-- portal_datasource__new/3 maybe obsolete, when we define proper defaults for /9 +-- +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := portal_datasource__new(null, p_name, p_description, p_css_dir, - ''portal_datasource'', + 'portal_datasource', now(), null, null, null); return v_datasource_id; -end;' language 'plpgsql'; +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 + + +-- +-- procedure portal_datasource__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_datasource__delete( + p_datasource_id integer +) RETURNS integer AS $$ +DECLARE +BEGIN perform acs_object__delete(p_datasource_id); return 0; -end;' language 'plpgsql'; +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,varchar,varchar,varchar,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; -begin + +-- +-- procedure portal_datasource__set_def_param/5 +-- +CREATE OR REPLACE FUNCTION portal_datasource__set_def_param( + p_datasource_id integer, + p_config_required_p varchar, + p_configured_p varchar, + p_key varchar, + p_value varchar +) RETURNS integer AS $$ +DECLARE +BEGIN + insert into portal_datasource_def_params (parameter_id, datasource_id, config_required_p, configured_p, key, value) values - (nextval(''t_acs_object_id_seq''), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + (nextval('t_acs_object_id_seq'), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; 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 -r1.5 -r1.6 --- openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql 9 Aug 2002 20:56:28 -0000 1.5 +++ openacs-4/packages/new-portal/sql/postgresql/datasource-sc-create.sql 1 Nov 2013 21:45:33 -0000 1.6 @@ -21,166 +21,166 @@ -- @version $Id$ -- -create function inline_0 () -returns integer as ' -begin +CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$ +BEGIN perform acs_sc_contract__new( - ''portal_datasource'', - ''Portal Datasource interface'' + 'portal_datasource', + 'Portal Datasource interface' ); -- Get my name - not to be confused with the pretty_name perform acs_sc_msg_type__new( - ''portal_datasource.GetMyName.InputType'', - '''' + 'portal_datasource.GetMyName.InputType', + '' ); perform acs_sc_msg_type__new( - ''portal_datasource.GetMyName.OutputType'', - ''get_my_name:string'' + 'portal_datasource.GetMyName.OutputType', + 'get_my_name:string' ); perform acs_sc_operation__new( - ''portal_datasource'', - ''GetMyName'', - ''Get the name'', - ''t'', + 'portal_datasource', + 'GetMyName', + 'Get the name', + 't', 0, - ''portal_datasource.GetMyName.InputType'', - ''portal_datasource.GetMyName.OutputType'' + 'portal_datasource.GetMyName.InputType', + 'portal_datasource.GetMyName.OutputType' ); -- Get a pretty name perform acs_sc_msg_type__new( - ''portal_datasource.GetPrettyName.InputType'', - '''' + 'portal_datasource.GetPrettyName.InputType', + '' ); perform acs_sc_msg_type__new( - ''portal_datasource.GetPrettyName.OutputType'', - ''pretty_name:string'' + 'portal_datasource.GetPrettyName.OutputType', + 'pretty_name:string' ); perform acs_sc_operation__new( - ''portal_datasource'', - ''GetPrettyName'', - ''Get the pretty name'', - ''t'', + 'portal_datasource', + 'GetPrettyName', + 'Get the pretty name', + 't', 0, - ''portal_datasource.GetPrettyName.InputType'', - ''portal_datasource.GetPrettyName.OutputType'' + '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'', - '''' + 'portal_datasource.Link.InputType', + '' ); perform acs_sc_msg_type__new( - ''portal_datasource.Link.OutputType'', - ''pretty_name:string'' + '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'', + 'portal_datasource', + 'Link', + 'Get the link ie the href target for this datasource', + 't', 0, - ''portal_datasource.Link.InputType'', - ''portal_datasource.Link.OutputType'' + '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'' + 'portal_datasource.AddSelfToPage.InputType', + 'page_id:integer,instance_id:integer,args:string' ); perform acs_sc_msg_type__new( - ''portal_datasource.AddSelfToPage.OutputType'', - ''element_id:integer'' + 'portal_datasource.AddSelfToPage.OutputType', + 'element_id:integer' ); perform acs_sc_operation__new( - ''portal_datasource'', - ''AddSelfToPage'', - ''Adds itself to the given page returns an element_id'', - ''f'', + 'portal_datasource', + 'AddSelfToPage', + 'Adds itself to the given page returns an element_id', + 'f', 3, - ''portal_datasource.AddSelfToPage.InputType'', - ''portal_datasource.AddSelfToPage.OutputType'' + 'portal_datasource.AddSelfToPage.InputType', + 'portal_datasource.AddSelfToPage.OutputType' ); perform acs_sc_msg_type__new( - ''portal_datasource.Edit.InputType'', - ''element_id:integer'' + 'portal_datasource.Edit.InputType', + 'element_id:integer' ); perform acs_sc_msg_type__new( - ''portal_datasource.Edit.OutputType'', - ''output:string'' + 'portal_datasource.Edit.OutputType', + 'output:string' ); perform acs_sc_operation__new( - ''portal_datasource'', - ''Edit'', - ''Returns the edit html'', - ''f'', + 'portal_datasource', + 'Edit', + 'Returns the edit html', + 'f', 1, - ''portal_datasource.Edit.InputType'', - ''portal_datasource.Edit.OutputType'' + 'portal_datasource.Edit.InputType', + 'portal_datasource.Edit.OutputType' ); perform acs_sc_msg_type__new( - ''portal_datasource.Show.InputType'', - ''cf:string'' + 'portal_datasource.Show.InputType', + 'cf:string' ); perform acs_sc_msg_type__new( - ''portal_datasource.Show.OutputType'', - ''output:string'' + 'portal_datasource.Show.OutputType', + 'output:string' ); perform acs_sc_operation__new( - ''portal_datasource'', - ''Show'', - ''Render the portal element returning a chunk of HTML'', - ''f'', + 'portal_datasource', + 'Show', + 'Render the portal element returning a chunk of HTML', + 'f', 1, - ''portal_datasource.Show.InputType'', - ''portal_datasource.Show.OutputType'' + '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'' + 'portal_datasource.RemoveSelfFromPage.InputType', + 'page_id:integer,instance_id:integer' ); perform acs_sc_msg_type__new( - ''portal_datasource.RemoveSelfFromPage.OutputType'', - '''' + 'portal_datasource.RemoveSelfFromPage.OutputType', + '' ); perform acs_sc_operation__new( - ''portal_datasource'', - ''RemoveSelfFromPage'', - '' remove itself from the given page'', - ''f'', + 'portal_datasource', + 'RemoveSelfFromPage', + ' remove itself from the given page', + 'f', 2, - ''portal_datasource.RemoveSelfFromPage.InputType'', - ''portal_datasource.RemoveSelfFromPage.OutputType'' + 'portal_datasource.RemoveSelfFromPage.InputType', + 'portal_datasource.RemoveSelfFromPage.OutputType' ); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select 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 -r1.5 -r1.6 --- openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql 9 Aug 2002 20:56:28 -0000 1.5 +++ openacs-4/packages/new-portal/sql/postgresql/datasource-sc-drop.sql 1 Nov 2013 21:45:33 -0000 1.6 @@ -21,116 +21,116 @@ -- @version $Id$ -- -create function inline_0 () -returns integer as ' -begin +CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$ +BEGIN -- drop GetMyName perform acs_sc_operation__delete( - ''portal_datasource'', - ''GetMyName'' + 'portal_datasource', + 'GetMyName' ); perform acs_sc_msg_type__delete( - ''portal_datasource.GetMyName.InputType'' + 'portal_datasource.GetMyName.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.GetMyName.OutputType'' + 'portal_datasource.GetMyName.OutputType' ); -- drop GetPrettyName perform acs_sc_operation__delete( - ''portal_datasource'', - ''GetPrettyName'' + 'portal_datasource', + 'GetPrettyName' ); perform acs_sc_msg_type__delete( - ''portal_datasource.GetPrettyName.InputType'' + 'portal_datasource.GetPrettyName.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.GetPrettyName.OutputType'' + 'portal_datasource.GetPrettyName.OutputType' ); -- drop Link perform acs_sc_operation__delete( - ''portal_datasource'', - ''Link'' + 'portal_datasource', + 'Link' ); perform acs_sc_msg_type__delete( - ''portal_datasource.Link.InputType'' + 'portal_datasource.Link.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.Link.OutputType'' + 'portal_datasource.Link.OutputType' ); -- Drop add_self_to_page perform acs_sc_operation__delete( - ''portal_datasource'', - ''AddSelfToPage'' + 'portal_datasource', + 'AddSelfToPage' ); perform acs_sc_msg_type__delete( - ''portal_datasource.AddSelfToPage.InputType'' + 'portal_datasource.AddSelfToPage.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.AddSelfToPage.OutputType'' + 'portal_datasource.AddSelfToPage.OutputType' ); -- Delete Show perform acs_sc_operation__delete( - ''portal_datasource'', - ''Show'' + 'portal_datasource', + 'Show' ); perform acs_sc_msg_type__delete( - ''portal_datasource.Show.InputType'' + 'portal_datasource.Show.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.Show.OutputType'' + 'portal_datasource.Show.OutputType' ); -- Delete Edit perform acs_sc_operation__delete( - ''portal_datasource'', - ''Edit'' + 'portal_datasource', + 'Edit' ); perform acs_sc_msg_type__delete( - ''portal_datasource.Edit.InputType'' + 'portal_datasource.Edit.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.Edit.OutputType'' + 'portal_datasource.Edit.OutputType' ); -- RemoveSelfFromPage perform acs_sc_operation__delete( - ''portal_datasource'', - ''RemoveSelfFromPage'' + 'portal_datasource', + 'RemoveSelfFromPage' ); perform acs_sc_msg_type__delete( - ''portal_datasource.RemoveSelfFromPage.InputType'' + 'portal_datasource.RemoveSelfFromPage.InputType' ); perform acs_sc_msg_type__delete( - ''portal_datasource.RemoveSelfFromPage.OutputType'' + 'portal_datasource.RemoveSelfFromPage.OutputType' ); -- drop the contract perform acs_sc_contract__delete( - ''portal_datasource'' + 'portal_datasource' ); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select 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 -r1.7 -r1.8 --- openacs-4/packages/new-portal/sql/postgresql/defaults.sql 8 Aug 2006 21:26:59 -0000 1.7 +++ openacs-4/packages/new-portal/sql/postgresql/defaults.sql 1 Nov 2013 21:45:33 -0000 1.8 @@ -21,79 +21,86 @@ -- @version $Id$ -- -create function inline_0 () -returns integer as ' -declare + + +-- +-- procedure inline_0/0 +-- +CREATE OR REPLACE FUNCTION inline_0( + +) RETURNS integer AS $$ +DECLARE layout_id portal_layouts.layout_id%TYPE; -begin +BEGIN -- two-column layout, without a header. layout_id := portal_layout__new( - ''#new-portal.simple_2column_layout_name#'', - ''#new-portal.simple_2column_layout_description#'', - ''layouts/simple2'', - ''layouts/components/simple2'' + '#new-portal.simple_2column_layout_name#', + '#new-portal.simple_2column_layout_description#', + 'layouts/simple2', + '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''); + perform portal_layout__add_region(layout_id, '1'); + perform portal_layout__add_region(layout_id, '2'); -- one-column layout, without a header. layout_id := portal_layout__new( - ''#new-portal.simple_1column_layout_name#'', - ''#new-portal.simple_1column_layout_description#'', - ''layouts/simple1'', - ''layouts/components/simple1'' + '#new-portal.simple_1column_layout_name#', + '#new-portal.simple_1column_layout_description#', + 'layouts/simple1', + 'layouts/components/simple1' ); -- the supported regions for that layout. - perform portal_layout__add_region(layout_id, ''1''); + perform portal_layout__add_region(layout_id, '1'); -- same as above, only, three columns. layout_id := portal_layout__new( - ''#new-portal.simple_3column_layout_name#'', - ''#new-portal.simple_3column_layout_description#'', - ''layouts/simple3'', - ''layouts/components/simple3'' + '#new-portal.simple_3column_layout_name#', + '#new-portal.simple_3column_layout_description#', + 'layouts/simple3', + '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, '1'); + perform portal_layout__add_region(layout_id, '2'); + perform portal_layout__add_region(layout_id, '3'); -- Now, some element themes. perform portal_element_theme__new( - ''#new-portal.simple_red_theme_name#'', - ''#new-portal.simple_red_theme_description#'', - ''themes/simple-theme'', - ''themes/simple-theme'' + '#new-portal.simple_red_theme_name#', + '#new-portal.simple_red_theme_description#', + 'themes/simple-theme', + 'themes/simple-theme' ); perform portal_element_theme__new( - ''#new-portal.nada_theme_name#'', - ''#new-portal.nada_theme_description#'', - ''themes/nada-theme'', - ''themes/nada-theme'' + '#new-portal.nada_theme_name#', + '#new-portal.nada_theme_description#', + 'themes/nada-theme', + 'themes/nada-theme' ); perform portal_element_theme__new( - ''#new-portal.deco_theme_name#'', - ''#new-portal.deco_theme_description#'', - ''themes/deco-theme'', - ''themes/deco-theme'' + '#new-portal.deco_theme_name#', + '#new-portal.deco_theme_description#', + 'themes/deco-theme', + 'themes/deco-theme' ); perform portal_element_theme__new ( - ''#new-portal.sloan_theme_name#'', -- name - ''#new-portal.sloan_theme_description#'', -- description - ''themes/sloan-theme'', -- filename - ''themes/sloan-theme'' -- directory + '#new-portal.sloan_theme_name#', -- name + '#new-portal.sloan_theme_description#', -- description + 'themes/sloan-theme', -- filename + 'themes/sloan-theme' -- directory ); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select inline_0(); Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.0.3-2.1.0a1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.0.3-2.1.0a1.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.0.3-2.1.0a1.sql 13 Jan 2005 13:58:24 -0000 1.3 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.0.3-2.1.0a1.sql 1 Nov 2013 21:45:33 -0000 1.4 @@ -1,14 +1,22 @@ -- fixes bug where you couldn't delete and emply page - 476 -create or replace function portal_page__delete(integer) -returns integer as ' -declare - p_page_id alias for $1; + + +-- added +select define_function_args('portal_page__delete','page_id'); + +-- +-- procedure portal_page__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_page__delete( + p_page_id integer +) RETURNS integer AS $$ +DECLARE 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 +BEGIN -- IMPORTANT: sort keys MUST be an unbroken sequence from 0 to max(sort_key) @@ -50,6 +58,7 @@ return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.0a1-2.1.0a2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.0a1-2.1.0a2.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.0a1-2.1.0a2.sql 24 Jul 2004 15:24:35 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.0a1-2.1.0a2.sql 1 Nov 2013 21:45:33 -0000 1.2 @@ -1,20 +1,38 @@ -- missing declare statements -create or replace function portal_element_theme__delete (integer) -returns integer as ' -declare - p_theme_id alias for $1; -begin + + +-- added +select define_function_args('portal_element_theme__delete','theme_id'); + +-- +-- procedure portal_element_theme__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_element_theme__delete( + p_theme_id integer +) RETURNS integer AS $$ +DECLARE +BEGIN PERFORM acs_object__delete(p_theme_id); return (0); -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function portal_layout__delete(integer) -returns integer as ' -declare - p_layout_id alias for $1; -begin + + +-- added +select define_function_args('portal_layout__delete','layout_id'); + +-- +-- procedure portal_layout__delete/1 +-- +CREATE OR REPLACE FUNCTION portal_layout__delete( + p_layout_id integer +) RETURNS integer AS $$ +DECLARE +BEGIN perform acs_object__delete(layout_id); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.2d1-2.1.2d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.2d1-2.1.2d2.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.2d1-2.1.2d2.sql 8 Aug 2006 21:26:59 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.1.2d1-2.1.2d2.sql 1 Nov 2013 21:45:33 -0000 1.3 @@ -21,23 +21,29 @@ select define_function_args('portal_page__new','page_id,pretty_name,portal_id,layout_id,hidden_p,object_type;portal_page,creation_date,creation_user,creation_ip,context_id'); -create function portal_page__new (integer,varchar,integer,integer,char,varchar,timestamptz,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_hidden_p 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; + + +-- +-- procedure portal_page__new/10 +-- +CREATE OR REPLACE FUNCTION portal_page__new( + p_page_id integer, + p_pretty_name varchar, + p_portal_id integer, + p_layout_id integer, + p_hidden_p char, + p_object_type varchar, -- default 'portal_page' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE 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 +BEGIN v_page_id := acs_object__new( null, @@ -46,7 +52,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_layout_id is null then @@ -69,22 +75,31 @@ return v_page_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function portal__new (integer,varchar,integer,integer,integer,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_portal_id alias for $1; - p_name alias for $2; - p_theme_id alias for $3; - p_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; + + +-- added +select define_function_args('portal__new','portal_id,name,theme_id,layout_id,template_id,default_page_name,object_type,creation_date,creation_user,creation_ip,context_id'); + +-- +-- procedure portal__new/11 +-- +CREATE OR REPLACE FUNCTION portal__new( + p_portal_id integer, + p_name varchar, + p_theme_id integer, + p_layout_id integer, + p_template_id integer, + p_default_page_name varchar, + p_object_type varchar, + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer +) RETURNS integer AS $$ +DECLARE v_portal_id portals.portal_id%TYPE; v_theme_id portals.theme_id%TYPE; v_layout_id portal_layouts.layout_id%TYPE; @@ -94,7 +109,7 @@ v_param record; v_new_element_id integer; v_new_parameter_id integer; -begin +BEGIN v_portal_id := acs_object__new( p_portal_id, @@ -103,7 +118,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_template_id is null then @@ -136,8 +151,8 @@ p_default_page_name, v_portal_id, v_layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -170,8 +185,8 @@ v_page.pretty_name, v_portal_id, v_page.layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -222,4 +237,5 @@ return v_portal_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d2-2.3.0d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d2-2.3.0d3.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d2-2.3.0d3.sql 15 May 2007 20:14:48 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d2-2.3.0d3.sql 1 Nov 2013 21:45:33 -0000 1.3 @@ -1,21 +1,31 @@ alter table portal_datasources add column css_dir varchar(200); -select define_function_args('portal_datasource__new','datasource_id,name,description,css_dir,object_type;portal_datasource,creation_date,creation_user,creation_ip,context_id'); -create or replace function portal_datasource__new (integer,varchar,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_datasource_id alias for $1; -- default null - p_name alias for $2; -- default null - p_description alias for $3; -- default null - p_css_dir alias for $4; - p_object_type alias for $5; -- default ''portal_datasource'' - p_creation_date alias for $6; -- default now() - p_creation_user alias for $7; -- default null - p_creation_ip alias for $8; -- default null - p_context_id alias for $9; -- default null +-- old define_function_args('portal_datasource__new','datasource_id,name,description,css_dir,object_type;portal_datasource,creation_date,creation_user,creation_ip,context_id') +-- new +select define_function_args('portal_datasource__new','datasource_id;null,name;null,description;null,css_dir,object_type;portal_datasource,creation_date;now(),creation_user;null,creation_ip;null,context_id;null'); + + + + +-- +-- procedure portal_datasource__new/9 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_datasource_id integer, -- default null + p_name varchar, -- default null + p_description varchar, -- default null + p_css_dir varchar, + p_object_type varchar, -- default 'portal_datasource' + p_creation_date timestamptz, -- default now() + p_creation_user integer, -- default null + p_creation_ip varchar, -- default null + p_context_id integer -- default null + +) RETURNS integer AS $$ +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := acs_object__new( p_datasource_id, @@ -24,7 +34,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); insert into portal_datasources @@ -34,21 +44,31 @@ return v_datasource_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function portal_datasource__new (integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_datasource_id alias for $1; -- default null - p_name alias for $2; -- default null - p_description alias for $3; -- default null - p_object_type alias for $4; -- default ''portal_datasource'' - p_creation_date alias for $5; -- default now() - p_creation_user alias for $6; -- default null - p_creation_ip alias for $7; -- default null - p_context_id alias for $8; -- default null + + +-- +-- procedure portal_datasource__new/8 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_datasource_id integer, -- default null + p_name varchar, -- default null + p_description varchar, -- default null + p_object_type varchar, -- default 'portal_datasource' + p_creation_date timestamptz, -- default now() + p_creation_user integer, -- default null + p_creation_ip varchar, -- default null + p_context_id integer -- default null + +) RETURNS integer AS $$ +-- +-- portal_datasource__new/8 maybe obsolete, when we define proper defaults for /9 +-- +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := portal_datasource__new(null, p_name, @@ -62,29 +82,40 @@ return v_datasource_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function portal_datasource__new (varchar,varchar,varchar) -returns integer as ' -declare - p_name alias for $1; -- default null - p_description alias for $2; -- default null - p_css_dir alias for $3; + + +-- +-- procedure portal_datasource__new/3 +-- +CREATE OR REPLACE FUNCTION portal_datasource__new( + p_name varchar, -- default null + p_description varchar, -- default null + p_css_dir varchar + +) RETURNS integer AS $$ +-- +-- portal_datasource__new/3 maybe obsolete, when we define proper defaults for /9 +-- +DECLARE v_datasource_id portal_datasources.datasource_id%TYPE; -begin +BEGIN v_datasource_id := portal_datasource__new(null, p_name, p_description, p_css_dir, - ''portal_datasource'', + 'portal_datasource', now(), null, null, null); return v_datasource_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d3-2.3.0d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d3-2.3.0d4.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d3-2.3.0d4.sql 15 May 2007 20:14:48 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.0d3-2.3.0d4.sql 1 Nov 2013 21:45:33 -0000 1.3 @@ -4,24 +4,30 @@ drop function portal_page__new (integer,varchar,integer,integer,char,varchar,timestamptz,integer,varchar,integer); -create or replace function portal_page__new (integer,char,varchar,integer,integer,char,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_page_id alias for $1; - p_pretty_name alias for $2; - p_accesskey alias for $3; - p_portal_id alias for $4; - p_layout_id alias for $5; - p_hidden_p 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; + + +-- +-- procedure portal_page__new/11 +-- +CREATE OR REPLACE FUNCTION portal_page__new( + p_page_id integer, + p_pretty_name char, + p_accesskey varchar, + p_portal_id integer, + p_layout_id integer, + p_hidden_p char, + p_object_type varchar, -- default 'portal_page' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE 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 +BEGIN v_page_id := acs_object__new( null, @@ -30,7 +36,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_layout_id is null then @@ -53,25 +59,32 @@ return v_page_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select define_function_args('portal__new','portal_id,name,theme_id,layout_id,template_id,default_page_name,default_accesskey,object_type;portal,creation_date,creation_user,creation_ip,context_id'); -create function portal__new (integer,varchar,integer,integer,integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_portal_id alias for $1; - p_name alias for $2; - p_theme_id alias for $3; - p_layout_id alias for $4; - p_template_id alias for $5; - p_default_page_name alias for $6; - p_default_accesskey 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; + + +-- +-- procedure portal__new/12 +-- +CREATE OR REPLACE FUNCTION portal__new( + p_portal_id integer, + p_name varchar, + p_theme_id integer, + p_layout_id integer, + p_template_id integer, + p_default_page_name varchar, + p_default_accesskey varchar, + p_object_type varchar, -- default 'portal' + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE v_portal_id portals.portal_id%TYPE; v_theme_id portals.theme_id%TYPE; v_layout_id portal_layouts.layout_id%TYPE; @@ -81,7 +94,7 @@ v_param record; v_new_element_id integer; v_new_parameter_id integer; -begin +BEGIN v_portal_id := acs_object__new( p_portal_id, @@ -90,7 +103,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_template_id is null then @@ -124,8 +137,8 @@ p_default_accesskey, v_portal_id, v_layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -159,8 +172,8 @@ v_page.accesskey, v_portal_id, v_page.layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -211,5 +224,6 @@ return v_portal_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.1d1-2.3.1d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.1d1-2.3.1d2.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.1d1-2.3.1d2.sql 7 Oct 2007 22:37:03 -0000 1.2 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.3.1d1-2.3.1d2.sql 1 Nov 2013 21:45:33 -0000 1.3 @@ -1,20 +1,28 @@ -- Create portal pages in the correct order. -create or replace function portal__new (integer,varchar,integer,integer,integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_portal_id alias for $1; - p_name alias for $2; - p_theme_id alias for $3; - p_layout_id alias for $4; - p_template_id alias for $5; - p_default_page_name alias for $6; - p_default_accesskey 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; + + +-- added +select define_function_args('portal__new','portal_id,name,theme_id,layout_id,template_id,default_page_name,default_accesskey,object_type,creation_date,creation_user,creation_ip,context_id'); + +-- +-- procedure portal__new/12 +-- +CREATE OR REPLACE FUNCTION portal__new( + p_portal_id integer, + p_name varchar, + p_theme_id integer, + p_layout_id integer, + p_template_id integer, + p_default_page_name varchar, + p_default_accesskey varchar, + p_object_type varchar, + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer +) RETURNS integer AS $$ +DECLARE v_portal_id portals.portal_id%TYPE; v_theme_id portals.theme_id%TYPE; v_layout_id portal_layouts.layout_id%TYPE; @@ -24,7 +32,7 @@ v_param record; v_new_element_id integer; v_new_parameter_id integer; -begin +BEGIN v_portal_id := acs_object__new( p_portal_id, @@ -33,7 +41,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_template_id is null then @@ -67,8 +75,8 @@ p_default_accesskey, v_portal_id, v_layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -103,8 +111,8 @@ v_page.accesskey, v_portal_id, v_page.layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -155,4 +163,5 @@ return v_portal_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql 8 Nov 2010 07:23:38 -0000 1.1 +++ openacs-4/packages/new-portal/sql/postgresql/upgrade/upgrade-2.6.0d1-2.6.0d2.sql 1 Nov 2013 21:45:33 -0000 1.2 @@ -8,21 +8,29 @@ -- PG 9.x support - changes regarding usage of sequences -create or replace function portal__new (integer,varchar,integer,integer,integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer) -returns integer as ' -declare - p_portal_id alias for $1; - p_name alias for $2; - p_theme_id alias for $3; - p_layout_id alias for $4; - p_template_id alias for $5; - p_default_page_name alias for $6; - p_default_accesskey 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; + + +-- added +select define_function_args('portal__new','portal_id,name,theme_id,layout_id,template_id,default_page_name,default_accesskey,object_type,creation_date,creation_user,creation_ip,context_id'); + +-- +-- procedure portal__new/12 +-- +CREATE OR REPLACE FUNCTION portal__new( + p_portal_id integer, + p_name varchar, + p_theme_id integer, + p_layout_id integer, + p_template_id integer, + p_default_page_name varchar, + p_default_accesskey varchar, + p_object_type varchar, + p_creation_date timestamptz, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer +) RETURNS integer AS $$ +DECLARE v_portal_id portals.portal_id%TYPE; v_theme_id portals.theme_id%TYPE; v_layout_id portal_layouts.layout_id%TYPE; @@ -32,7 +40,7 @@ v_param record; v_new_element_id integer; v_new_parameter_id integer; -begin +BEGIN v_portal_id := acs_object__new( p_portal_id, @@ -41,7 +49,7 @@ p_creation_user, p_creation_ip, p_context_id, - ''t'' + 't' ); if p_template_id is null then @@ -75,8 +83,8 @@ p_default_accesskey, v_portal_id, v_layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -111,8 +119,8 @@ v_page.accesskey, v_portal_id, v_page.layout_id, - ''f'', - ''portal_page'', + 'f', + 'portal_page', p_creation_date, p_creation_user, p_creation_ip, @@ -125,7 +133,7 @@ where page_id = v_page.page_id loop - select nextval(''t_acs_object_id_seq'') + select nextval('t_acs_object_id_seq') into v_new_element_id from dual; @@ -142,7 +150,7 @@ where element_id = v_element.element_id loop - select nextval(''t_acs_object_id_seq'') + select nextval('t_acs_object_id_seq') into v_new_parameter_id from dual; @@ -163,23 +171,33 @@ return v_portal_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function portal_datasource__set_def_param (integer,varchar,varchar,varchar,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; -begin + +-- added +select define_function_args('portal_datasource__set_def_param','datasource_id,config_required_p,configured_p,key,value'); + +-- +-- procedure portal_datasource__set_def_param/5 +-- +CREATE OR REPLACE FUNCTION portal_datasource__set_def_param( + p_datasource_id integer, + p_config_required_p varchar, + p_configured_p varchar, + p_key varchar, + p_value varchar +) RETURNS integer AS $$ +DECLARE +BEGIN + insert into portal_datasource_def_params (parameter_id, datasource_id, config_required_p, configured_p, key, value) values - (nextval(''t_acs_object_id_seq''), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); + (nextval('t_acs_object_id_seq'), p_datasource_id, p_config_required_p, p_configured_p, p_key, p_value); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; 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.190 -r1.191 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 29 Sep 2013 13:59:55 -0000 1.190 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 1 Nov 2013 21:45:33 -0000 1.191 @@ -40,19 +40,19 @@ } { Call a particular ds op } { - if {[empty_string_p $datasource_name]} { + if {$datasource_name eq ""} { set datasource_name [get_datasource_name $ds_id] } - return [acs_sc_call portal_datasource $op $list_args $datasource_name] + return [acs_sc::invoke -contract portal_datasource -operation $op -call_args $list_args -impl $datasource_name] } ad_proc -public portal::list_datasources { {portal_id ""} } { Lists the datasources available to a portal or in general } { - if {[empty_string_p $portal_id]} { + if {$portal_id eq ""} { # List all applets return [db_list select_all_datasources {}] } else { @@ -145,25 +145,26 @@ set page_name_list [list $default_page_name] set page_accesskey_list [list $default_accesskey] - if { [string eq $layout_name ""] } { + if {$layout_name eq ""} { set layout_name_list [list [parameter::get_from_package_key \ -package_key new-portal \ -parameter default_layout]] } else { set layout_name_list [list $layout_name] } - if {![empty_string_p $csv_list]} { + if {$csv_list ne ""} { set page_name_and_layout_list [split [string trimright $csv_list ";"] ";"] set page_name_list [list] set page_accesskey_list [list] set layout_name_list [list] # seperate name and layout foreach item $page_name_and_layout_list { - lappend page_name_list [lindex [split $item ","] 0] - lappend layout_name_list [lindex [split $item ","] 1] - lappend page_accesskey_list [lindex [split $item ","] 2] + lassign [split $item ","] page_name layout_name page_accesskey + lappend page_name_list $page_name + lappend layout_name_list $layout_name + lappend page_accesskey_list $page_accesskey } } @@ -173,12 +174,12 @@ # get the default layout_id - simple2 set layout_id [get_layout_id] - if {![empty_string_p $layout_name]} { + if {$layout_name ne ""} { set layout_id [get_layout_id -layout_name $layout_name] } # get the default theme name from param, if no theme given - if {[empty_string_p $theme_name]} { + if {$theme_name eq ""} { set theme_name [parameter::get -package_id [get_package_id] -parameter default_theme_name] } @@ -194,7 +195,7 @@ permission::grant -party_id $user_id -object_id $portal_id -privilege portal_admin_portal # ignore the csv list if we have a template - if {![empty_string_p $csv_list] && [empty_string_p $template_id]} { + if {$csv_list ne "" && $template_id eq ""} { # if there are more pages in the csv_list, create them for {set i 1} {$i < [expr [llength $page_name_list]]} {incr i} { portal::page_create -portal_id $portal_id \ @@ -257,9 +258,9 @@ set master_template [parameter::get -parameter master_template] # if no page_num set, render page 0 - if {[empty_string_p $page_id] && [empty_string_p $page_num]} { + if {$page_id eq "" && $page_num eq ""} { set sort_key 0 - } elseif {![empty_string_p $page_num]} { + } elseif {$page_num ne ""} { set sort_key $page_num } @@ -284,7 +285,7 @@ # which in turn includes the theme, then elements set template " @portal.name@" - if { ![empty_string_p $element_list] } { + if { $element_list ne "" } { set element_src "[www_path]/render_styles/${render_style}/render-element" append template " [_ new-portal.Go_back]" } else { set return_text "" @@ -451,7 +452,7 @@ set list_of_page_ids [list_pages_tcl_list -portal_id $portal_id] - set last_page [lindex $list_of_page_ids [expr [llength $list_of_page_ids] - 1]] + set last_page [lindex $list_of_page_ids [llength $list_of_page_ids]-1] ns_log warning "last_page is $last_page" foreach page_id $list_of_page_ids { @@ -460,7 +461,7 @@ db_1row get_page_info {} set page_name [lang::util::localize $pretty_name_unlocalized] set page_layout_id [portal::get_layout_id -page_id $page_id] - if { [string equal $hidden_p t] } { + if {$hidden_p == "t"} { set tab_toggle_label [lang::util::localize "\#new-portal.Show_in_main_navigation\#"] } else { set tab_toggle_label [lang::util::localize "\#new-portal.Hide_in_main_navigation\#"] @@ -644,7 +645,7 @@ # New page chunk # - set new_page_num [expr [page_count -portal_id $portal_id] + 1] + set new_page_num [expr {[page_count -portal_id $portal_id] + 1}] append template "
@@ -673,7 +674,7 @@ # Revert page chunk # - if {![empty_string_p [get_portal_template_id $portal_id]]} { + if {[get_portal_template_id $portal_id] ne ""} { append template "
@@ -717,7 +718,7 @@ # set __adp_stub "[get_server_root][www_path]/." - set {master_template} \"master\" + set master_template \"master\" set code [template::adp_compile -string $template] set output [template::adp_eval code] @@ -748,7 +749,7 @@ } - if { ![empty_string_p [ns_set get $form "op_revert_all"]] } { + if { [ns_set get $form "op_revert_all"] ne "" } { set template_id [ns_set get $form "portal_id"] ns_log notice "REVERTING ALL template_id='${template_id}'" set revert_all_set_id [ns_set create] @@ -760,7 +761,7 @@ portal::configure_dispatch -portal_id $portal_id -form $revert_all_set_id } - } elseif { ![empty_string_p [ns_set get $form "op_revert"]] } { + } elseif { [ns_set get $form "op_revert"] ne "" } { #Transaction here was causeing uncaught deadlocks so it was removed. - CM 9-11-02 #It doesn't seem necessary to have a transaction here. Its not a big deal if this fails in the the middle. The user can just revert again. @@ -837,25 +838,25 @@ # added, that was not originally mapped # usually with custom portlets - if ![empty_string_p $target_element_id] { + if {$target_element_id ne ""} { db_dml revert_element_update {} } } } - } elseif { ![empty_string_p [ns_set get $form "op_rename"]] } { + } elseif { [ns_set get $form "op_rename"] ne "" } { portal::update_name $portal_id [ns_set get $form new_name] - } elseif { ![empty_string_p [ns_set get $form "op_swap"]] } { + } elseif { [ns_set get $form "op_swap"] ne "" } { portal::swap_element $portal_id \ [ns_set get $form element_id] \ [ns_set get $form region] \ [ns_set get $form direction] - } elseif { ![empty_string_p [ns_set get $form "op_move"]] } { + } elseif { [ns_set get $form "op_move"] ne "" } { portal::move_element $portal_id \ [ns_set get $form element_id] \ [ns_set get $form region] \ [ns_set get $form direction] - } elseif { ![empty_string_p [ns_set get $form "op_show_here"]] } { + } elseif { [ns_set get $form "op_show_here"] ne "" } { set region [ns_set get $form region] set element_id [ns_set get $form element_id] set page_id [ns_set get $form page_id] @@ -865,20 +866,20 @@ db_dml show_here_update_sk {} db_dml show_here_update_state {} } - } elseif { ![empty_string_p [ns_set get $form "op_move_to_page"]] } { + } elseif { [ns_set get $form "op_move_to_page"] ne "" } { portal::move_element_to_page \ -page_id [ns_set get $form page_id] \ -element_id [ns_set get $form element_id] - } elseif { ![empty_string_p [ns_set get $form "op_hide"]] } { + } elseif { [ns_set get $form "op_hide"] ne "" } { set element_id_list [list] # iterate through the set, destructive! - while { [expr [ns_set find $form "element_id"] + 1 ] } { + while { [ns_set find $form "element_id"] + 1 } { lappend element_id_list [ns_set get $form "element_id"] ns_set delkey $form "element_id" } - if {! [empty_string_p $element_id_list] } { + if {$element_id_list ne "" } { db_transaction { foreach element_id $element_id_list { db_dml hide_update {} @@ -892,39 +893,39 @@ } } } - } elseif { ![empty_string_p [ns_set get $form "op_change_theme"]] } { + } elseif { [ns_set get $form "op_change_theme"] ne "" } { set theme_id [ns_set get $form theme_id] db_dml update_theme {} - } elseif { ![empty_string_p [ns_set get $form "op_add_page"]] } { + } elseif { [ns_set get $form "op_add_page"] ne "" } { set pretty_name [ns_set get $form pretty_name] - if {[empty_string_p $pretty_name]} { + if {$pretty_name eq ""} { ad_return_complaint 1 "[_ new-portal.lt_You_must_enter_new_na]" } page_create -pretty_name $pretty_name -portal_id $portal_id - } elseif { ![empty_string_p [ns_set get $form "op_remove_empty_page"]] } { + } elseif { [ns_set get $form "op_remove_empty_page"] ne "" } { set page_id [ns_set get $form page_id] page_delete -page_id $page_id - } elseif { ![empty_string_p [ns_set get $form "op_change_page_layout"]] } { + } elseif { [ns_set get $form "op_change_page_layout"] ne "" } { set_layout_id \ -portal_id $portal_id \ -page_id [ns_set get $form page_id] \ -layout_id [ns_set get $form layout_id] - } elseif { ![empty_string_p [ns_set get $form "op_rename_page"]] } { + } elseif { [ns_set get $form "op_rename_page"] ne "" } { set pretty_name [ns_set get $form pretty_name] set page_id [ns_set get $form page_id] - if {[empty_string_p $pretty_name]} { + if {$pretty_name eq ""} { ad_return_complaint 1 "[_ new-portal.lt_You_must_enter_new_na]" } set_page_pretty_name -pretty_name $pretty_name -page_id $page_id - } elseif { ![empty_string_p [ns_set get $form "op_toggle_tab_visibility"]] } { + } elseif { [ns_set get $form "op_toggle_tab_visibility"] ne "" } { set page_id [ns_set get $form page_id] db_dml toggle_tab_visibility {} - } elseif { ![empty_string_p [ns_set get $form "op_toggle_pinned"]] } { + } elseif { [ns_set get $form "op_toggle_pinned"] ne "" } { set element_id [ns_set get $form element_id] - if {[db_string toggle_pinned_select {}] == "full"} { + if {[db_string toggle_pinned_select {}] eq "full"} { db_dml toggle_pinned_update_pin {} @@ -935,10 +936,10 @@ } else { db_dml toggle_pinned_update_unpin {} } - } elseif { ![empty_string_p [ns_set get $form "op_toggle_hideable"]] } { + } elseif { [ns_set get $form "op_toggle_hideable"] ne "" } { set element_id [ns_set get $form element_id] toggle_element_param -element_id $element_id -key "hideable_p" - } elseif { ![empty_string_p [ns_set get $form "op_toggle_shadeable"]] } { + } elseif { [ns_set get $form "op_toggle_shadeable"] ne "" } { set element_id [ns_set get $form element_id] toggle_element_param -element_id $element_id -key "shadeable_p" } @@ -1003,12 +1004,12 @@ @param portal_id @param sort_key - optional, defaults to page 0 } { - if { ![empty_string_p $page_name] } { + if { $page_name ne "" } { # Get page by page_name set page_id [db_string get_page_id_from_name {} -default ""] - if { [empty_string_p $page_id] } { + if { $page_id eq "" } { if { $create_p } { # there is no page by that name in the portal, create it return [portal::page_create \ @@ -1088,7 +1089,7 @@ @param portal_id } { # get the layout_id - if {![empty_string_p $layout_name]} { + if {$layout_name ne ""} { set layout_id [get_layout_id -layout_name $layout_name] } else { set layout_id [get_layout_id] @@ -1170,7 +1171,7 @@ @param sort_key If provided will be used to insert the element. Other elements won't be reordered @return the id of the new element } { - if {[empty_string_p $pretty_name]} { + if {$pretty_name eq ""} { set pretty_name $portlet_name } @@ -1190,7 +1191,7 @@ lappend region_list $region } - if {[empty_string_p $force_region]} { + if {$force_region eq ""} { # find the "best" region to put it in foreach region $region_list { db_1row region_count {} @@ -1247,10 +1248,10 @@ or 2. the portal_id and the datasource_name which will remove all elements of that datasource on the portal. An element_id overrides all other params } { - if {![empty_string_p $element_id]} { + if {$element_id ne ""} { db_dml delete {} } else { - if {[empty_string_p $portal_id] && [empty_string_p $portlet_name]} { + if {$portal_id eq "" && $portlet_name eq ""} { ad_return_complaint 1 "portal::remove_element [_ new-portal.lt_Error_bad_params_n___]" } @@ -1287,7 +1288,7 @@ # XXX AKS: The whole issue of datasource/portlet naming must # be cleaned up! FIXME - if {[empty_string_p $pretty_name]} { + if {$pretty_name eq ""} { set pretty_name $ds_name } @@ -1349,12 +1350,12 @@ # get this element's sk db_1row get_my_sort_key_and_page_id {} - if { $dir == "up" } { + if { $dir eq "up" } { # get the sort_key and id of the element above if {[db_0or1row get_prev_sort_key {}] == 0} { return } - } elseif { $dir == "down"} { + } elseif { $dir eq "down"} { # get the sort_key and id of the element below if {[db_0or1row get_next_sort_key {}] == 0} { return @@ -1399,10 +1400,10 @@ permission::require_permission -object_id $portal_id -privilege portal_read_portal permission::require_permission -object_id $portal_id -privilege portal_edit_portal - if { $direction == "right" } { - set target_region [expr $region + 1] - } elseif { $direction == "left" } { - set target_region [expr $region - 1] + if { $direction eq "right" } { + set target_region [expr {$region + 1}] + } elseif { $direction eq "left" } { + set target_region [expr {$region - 1}] } else { ad_return_complaint 1 "portal::move_element [_ new-portal.Bad_direction_1]" } @@ -1428,7 +1429,7 @@ } { Moves a PE to the given page } { - if {[empty_string_p $region]} { + if {$region eq ""} { set curr_reg [get_element_region -element_id $element_id] } else { set curr_reg $region @@ -1637,10 +1638,9 @@ # get the element's params set element_params [util_memoize "portal::element_params_not_cached $element_id" 86400] - if [llength $element_params] { + if {[llength $element_params]} { foreach param $element_params { - set key [lindex $param 0] - set value [lindex $param 1] + lassign $param key value lappend config($key) $value } } else { @@ -1817,7 +1817,7 @@ if { [db_0or1row select {}] } { # passed in element_id is good, do they have perms? - if {[empty_string_p $noconn]} { + if {$noconn eq ""} { permission::require_permission -object_id $portal_id -privilege portal_read_portal permission::require_permission -object_id $portal_id -privilege portal_edit_portal } @@ -1832,7 +1832,7 @@ set html_string [datasource_call $datasource_id "Edit" \ [list $element_id]] - if { $html_string == "" } { + if { $html_string eq "" } { ns_log Error "portal::configure_element op = edit, but portlet's edit proc returned null string" @@ -1877,7 +1877,7 @@ "hide" { db_dml hide_update {} - if {![empty_string_p $return_url]} { + if {$return_url ne ""} { ad_returnredirect $return_url } } @@ -1995,7 +1995,7 @@ current location with "-2" appended to the name of the page. } { - return "[lindex [ns_conn urlv] [expr [ns_conn urlc] - 1]]-2" + return "[lindex [ns_conn urlv] [ns_conn urlc]-1]-2" } ad_proc -private portal::get_element_ids_by_ds {portal_id ds_name} { @@ -2081,11 +2081,11 @@ -package_key new-portal \ -parameter default_layout] } - if { ![empty_string_p $page_num] } { + if { $page_num ne "" } { db_1row get_layout_id_num_select {} - } elseif { ![empty_string_p $page_id] } { + } elseif { $page_id ne "" } { db_1row get_layout_id_page_select {} - } elseif { ![empty_string_p $layout_name] } { + } elseif { $layout_name ne "" } { db_1row get_layout_id_name_select {} } else { ad_return_complaint 1 "portal::get_layout_id bad params!" @@ -2138,7 +2138,7 @@ @param sort_key If set, will be used to insert a new element. Other elements of the region won't be reordered } { - if {[empty_string_p $param_action]} { + if {$param_action eq ""} { set param_action "overwrite" } @@ -2160,39 +2160,39 @@ # There is already a value for the param which is overwritten set_element_param $element_id $key $value - if {![empty_string_p $extra_params]} { + if {$extra_params ne ""} { check_key_value_list $extra_params for {set x 0} {$x < [llength $extra_params]} {incr x 2} { set_element_param $element_id \ [lindex $extra_params $x] \ - [lindex $extra_params [expr $x + 1]] + [lindex $extra_params $x+1] } } } } else { db_transaction { set element_id [lindex $element_id_list 0] - if {[string equal $param_action "append"]} { + if {$param_action eq "append"} { add_element_param_value -element_id $element_id -key $key -value $value - } elseif {[string equal $param_action "overwrite"]} { + } elseif {$param_action eq "overwrite"} { set_element_param $element_id $key $value } else { error "portal::add_element_parameters error: bad param action! $param_action 1" } - if {![empty_string_p $extra_params]} { + if {$extra_params ne ""} { check_key_value_list $extra_params for {set x 0} {$x < [llength $extra_params]} {incr x 2} { - if {[string equal $param_action "append"]} { + if {$param_action eq "append"} { add_element_param_value \ -element_id $element_id \ -key [lindex $extra_params $x] \ - -value [lindex $extra_params [expr $x + 1]] - } elseif {[string equal $param_action "overwrite"]} { - set_element_param $element_id [lindex $extra_params $x] [lindex $extra_params [expr $x + 1]] + -value [lindex $extra_params $x+1] + } elseif {$param_action eq "overwrite"} { + set_element_param $element_id [lindex $extra_params $x] [lindex $extra_params $x+1] } else { error "portal::add_element_parameters error: bad param action! $param_action 2" } @@ -2236,14 +2236,14 @@ -key $key \ -value $value - if {![empty_string_p $extra_params]} { + if {$extra_params ne ""} { check_key_value_list $extra_params for {set x 0} {$x < [llength $extra_params]} {incr x 2} { remove_element_param_value -element_id $element_id \ -key [lindex $extra_params $x] \ - -value [lindex $extra_params [expr $x + 1]] + -value [lindex $extra_params $x+1] } } } @@ -2266,7 +2266,7 @@ } { rat-simple consistency check for the above 2 procs } { - if {[expr [llength $list_to_check] % 2] != 0} { + if {[llength $list_to_check] % 2 != 0} { ns_log error "portal::check_key_value_list bad var list_to_check!" ad_return_complaint 1 "portal::check_key_value_list bad var list_to_check!" } @@ -2280,7 +2280,7 @@ hides ugly templating calls for portlet "show" procs } { - if { $template_src == ""} { + if { $template_src eq ""} { set template_src $package_key } @@ -2362,15 +2362,15 @@ } { An enhanced ad_dimensional. see that proc for usage details } { - if {[empty_string_p $option_list]} { + if {$option_list eq ""} { return } - if {[empty_string_p $options_set]} { + if {$options_set eq ""} { set options_set [ns_getform] } - if {[empty_string_p $url]} { + if {$url eq ""} { set url [ad_conn url] } @@ -2417,9 +2417,9 @@ # check if a default is set otherwise the first value is used set option_key [lindex $option 0] set option_val [lindex $option 2] - if {![empty_string_p $options_set]} { + if {$options_set ne ""} { set options_set_val [ns_set get $options_set $option_key] - if { ![empty_string_p $options_set_val] } { + if { $options_set_val ne "" } { set option_val $options_set_val } } @@ -2441,7 +2441,7 @@ append html $break_html } - if {([string equal $option_val $thisoption_name] == 1 && !$link_all) || !$thisoption_link_p} { + if {($option_val eq $thisoption_name && !$link_all) || !$thisoption_link_p} { append html "${pre_selected_td_html}${pre_html}${thisoption_value}${post_selected_html}\n" } else { append html "${pre_td_html}${pre_html}${thisoption_value}${post_html}\n" Index: openacs-4/packages/new-portal/www/show-here.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/show-here.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/new-portal/www/show-here.tcl 15 May 2007 20:14:48 -0000 1.5 +++ openacs-4/packages/new-portal/www/show-here.tcl 1 Nov 2013 21:45:33 -0000 1.6 @@ -31,7 +31,7 @@ set show_html "" append show_html "