← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6158: Modify POST and GET method into dhis-web-maintenance-dataset and dhis-web-reporting.

 

------------------------------------------------------------
revno: 6158
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-03-04 20:46:17 +0700
message:
  Modify POST and GET method into dhis-web-maintenance-dataset and dhis-web-reporting.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/shortName.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.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/dataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js	2012-02-24 08:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js	2012-03-04 13:46:17 +0000
@@ -19,32 +19,23 @@
 
 function validateDataEntryForm()
 {  
-  var params  = 'name=' + document.getElementById( 'nameField' ).value;
-	  params += '&dataSetId=' + document.getElementById( 'dataSetIdField' ).value;
-  if(stat == "EDIT")
-  {
-    params += '&dataEntryFormId=' + dataEntryFormId;      
-  }        
-
-  if(autoSave == false)
-  {
-	$.ajax({
-	   type: "POST",
-	   url: "validateDataEntryForm.action",
-	   data: params,
-	   dataType: "xml",
-	   success: dataEntryFormValidationCompleted
-	});
-  }
-  else{
-	$.ajax({
-	   type: "POST",
-	   url: "validateDataEntryForm.action",
-	   data: params,
-	   dataType: "xml",
-	   success: autoSaveDataEntryFormValidationCompleted
-	});
-  }
+	$.postUTF8( 'validateDataEntryForm.action',
+		{
+			name: byId( 'nameField' ).value,
+			dataSetId: byId( 'dataSetIdField' ).value,
+			dataEntryFormId: dataEntryFormId
+		}
+		, function( xmlObject ) 
+		{
+			if(autoSave == false)
+			{
+				dataEntryFormValidationCompleted(xmlObject);
+			}
+			else
+			{
+				autoSaveDataEntryFormValidationCompleted(xmlObject);
+			}
+		} );
 }
 
 function dataEntryFormValidationCompleted( messageElement )
