Index: openacs-4/packages/dotlrn/dotlrn.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/dotlrn.info,v diff -u -N -r1.67 -r1.68 --- openacs-4/packages/dotlrn/dotlrn.info 14 Mar 2002 23:30:26 -0000 1.67 +++ openacs-4/packages/dotlrn/dotlrn.info 16 Mar 2002 02:02:07 -0000 1.68 @@ -157,11 +157,11 @@ + - @@ -224,6 +224,8 @@ + + @@ -251,10 +253,13 @@ + + + @@ -304,6 +309,8 @@ + + Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-communities-create.sql,v diff -u -N -r1.26 -r1.27 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql 21 Feb 2002 17:28:16 -0000 1.26 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-create.sql 16 Mar 2002 02:02:07 -0000 1.27 @@ -60,6 +60,15 @@ unique (community_key, parent_community_id) ); +create or replace view dotlrn_communities_full +as + select dotlrn_communities.*, + groups.group_name, + groups.join_policy + from dotlrn_communities, + groups + where dotlrn_communities.community_id = groups.group_id; + create or replace view dotlrn_communities_not_closed as select dotlrn_communities.*, 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 -N -r1.9 -r1.10 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 15 Mar 2002 02:06:12 -0000 1.9 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-create.sql 16 Mar 2002 02:02:07 -0000 1.10 @@ -24,14 +24,28 @@ create or replace view dotlrn_member_rels_full as select acs_rels.rel_id as rel_id, - object_id_one as community_id, - object_id_two as user_id, - rel_type, - portal_id + acs_rels.object_id_one as community_id, + acs_rels.object_id_two as user_id, + acs_rels.rel_type, + (select acs_rel_roles.pretty_name + from acs_rel_roles + where acs_rel_roles.role = (select acs_rel_types.role_two + from acs_rel_types + where acs_rel_types.rel_type = acs_rels.rel_type)) as role, + dotlrn_member_rels.portal_id, + membership_rels.member_state from dotlrn_member_rels, - acs_rels - where dotlrn_member_rels.rel_id = acs_rels.rel_id; + acs_rels, + membership_rels + where dotlrn_member_rels.rel_id = acs_rels.rel_id + and acs_rels.rel_id = membership_rels.rel_id; +create or replace view dotlrn_member_rels_approved +as + select * + from dotlrn_member_rels_full + where member_state = 'approved'; + create table dotlrn_admin_rels ( rel_id constraint dotlrn_admin_rels_rel_id_fk references dotlrn_member_rels (rel_id) @@ -41,16 +55,16 @@ create or replace view dotlrn_admin_rels_full as - select acs_rels.rel_id as rel_id, - acs_rels.object_id_one as community_id, - acs_rels.object_id_two as user_id, - acs_rels.rel_type, - dotlrn_member_rels.portal_id - from dotlrn_member_rels, - dotlrn_admin_rels, - acs_rels - where dotlrn_member_rels.rel_id = acs_rels.rel_id - and dotlrn_admin_rels.rel_id = acs_rels.rel_id; + select dotlrn_member_rels_full.rel_id, + dotlrn_member_rels_full.community_id, + dotlrn_member_rels_full.user_id, + dotlrn_member_rels_full.rel_type, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.portal_id, + dotlrn_member_rels_full.member_state + from dotlrn_member_rels_full, + dotlrn_admin_rels + where dotlrn_member_rels_full.rel_id = dotlrn_admin_rels.rel_id; -- -- For Classes @@ -65,13 +79,16 @@ create or replace view dotlrn_student_rels_full as - select acs_rels.rel_id as rel_id, - acs_rels.object_id_one as community_id, - acs_rels.object_id_two as user_id, - acs_rels.rel_type - from dotlrn_student_rels, - acs_rels - where dotlrn_student_rels.rel_id = acs_rels.rel_id; + select dotlrn_member_rels_full.rel_id, + dotlrn_member_rels_full.community_id, + dotlrn_member_rels_full.user_id, + dotlrn_member_rels_full.rel_type, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.portal_id, + dotlrn_member_rels_full.member_state + from dotlrn_member_rels_full, + dotlrn_student_rels + where dotlrn_member_rels_full.rel_id = dotlrn_student_rels.rel_id; create table dotlrn_ta_rels ( rel_id constraint dotlrn_ta_rels_rel_id_fk @@ -82,13 +99,16 @@ create or replace view dotlrn_ta_rels_full as - select acs_rels.rel_id as rel_id, - acs_rels.object_id_one as community_id, - acs_rels.object_id_two as user_id, - acs_rels.rel_type - from dotlrn_ta_rels, - acs_rels - where dotlrn_ta_rels.rel_id = acs_rels.rel_id; + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.portal_id, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_ta_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_ta_rels.rel_id; create table dotlrn_ca_rels ( rel_id constraint dotlrn_ca_rels_rel_id_fk @@ -99,13 +119,16 @@ create or replace view dotlrn_ca_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_ca_rels, - acs_rels - where dotlrn_ca_rels.rel_id = acs_rels.rel_id; + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.portal_id, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_ca_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_ca_rels.rel_id; create table dotlrn_cadmin_rels ( rel_id constraint dotlrn_cadmin_rels_rel_id_fk @@ -116,13 +139,16 @@ 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; + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.portal_id, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_cadmin_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_cadmin_rels.rel_id; create table dotlrn_instructor_rels ( rel_id constraint dotlrn_instructor_rels_rel_fk @@ -131,15 +157,18 @@ primary key ); -create view dotlrn_instructor_rels_full +create or replace view dotlrn_instructor_rels_full as - select acs_rels.rel_id as rel_id, - acs_rels.object_id_two as community_id, - acs_rels.object_id_two as user_id, - acs_rels.rel_type - from dotlrn_instructor_rels, - acs_rels - where dotlrn_instructor_rels.rel_id = acs_rels.rel_id; + select dotlrn_admin_rels_full.rel_id, + dotlrn_admin_rels_full.community_id, + dotlrn_admin_rels_full.user_id, + dotlrn_admin_rels_full.rel_type, + dotlrn_admin_rels_full.role, + dotlrn_admin_rels_full.portal_id, + dotlrn_admin_rels_full.member_state + from dotlrn_admin_rels_full, + dotlrn_instructor_rels + where dotlrn_admin_rels_full.rel_id = dotlrn_instructor_rels.rel_id; -- -- Object Types and Attributes 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 -N -r1.8 -r1.9 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql 13 Mar 2002 00:11:35 -0000 1.8 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-community-memberships-packages-create.sql 16 Mar 2002 02:02:07 -0000 1.9 @@ -23,6 +23,7 @@ portal_id in dotlrn_member_rels.portal_id%TYPE default NULL, community_id in dotlrn_communities.community_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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,6 +45,7 @@ portal_id in dotlrn_member_rels.portal_id%TYPE default NULL, community_id in dotlrn_communities.community_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -55,6 +57,7 @@ rel_type => rel_type, object_id_one => community_id, object_id_two => user_id, + member_state => dotlrn_member_rel.new.member_state, creation_user => creation_user, creation_ip => creation_ip ); @@ -92,6 +95,7 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_admin_rel', community_id in dotlrn_communities.community_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', portal_id in dotlrn_member_rels.portal_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null @@ -113,6 +117,7 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_admin_rel', community_id in dotlrn_communities.community_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', portal_id in dotlrn_member_rels.portal_id%TYPE default null, creation_user in acs_objects.creation_user%TYPE default null, creation_ip in acs_objects.creation_ip%TYPE default null @@ -125,6 +130,7 @@ rel_type => rel_type, community_id => community_id, user_id => user_id, + member_state => dotlrn_admin_rel.new.member_state, portal_id => portal_id, creation_user => creation_user, creation_ip => creation_ip @@ -164,6 +170,7 @@ portal_id in dotlrn_member_rels.portal_id%TYPE default NULL, class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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; @@ -185,6 +192,7 @@ portal_id in dotlrn_member_rels.portal_id%TYPE default NULL, class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -197,6 +205,7 @@ portal_id => portal_id, community_id => class_instance_id, user_id => user_id, + member_state => dotlrn_student_rel.new.member_state, creation_user => creation_user, creation_ip => creation_ip ); @@ -234,6 +243,7 @@ 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 users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -255,6 +265,7 @@ 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 users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -267,6 +278,7 @@ rel_type => rel_type, community_id => class_instance_id, user_id => user_id, + member_state => dotlrn_ta_rel.new.member_state, portal_id => portal_id, creation_user => creation_user, creation_ip => creation_ip @@ -305,6 +317,7 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_ca_rel', class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -326,6 +339,7 @@ rel_type in acs_rels.rel_type%TYPE default 'dotlrn_ca_rel', class_instance_id in dotlrn_class_instances.class_instance_id%TYPE, user_id in users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -338,6 +352,7 @@ rel_type => rel_type, community_id => class_instance_id, user_id => user_id, + member_state => dotlrn_ca_rel.new.member_state, portal_id => portal_id, creation_user => creation_user, creation_ip => creation_ip @@ -376,6 +391,7 @@ 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, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -397,6 +413,7 @@ 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, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -409,6 +426,7 @@ rel_type => rel_type, community_id => class_instance_id, user_id => user_id, + member_state => dotlrn_cadmin_rel.new.member_state, portal_id => portal_id, creation_user => creation_user, creation_ip => creation_ip @@ -447,6 +465,7 @@ 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 users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -468,6 +487,7 @@ 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 users.user_id%TYPE, + member_state in membership_rels.member_state%TYPE default 'approved', 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 @@ -480,6 +500,7 @@ rel_type => rel_type, community_id => class_instance_id, user_id => user_id, + member_state => dotlrn_instructor_rel.new.member_state, portal_id => portal_id, creation_user => creation_user, creation_ip => creation_ip Index: openacs-4/packages/dotlrn/tcl/class-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/class-procs.tcl,v diff -u -N -r1.25 -r1.26 --- openacs-4/packages/dotlrn/tcl/class-procs.tcl 14 Mar 2002 06:47:58 -0000 1.25 +++ openacs-4/packages/dotlrn/tcl/class-procs.tcl 16 Mar 2002 02:02:07 -0000 1.26 @@ -147,15 +147,19 @@ {-rel_type "dotlrn_student_rel"} {-community_id:required} {-user_id:required} + {-member_state "approved"} } { Assigns a user to a particular role for that class. Roles in DOTLRN can be student, prof, ta, admin } { - db_transaction { - set extra_vars [ns_set create] - ns_set put $extra_vars class_instance_id $community_id + set extra_vars [ns_set create] + ns_set put $extra_vars class_instance_id $community_id - dotlrn_community::add_user_to_community -rel_type $rel_type -extra_vars $extra_vars -community_id $community_id -user_id $user_id - } + dotlrn_community::add_user_to_community \ + -rel_type $rel_type \ + -extra_vars $extra_vars \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } ad_proc -public pretty_name { Index: openacs-4/packages/dotlrn/tcl/club-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/club-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/dotlrn/tcl/club-procs.tcl 14 Mar 2002 06:47:58 -0000 1.8 +++ openacs-4/packages/dotlrn/tcl/club-procs.tcl 16 Mar 2002 02:02:07 -0000 1.9 @@ -83,11 +83,15 @@ {-rel_type "dotlrn_member_rel"} {-community_id:required} {-user_id:required} + {-member_state "approved"} } { Assigns a user to a particular role for that club. } { - db_transaction { - dotlrn_community::add_user_to_community -rel_type $rel_type -community_id $community_id -user_id $user_id - } + dotlrn_community::add_user_to_community \ + -rel_type $rel_type \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } + } 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 -N -r1.77 -r1.78 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 15 Mar 2002 00:05:20 -0000 1.77 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 16 Mar 2002 02:02:07 -0000 1.78 @@ -154,7 +154,7 @@ -extra_vars $extra_vars $object_type] set user_id [ad_conn user_id] - + # based on the community_type: # 1. get the page_names and layouts # 2. the the list of default applets for this type @@ -454,11 +454,11 @@ community_id } { Returns the list of users with a membership_id, a user_id, - first name, last name, email, in a given role. + first name, last name, email, in a given role. } { return [db_list_of_lists select_users_in_role {}] } - + ad_proc -public member_p { community_id user_id @@ -479,28 +479,50 @@ ad_proc -public add_user { {-rel_type ""} + {-member_state "approved"} 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"]} { if {![empty_string_p $rel_type]} { - dotlrn_class::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + dotlrn_class::add_user \ + -rel_type $rel_type \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } else { - dotlrn_class::add_user -community_id $community_id -user_id $user_id + dotlrn_class::add_user \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } } elseif {[string equal [get_toplevel_community_type_from_community_id $community_id] "dotlrn_club"]} { if {![empty_string_p $rel_type]} { - dotlrn_club::add_user -rel_type $rel_type -community_id $community_id -user_id $user_id + dotlrn_club::add_user \ + -rel_type $rel_type \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } else { - dotlrn_club::add_user -community_id $community_id -user_id $user_id + dotlrn_club::add_user \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } } else { if {![empty_string_p $rel_type]} { - add_user_to_community -rel_type $rel_type -community_id $community_id -user_id $user_id + add_user_to_community \ + -rel_type $rel_type \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } else { - add_user_to_community -community_id $community_id -user_id $user_id + add_user_to_community \ + -community_id $community_id \ + -user_id $user_id \ + -member_state $member_state } } } @@ -509,6 +531,7 @@ {-rel_type "dotlrn_member_rel"} {-community_id:required} {-user_id:required} + {-member_state "approved"} {-extra_vars ""} } { Assigns a user to a particular role for that class. Roles in DOTLRN can be student, prof, ta, admin @@ -520,9 +543,10 @@ db_transaction { # Set up a portal page for that user and that community set portal_id [portal::create \ - -name "Your [get_community_name $community_id] page" \ - -template_id [get_portal_template_id $community_id] \ - $user_id] + -name "Your [get_community_name $community_id] page" \ + -template_id [get_portal_template_id $community_id] \ + $user_id \ + ] # Create the form with the portal_id if {[empty_string_p $extra_vars]} { @@ -533,15 +557,52 @@ ns_set put $extra_vars community_id $community_id # Set up the relationship - set rel_id [relation_add -extra_vars $extra_vars $rel_type $community_id $user_id] + set rel_id [relation_add \ + -member_state "needs approval" \ + -extra_vars $extra_vars \ + $rel_type \ + $community_id \ + $user_id \ + ] + + if {[string equal $member_state "approved"] == 1} { + membership_approve -user_id $user_id -community_id $community_id + } } + } - # do the callbacks, can't be in the transaction since the portal_id must exist - applets_dispatch -community_id $community_id \ + ad_proc -public membership_approve { + {-user_id:required} + {-community_id:required} + } { + Approve membership to a community + } { + db_1row select_rel_info {} + + db_transaction { + membership_rel::approve -rel_id $rel_id + + applets_dispatch -community_id $community_id \ -op AddUserToCommunity \ -list_args [list $community_id $user_id] + } + } + ad_proc -public membership_reject { + {-user_id:required} + {-community_id:required} + } { + Reject membership to a community + } { + db_1row select_rel_info {} + db_transaction { + membership_rel::reject -rel_id $rel_id + + if {![empty_string_p $portal_id]} { + portal::delete $portal_id + } + } } ad_proc -public remove_user { @@ -553,24 +614,24 @@ db_transaction { # recursively drop membership from subgroups of this comm foreach subcomm_id [get_subcomm_list -community_id $community_id] { - if { [member_p $subcomm_id $user_id] } { + if { [member_p $subcomm_id $user_id] } { remove_user $subcomm_id $user_id - } + } } - + # Do Callbacks applets_dispatch \ - -community_id $community_id \ - -op RemoveUserFromCommunity \ - -list_args [list $community_id $user_id] - - # Get a few important things, + -community_id $community_id \ + -op RemoveUserFromCommunity \ + -list_args [list $community_id $user_id] + + # Get a few important things, # like rel_id and portal portal_id db_1row select_rel_info {} - + # Remove it relation_remove $rel_id - + # Remove the page portal::delete $portal_id } @@ -673,7 +734,7 @@ ad_proc -public get_community_id { {-package_id ""} } { - Returns the community id depending on the package_id + Returns the community id depending on the package_id we're at, or the package_id passed in } { if {[empty_string_p $package_id]} { @@ -686,7 +747,7 @@ ad_proc -public get_parent_community_id { {-package_id ""} } { - Returns the community_id of our parent node or the parent + Returns the community_id of our parent node or the parent of the passed in package_id. This is used for certain scripts under a dotlrn community, such as workflow panels, that cannot be passed their community_id. @@ -718,7 +779,7 @@ if {[empty_string_p [get_parent_id -community_id $community_id]]} { return 0 } else { - return 1 + return 1 } } @@ -733,14 +794,14 @@ ad_proc -public get_subcomm_list { {-community_id:required} } { - Returns a tcl list of the subcommunities of this community or + Returns a tcl list of the subcommunities of this community or if none, the empty list } { set subcomm_list [list] db_foreach select_subcomms {} { lappend subcomm_list $subcomm_id - } + } return $subcomm_list } @@ -759,28 +820,28 @@ if {[empty_string_p $user_id]} { set user_id [ad_get_user_id] } - + foreach sc_id [get_subcomm_list -community_id $community_id] { if {[has_subcommunity_p -community_id $sc_id] \ && [member_p $sc_id $user_id]} { # only go down a level if user is a member of the sc set url [get_community_url $sc_id] - append chunk "$pretext [get_community_name $sc_id]\n" - + append chunk "$pretext [get_community_name $sc_id]\n" + if {[dotlrn::user_can_admin_community_p $sc_id]} { append chunk \ "\[admin\]" } - + append chunk \ "
    \n[get_chunk -community_id $sc_id -user_id $user_id]
\n" } elseif { [not_closed_p -community_id $sc_id] \ || [member_p $sc_id $user_id]} { # if the sc is not closed or i'm a member print it - + set url [get_community_url $sc_id] - + append chunk "$pretext [get_community_name $sc_id]\n" if {[not_closed_p -community_id $sc_id] \ @@ -796,10 +857,10 @@ } - } + } return $chunk } - + ad_proc -public get_community_type_url { community_type } { @@ -1000,7 +1061,7 @@ {-community_id:required} {-applet_key:required} } { - Is this applet active in this community? Does it do voulunteer work? + Is this applet active in this community? Does it do voulunteer work? Helps its neighbors? returns 1 or 0 } { return [db_0or1row select_active_applet_p {}] Index: openacs-4/packages/dotlrn/tcl/community-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.xql,v diff -u -N -r1.36 -r1.37 --- openacs-4/packages/dotlrn/tcl/community-procs.xql 14 Mar 2002 23:47:40 -0000 1.36 +++ openacs-4/packages/dotlrn/tcl/community-procs.xql 16 Mar 2002 02:02:07 -0000 1.37 @@ -2,6 +2,24 @@ + + + select * + from dotlrn_member_rels_full + where user_id = :user_id + and community_id = :community_id + + + + + + select * + from dotlrn_member_rels_full + where user_id = :user_id + and community_id = :community_id + + + declare @@ -93,9 +111,9 @@ last_name, email from registered_users users, - dotlrn_member_rels_full + dotlrn_member_rels_approved where community_id = :community_id - and users.user_id = dotlrn_member_rels_full.user_id + and users.user_id = dotlrn_member_rels_approved.user_id order by rel_type @@ -110,32 +128,36 @@ last_name, email from registered_users users, - dotlrn_member_rels_full + dotlrn_member_rels_approved where community_id = :community_id - and users.user_id = dotlrn_member_rels_full.user_id + and users.user_id = dotlrn_member_rels_approved.user_id and rel_type = :rel_type + + + select count(*) + from dual + where exists (select 1 + from dotlrn_member_rels_full + where community_id = :community_id + and user_id = :user_id) + + - - -select count(*) from dotlrn_member_rels_full where community_id= :community_id and user_id= :user_id - - + + + select count(*) + from dual + where exists (select 1 + from dotlrn_member_rels_full + where community_id = :community_id + and user_id = :user_id + and member_state = 'needs approval') + + - - - select count(*) - from group_member_map, - membership_rels - where group_member_map.group_id = :community_id - and group_member_map.member_id = :user_id - and group_member_map.rel_id = membership_rels.rel_id - and membership_rels.member_state = 'needs approval' - - - select rel_id, portal_id from dotlrn_member_rels_full where community_id= :community_id and user_id= :user_id @@ -168,9 +190,9 @@ dotlrn_communities.pretty_name, dotlrn_communities.package_id from dotlrn_communities, - dotlrn_member_rels_full - where dotlrn_communities.community_id = dotlrn_member_rels_full.community_id - and dotlrn_member_rels_full.user_id = :user_id + dotlrn_member_rels_approved + where dotlrn_communities.community_id = dotlrn_member_rels_approved.community_id + and dotlrn_member_rels_approved.user_id = :user_id Index: openacs-4/packages/dotlrn/www/approve-link.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/approve-link.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/approve-link.adp 16 Mar 2002 02:02:07 -0000 1.1 @@ -0,0 +1 @@ + Approve@label@ Index: openacs-4/packages/dotlrn/www/approve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/approve.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/approve.tcl 16 Mar 2002 02:02:07 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + approve + + @author yon (yon@openforce.net) + @creation-date 2002-03-15 + @version $Id: approve.tcl,v 1.1 2002/03/16 02:02:07 yon Exp $ +} -query { + {user_id ""} + {community_id ""} + {referer "./"} +} + +ad_maybe_redirect_for_registration + +if {[empty_string_p $community_id]} { + set community_id [dotlrn_community::get_community_id] +} + +if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] +} else { + dotlrn::require_user_admin_community $community_id +} + +dotlrn_community::membership_approve -community_id $community_id -user_id $user_id + +ad_returnredirect $referer Index: openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql 18 Feb 2002 16:50:43 -0000 1.5 +++ openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql 16 Mar 2002 02:02:07 -0000 1.6 @@ -1,14 +1,14 @@ - oracle8.1.6 + oracle8.1.6 - - - select count(*) - from dotlrn_communities_not_closed dotlrn_communities - - + + + select count(*) + from dotlrn_communities_not_closed dotlrn_communities + + @@ -26,9 +26,9 @@ start with community_type = dotlrn_communities.community_type connect by community_type = prior supertype) as root_community_type from dotlrn_active_communities dotlrn_communities, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_communities.community_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_communities.community_id order by root_community_type, dotlrn_communities.community_type, dotlrn_communities.pretty_name @@ -49,9 +49,9 @@ start with community_type = dotlrn_communities.community_type connect by community_type = prior supertype) as root_community_type from dotlrn_communities dotlrn_communities, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_communities.community_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_communities.community_id order by root_community_type, dotlrn_communities.community_type, dotlrn_communities.pretty_name @@ -129,9 +129,9 @@ start with community_type = dotlrn_communities.community_type connect by community_type = prior supertype) as root_community_type from dotlrn_active_communities dotlrn_communities, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_communities.community_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_communities.community_id and dotlrn_communities.community_type = :community_type order by root_community_type, dotlrn_communities.community_type, dotlrn_communities.pretty_name @@ -153,9 +153,9 @@ start with community_type = dotlrn_communities.community_type connect by community_type = prior supertype) as root_community_type from dotlrn_communities dotlrn_communities, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_communities.community_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_communities.community_id and dotlrn_communities.community_type = :community_type order by root_community_type, dotlrn_communities.community_type, dotlrn_communities.pretty_name Index: openacs-4/packages/dotlrn/www/dotlrn-main-portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/dotlrn-main-portlet.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/dotlrn/www/dotlrn-main-portlet.xql 4 Mar 2002 23:54:00 -0000 1.3 +++ openacs-4/packages/dotlrn/www/dotlrn-main-portlet.xql 16 Mar 2002 02:02:07 -0000 1.4 @@ -8,9 +8,9 @@ dotlrn_class_instances_full.url, acs_permission.permission_p(community_id, :user_id, 'admin') as admin_p from dotlrn_class_instances_full, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_class_instances_full.class_instance_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_class_instances_full.class_instance_id @@ -21,9 +21,9 @@ dotlrn_clubs_full.url, acs_permission.permission_p(community_id, :user_id, 'admin') as admin_p from dotlrn_clubs_full, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_clubs_full.club_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_clubs_full.club_id Index: openacs-4/packages/dotlrn/www/manage-memberships-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/manage-memberships-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/manage-memberships-oracle.xql 13 Mar 2002 00:12:09 -0000 1.2 +++ openacs-4/packages/dotlrn/www/manage-memberships-oracle.xql 16 Mar 2002 02:02:07 -0000 1.3 @@ -16,11 +16,8 @@ select dotlrn_class_instances_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.member_state, acs_permission.permission_p(dotlrn_class_instances_full.class_instance_id, :user_id, 'admin') as admin_p from dotlrn_class_instances_full, dotlrn_member_rels_full @@ -36,11 +33,8 @@ select dotlrn_class_instances_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.member_state, acs_permission.permission_p(dotlrn_class_instances_full.class_instance_id, :user_id, 'admin') as admin_p from dotlrn_class_instances_full, dotlrn_member_rels_full @@ -57,11 +51,8 @@ select dotlrn_class_instances_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.member_state, acs_permission.permission_p(dotlrn_class_instances_full.class_instance_id, :user_id, 'admin') as admin_p from dotlrn_class_instances_full, dotlrn_member_rels_full @@ -78,11 +69,8 @@ select dotlrn_class_instances_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.member_state, acs_permission.permission_p(dotlrn_class_instances_full.class_instance_id, :user_id, 'admin') as admin_p from dotlrn_class_instances_full, dotlrn_member_rels_full @@ -100,11 +88,8 @@ select dotlrn_clubs_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_full.role, + dotlrn_member_rels_full.member_state, acs_permission.permission_p(dotlrn_clubs_full.club_id, :user_id, 'admin') as admin_p from dotlrn_clubs_full, dotlrn_member_rels_full Index: openacs-4/packages/dotlrn/www/manage-memberships.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/manage-memberships.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/dotlrn/www/manage-memberships.adp 15 Mar 2002 23:14:41 -0000 1.5 +++ openacs-4/packages/dotlrn/www/manage-memberships.adp 16 Mar 2002 02:02:07 -0000 1.6 @@ -64,7 +64,12 @@ @member_classes.pretty_name@ @member_classes.term_name@ @member_classes.term_year@ @member_classes.role@ + + [ Pending Approval ] + + [] + @@ -97,7 +102,12 @@ @member_clubs.pretty_name@ @member_clubs.role@ + + [ Pending Approval ] + + [] + @@ -150,7 +160,12 @@ @non_member_classes.pretty_name@ @non_member_classes.term_name@ @non_member_classes.term_year@   + [] + + + [] + @@ -181,7 +196,12 @@ @non_member_clubs.pretty_name@ + [] + + + [] + Index: openacs-4/packages/dotlrn/www/member-add-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/member-add-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/member-add-oracle.xql 11 Feb 2002 22:03:23 -0000 1.2 +++ openacs-4/packages/dotlrn/www/member-add-oracle.xql 16 Mar 2002 02:02:07 -0000 1.3 @@ -1,15 +1,20 @@ - - - select user_id, first_names, last_name, email - from dotlrn_users - where lower(last_name) like lower('%' || :search_text || '%') - or lower(email) like lower('%' || :search_text || '%') - and user_id not in (select user_id - from dotlrn_member_rels_full - where community_id = :community_id) - - + + + + select user_id, + first_names, + last_name, + email + from dotlrn_users + where lower(last_name) like lower('%' || :search_text || '%') + or lower(email) like lower('%' || :search_text || '%') + and user_id not in (select user_id + from dotlrn_member_rels_full + where community_id = :community_id) + + + Index: openacs-4/packages/dotlrn/www/members-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/members-chunk.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/dotlrn/www/members-chunk.adp 15 Mar 2002 01:09:21 -0000 1.5 +++ openacs-4/packages/dotlrn/www/members-chunk.adp 16 Mar 2002 02:02:07 -0000 1.6 @@ -13,8 +13,8 @@   [] - + @@ -37,3 +37,30 @@ + + + + +

Membership Requests

+ +
+ + + Index: openacs-4/packages/dotlrn/www/members-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/members-chunk.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/dotlrn/www/members-chunk.tcl 15 Mar 2002 01:09:21 -0000 1.5 +++ openacs-4/packages/dotlrn/www/members-chunk.tcl 16 Mar 2002 02:02:07 -0000 1.6 @@ -48,4 +48,16 @@ [lindex $user 5] } +db_multirow pending_users select_pending_users { + select dotlrn_users.*, + dotlrn_member_rels_full.rel_type, + dotlrn_member_rels_full.role + from dotlrn_users, + dotlrn_member_rels_full + where dotlrn_users.user_id = :user_id + and dotlrn_users.user_id = dotlrn_member_rels_full.user_id + and dotlrn_member_rels_full.community_id = :community_id + and dotlrn_member_rels_full.member_state = 'needs approval' +} + ad_return_template Index: openacs-4/packages/dotlrn/www/my-communities-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/my-communities-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/my-communities-oracle.xql 19 Jan 2002 22:54:20 -0000 1.1 +++ openacs-4/packages/dotlrn/www/my-communities-oracle.xql 16 Mar 2002 02:02:07 -0000 1.2 @@ -11,18 +11,12 @@ dotlrn_communities.description, dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, - (select pretty_name - from acs_rel_roles - where role = (select acs_rel_types.role_two - from acs_rel_types, - acs_rels - where acs_rel_types.rel_type = acs_rels.rel_type - and acs_rels.rel_id = dotlrn_member_rels_full.rel_id)) as role, - decode(dotlrn_community.admin_p(dotlrn_communities.community_id, dotlrn_member_rels_full.user_id),'f',0,1) as admin_p + dotlrn_member_rels_approved.role, + decode(dotlrn_community.admin_p(dotlrn_communities.community_id, dotlrn_member_rels_approved.user_id),'f',0,1) as admin_p from dotlrn_communities, - dotlrn_member_rels_full - where dotlrn_communities.community_id = dotlrn_member_rels_full.community_id - and dotlrn_member_rels_full.user_id = :user_id + dotlrn_member_rels_approved + where dotlrn_communities.community_id = dotlrn_member_rels_approved.community_id + and dotlrn_member_rels_approved.user_id = :user_id order by dotlrn_communities.community_type, dotlrn_communities.pretty_name
Index: openacs-4/packages/dotlrn/www/register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/register.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/dotlrn/www/register.tcl 23 Jan 2002 00:15:43 -0000 1.2 +++ openacs-4/packages/dotlrn/www/register.tcl 16 Mar 2002 02:02:07 -0000 1.3 @@ -6,18 +6,36 @@ @creation-date 2001-10-06 @version $Id$ } -query { + {user_id ""} {community_id ""} {referer "./"} } ad_maybe_redirect_for_registration -set user_id [ad_conn user_id] - if {[empty_string_p $community_id]} { set community_id [dotlrn_community::get_community_id] } -dotlrn_community::add_user $community_id $user_id +if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] +} else { + dotlrn::require_user_admin_community $community_id +} +set join_policy [db_string select_join_policy { + select join_policy + from dotlrn_communities_full + where community_id = :community_id +}] + +switch -exact $join_policy { + "open" { + dotlrn_community::add_user $community_id $user_id + } + "needs approval" { + dotlrn_community::add_user -member_state "needs approval" $community_id $user_id + } +} + ad_returnredirect $referer Index: openacs-4/packages/dotlrn/www/reject-link.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/reject-link.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/reject-link.adp 16 Mar 2002 02:02:07 -0000 1.1 @@ -0,0 +1 @@ + Reject@label@ Index: openacs-4/packages/dotlrn/www/reject.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/reject.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/www/reject.tcl 16 Mar 2002 02:02:07 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + reject + + @author yon (yon@openforce.net) + @creation-date 2002-03-15 + @version $Id: reject.tcl,v 1.1 2002/03/16 02:02:07 yon Exp $ +} -query { + {user_id ""} + {community_id ""} + {referer "./"} +} + +ad_maybe_redirect_for_registration + +if {[empty_string_p $community_id]} { + set community_id [dotlrn_community::get_community_id] +} + +if {[empty_string_p $user_id]} { + set user_id [ad_conn user_id] +} else { + dotlrn::require_user_admin_community $community_id +} + +dotlrn_community::membership_reject -community_id $community_id -user_id $user_id + +ad_returnredirect $referer Index: openacs-4/packages/dotlrn/www/admin/user-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/user-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/user-oracle.xql 14 Mar 2002 05:40:14 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/user-oracle.xql 16 Mar 2002 02:02:07 -0000 1.2 @@ -36,16 +36,12 @@ select dotlrn_class_instances_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_approved.role, acs_permission.permission_p(dotlrn_class_instances_full.class_instance_id, :user_id, 'admin') as admin_p from dotlrn_class_instances_full, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_class_instances_full.class_instance_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_class_instances_full.class_instance_id order by dotlrn_class_instances_full.department_name, dotlrn_class_instances_full.department_key, dotlrn_class_instances_full.pretty_name, @@ -56,16 +52,12 @@ select dotlrn_clubs_full.*, - (select acs_rel_roles.pretty_name - from acs_rel_roles - where acs_rel_roles.role = (select acs_rel_types.role_two - from acs_rel_types - where acs_rel_types.rel_type = dotlrn_member_rels_full.rel_type)) as role, + dotlrn_member_rels_approved.role, acs_permission.permission_p(dotlrn_clubs_full.club_id, :user_id, 'admin') as admin_p from dotlrn_clubs_full, - dotlrn_member_rels_full - where dotlrn_member_rels_full.user_id = :user_id - and dotlrn_member_rels_full.community_id = dotlrn_clubs_full.club_id + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.community_id = dotlrn_clubs_full.club_id order by dotlrn_clubs_full.pretty_name, dotlrn_clubs_full.community_key