Index: openacs-4/packages/static-portlet/sql/postgresql/static-core.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/sql/postgresql/static-core.sql,v
diff -u -r1.6 -r1.6.8.1
--- openacs-4/packages/static-portlet/sql/postgresql/static-core.sql	8 Aug 2006 21:27:12 -0000	1.6
+++ openacs-4/packages/static-portlet/sql/postgresql/static-core.sql	19 Aug 2014 17:11:31 -0000	1.6.8.1
@@ -32,24 +32,24 @@
 --
 
 
-create function inline_0()
-returns integer as '
-begin
+CREATE OR REPLACE FUNCTION inline_0() RETURNS integer AS $$
+BEGIN
 
    perform acs_object_type__create_type (
-        ''static_portal_content'',            -- object_type
-        ''Static Content'',                            -- pretty_name
-        ''Static Content'',                            -- pretty_plural
-            ''acs_object'',                                    -- supertype
-        ''static_portal_content'',            -- table_name
-        ''content_id'',                                    -- id_column
+        'static_portal_content',            -- object_type
+        'Static Content',                            -- pretty_name
+        'Static Content',                            -- pretty_plural
+            'acs_object',                                    -- supertype
+        'static_portal_content',            -- table_name
+        'content_id',                                    -- id_column
                 null,                                                        -- package_name
-                ''f'',                                                    -- abstract_p
+                'f',                                                    -- abstract_p
                 null,                                                        -- type_extension_table
                 null                                                        -- name_method
     );
     return 0;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 select inline_0();
 
@@ -82,14 +82,21 @@
 -- API
 --
 
-create function static_portal_content_item__new (integer, varchar, varchar, varchar)
-returns integer as '
-declare
-    p_package_id                    alias for $1;
-    p_pretty_name                   alias for $2;
-    p_content                       alias for $3;
-    p_format                        alias for $4;
-begin
+
+
+-- added
+
+--
+-- procedure static_portal_content_item__new/4
+--
+CREATE OR REPLACE FUNCTION static_portal_content_item__new(
+   p_package_id integer,
+   p_pretty_name varchar,
+   p_content varchar,
+   p_format varchar
+) RETURNS integer AS $$
+DECLARE
+BEGIN
     return static_portal_content_item__new(
         p_package_id,
         p_pretty_name,
@@ -101,36 +108,35 @@
         null,
         null
     );
-end;
-' language 'plpgsql';
+END;
 
-create function static_portal_content_item__new (
-    integer,                        -- package_id in static_portal_content.package_id%TYPE default null,
-    varchar,                        -- pretty_name in static_portal_content.pretty_name%TYPE default null,
-    varchar,                        -- content in static_portal_content.content%TYPE default null,
-    varchar,                        -- format in static_portal_content.format%TYPE default text/html,
-    varchar,                        -- object_type in acs_objects.object_type%TYPE default [static_portal_content],
-    timestamptz,                    -- creation_date in acs_objects.creation_date%TYPE default sysdate,
-    integer,                        -- creation_user in acs_objects.creation_user%TYPE default null,
-    varchar,                        -- creation_ip in acs_objects.creation_ip%TYPE default null,
-    integer                         -- context_id in acs_objects.context_id%TYPE default null
-)
-returns integer as '
-declare
-    p_package_id                    alias for $1;
-    p_pretty_name                   alias for $2;
-    p_content                       alias for $3;
-    p_format                        alias for $4;
-    p_object_type                   alias for $5;
-    p_creation_date                 alias for $6;
-    p_creation_user                 alias for $7;
-    p_creation_ip                   alias for $8;
-    p_context_id                    alias for $9;
+$$ LANGUAGE plpgsql;
+
+
+
+-- added
+select define_function_args('static_portal_content_item__new','package_id,pretty_name,content,format,object_type,creation_date,creation_user,creation_ip,context_id');
+
+--
+-- procedure static_portal_content_item__new/9
+--
+CREATE OR REPLACE FUNCTION static_portal_content_item__new(
+   p_package_id integer,
+   p_pretty_name varchar,
+   p_content varchar,
+   p_format 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_content_id                    static_portal_content.content_id%TYPE;
     v_object_type                   varchar;
-begin
+BEGIN
     if p_object_type is null then
-        v_object_type := ''static_portal_content'';
+        v_object_type := 'static_portal_content';
     else
         v_object_type := p_object_type;
     end if;
@@ -151,7 +157,8 @@
     (v_content_id, p_package_id, p_pretty_name, p_content, p_format);
 
     return v_content_id;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 create  function static_portal_content_item__delete (
     integer        -- content_id    in static_portal_content.content_id%TYPE
@@ -170,33 +177,33 @@
 -- perms
 --
 
-create function inline_1()
-returns integer as '
-begin
+CREATE OR REPLACE FUNCTION inline_1() RETURNS integer AS $$
+BEGIN
 
-      perform acs_privilege__create_privilege(''static_portal_create'');
-      perform acs_privilege__create_privilege(''static_portal_read'');
-      perform acs_privilege__create_privilege(''static_portal_delete'');
-      perform acs_privilege__create_privilege(''static_portal_modify'');
-      perform acs_privilege__create_privilege(''static_portal_admin'');
+      perform acs_privilege__create_privilege('static_portal_create');
+      perform acs_privilege__create_privilege('static_portal_read');
+      perform acs_privilege__create_privilege('static_portal_delete');
+      perform acs_privilege__create_privilege('static_portal_modify');
+      perform acs_privilege__create_privilege('static_portal_admin');
 
       -- set up the admin priv
 
-      perform acs_privilege__add_child(''static_portal_admin'', ''static_portal_create'');
-      perform acs_privilege__add_child(''static_portal_admin'', ''static_portal_read'');
-      perform acs_privilege__add_child(''static_portal_admin'', ''static_portal_delete'');
-      perform acs_privilege__add_child(''static_portal_admin'', ''static_portal_modify'');
+      perform acs_privilege__add_child('static_portal_admin', 'static_portal_create');
+      perform acs_privilege__add_child('static_portal_admin', 'static_portal_read');
+      perform acs_privilege__add_child('static_portal_admin', 'static_portal_delete');
+      perform acs_privilege__add_child('static_portal_admin', 'static_portal_modify');
 
       -- bind privileges to global names
 
-      perform acs_privilege__add_child(''create'',''static_portal_create'');
-      perform acs_privilege__add_child(''read'',''static_portal_read'');
-      perform acs_privilege__add_child(''delete'',''static_portal_delete'');
-      perform acs_privilege__add_child(''write'',''static_portal_modify'');
-      perform acs_privilege__add_child(''admin'',''static_portal_admin'');
+      perform acs_privilege__add_child('create','static_portal_create');
+      perform acs_privilege__add_child('read','static_portal_read');
+      perform acs_privilege__add_child('delete','static_portal_delete');
+      perform acs_privilege__add_child('write','static_portal_modify');
+      perform acs_privilege__add_child('admin','static_portal_admin');
 
     return 0;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 select inline_1();
 
