← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6102: Use jQuery methods insteads of Request object in dhis-web-maintenance-dataadmin.

 

------------------------------------------------------------
revno: 6102
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-24 15:44:29 +0700
message:
  Use jQuery methods insteads of Request object in dhis-web-maintenance-dataadmin.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.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-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js	2011-02-01 18:55:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js	2012-02-24 08:44:29 +0000
@@ -16,21 +16,19 @@
             "&zeroValues=" + zeroValues +
             "&dataSetCompleteness=" + dataSetCompleteness +
             "&prunePeriods=" + prunePeriods;
-            
-        var url = "performMaintenance.action";
         
-        var request = new Request();
-        request.sendAsPost( params );
-        request.setCallbackSuccess( performMaintenanceReceived );
-        request.send( url );
+		$.ajax({
+			   type: "POST",
+			   url: "performMaintenance.action",
+			   data: params,
+			   dataType: "xml",
+			   success: function(result){
+					setMessage( i18n_maintenance_performed );
+			   }
+			});
     }
     else
     {
         setMessage( i18n_select_options );
     }
 }
-
-function performMaintenanceReceived( messageElement )
-{
-    setMessage( i18n_maintenance_performed );
-}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js	2011-01-19 06:43:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js	2012-02-24 08:44:29 +0000
@@ -1,8 +1,5 @@
 function generateMinMaxValue(){
-	var request = new Request();
-	request.setResponseTypeXML( 'xmlObject' );
-	request.setCallbackSuccess( minMaxValueCompleted );	
-
+	
 	var datasetIds = "";
 	var datasetField = byId( 'dataSetIds' ); 
 	for (var i = 0; i < datasetField.options.length; i++)
@@ -13,45 +10,16 @@
 		}
 	}
 	
-	request.sendAsPost( datasetIds );
-	request.send( 'generateMinMaxValue.action' );
-	
-}
-
-function minMaxValueCompleted( xmlObject ) {
-    showSuccessMessage (xmlObject.firstChild.nodeValue);
-	return false;
-}
-//-----------------------------------------------------------------------------------
-// Default Min/Max values
-//-----------------------------------------------------------------------------------
-
-function saveDefaultValues(){
-	var request = new Request();
-	request.setResponseTypeXML( 'xmlObject' );
-	request.setCallbackSuccess( saveDefaultValuesCompleted );	
-	var params = 'minValue=' + getFieldValue('minValue');
-		params += '&maxValue=' + getFieldValue('maxValue');
-	request.send( 'saveDefaultMinMaxValues.action?' + params );	
-}
-
-function saveDefaultValuesCompleted(xmlObject){
-	setMessage(xmlObject.firstChild.nodeValue);
-}
-
-//------------------------------------------------------------------------------
-// Save factor
-//------------------------------------------------------------------------------
-
-function saveFactor(){
-	var request = new Request();
-	request.setResponseTypeXML( 'xmlObject' );
-    request.setCallbackSuccess( saveFactorSuccess );
-    request.send( 'saveFactor.action?factor='+ getFieldValue('factor') );
-}
-
-function saveFactorSuccess(){
-	setMessage( i18n_save_factory_success );
+	$.ajax({
+		   type: "POST",
+		   url: "generateMinMaxValue.action",
+		   data: datasetIds,
+		   dataType: "xml",
+		   success: function(xmlObject){
+				xmlObject = xmlObject.getElementsByTagName( 'message' )[0];
+				showSuccessMessage (xmlObject.firstChild.nodeValue);
+		   }
+		});
 }
 
 //-----------------------------------------------------------------------------------
@@ -60,10 +28,6 @@
 
 function removeMinMaxValue(){
 
-	var request = new Request();
-	request.setResponseTypeXML( 'xmlObject' );
-	request.setCallbackSuccess( minMaxValueCompleted );	
-	
 	var datasetIds = "";
 	var datasetField = byId( 'dataSetIds' ); 
 	for (var i = 0; i < datasetField.options.length; i++)
@@ -74,7 +38,14 @@
 		}
 	}
 	
-	request.sendAsPost( datasetIds );
-	request.send( 'removeMinMaxValue.action' );
-	
+	$.ajax({
+		   type: "POST",
+		   url: "removeMinMaxValue.action",
+		   data: datasetIds,
+		   dataType: "xml",
+		   success: function(xmlObject){
+				xmlObject = xmlObject.getElementsByTagName( 'message' )[0];
+				showSuccessMessage (xmlObject.firstChild.nodeValue);
+		   }
+		});
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js	2011-03-17 19:31:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js	2012-02-24 08:44:29 +0000
@@ -24,12 +24,15 @@
             "&categoryOptionComboName=" + categoryOptionComboName +
             "&dataElementStructure=" + dataElementStructure;
             
-        var url = "generateResourceTable.action";
-        
-        var request = new Request();
-        request.sendAsPost( params );
-        request.setCallbackSuccess( generateResourceTableReceived );
-        request.send( url );
+		$.ajax({
+			   type: "POST",
+			   url: "generateResourceTable.action",
+			   data: params,
+			   dataType: "xml",
+			   success: function(result){
+					setMessage( i18n_resource_tables_generated );
+			   }
+			});
     }
     else
     {
@@ -37,11 +40,6 @@
     }
 }
 
-function generateResourceTableReceived( messageElement )
-{
-    setMessage( i18n_resource_tables_generated );
-}
-
 function toggleAll()
 {	
 	selected = !selected;