Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-community-memberships-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 7 Nov 2001 17:18:41 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 8 Nov 2001 23:57:40 -0000 1.2 @@ -59,3 +59,96 @@ ); create view dotlrn_instructor_rels_full as select acs_rels.rel_id as rel_id, object_id_two as community_id, object_id_two as user_id, rel_type from dotlrn_instructor_rels, acs_rels where dotlrn_instructor_rels.rel_id = acs_rels.rel_id; + + +-- +-- Object Types and Attributes +-- + +declare + foo integer; +begin + acs_rel_type.create_type ( + rel_type => 'dotlrn_member_rel', + supertype => 'membership_rel', + pretty_name => 'dotLRN Membership', + pretty_plural => 'dotLRN Memberships', + package_name => 'dotlrn_member_rel', + table_name => 'dotlrn_member_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_community', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'dotlrn_user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); + + acs_rel_type.create_type ( + rel_type => 'dotlrn_admin_rel', + supertype => 'dotlrn_member_rel', + pretty_name => 'dotLRN Admin Membership', + pretty_plural => 'dotLRN Admin Memberships', + package_name => 'dotlrn_admin_rel', + table_name => 'dotlrn_admin_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_community', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'dotlrn_user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); + + acs_rel_type.create_type ( + rel_type => 'dotlrn_student_rel', + supertype => 'dotlrn_member_rel', + pretty_name => 'dotLRN Student Membership', + pretty_plural => 'dotLRN Student Memberships', + package_name => 'dotlrn_student_rel', + table_name => 'dotlrn_student_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_class', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'dotlrn_user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); + + acs_rel_type.create_type ( + rel_type => 'dotlrn_ta_rel', + supertype => 'dotlrn_admin_rel', + pretty_name => 'dotLRN TA Membership', + pretty_plural => 'dotLRN TA Memberships', + package_name => 'dotlrn_ta_rel', + table_name => 'dotlrn_ta_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_class', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'dotlrn_user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); + + acs_rel_type.create_type ( + rel_type => 'dotlrn_instructor_rel', + supertype => 'dotlrn_admin_rel', + pretty_name => 'dotLRN Instructor Membership', + pretty_plural => 'dotLRN Instructor Memberships', + package_name => 'dotlrn_instructor_rel', + table_name => 'dotlrn_instructor_rels', + id_column => 'rel_id', + object_type_one => 'dotlrn_class', role_one => NULL, + min_n_rels_one => 0, max_n_rels_one => NULL, + object_type_two => 'dotlrn_user', role_two => NULL, + min_n_rels_two => 0, max_n_rels_two => NULL + ); + + -- + -- and now for the attributes + -- + foo:= acs_attribute.create_attribute ( + object_type => 'dotlrn_member_rel', + attribute_name => 'page_id', + datatype => 'integer', + pretty_name => 'Page ID', + pretty_plural => 'Page IDs' + ); + +end; +/ +show errors Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-community-memberships-packages-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql 7 Nov 2001 17:18:41 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql 8 Nov 2001 23:57:40 -0000 1.2 @@ -22,7 +22,6 @@ page_id in dotlrn_member_rels.page_id%TYPE default NULL, community_id in dotlrn_communities.community_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_member_rels.rel_id%TYPE; @@ -44,7 +43,6 @@ page_id in dotlrn_member_rels.page_id%TYPE default NULL, community_id in dotlrn_communities.community_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_member_rels.rel_id%TYPE @@ -91,7 +89,6 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_admin_rel', community_id in dotlrn_communities.community_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_admin_rels.rel_id%TYPE; @@ -112,7 +109,6 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_admin_rel', community_id in dotlrn_communities.community_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_admin_rels.rel_id%TYPE @@ -123,7 +119,6 @@ rel_type => rel_type, community_id => community_id, user_id => user_id, - context_id => context_id, creation_user => creation_user, creation_ip => creation_ip); @@ -161,7 +156,6 @@ page_id in dotlrn_member_rels.page_id%TYPE default NULL, class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_student_rels.rel_id%TYPE; @@ -183,7 +177,6 @@ page_id in dotlrn_member_rels.page_id%TYPE default NULL, class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_student_rels.rel_id%TYPE @@ -195,7 +188,6 @@ page_id => page_id, community_id => class_instance_id, user_id => user_id, - context_id => context_id, creation_user => creation_user, creation_ip => creation_ip); @@ -232,7 +224,6 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_ta_rel', class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_ta_rels.rel_id%TYPE; @@ -253,7 +244,6 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_ta_rel', class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_ta_rels.rel_id%TYPE @@ -264,7 +254,6 @@ rel_type => rel_type, community_id => class_instance_id, user_id => user_id, - context_id => context_id, creation_user => creation_user, creation_ip => creation_ip); @@ -301,7 +290,6 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_instructor_rel', class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_instructor_rels.rel_id%TYPE; @@ -322,7 +310,6 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_instructor_rel', class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in dotlrn_users.user_id%TYPE, - context_id in acs_objects.context_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null ) return dotlrn_instructor_rels.rel_id%TYPE @@ -333,7 +320,6 @@ rel_type => rel_type, community_id => class_instance_id, user_id => user_id, - context_id => context_id, creation_user => creation_user, creation_ip => creation_ip); @@ -360,82 +346,3 @@ --- --- Now we actually create the rel_types --- - -declare -begin - acs_rel_type.create_type ( - rel_type => 'dotlrn_member_rel', - supertype => 'membership_rel', - pretty_name => 'dotLRN Membership', - pretty_plural => 'dotLRN Memberships', - package_name => 'dotlrn_member_rel', - table_name => 'dotlrn_member_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_community', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'dotlrn_user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); - - acs_rel_type.create_type ( - rel_type => 'dotlrn_admin_rel', - supertype => 'dotlrn_member_rel', - pretty_name => 'dotLRN Admin Membership', - pretty_plural => 'dotLRN Admin Memberships', - package_name => 'dotlrn_admin_rel', - table_name => 'dotlrn_admin_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_community', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'dotlrn_user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); - - acs_rel_type.create_type ( - rel_type => 'dotlrn_student_rel', - supertype => 'dotlrn_member_rel', - pretty_name => 'dotLRN Student Membership', - pretty_plural => 'dotLRN Student Memberships', - package_name => 'dotlrn_student_rel', - table_name => 'dotlrn_student_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_class_instance', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'dotlrn_user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); - - acs_rel_type.create_type ( - rel_type => 'dotlrn_ta_rel', - supertype => 'dotlrn_admin_rel', - pretty_name => 'dotLRN TA Membership', - pretty_plural => 'dotLRN TA Memberships', - package_name => 'dotlrn_ta_rel', - table_name => 'dotlrn_ta_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_class_instance', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'dotlrn_user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); - - acs_rel_type.create_type ( - rel_type => 'dotlrn_instructor_rel', - supertype => 'dotlrn_admin_rel', - pretty_name => 'dotLRN Instructor Membership', - pretty_plural => 'dotLRN Instructor Memberships', - package_name => 'dotlrn_instructor_rel', - table_name => 'dotlrn_instructor_rels', - id_column => 'rel_id', - object_type_one => 'dotlrn_class_instance', role_one => NULL, - min_n_rels_one => 0, max_n_rels_one => NULL, - object_type_two => 'dotlrn_user', role_two => NULL, - min_n_rels_two => 0, max_n_rels_two => NULL - ); - -end; -/ -show errors Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 6 Nov 2001 21:46:48 -0000 1.5 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 8 Nov 2001 23:57:40 -0000 1.6 @@ -167,21 +167,3 @@ / show errors - --- One more object type - -declare -begin - acs_object_type.create_type ( - supertype => 'dotlrn_community', - object_type => 'dotlrn_class_instance', - pretty_name => 'dotLRN Class Instace', - pretty_plural => 'dotLRN Class Instances', - table_name => 'dotlrn_class_instances', - id_column => 'class_instance_id', - package_name => 'dotlrn_class_instance', - name_method => 'acs_object.name' - ); -end; -/ -show errors Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-users-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-users-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-users-create.sql 30 Oct 2001 21:26:58 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-users-create.sql 8 Nov 2001 23:57:40 -0000 1.2 @@ -26,3 +26,22 @@ constraint dlrn_user_page_id_fk references portals(portal_id) ); + + + +declare +begin + acs_object_type.create_type ( + supertype => 'user', + object_type => 'dotlrn_user', + pretty_name => 'dotLRN User', + pretty_plural => 'dotLRN Users', + table_name => 'dotlrn_users', + id_column => 'user_id', + package_name => 'dotlrn_user', + name_method => 'acs_object.name' + ); +end; +/ +show errors + Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-users-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-users-package-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-users-package-create.sql 6 Nov 2001 21:46:48 -0000 1.3 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-users-package-create.sql 8 Nov 2001 23:57:40 -0000 1.4 @@ -39,6 +39,7 @@ is begin insert into dotlrn_users (user_id, role) values (user_id, role); + update acs_objects set object_type='dotlrn_user' where object_id=user_id; return user_id; end; @@ -54,21 +55,3 @@ / show errors - - -declare -begin - acs_object_type.create_type ( - supertype => 'user', - object_type => 'dotlrn_user', - pretty_name => 'dotLRN User', - pretty_plural => 'dotLRN Users', - table_name => 'dotlrn_users', - id_column => 'user_id', - package_name => 'dotlrn_user', - name_method => 'acs_object.name' - ); -end; -/ -show errors - Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 7 Nov 2001 22:22:09 -0000 1.15 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 8 Nov 2001 23:57:40 -0000 1.16 @@ -134,13 +134,14 @@ set page_id [portal::create $user_id] # Create the form with the page_id - set vars(page_id) $page_id + set extra_vars [ns_set create] + ns_set put $extra_vars page_id $page_id + ns_set put $extra_vars user_id $user_id + ns_set put $extra_vars community_id $community_id + ns_set put $extra_vars class_instance_id $community_id - template::form::create add_member_form - template::form::set_values add_member_form vars - # Set up the relationship - set rel_id [relation_add -form_id add_member_form -member_state approved $rel_type $community_id $user_id] + set rel_id [relation_add -extra_vars $extra_vars -member_state approved $rel_type $community_id $user_id] # do the callbacks applets_dispatch $community_id AddUser [list $community_id $user_id]