@@ -146,24 +137,19 @@
 function autoSaveDataEntryForm() {
 	var field = $("#designTextarea").ckeditorGet();
 	var designTextarea = htmlEncode(field.getData());
-	var params = 'nameField=' + getFieldValue('nameField');
-		params += '&designTextarea=' + designTextarea;
-		params += '&dataSetIdField=' + getFieldValue('dataSetIdField');
-		
-	if(byId('dataEntryFormId') != null){
-		params += '&dataEntryFormId=' + getFieldValue('dataEntryFormId');
-	}
 	
-	$.ajax({
-		   type: "POST",
-		   url: "autoSaveDataEntryForm.action",
-		   data: params,
-		   dataType: "xml",
-		   success: function(xmlObject){
-				setMessage(i18n_save_success); 
-				stat = "EDIT";
-				dataEntryFormId = xmlObject.getElementsByTagName( 'message' )[0].firstChild.nodeValue;
-				enable('delete');
-		   }
-		});
+	$.postUTF8( 'autoSaveDataEntryForm.action',
+		{
+			nameField: getFieldValue('nameField'),
+			designTextarea: designTextarea,
+			dataSetIdField: getFieldValue('dataSetIdField'),
+			dataEntryFormId: dataEntryFormId
+		}
+		, function( xmlObject ) 
+		{
+			setMessage(i18n_save_success); 
+			stat = "EDIT";
+			dataEntryFormId = xmlObject.getElementsByTagName( 'message' )[0].firstChild.nodeValue;
+			enable('delete');
+		} );
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js	2011-10-06 09:36:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js	2012-03-04 13:46:17 +0000
@@ -4,7 +4,7 @@
 
 function showDataSetDetails( dataSetId )
 {
-    jQuery.post( '../dhis-web-commons-ajax-json/getDataSet.action', {
+    jQuery.get( '../dhis-web-commons-ajax-json/getDataSet.action', {
         id : dataSetId
     }, function( json )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js	2012-02-22 18:30:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js	2012-03-04 13:46:17 +0000
@@ -4,7 +4,7 @@
 
 function showSectionDetails( sectionId )
 {
-	jQuery.post( 'getSection.action', { sectionId: sectionId }, function ( json ) {
+	jQuery.get( 'getSection.action', { sectionId: sectionId }, function ( json ) {
 		setInnerHTML( 'nameField', json.section.name );
 		setInnerHTML( 'dataSetField', json.section.dataSet );
 		setInnerHTML( 'categoryComboField', json.section.categoryCombo );
@@ -63,15 +63,15 @@
 
 	elementId = elementId + ']';
 
-	if (document.getElementById(elementId + '.text').disabled == true) 
+	if (byId(elementId + '.text').disabled == true) 
 	{
-		document.getElementById(elementId + '.text').disabled = false;
-		document.getElementById(elementId + '.button').value = i18n_disable;
+		byId(elementId + '.text').disabled = false;
+		byId(elementId + '.button').value = i18n_disable;
 	} 
 	else 
 	{
-		document.getElementById(elementId + '.text').disabled = true;
-		document.getElementById(elementId + '.button').value = i18n_enable;
+		byId(elementId + '.text').disabled = true;
+		byId(elementId + '.button').value = i18n_enable;
 	}
 }
 
@@ -114,7 +114,7 @@
 	
 	// TODO check result
 	
-	$.get( 'saveSectionGreyStatus.action',
+	$.post( 'saveSectionGreyStatus.action',
 		{ sectionId:sectionId, dataElementId:dataElementId, optionComboId:optionComboId, isGreyed:isGreyed }, 
 		function() {} );
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/shortName.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/shortName.js	2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/shortName.js	2012-03-04 13:46:17 +0000
@@ -7,16 +7,9 @@
 {
     var nameField = document.getElementById( 'name' );
     var shortNameField = document.getElementById( 'shortName' );
-//    var maxLength = parseInt( shortNameField.maxLength );
 
 	if ( nameField.value.length >= 20 )
 	{
-		//if ( (previousName != nameField.value) 
-		//&& (nameField.value.length <= maxLength) 
-		//&& ( shortNameField.value == previousName 
-		//|| shortNameField.value.length == 0 ) )
-		//{}
-		
 		shortNameField.value = nameField.value;
     }
     previousName = nameField.value;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js	2012-03-04 04:12:20 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js	2012-03-04 13:46:17 +0000
@@ -9,7 +9,7 @@
 
     if ( dataElementGroupId != null )
     {
-		$.post( '../dhis-web-commons-ajax/getDataElements.action',
+		$.get( '../dhis-web-commons-ajax/getDataElements.action',
 		{
 			id: dataElementGroupId,
 			aggregate: 'true'
@@ -47,10 +47,10 @@
 
     if ( categoryComboId != null )
     {
-		$.post( 'getCategoryComboDataElements.action',
+		$.get( 'getCategoryComboDataElements.action',
 		{
 			categoryComboId: categoryComboId
-		},getCategoryComboDataElementsReceived );
+		}, getCategoryComboDataElementsReceived );
     }
 }
 
@@ -83,7 +83,7 @@
 
     if ( indicatorGroupId != null )
     {
-		$.post( '../dhis-web-commons-ajax/getIndicators.action',
+		$.get( '../dhis-web-commons-ajax/getIndicators.action',
 		{
 			id: indicatorGroupId
 		},getIndicatorsReceived );
@@ -121,7 +121,7 @@
 
     if ( organisationUnitLevel != null )
     {
-		$.post( '../dhis-web-commons-ajax/getOrganisationUnits.action',
+		$.get( '../dhis-web-commons-ajax/getOrganisationUnits.action',
 		{
 			level: organisationUnitLevel
 		},getOrganisationUnitsReceived );
@@ -161,7 +161,7 @@
 
 		if ( organisationUnitId != null )
 		{
-			$.post( '../dhis-web-commons-ajax/getOrganisationUnitChildren.action',
+			$.get( '../dhis-web-commons-ajax/getOrganisationUnitChildren.action',
 				{
 					id: organisationUnitId
 				},getOrganisationUnitChildrenReceived );