← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 4170
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-07-20 13:34:34 +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/java/org/hisp/dhis/patient/action/relationship/SearchRelationshipPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationship.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programEnrollmentSelectForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programUnenrollmentSelectForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatient.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/java/org/hisp/dhis/patient/action/relationship/SearchRelationshipPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SearchRelationshipPatientAction.java	2011-05-13 09:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SearchRelationshipPatientAction.java	2011-07-20 06:34:34 +0000
@@ -124,10 +124,19 @@
     {
         Patient patient = patientService.getPatient( patientId );
 
+        if ( searchText != null && searchText.length() > 0 )
+            searchText = searchText.trim();
+
+        int index = searchText.indexOf( ' ' );
+
+        if ( index != -1 && index == searchText.lastIndexOf( ' ' ) )
+        {
+            String[] keys = searchText.split( " " );
+            searchText = keys[0] + "  " + keys[1];
+        }
+
         if ( searchingAttributeId != null && searchText != null )
         {
-            searchText = searchText.trim();
-
             if ( searchText.length() > 0 )
             {
                 PatientAttribute patientAttribute = patientAttributeService.getPatientAttribute( searchingAttributeId );
@@ -149,8 +158,6 @@
 
         if ( searchText != null )
         {
-            searchText = searchText.trim();
-
             if ( searchText.length() > 0 )
             {
                 patients = patientService.getPatientsByNames( searchText );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-07-19 03:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patient.js	2011-07-20 06:34:34 +0000
@@ -1,6 +1,6 @@
 
 function organisationUnitSelected( orgUnits )
-{		
+{	
 	showById('selectDiv');
 	disable('listPatientBtn');
 	
@@ -12,40 +12,41 @@
 	hideById('listRelationshipDiv');
 	hideById('addRelationshipDiv');
 			
-	$.getJSON( 'organisationUnitHasPatients.action?orgunitId=' + orgUnits[0], function( json ) 
-	{
-		var type = json.response;
-		setFieldValue('selectedOrgunitText', json.message );
-			
-		if( type == 'success' )
+	$.getJSON( 'organisationUnitHasPatients.action?orgunitId=' + orgUnits[0], {}
+		, function( json ) 
 		{
-					
-			$( "#loaderDiv" ).show();
-			jQuery.postJSON( "patientform.action",
-				{
-				}, 
-				function( json ) 
-				{    
-					clearListById('programId');
-					addOptionById( 'programId', "0", i18n_select_program );
-					for ( i in json.programs ) 
+			var type = json.response;
+			setFieldValue('selectedOrgunitText', json.message );
+				
+			if( type == 'success' )
+			{
+						
+				$( "#loaderDiv" ).show();
+				jQuery.postJSON( "patientform.action",
 					{
-						addOptionById( 'programId', json.programs[i].id, json.programs[i].name );
-					} 
-					
-					showById('searchPatientDiv');
-					enable('listPatientBtn');
-					setInnerHTML('warnmessage','');
-					
-					$( "#loaderDiv" ).hide();
-				});
-		}
-		else if( type == 'input' )
-		{
-			setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
-			disable('listPatientBtn');
-		}
-	} );
+					}, 
+					function( json ) 
+					{    
+						clearListById('programId');
+						addOptionById( 'programId', "0", i18n_select_program );
+						for ( i in json.programs ) 
+						{
+							addOptionById( 'programId', json.programs[i].id, json.programs[i].name );
+						} 
+						
+						showById('searchPatientDiv');
+						enable('listPatientBtn');
+						setInnerHTML('warnmessage','');
+						
+						$( "#loaderDiv" ).hide();
+					});
+			}
+			else if( type == 'input' )
+			{
+				setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
+				disable('listPatientBtn');
+			}
+		} );
 }
 
 selection.setListenerFunction( organisationUnitSelected );
@@ -154,12 +155,12 @@
 	// Get common-information
     // ----------------------------------------------------------------------------
 	
-	var id = patientElement.getElementsByTagName( "id" )[0].firstChild.nodeValue;
-	var fullName = patientElement.getElementsByTagName( "fullName" )[0].firstChild.nodeValue;   
-	var gender = patientElement.getElementsByTagName( "gender" )[0].firstChild.nodeValue;   
-	var dobType = patientElement.getElementsByTagName( "dobType" )[0].firstChild.nodeValue;   
-	var birthDate = patientElement.getElementsByTagName( "dateOfBirth" )[0].firstChild.nodeValue;   
-	var bloodGroup= patientElement.getElementsByTagName( "bloodGroup" )[0].firstChild.nodeValue;   
+	var id = $(patientElement).find( "id" ).text();
+	var fullName = $(patientElement).find( "fullName" ).text();
+	var gender = $(patientElement).find( "gender" ).text();
+	var dobType = $(patientElement).find( "dobType" ).text();
+	var birthDate = $(patientElement).find( "dateOfBirth" ).text();
+	var bloodGroup= $(patientElement).find( "bloodGroup" ).text();
     
 	var commonInfo =  '<strong>'  + i18n_id + ':</strong> ' + id + "<br>" 
 					+ '<strong>' + i18n_full_name + ':</strong> ' + fullName + "<br>" 
@@ -171,46 +172,45 @@
 	setInnerHTML( 'commonInfoField', commonInfo );
 	
 	// ----------------------------------------------------------------------------
-	// Get identifier
+	// Get identifiers
     // ----------------------------------------------------------------------------
 	
-	var identifiers = patientElement.getElementsByTagName( "identifier" );   
-    
     var identifierText = '';
 	
-	for ( var i = 0; i < identifiers.length; i++ )
-	{		
-		identifierText = identifierText + identifiers[ i ].getElementsByTagName( "identifierText" )[0].firstChild.nodeValue + '<br>';		
-	}
+	var identifiers = $(patientElement).find( "identifier" );
+	$( identifiers ).each( function( i, item )
+        {
+            identifierText += $( item ).text() + '<br>';		
+        } );
 	
 	setInnerHTML( 'identifierField', identifierText );
 	
-	
-	
 	// ----------------------------------------------------------------------------
-	// Get attribute
+	// Get attributes
     // ----------------------------------------------------------------------------
 	
-	var attributes = patientElement.getElementsByTagName( "attribute" );   
-    
     var attributeValues = '';
 	
-	for ( var i = 0; i < attributes.length; i++ )
-	{	
-		attributeValues = attributeValues + '<strong>' + attributes[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue  + ':  </strong>' + attributes[ i ].getElementsByTagName( "value" )[0].firstChild.nodeValue + '<br>';		
-	}
+	var attributes = $(patientElement).find( "attribute" );
+	$( attributes ).each( function( i, item )
+        {
+            attributeValues += '<strong>' + $( item ).find( 'name' ).text() + ':</strong> ' + $( item ).find( 'value' ).text() + '<br>';				
+        } );
 	
 	setInnerHTML( 'attributeField', attributeValues );
     
-    var programs = patientElement.getElementsByTagName( "program" );   
-    
+	// ----------------------------------------------------------------------------
+	// Get programs
+    // ----------------------------------------------------------------------------
+	
     var programName = '';
 	
-	for ( var i = 0; i < programs.length; i++ )
-	{		
-		programName = programName + programs[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue + '<br>';		
-	}
-	
+	var programs = $( patientElement ).find( "program" );
+	$( programs ).each( function( i, item )
+        {
+            programName += $( item ).text() + '<br>';
+        } );
+		
 	setInnerHTML( 'programField', programName );
    
     showDetails();
@@ -985,9 +985,7 @@
 	}
 	else
 	{
-		showById('selectDiv');
-		showById('searchPatientDiv');
-		showById('listPatientDiv');
+		loadPatientList();
 	}
 }
 
@@ -1010,18 +1008,19 @@
 
 function loadPatientList()
 {
-	showById('selectDiv');
-	showById('searchPatientDiv');
-	showById('listPatientDiv');
-	
+	$.ajaxSettings.cache = false;
+
+	hideById('listPatientDiv');
 	hideById('addPatientDiv');
 	hideById('updatePatientDiv');
 	hideById('enrollmentDiv');
 	hideById('listRelationshipDiv');
 	hideById('addRelationshipDiv');
 	
-	$('#listPatientDiv').load("searchPatient.action", {}
+	jQuery('#listPatientDiv').load("searchPatient.action", {}
 		, function(){
+			showById('selectDiv');
+			showById('searchPatientDiv');
 			showById('listPatientDiv');
 			$( "#loaderDiv" ).hide();
 		});

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationship.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationship.js	2011-07-19 03:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationship.js	2011-07-20 06:34:34 +0000
@@ -136,6 +136,7 @@
 			{
 				jQuery(this).attr('disabled', 'disabled');
 			});
+			
 		$.ajax({
 			type: "GET",
 			url: 'searchRelationshipPatient.action',

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm	2011-07-19 03:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/listPatient.vm	2011-07-20 06:34:34 +0000
@@ -3,10 +3,10 @@
 		<td>$i18n.getString( "search_result_matching_the_search_criteria" )</td>
 		<td>&nbsp;</td>
 		<td>&nbsp;</td>
-		<td id='searchTextInfo'>
+		<td>
 		    #if($!program)
 				$i18n.getString( "list_patients_by_program") '$program.name'
-			#elseif($!searchText) 
+			#elseif($!searchText && $searchText!='') 
 				$searchText
 			#else 
 				$i18n.getString( "list_all_patients" )
@@ -23,12 +23,6 @@
 
 <table class="mainPageTable">
 	<tr>
-		<td colspan="14" style="text-align:right">			
-			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='patient.action'" style="width:10em; align:right;">
-		</td>
-	</tr>	
-	
-	<tr>
     <td>    
       <table class="listTable" id="patientList" width='100%'>               
           <col width="30"/>
@@ -149,16 +143,6 @@
 	
 	jQuery(document).ready(function(){	
 		tableSorter( 'patientList' );
-		
-		if( byId('searchingAttributeId').value == '0' )
-		{
-			var  programName = byId('programId').options[byId('programId').selectedIndex].text;
-			setInnerHTML( 'searchTextInfo', i18n_list_patients_by_program + programName );
-		}
-		else 
-		{
-			setInnerHTML( 'searchTextInfo', getFieldValue('searchText'));
-		}
 	});
 	
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient" ) , "'" )';

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programEnrollmentSelectForm.vm	2011-05-13 09:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programEnrollmentSelectForm.vm	2011-07-20 06:34:34 +0000
@@ -1,5 +1,5 @@
 <div>
-    <input type="button" value="$i18n.getString( "back_to_search" )" onclick="onClickBackBtn();" style="width:10em">
+    <input type="button" value="$i18n.getString( "back_to_search" )" onclick="loadPatientList();" style="width:10em">
 </div>
 
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programUnenrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programUnenrollmentSelectForm.vm	2011-07-19 03:48:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programUnenrollmentSelectForm.vm	2011-07-20 06:34:34 +0000
@@ -89,13 +89,15 @@
 		</tr>
 
 		<tr>
-			<td colspan='2'><hr/></td>	
+			<td colspan='2'></td>	
 		<tr>
 	
 		<!-- ------------------------------------------------------------ -->
 		<!--                   Show Program - Attributes                  -->
 		<!-- ------------------------------------------------------------ -->
-		
+		<tr>
+			<th colspan='2'>$i18n.getString('reason')</th>
+		<tr>
 		#foreach($attribute in $programAttributes)
 		<tr>
 			<td style="width:180px">$attribute.name</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatient.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatient.vm	2011-03-15 03:26:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responsePatient.vm	2011-07-20 06:34:34 +0000
@@ -7,23 +7,28 @@
   <dateOfBirth>$format.formatDate( $!patient.birthDate )</dateOfBirth>
   <age>$encoder.xmlEncode( $patient.getAge() )</age>
   <bloodGroup>#if($!patient.bloodGroup) $patient.bloodGroup #else $i18n.getString('none') #end</bloodGroup>
+  <identifiers>    
   #foreach( $patientIdentifier in $patient.identifiers )
     <identifier>        
         <identifierText>$encoder.xmlEncode( $patientIdentifier.identifier )</identifierText>
      </identifier>
   #end
+  </identifiers>   
+  <attributes>
   #foreach( $attribute in $patient.attributes )
-    #set( $attributeValue = false )
     #set( $attributeValue = $patientAttributeValueMap.get( $attribute.id ) )             
     <attribute>
         <name>$encoder.xmlEncode( $attribute.name )</name>
         <value>$encoder.xmlEncode( $attributeValue )</value>
     </attribute> 
-  #end  
+  #end 
+  </attributes> 
+  <programs>  
   #foreach( $program in $patient.programs )
     <program>
         <name>$encoder.xmlEncode( $program.name )</name>
     </program> 
-  #end         
+  #end    
+  </programs>   
 </patient>