rem: sendPageAndWait("users/groups.xml", { 
add: sendPageAndWait("users/" + userId + "/groups.xml", { 
context: function user_change_groups(userId) {    var user = getUserManager().getUser(userId);        var userGroupArray = user.getGroups();    var userGroups = new java.util.ArrayList(java.util.Arrays.asList(userGroupArray));        var iterator = getGroupManager().getGroups();    var groups = new java.util.ArrayList();    while (iterator.hasNext()) {    	var group = iterator.next();    	if (!userGroups.contains(group)) {    		groups.add(group);    	}    }        while (true) {	    sendPageAndWait("users/groups.xml", {	    	"user-id" : userId,	    	"groups" : groups,	    	"user-groups" : userGroups	    });	    		var groupId = cocoon.request.get("group");		if (cocoon.request.get("add_group") && groupId != "") {			var group = getGroupManager().getGroup(groupId);			if (!userGroups.contains(group)) {				userGroups.add(group);				groups.remove(group);			}		}	    		var userGroupId = cocoon.request.get("user_group");		if (cocoon.request.get("remove_group") && userGroupId != "") {			var group = getGroupManager().getGroup(userGroupId);			if (userGroups.contains(group)) {				userGroups.remove(group);				groups.add(group);			}		}	    if (cocoon.request.get("cancel")) {	    	break;	    }	    		if (cocoon.request.get("submit")) {			user.removeFromAllGroups();			var iterator = userGroups.iterator();			while (iterator.hasNext()) {				var group = iterator.next();				group.add(user);			}			user.save();			break;		}	}   	sendPage("redirect.html", { "url" : "index.html" });}
meta: 791	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/791/12471b61211afdc841e584d85fb80a05d69d4b6a/user-admin.js/clean/src/webapp/lenya/content/admin/users/user-admin.js