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.7 -r1.8 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 7 Mar 2002 22:22:44 -0000 1.7 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 13 Mar 2002 00:11:35 -0000 1.8 @@ -107,6 +107,23 @@ acs_rels where dotlrn_ca_rels.rel_id = acs_rels.rel_id; +create table dotlrn_cadmin_rels ( + rel_id constraint dotlrn_cadmin_rels_rel_id_fk + references dotlrn_admin_rels (rel_id) + constraint dotlrn_cadmin_rels_rel_id_pk + primary key +); + +create or replace view dotlrn_cadmin_rels_full +as + select acs_rels.rel_id, + acs_rels.object_id_one as community_id, + acs_rels.object_id_two as user_id, + acs_rels.rel_type + from dotlrn_cadmin_rels, + acs_rels + where dotlrn_cadmin_rels.rel_id = acs_rels.rel_id; + create table dotlrn_instructor_rels ( rel_id constraint dotlrn_instructor_rels_rel_fk references dotlrn_admin_rels(rel_id) 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.7 -r1.8 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql 8 Mar 2002 00:50:41 -0000 1.7 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql 13 Mar 2002 00:11:35 -0000 1.8 @@ -368,6 +368,77 @@ / show errors; +create or replace package dotlrn_cadmin_rel +is + + function new ( + rel_id in dotlrn_cadmin_rels.rel_id%TYPE default NULL, + rel_type in acs_rels.rel_type%TYPE default 'dotlrn_cadmin_rel', + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, + user_id in users.user_id%TYPE, + portal_id in dotlrn_member_rels.portal_id%TYPE, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return dotlrn_cadmin_rels.rel_id%TYPE; + + procedure delete ( + rel_id in dotlrn_cadmin_rels.rel_id%TYPE + ); + +end; +/ +show errors; + +create or replace package body dotlrn_cadmin_rel +is + + function new ( + rel_id in dotlrn_cadmin_rels.rel_id%TYPE default NULL, + rel_type in acs_rels.rel_type%TYPE default 'dotlrn_cadmin_rel', + class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, + user_id in users.user_id%TYPE, + portal_id in dotlrn_member_rels.portal_id%TYPE, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return dotlrn_cadmin_rels.rel_id%TYPE + is + v_rel_id dotlrn_cadmin_rels.rel_id%TYPE; + begin + v_rel_id:= dotlrn_admin_rel.new( + rel_id => rel_id, + rel_type => rel_type, + community_id => class_instance_id, + user_id => user_id, + portal_id => portal_id, + creation_user => creation_user, + creation_ip => creation_ip + ); + + insert + into dotlrn_cadmin_rels + (rel_id) + values + (v_rel_id); + + return v_rel_id; + end; + + procedure delete ( + rel_id in dotlrn_cadmin_rels.rel_id%TYPE + ) + is + begin + delete + from dotlrn_cadmin_rels + where rel_id = dotlrn_cadmin_rel.delete.rel_id; + + dotlrn_admin_rel.delete(rel_id); + end; + +end; +/ +show errors; + create or replace package dotlrn_instructor_rel is 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.14 -r1.15 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 7 Mar 2002 22:22:44 -0000 1.14 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-init.sql 13 Mar 2002 00:11:35 -0000 1.15 @@ -46,6 +46,7 @@ acs_rel_type.create_role ('course_assistant', 'Course Assistant', 'Course Assistants'); acs_rel_type.create_role ('teaching_assistant', 'Teaching Assistant', 'Teaching Assistants'); acs_rel_type.create_role ('instructor', 'Professor', 'Professors'); + acs_rel_type.create_role ('course_admin', 'Course Administrator', 'Course Administrators'); acs_rel_type.create_role ('admin', 'Administrator', 'Administrators'); end; / 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.71 -r1.72 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 11 Mar 2002 23:05:04 -0000 1.71 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 13 Mar 2002 00:11:35 -0000 1.72 @@ -323,14 +323,14 @@ } # else, it's a class instance - return {dotlrn_student_rel dotlrn_ta_rel dotlrn_instructor_rel dotlrn_ca_rel dotlrn_admin_rel} + return {dotlrn_student_rel dotlrn_ta_rel dotlrn_instructor_rel dotlrn_ca_rel dotlrn_cadmin_rel dotlrn_admin_rel} } ad_proc -public get_all_roles {} { return the list of roles used in dotLRN } { - return {dotlrn_admin_rel dotlrn_member_rel dotlrn_instructor_rel dotlrn_ca_rel dotlrn_ta_rel dotlrn_student_rel} + return {dotlrn_admin_rel dotlrn_member_rel dotlrn_instructor_rel dotlrn_cadmin_rel dotlrn_ca_rel dotlrn_ta_rel dotlrn_student_rel} } ad_proc -public get_all_roles_as_options {} { @@ -472,18 +472,30 @@ } ad_proc -public add_user { - {-rel_type "dotlrn_member_rel"} + {-rel_type ""} community_id user_id } { add a user to a particular community } { if {[string equal [get_toplevel_community_type_from_community_id $community_id] "dotlrn_class_instance"]} { - dotlrn_class::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + if {![empty_string_p $rel_type]} { + dotlrn_class::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + } else { + dotlrn_class::add_user -community_id $community_id -user_id $user_id + } } elseif {[string equal [get_toplevel_community_type_from_community_id $community_id] "dotlrn_club"]} { - dotlrn_club::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + if {![empty_string_p $rel_type]} { + dotlrn_club::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + } else { + dotlrn_club::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + } } else { - add_user_to_community -rel_type $rel_type -community_id $community_id -user_id $user_id + if {![empty_string_p $rel_type]} { + add_user_to_community -rel_type $rel_type -community_id $community_id -user_id $user_id + } else { + add_user_to_community -community_id $community_id -user_id $user_id + } } }