Index: lams_admin/web/userorg.jsp =================================================================== diff -u -r51e6dce474861837e1e86838bcbc1b1efba971e3 -r36a78fea0bae9c4073ef18576e3dabd15380da4e --- lams_admin/web/userorg.jsp (.../userorg.jsp) (revision 51e6dce474861837e1e86838bcbc1b1efba971e3) +++ lams_admin/web/userorg.jsp (.../userorg.jsp) (revision 36a78fea0bae9c4073ef18576e3dabd15380da4e) @@ -63,8 +63,8 @@ function bindAddLink() { jQuery("a.addLink").click(function() { - var rowText = jQuery(this).parent().text(); var rowId = jQuery(this).parent().attr("id"); + var rowText = jQuery(this).parent().text(); jQuery("div#existing").append("
  • "+rowText+"
  • "); jQuery(this).parent().remove(); updateExistingTotal(); @@ -98,19 +98,25 @@ function loadSearchResultsCallback(potential) { updatePotentialTotal(); jQuery("li", "div#potential").each(function() { - var rowHtml = jQuery(this).html(); - jQuery(this).html(""+rowHtml+""); + if ($('div#existing li#' + $(this).attr('id')).length > 0) { + $(this).remove(); + } else { + $(this).html(""+$(this).html()+""); + } }); if (potential == '1') { for (var userId in removedUsers) { - jQuery("div#potential").append("
  • " + removedUsers[userId] + "
  • "); + if ($('div#existing li#' + userId + ', div#potential li#' + userId).length == 0) { + $("div#potential").append("
  • " + removedUsers[userId] + "
  • "); + } } removedUsers = []; } else { for (var userId in removedUsers) { var term = jQuery("#term").val(); - if (removedUsers[userId].toLowerCase().indexOf(term.toLowerCase()) >= 0) { + if (removedUsers[userId].toLowerCase().indexOf(term.toLowerCase()) >= 0 + && $('div#existing li#' + userId + ', div#potential li#' + userId).length == 0) { jQuery("div#potential").append("
  • " + removedUsers[userId] + "
  • "); delete removedUsers[userId]; }