Index: openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql	2 Jul 2002 19:53:51 -0000	1.5
+++ openacs-4/packages/dotlrn/sql/postgresql/dotlrn-init.sql	3 Jul 2002 19:58:07 -0000	1.6
@@ -30,301 +30,353 @@
 -- @note We remember September 11th, 2001
 --
 
+create function inline_0()
+returns integer as '
 begin
+
     -- Create the base community type
-    select dotlrn_community_type__new(
-        'dotlrn_community',
+    perform dotlrn_community_type__new(
+        ''dotlrn_community'',
         null,
-        'Community',
-        'Communities',
-        'Communities - the base community type'
+        ''Community'',
+        ''Communities'',
+        ''Communities - the base community type''
     );
 
     -- these are the possible attributes of a community
-    select acs_attribute__create_attribute(
-	   'dotlrn_community',
-	   'header_font',
-	   'string',
-	   'Header Font',
-	   'Header Fonts',
+    perform acs_attribute__create_attribute(
+	   ''dotlrn_community'',
+	   ''header_font'',
+	   ''string'',
+	   ''Header Font'',
+	   ''Header Fonts'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_attribute(
-	   'dotlrn_community',
-	   'header_font_size',
-	   'string',
-	   'Header Fon Sizet',
-	   'Header Fonts Sizes',
+    perform acs_attribute__create_attribute(
+	   ''dotlrn_community'',
+	   ''header_font_size'',
+	   ''string'',
+	   ''Header Fon Sizet'',
+	   ''Header Fonts Sizes'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_attribute(
-	   'dotlrn_community',
-	   'header_font_color',
-	   'string',
-	   'Header Font Color',
-	   'Header Fonts Colors',
+    perform acs_attribute__create_attribute(
+	   ''dotlrn_community'',
+	   ''header_font_color'',
+	   ''string'',
+	   ''Header Font Color'',
+	   ''Header Fonts Colors'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_attribute(
-	   'dotlrn_community',
-	   'header_logo_item_id',
-	   'integer',
-	   'Header Logo Item ID',
-	   'Header Logo Item ID',
+    perform acs_attribute__create_attribute(
+	   ''dotlrn_community'',
+	   ''header_logo_item_id'',
+	   ''integer'',
+	   ''Header Logo Item ID'',
+	   ''Header Logo Item ID'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_attribute(
-	   'dotlrn_community',
-	   'header_logo_alt_text',
-	   'integer',
-	   'Header Logo Alt Text',
-	   'Header Logo Alt Text',
+    perform acs_attribute__create_attribute(
+	   ''dotlrn_community'',
+	   ''header_logo_alt_text'',
+	   ''integer'',
+	   ''Header Logo Alt Text'',
+	   ''Header Logo Alt Text'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
 
     -- create the dotlrn_class community type
-    select dotlrn_community_type__new(
-        'dotlrn_class_instance',
-        'dotlrn_community',
-        'Class',
-        'Classes',
-        'e.g. 6.001'
+    perform dotlrn_community_type__new(
+        ''dotlrn_class_instance'',
+        ''dotlrn_community'',
+        ''Class'',
+        ''Classes'',
+        ''e.g. 6.001''
     );
 
     -- create the dotlrn_club community type
     dotlrn_community_type__new(
-        'dotlrn_club',
-        'dotlrn_community',
-        'Club',
-        'Clubs',
-        'e.g. Alumni'
+        ''dotlrn_club'',
+        ''dotlrn_community'',
+        ''Club'',
+        ''Clubs'',
+        ''e.g. Alumni''
     );
 
-    update acs_object_types set table_name = 'dotlrn_community', package_name = 'dotlrn_community' where object_type = 'dotlrn_community';
-    update acs_object_types set table_name = 'dotlrn_class_instance', package_name = 'dotlrn_class_instance' where object_type = 'dotlrn_class_instance';
-    update acs_object_types set table_name = 'dotlrn_club', package_name = 'dotlrn_club' where object_type = 'dotlrn_club';
+    update acs_object_types set table_name = ''dotlrn_community'', package_name = ''dotlrn_community'' where object_type = ''dotlrn_community'';
+    update acs_object_types set table_name = ''dotlrn_class_instance'', package_name = ''dotlrn_class_instance'' where object_type = ''dotlrn_class_instance'';
+    update acs_object_types set table_name = ''dotlrn_club'', package_name = ''dotlrn_club'' where object_type = ''dotlrn_club'';
 
-    select acs_attribute__create_atribute(
-	   'dotlrn_community',
-	   'member_pretty_name',
-	   'string',
-	   'Member Pretty Name',
-	   'Member Pretty Name',
+    perform acs_attribute__create_atribute(
+	   ''dotlrn_community'',
+	   ''member_pretty_name'',
+	   ''string'',
+	   ''Member Pretty Name'',
+	   ''Member Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute(
-	   'dotlrn_community',
-	   'member_pretty_plural',
-	   'string',
-	   'Member Pretty Plural',
-	   'Member Pretty Plural',
+    perform acs_attribute__create_atribute(
+	   ''dotlrn_community'',
+	   ''member_pretty_plural'',
+	   ''string'',
+	   ''Member Pretty Plural'',
+	   ''Member Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
     -- create roles
-    select acs_rel_type__create_role('student', 'Student', 'Students');
-    select acs_rel_type__create_role('course_assistant', 'Course Assistant', 'Course Assistants');
-    select acs_rel_type__create_role('teaching_assistant', 'Teaching Assistant', 'Teaching Assistants');
-    select acs_rel_type__create_role('instructor', 'Professor', 'Professors');
-    select acs_rel_type__create_role('course_admin', 'Course Administrator', 'Course Administrators');
-    select acs_rel_type__create_role('admin', 'Administrator', 'Administrators');
+    perform acs_rel_type__create_role(''student'', ''Student'', ''Students'');
+    perform acs_rel_type__create_role(''course_assistant'', ''Course Assistant'', ''Course Assistants'');
+    perform acs_rel_type__create_role(''teaching_assistant'', ''Teaching Assistant'', ''Teaching Assistants'');
+    perform acs_rel_type__create_role(''instructor'', ''Professor'', ''Professors'');
+    perform acs_rel_type__create_role(''course_admin'', ''Course Administrator'', ''Course Administrators'');
+    perform acs_rel_type__create_role(''admin'', ''Administrator'', ''Administrators'');
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'student_pretty_name',
-	   'string',
-	   'Student Pretty Name',
-	   'Student Pretty Name',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''student_pretty_name'',
+	   ''string'',
+	   ''Student Pretty Name'',
+	   ''Student Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'student_pretty_plural',
-	   'string',
-	   'Student Pretty Plural',
-	   'Student Pretty Plural',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''student_pretty_plural'',
+	   ''string'',
+	   ''Student Pretty Plural'',
+	   ''Student Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'course_assistant_pretty_name',
-	   'string',
-	   'Course Assistant Pretty Name',
-	   'Course Assistant Pretty Name',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''course_assistant_pretty_name'',
+	   ''string'',
+	   ''Course Assistant Pretty Name'',
+	   ''Course Assistant Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'course_assistant_pretty_plural',
-	   'string',
-	   'Course Assistant Pretty Plural',
-	   'Course Assistant Pretty Plural',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''course_assistant_pretty_plural'',
+	   ''string'',
+	   ''Course Assistant Pretty Plural'',
+	   ''Course Assistant Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'teaching_assistant_pretty_name',
-	   'string',
-	   'Teaching Assistant Pretty Name',
-	   'Teaching Assistant Pretty Name',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''teaching_assistant_pretty_name'',
+	   ''string'',
+	   ''Teaching Assistant Pretty Name'',
+	   ''Teaching Assistant Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'teaching_assistant_pretty_plural',
-	   'string',
-	   'Teaching Assistant Pretty Plural',
-	   'Teaching Assistant Pretty Plural',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''teaching_assistant_pretty_plural'',
+	   ''string'',
+	   ''Teaching Assistant Pretty Plural'',
+	   ''Teaching Assistant Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'instructor_pretty_name',
-	   'string',
-	   'Professor Pretty Name',
-	   'Professor Pretty Name',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''instructor_pretty_name'',
+	   ''string'',
+	   ''Professor Pretty Name'',
+	   ''Professor Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'instructor_pretty_plural',
-	   'string',
-	   'Professor Pretty Plural',
-	   'Professor Pretty Plural',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''instructor_pretty_plural'',
+	   ''string'',
+	   ''Professor Pretty Plural'',
+	   ''Professor Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'course_admin_pretty_name',
-	   'string',
-	   'Course Administrator Pretty Name',
-	   'Course Administrator Pretty Name',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''course_admin_pretty_name'',
+	   ''string'',
+	   ''Course Administrator Pretty Name'',
+	   ''Course Administrator Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'course_admin_pretty_plural',
-	   'string',
-	   'Course Administrator Pretty Plural',
-	   'Course Administrator Pretty Plural',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''course_admin_pretty_plural'',
+	   ''string'',
+	   ''Course Administrator Pretty Plural'',
+	   ''Course Administrator Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',		  
-	   'admin_pretty_name',
-	   'string',
-	   'Administrator Pretty Name',
-	   'Administrator Pretty Name',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',		  
+	   ''admin_pretty_name'',
+	   ''string'',
+	   ''Administrator Pretty Name'',
+	   ''Administrator Pretty Name'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
-    select acs_attribute__create_atribute (
-	   'dotlrn_community',
-	   'admin_pretty_plural',
-	   'string',
-	   'Administrator Pretty Plural',
-	   'Administrator Pretty Plural',
+    perform acs_attribute__create_atribute (
+	   ''dotlrn_community'',
+	   ''admin_pretty_plural'',
+	   ''string'',
+	   ''Administrator Pretty Plural'',
+	   ''Administrator Pretty Plural'',
+	   null, null, null,
 	   0,
 	   1,
-	   'generic'
+	   ''generic'',
+	   ''f''
     );
 
     -- create basic rel_types
 
-    select acs_rel_type__create_type (
-	   'dotlrn_member_rel',
-	   'membership_rel',
-	   'dotLRN Community Membership',
-	   'dotLRN Community Memberships',
-	   'dotlrn_member_rel',
-	   'dotlrn_member_rels',
-	   'red_id',
-	   'dotlrn_community',
+    perform acs_rel_type__create_type (
+	   ''dotlrn_member_rel'',
+	   ''dotLRN Community Membership'',
+	   ''dotLRN Community Memberships'',
+	   ''membership_rel'',
+	   ''dotlrn_member_rels'',
+	   ''red_id'',
+	   ''dotlrn_member_rel'',
+	   ''dotlrn_community'',
 	   null,
 	   0,
 	   null,
-	   'user',
-	   'member',
+	   ''user'',
+	   ''member'',
 	   0,
 	   null
     );
 
-    select acs_rel_type__create_type (
-	   'dotlrn_admin_rel',
-	   'dotlrn_member_rel',
-	   'dotLRN Admin Community Membership',
-	   'dotLRN Admin Community Memberships',
-	   'dotlrn_admin_rel',
-	   'dotlrn_admin_rels',
-	   'red_id',
-	   'dotlrn_community',
+    perform acs_rel_type__create_type (
+	   ''dotlrn_admin_rel'',
+	   ''dotLRN Admin Community Membership'',
+	   ''dotLRN Admin Community Memberships'',
+	   ''dotlrn_member_rel'',
+	   ''dotlrn_admin_rels'',
+	   ''red_id'',
+	   ''dotlrn_admin_rel'',
+	   ''dotlrn_community'',
 	   null,
 	   0,
 	   null,
+	   ''user'',
+	   ''admin'',
 	   0,
-	   'admin',
-	   0,
 	   null
     );
 
     -- all rels to communities must have a portal_id
-    select acs_rel_type__create_type (
-	  'dotlrn_member_rel',
-	  'portal_id',
-	  'integer',
-	  'Page ID',
-	  'Page IDs'
+    perform acs_attribute__create_atribute (
+	  ''dotlrn_member_rel'',
+	  ''portal_id'',
+	  ''integer'',
+	  ''Page ID'',
+	  ''Page IDs''
+	  null, null, null,
+	  1,
+	  1,
+	  null,
+	  ''type_specific'',
+	  ''f''
     );
-end;
+
+    return 0;
+end;' language 'plpgsql';
+
+select inline_0();
+drop function inline_0();
