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.191.2.30 -r1.191.2.31 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 4 May 2006 11:45:21 -0000 1.191.2.30 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 20 Nov 2006 20:00:16 -0000 1.191.2.31 @@ -738,6 +738,41 @@ return [db_list_of_lists select_users_in_role {}] } + ad_proc -public members_count { + -community_id + {-join_policy "open"} + } { + Count members given the join policy. + } { + return [db_string select_count {}] + } + + ad_proc -public max_members { + -community_id + } { + Returns the max members setting for the community + } { + return [db_string select_max_members {}] + } + + ad_proc -public max_members_p { + -community_id + } { + Have we reached maximum members + } { + set max_members [db_string select_max_members {}] + if {$max_members == 0} { + return 0 + } else { + set size [members_count -community_id $community_id] + if {$size < $max_members} { + return 0 + } else { + return 1 + } + } + } + ad_proc -public member_p { community_id user_id @@ -928,6 +963,18 @@ } } + ad_proc -public remove_banned_users_from_all { + } { + Remove all banned users from all communities (if they are members) + } { + db_foreach get_banned_users_with_membership {} { + dotlrn_community::remove_user_from_all -user_id $user_id + ns_log Debug "User $user_id is banned and was removed from all communities" + } if_no_rows { + ns_log Debug "No banned user needed to be removed from a community" + } + } + ad_proc -public get_all_communities_by_user { user_id } { @@ -1276,7 +1323,12 @@ } elseif {[needs_approval_p -community_id $sc_id]} { append chunk "[_ dotlrn.Request_Membership]\n" } else { - append chunk "([_ dotlrn.Join])\n" + set max_members_p [max_members_p -community_id $sc_id] + if {$max_members_p} { + append chunk "([_ dotlrn.full])\n" + } else { + append chunk "([_ dotlrn.Join])\n" + } } append chunk "\n"