← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4192: Ajax Request stuff don't work does not work with IE9 ( Patient module ).

 

------------------------------------------------------------
revno: 4192
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-07-22 10:53:49 +0700
message:
  Ajax Request stuff don't work does not work with IE9 ( Patient module ).
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.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-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2011-07-08 02:12:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2011-07-22 03:53:49 +0000
@@ -5,20 +5,18 @@
 
 function getAggDataElements( )
 {
-  var dataElementGroup = document.getElementById( 'dataElementGroup' );
-  var dataElementGroupId = dataElementGroup.options[ dataElementGroup.selectedIndex ].value;
-  if( dataElementGroupId == 0 ){
-	clearList( byId('aggregationDataElementId'));
-	return;
-  }
-  
-  var requestString = 'getAggDataElements.action?dataElementGroupId=' + dataElementGroupId;
-
-  var request = new Request();
-  request.setResponseTypeXML( 'dataelement' );
-  request.setCallbackSuccess( getAggDataElementsCompleted );
-
-  request.send( requestString );
+	var dataElementGroup = document.getElementById( 'dataElementGroup' );
+	var dataElementGroupId = dataElementGroup.options[ dataElementGroup.selectedIndex ].value;
+	if( dataElementGroupId == 0 ){
+		clearList( byId('aggregationDataElementId'));
+		return;
+	}
+	$.ajax({
+		url: 'getAggDataElements.action?dataElementGroupId=' + dataElementGroupId,
+		cache: false,
+		dataType: "xml",
+		success: getAggDataElementsCompleted
+	});
 }
 
 function getAggDataElementsCompleted( dataelementElement )
