← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3283: Data Set Editor - Fixed bug could not assign to all now.

 

------------------------------------------------------------
revno: 3283
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-04-05 12:57:05 +0700
message:
  Data Set Editor - Fixed bug could not assign to all now.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js


--
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-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js	2011-03-30 05:05:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editor.js	2011-04-05 05:57:05 +0000
@@ -1,46 +1,50 @@
 
 // Global variables:
-
 arrayIds = new Array();
 
-
 function displayAssociatedForm()
 {
 	var url = "showedAssociationsEditor.action";
 	
 	showLoader();
 	
-	$( "#contentDiv" ).load( url, function(){
+	jQuery( "#contentDiv" ).load( url, function(){
 		hideLoader();
 	});
 }
 
 function changeAssociatedStatus( orgunitId, dataSetId, assigned )
 {
-	var url = "definedAssociationsEditor.action?";
+	var url = "definedAssociationEditor.action?";
 	url += "orgUnitId=" + orgunitId ;
 	url += "&dataSetId=" + dataSetId;
 	url += "&assigned=" + !assigned;
 	
-	$( "#div" + orgunitId + dataSetId ).load( url );
+	jQuery( "#div" + orgunitId + dataSetId ).load( url );
 }
 
 function assignAll( element, orgunitId )
 {
-	var status = false;
-	var checked = element.checked;
+	var url = "definedMultiAssociationsEditor.action?";
 
 	lockScreen();
 	
-	for ( var i = 0 ; i < arrayIds.length ; i++ )
+	for ( var i in arrayIds )
 	{
-		status = eval( $("#div" + orgunitId + arrayIds[i] + " input[type='hidden']").val() );
+		url += "dataSetIds=" + arrayIds[i] + "&";
+		url += "statuses=" + $("#div" + orgunitId + arrayIds[i] + " input[type='hidden']").val();
+		url += (i < arrayIds.length-1) ? "&" : "";
+	}
 	
-		if ( (checked && !status) || (!checked && status) )
+	if ( url.length > 0 )
+	{
+		jQuery( "tr#tr" + orgunitId ).load( url,
 		{
-			changeAssociatedStatus( orgunitId, arrayIds[i], !checked );
-		}
+			'orgUnitId': orgunitId,
+			'checked': element.checked
+		},
+		function(){
+			unLockScreen();
+		});
 	}
-	
-	unLockScreen();
 }
\ No newline at end of file