rem: if (cocoon.request.get("remove_user") && groupUserId != "") { 
add: if (cocoon.request.get("remove_user") && groupUserId != null) { 
context: function group_change_members(groupId) {	resolve();	try {		    var userManager = getAccreditableManager().getUserManager();	    var groupManager = getAccreditableManager().getGroupManager();	    var group = groupManager.getGroup(groupId);	    	    var memberArray = group.getMembers();	    	    var groupUsers = new java.util.ArrayList();	    var otherUsers = new java.util.ArrayList();	    var groupMachines = new java.util.ArrayList();	    var otherMachines = new java.util.ArrayList();	    	    for (var i = 0; i < memberArray.length; i++) {	    	var member = memberArray[i];	    	if (member instanceof Packages.org.apache.lenya.ac.User) {	    		groupUsers.add(member);	    	}	    	if (member instanceof Packages.org.apache.lenya.ac.Machine) {	    		groupMachines.add(machine);	    	}	    }	    	    var users = userManager.getUsers();	    for (var i = 0; i < users.length; i++) {	    	if (!groupUsers.contains(users[i])) {	    		otherUsers.add(users[i]);	    	}	    }	    	    while (true) {		    cocoon.sendPageAndWait("groups/" + groupId + "/members.xml", {		    	"group-id" : groupId,		    	"users" : otherUsers,		    	"group-users" : groupUsers,		    	"machines" : otherMachines,		    	"group-machines" : groupMachines,		    });		    			var otherUserId = cocoon.request.get("user");			if (cocoon.request.get("add_user") && otherUserId != "") {				var user = userManager.getUser(otherUserId);				if (!groupUsers.contains(user)) {					groupUsers.add(user);					otherUsers.remove(user);				}			}		    			var groupUserId = cocoon.request.get("group_user");			if (cocoon.request.get("remove_user") && groupUserId != "") {				var user = userManager.getUser(groupUserId);				if (groupUsers.contains(user)) {					groupUsers.remove(user);					otherUsers.add(user);				}			}			    if (cocoon.request.get("cancel")) {		    	break;		    }		    			if (cocoon.request.get("submit")) {				group.removeAllMembers();								var userIterator = groupUsers.iterator();				while (userIterator.hasNext()) {					var user = userIterator.next();					group.add(user);					user.save();				}								break;			}		}	   	cocoon.sendPage("redirect.html", { "url" : "index.html" });   	}   	finally {	   	release();   	}}
meta: 791	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/791/910cb4d4f662d1bd23d00201f18c580c89c5bc16/group-admin.js/clean/src/webapp/lenya/content/admin/groups/group-admin.js