← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3710: made usergroup use new move functionality

 

------------------------------------------------------------
revno: 3710
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-05-23 15:57:43 +0200
message:
  made usergroup use new move functionality
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm	2011-05-23 13:05:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm	2011-05-23 13:57:43 +0000
@@ -1,60 +1,13 @@
 <script type="text/javascript" src="javascript/addUserGroupForm.js"></script>
 <script type="text/javascript">
-	function groupMembersList_dblclick(e) {
-	    var settings = jQuery("#availableUsersList").data("settings");
-
-	    jQuery(this).find(":selected").each(function(i) {
-	        var jqThis = jQuery(this);
-	        var option_id = +jqThis.attr("value");
-	        jqThis.remove();
-
-	        if( jQuery.isArray(settings.removeUsers) )
-	        {
-	            var remove_idx = jQuery.inArray(option_id, settings.removeUsers);
-	            settings.removeUsers.splice(remove_idx, remove_idx+1);
-	        }
-	    });
-
-	    if(settings.removeUsers && settings.removeUsers.length > 0) {
-	        settings.params.removeUsers = settings.removeUsers.join(",");
-	    } else {
-	        delete settings.removeUsers;
-	        delete settings.params.removeUsers;
-	    }
-
-	    jQuery("#availableUsersList").dhisPaging("load", "availableUsersList");
-	}
-
-	function availableUsersList_dblclick(e) {
-		var jqGroupMembersList = jQuery("#groupMembersList");
-	    var settings = jQuery("#availableUsersList").data("settings");
-
-	    jQuery("#availableUsersList").find(":selected").each(function(i) {
-	        var jqThis = jQuery(this);
-	        var option_id = +jqThis.attr("value");
-
-	        jqGroupMembersList.append( this );
-
-	        if( jQuery.isArray(settings.Users) ) {
-	            settings.removeUsers.push(option_id);
-	        } else {
-	            settings.removeUsers = [option_id];
-	        }
-	    });
-
-	    if(settings.removeUsers && settings.removeUsers.length > 0) {
-	        settings.params.removeUsers = settings.removeUsers.join(",");
-	    } else {
-	        delete settings.removeUsers;
-	        delete settings.params.removeUsers;
-	    }
-	
-	    jQuery("#availableUsersList").dhisPaging("load", "availableUsersList");
-	}
-
 	jQuery(function() {
-		jQuery("#availableUsersList").dblclick(availableUsersList_dblclick);
-		jQuery("#groupMembersList").dblclick(groupMembersList_dblclick);
+		jQuery("#availableUsersList").dblclick(function() {
+			dhisPaging_availableList_dblclick("availableUsersList", "groupMembersList", "removeUsers");
+		});
+
+		jQuery("#groupMembersList").dblclick(function() {
+			dhisPaging_selectedList_dblclick("groupMembersList", "availableUsersList", "removeUsers");
+		});
 	
 		jQuery("#availableUsersList").dhisPaging({
 			source: "../dhis-web-commons-ajax-json/getUsers.action",

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm	2011-05-23 13:05:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserGroupForm.vm	2011-05-23 13:57:43 +0000
@@ -10,62 +10,16 @@
 		return list;
 	}
 
-	function groupMembersList_dblclick(e) {
-	    var settings = jQuery("#availableUsersList").data("settings");
-
-	    jQuery(this).find(":selected").each(function(i) {
-	        var jqThis = jQuery(this);
-	        var option_id = +jqThis.attr("value");
-	        jqThis.remove();
-
-	        if( jQuery.isArray(settings.removeUsers) )
-	        {
-	            var remove_idx = jQuery.inArray(option_id, settings.removeUsers);
-	            settings.removeUsers.splice(remove_idx, remove_idx+1);
-	        }
-	    });
-
-	    if(settings.removeUsers && settings.removeUsers.length > 0) {
-	        settings.params.removeUsers = settings.removeUsers.join(",");
-	    } else {
-	        delete settings.removeUsers;
-	        delete settings.params.removeUsers;
-	    }
-
-	    jQuery("#availableUsersList").dhisPaging("load", "availableUsersList");
-	}
-
-	function availableUsersList_dblclick(e) {
-		var jqGroupMembersList = jQuery("#groupMembersList");
-	    var settings = jQuery("#availableUsersList").data("settings");
-
-	    jQuery("#availableUsersList").find(":selected").each(function(i) {
-	        var jqThis = jQuery(this);
-	        var option_id = +jqThis.attr("value");
-
-	        jqGroupMembersList.append( this );
-
-	        if( jQuery.isArray(settings.Users) ) {
-	            settings.removeUsers.push(option_id);
-	        } else {
-	            settings.removeUsers = [option_id];
-	        }
-	    });
-
-	    if(settings.removeUsers && settings.removeUsers.length > 0) {
-	        settings.params.removeUsers = settings.removeUsers.join(",");
-	    } else {
-	        delete settings.removeUsers;
-	        delete settings.params.removeUsers;
-	    }
-	
-	    jQuery("#availableUsersList").dhisPaging("load", "availableUsersList");
-	}
-
 	jQuery(document).ready(function() {
+		jQuery("#availableUsersList").dblclick(function() {
+			dhisPaging_availableList_dblclick("availableUsersList", "groupMembersList", "removeUsers");
+		});
+
+		jQuery("#groupMembersList").dblclick(function() {
+			dhisPaging_selectedList_dblclick("groupMembersList", "availableUsersList", "removeUsers");
+		});
+
 		var removeUsersList = getRemoveUsersList(); 
-		jQuery("#availableUsersList").dblclick(availableUsersList_dblclick);
-		jQuery("#groupMembersList").dblclick(groupMembersList_dblclick);
 
 		jQuery("#availableUsersList").dhisPaging({
 			source: "../dhis-web-commons-ajax-json/getUsers.action",