@@ -49,56 +47,46 @@
 
 function getProgramStages()
 {
-  var program = document.getElementById( 'program' );
-  var programId = program.options[ program.selectedIndex ].value;
-  if(programId == '0'){
-	clearList( byId( 'programStage' ) );
-	clearList( byId( 'programstageDE' ) );
-	return;  
-  }
+	clearListById( 'programStage' );
+  	clearListById( 'programstageDE' );
 	
-  var requestString = 'getProgramStages.action?programId=' + programId;
-
-  var request = new Request();
-  request.setResponseTypeXML( 'programStage' );
-  request.setCallbackSuccess( getProgramStagesCompleted );
-
-  request.send( requestString );	
+	var program = document.getElementById( 'program' );
+	var programId = program.options[ program.selectedIndex ].value;
+	if( programId == '0' ){
+		return;  
+	}
+
+	$.ajax({
+		url: 'getProgramStages.action?programId=' + programId,
+		cache: false,
+		dataType: "xml",
+		success: getProgramStagesCompleted
+	});  
 }
 
 function getProgramStagesCompleted( programstageElement )
 {
-  var programstage = document.getElementById( 'programStage' );
-  
-  clearList( programstage );
-  	
-  var programstageList = programstageElement.getElementsByTagName( 'programstage' );
- 
-  for( var i = 0; i < programstageList.length; i++ )
-  {
-    var id = programstageList[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;
-    var name = programstageList[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
-
-    var option = document.createElement("option");
-    option.value = id;
-    option.text = name;
-    option.title = name;
-    
-    programstage.add(option, null);       	
-  }
-  
-  if( programstage.options.length > 0 )
-  {
-  	programstage.options[0].selected = true;
-    	
-   	getPrgramStageDataElements();
-  }
-  else
-  {
-   	var programstageDE = document.getElementById( 'programstageDE' );
-  
-  	clearList( programstageDE );
-  }	    
+	var programstage = document.getElementById( 'programStage' );
+	var programstageList = $(programstageElement).find( 'programstage' );
+
+	$( programstageList ).each( function( i, item )
+	{
+		var id = $( item ).find("id").text();
+		var name = $( item ).find("name").text();
+
+		var option = document.createElement("option");
+		option.value = id;
+		option.text = name;
+		option.title = name;
+
+		programstage.add(option, null);       	
+	});
+
+	if( programstage.options.length > 0 )
+	{
+		programstage.options[0].selected = true;
+		getPrgramStageDataElements();
+	}   
 }
 
 //------------------------------------------------------------------------------
@@ -107,39 +95,37 @@
 
 function getPrgramStageDataElements()
 {
-  var programStage = document.getElementById( 'programStage' );
-  var psId = programStage.options[ programStage.selectedIndex ].value;
-
-  var requestString = 'getPSDataElements.action?psId=' + psId;
-
-  var request = new Request();
-  request.setResponseTypeXML( 'dataelement' );
-  request.setCallbackSuccess( getPrgramStageDataElementsCompleted );
-
-  request.send( requestString );	
+	clearListById( 'programstageDE' );
+
+	var programStage = document.getElementById( 'programStage' );
+	var psId = programStage.options[ programStage.selectedIndex ].value;
+	
+	$.ajax({
+		url: 'getPSDataElements.action?psId=' + psId,
+		cache: false,
+		dataType: "xml",
+		success: getPrgramStageDataElementsCompleted
+	});
 }
 
 function getPrgramStageDataElementsCompleted( dataelementElement )
 {
-  var programstageDE = document.getElementById( 'programstageDE' );
-  
-  clearList( programstageDE );
-  	
-  var programstageDEList = dataelementElement.getElementsByTagName( 'dataelement' );
- 
-  for ( var i = 0; i < programstageDEList.length; i++ )
-  {
-    var id = programstageDEList[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;
-    var name = programstageDEList[ i ].getElementsByTagName("name")[0].firstChild.nodeValue;
-	var type = programstageDEList[ i ].getElementsByTagName("type")[0].firstChild.nodeValue;
-
-    var option = document.createElement("option");
-    option.value = id;
-    option.text = name;
-    option.title = name;
-    jQuery(option).attr({data:"{type:'"+type+"'}"});
-    programstageDE.add(option, null);       	
-  }	    
+	var programstageDE = byId('programstageDE');
+	var psDataElements = $(dataelementElement).find( 'dataelement' );
+
+	$( psDataElements ).each( function( i, item )
+	{
+		var id = $(item).find("id").text();
+		var name = $(item).find("name").text();
+		var type =$(item).find("type").text();
+
+		var option = document.createElement("option");
+		option.value = id;
+		option.text = name;
+		option.title = name;
+		jQuery(option).attr({data:"{type:'"+type+"'}"});
+		programstageDE.add(option, null);       	
+	} );	    
 }
 
 //-----------------------------------------------------------------
@@ -174,20 +160,22 @@
 
 function showCaseAggregationDetails( caseAggregationId )
 {
-    var request = new Request();
-    request.setResponseTypeXML( 'caseAggregation' );
-    request.setCallbackSuccess( caseAggregationReceived );
-    request.send( 'getCaseAggregation.action?id=' + caseAggregationId );
+    $.ajax({
+		url: 'getCaseAggregation.action?id=' + caseAggregationId,
+		cache: false,
+		dataType: "xml",
+		success: caseAggregationReceived
+	});
 }
 
 function caseAggregationReceived( caseAggregationElement )
 {
-	setInnerHTML( 'idField', getElementValue( caseAggregationElement, 'id' ) );
-	setInnerHTML( 'descriptionField', getElementValue( caseAggregationElement, 'description' ) );	
-    setInnerHTML( 'operatorField', getElementValue( caseAggregationElement, 'operator' ) );
-    setInnerHTML( 'aggregationDataElementField', getElementValue( caseAggregationElement, 'aggregationDataElement' ) );
-	setInnerHTML( 'optionComboField', getElementValue( caseAggregationElement, 'optionCombo' ) );	
-    setInnerHTML( 'aggregationExpressionField', getElementValue( caseAggregationElement, 'aggregationExpression' ) );
+	setInnerHTML( 'idField', $( caseAggregationElement).find('id' ).text() );
+	setInnerHTML( 'descriptionField', $( caseAggregationElement).find('description' ).text() );	
+    setInnerHTML( 'operatorField', $( caseAggregationElement).find('operator' ).text() );
+    setInnerHTML( 'aggregationDataElementField', $( caseAggregationElement).find('aggregationDataElement' ).text() );
+	setInnerHTML( 'optionComboField', $( caseAggregationElement).find('optionCombo' ).text() );	
+    setInnerHTML( 'aggregationExpressionField', $( caseAggregationElement).find('aggregationExpression' ).text() );
     
     showDetails();
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm	2011-05-06 08:09:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseAggDataElement.vm	2011-07-22 03:53:49 +0000
@@ -5,7 +5,6 @@
 		<dataelement>
   			<id>$optionComboIds.get($count)</id>
   			<name>$encoder.xmlEncode( $ocName )</name>
-  			<type>$encoder.xmlEncode( $optionComboType.get($count) )</type>
 		</dataelement>	
 	#end
 </dataelements>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm	2011-07-13 02:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm	2011-07-22 03:53:49 +0000
@@ -48,10 +48,7 @@
 		</td>				
 	</tr>
 	<tr>
-		<td width="20em"><label for="operator">$i18n.getString( "operator" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
-		<td>
-			<input type="radio" id="operator" name="operator" value="COUNT" #if( "$caseAggregation.operator" == "COUNT") checked #end style='display:none;'>
-		</td>				
+		<input type="radio" id="operator" name="operator" value="COUNT" checked style='display:none;'/>
 	</tr>
 	<tr>
         <td colspan="2"><p></p></td>