Index: openacs-4/packages/dotlrn/www/deregister.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/deregister.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/dotlrn/www/deregister.tcl 9 Aug 2002 18:39:26 -0000 1.5 +++ openacs-4/packages/dotlrn/www/deregister.tcl 17 Oct 2002 12:28:10 -0000 1.5.2.1 @@ -22,11 +22,20 @@ @creation-date 2001-10-06 @version $Id$ } -query { - {user_id ""} + {user_id:multiple,integer ""} {community_id ""} {referer "./"} } + +# This page was modified to allow more that one user to be dropped at a time. +# This one done so there is one consistent way of dropping members. +# +# The parameter "user_id" was kept so that other entry points (both current +# and those that might occur in the future from OpenACS and other changes) +# wouldn't break. This does have the unfortunate consequence that the name +# user_id is not intuative when it is a list of many user_ids. (teadams@alum.mit.edu) + ad_maybe_redirect_for_registration if {[empty_string_p $community_id]} { @@ -39,6 +48,27 @@ dotlrn::require_user_admin_community -community_id $community_id } -dotlrn_community::remove_user $community_id $user_id +foreach member_id $user_id { + + # This is catch most double clicks. + # The catch will take care of cases where the double click is too fast. + if {[dotlrn_community::member_p $community_id $member_id]} { + if {[catch { + dotlrn_community::remove_user $community_id $member_id + } errmsg]} { + + if {![dotlrn_community::member_p $community_id $user_id]} { + # assume this was a double click + ad_returnredirect $referer + ad_script_abort + } else { + ns_log Error "deregister.tcl failed: $errmsg" + ReturnHeaders + ad_return_error "Error removing user community" "An error occured while trying to remove a user to a community. This error has been logged." + } + } + } +} + ad_returnredirect $referer