← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2647: Fix bug: Seaching patients by name on Mozilla is getting crash.

 

------------------------------------------------------------
revno: 2647
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-20 09:12:00 +0700
message:
  Fix bug: Seaching patients by name on Mozilla is getting crash.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.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/patient/GetPatientsByNameAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java	2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/GetPatientsByNameAction.java	2011-01-20 02:12:00 +0000
@@ -29,7 +29,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.patient.Patient;
 import org.hisp.dhis.patient.PatientService;
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-01-12 02:22:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2011-01-20 02:12:00 +0000
@@ -464,3 +464,4 @@
 program_unenrollment = Program UnEnrollment
 death_date = Death date
 is_dead = isDead
+search_result = Search result

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-01-12 02:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-01-20 02:12:00 +0000
@@ -60,13 +60,10 @@
 	<tr>
 		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
 		<td class="input-column" >
-			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)">
-			<span id='searchIcon' style="display:none"><img src="../images/loader.gif"></span>
+			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[3,30]}}">
+			<img src='../images/magnifier.png' onclick='startSearch();' style="cursor: pointer;">
 		</td>
 	</tr>
-	<tr>
-        <td id="similarPatients" style="display:none" colspan='2'> $i18n.getString( "similar_patients" ): <span id="patientCount"></span> <a href="javascript:showSearchPatients();">(show/hide)</a></td>
-    </tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
 		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
@@ -293,4 +290,5 @@
 	var checkedDuplicate = false;
     var i18n_oucode_must_have_9_digits = '$encoder.jsEscape( $i18n.getString( "oucode_must_be_valid" ) , "'")';
 	var i18n_no_patients_found = '$encoder.jsEscape( $i18n.getString( "no_patients_found" ) , "'")';
+	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
 </script>
\ 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/addRelationshipPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2011-01-12 02:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm	2011-01-20 02:12:00 +0000
@@ -57,13 +57,10 @@
 	<tr>
 		<td><label for="fullName">$i18n.getString( "full_name" )</label></td>
 		<td class="input-column" >
-			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)">
-			<span id='searchIcon' style="display:none"><img src="../images/loader.gif"></span>
+			<input type="text" id="fullName" name="fullName" style="width:28em" class="{validate:{required:true, unicodechars:true, rangelength:[3,30]}}">
+			<img src='../images/magnifier.png' onclick='startSearch();' style="cursor: pointer;">
 		</td>
 	</tr>
-	<tr>
-        <td id="similarPatients" style="display:none" colspan='2'> $i18n.getString( "similar_patients" ): <span id="patientCount"></span> <a href="javascript:showSearchPatients();">(show/hide)</a></td>
-    </tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
 		<th colspan="2" class="heading-column">$i18n.getString( "demographics" )</th>
@@ -271,6 +268,8 @@
 	var i18n_no_duplicate_found = '$encoder.jsEscape( $i18n.getString( "no_duplicate_found" ) , "'")';
 	var i18n_patient_system_id = '$encoder.jsEscape( $i18n.getString( "patient_system_id" ) , "'")';
 	var i18n_child_representative = '$encoder.jsEscape( $i18n.getString( "child_representative" ) , "'")';
+	var i18n_no_patients_found = '$encoder.jsEscape( $i18n.getString( "no_patients_found" ) , "'")';
+	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
 	var checkedDuplicate = false;
 </script>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js	2011-01-12 02:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/commons.js	2011-01-20 02:12:00 +0000
@@ -18,34 +18,17 @@
 // Search patients by name
 // ----------------------------------------------------------------------------
 
-var prename = "";
-function startSearch( e )
+function startSearch( )
 {	
-	var fullName = getFieldValue('fullName');
-	
-	if ( prename == fullName){
-		return;
-	}
-	prename = fullName;
-	
-	if ( fullName.length < 3){
-		$("#similarPatients").hide();
-		return;
-	}
-	
-	byId('searchIcon').style.display = 'block';
-	$.post("getPatientsByName.action",
-		{
-			fullName: fullName
-		},
-		function (html)
-		{
-			jQuery("#similarPatients").show();
-			var patientCount = $('<div/>').html(html).find('#matchCount');
-			jQuery('#patientCount').html( patientCount );
-			jQuery('#searchResults').html( html );
-			byId('searchIcon').style.display = 'none';
-		},'html');
+	var fullName = getFieldValue('fullName').replace(/^\s+|\s+$/g,"");
+	if( fullName.length > 0) 
+	{
+		tb_show( i18n_search_result,"getPatientsByName.action?fullName=" + fullName + "&TB_iframe=true&height=400&width=500",null );
+	}
+	else
+	{
+		alert( i18n_no_patients_found );
+	}
 }
 
 // ----------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm	2011-01-11 01:56:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/resultSearchPatients.vm	2011-01-20 02:12:00 +0000
@@ -30,4 +30,3 @@
 	</tr>
 #end
 </table>
-

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm	2011-01-12 02:26:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/underAgeForm.vm	2011-01-20 02:12:00 +0000
@@ -166,13 +166,10 @@
 	<tr>
 		<td><label for="required">$i18n.getString( "full_name" )</label></td>
 		<td class="input-column" >
-			<input type="text" id="fullName" name="fullName" style="width:15em" class="{validate:{required:true, unicodechars:true, rangelength:[2,30]}}" onkeyup="startSearch(event)">
-			<span id='searchIcon' style="display:none"><img src="../images/loader.gif"></span>
+			<input type="text" id="fullName" name="fullName" style="width:15em" class="{validate:{required:true, unicodechars:true, rangelength:[3,30]}}">
+			<img src='../images/magnifier.png' onclick='startSearch();' style="cursor: pointer;">
 		</td>
 	</tr>
-	<tr>
-        <td id="similarPatients" style="display:none" colspan='2'> $i18n.getString( "similar_patients" ): <span id="patientCount"></span> <a href="javascript:showSearchPatients();">(show/hide)</a></td>
-    </tr>
 	<tr><td>&nbsp;</td></tr>	
 	<tr>
 		<th colspan="2">$i18n.getString( "demographics" )</th>
@@ -265,27 +262,27 @@
 </div>
 <script>
 
-var i18n_patient_identifiers = '$encoder.jsEscape( $i18n.getString( "patient_identifiers" ) , "'")';
-var i18n_patient_attributes = '$encoder.jsEscape( $i18n.getString( "patient_attributes" ) , "'")';
-var i18n_patient_fullName = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'")';
-var i18n_patient_demographics = '$encoder.jsEscape( $i18n.getString( "demographics" ) , "'")';
-var i18n_patient_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'")';
-var i18n_patient_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'")';
-var i18n_patient_age = '$encoder.jsEscape( $i18n.getString( "age" ) , "'")';
-var i18n_patient_blood_group = '$encoder.jsEscape( $i18n.getString( "blood_group" ) , "'")';
-var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_patient" ) , "'")';
-var i18n_no_duplicate_found = '$encoder.jsEscape( $i18n.getString( "no_duplicate_found" ) , "'")';
-var i18n_patient_system_id = '$encoder.jsEscape( $i18n.getString( "patient_system_id" ) , "'")';
-var i18n_child_representative = '$encoder.jsEscape( $i18n.getString( "child_representative" ) , "'")';
-var i18n_no_result = '$encoder.jsEscape( $i18n.getString( "no_result" ) , "'")';
-var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'")';
-var i18n_please_enter_value = '$encoder.jsEscape( $i18n.getString( "please_enter_value" ) , "'")';
-var i18n_please_select_search_type = '$encoder.jsEscape( $i18n.getString( "please_select_search_type" ) , "'")';
-var i18n_please_select_identifier_type = '$encoder.jsEscape( $i18n.getString( "please_select_identifier_type" ) , "'")';
-var i18n_please_select_attribute_type = '$encoder.jsEscape( $i18n.getString( "please_select_attribute_type" ) , "'")';
-var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'")';
-var i18n_please_select_relationshipType = '$encoder.jsEscape( $i18n.getString( "please_select_relationshipType" ) , "'")';
-
-
+	var i18n_patient_identifiers = '$encoder.jsEscape( $i18n.getString( "patient_identifiers" ) , "'")';
+	var i18n_patient_attributes = '$encoder.jsEscape( $i18n.getString( "patient_attributes" ) , "'")';
+	var i18n_patient_fullName = '$encoder.jsEscape( $i18n.getString( "full_name" ) , "'")';
+	var i18n_patient_demographics = '$encoder.jsEscape( $i18n.getString( "demographics" ) , "'")';
+	var i18n_patient_gender = '$encoder.jsEscape( $i18n.getString( "gender" ) , "'")';
+	var i18n_patient_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ) , "'")';
+	var i18n_patient_age = '$encoder.jsEscape( $i18n.getString( "age" ) , "'")';
+	var i18n_patient_blood_group = '$encoder.jsEscape( $i18n.getString( "blood_group" ) , "'")';
+	var i18n_choose_this_person = '$encoder.jsEscape( $i18n.getString( "choose_this_patient" ) , "'")';
+	var i18n_no_duplicate_found = '$encoder.jsEscape( $i18n.getString( "no_duplicate_found" ) , "'")';
+	var i18n_patient_system_id = '$encoder.jsEscape( $i18n.getString( "patient_system_id" ) , "'")';
+	var i18n_child_representative = '$encoder.jsEscape( $i18n.getString( "child_representative" ) , "'")';
+	var i18n_no_result = '$encoder.jsEscape( $i18n.getString( "no_result" ) , "'")';
+	var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'")';
+	var i18n_please_enter_value = '$encoder.jsEscape( $i18n.getString( "please_enter_value" ) , "'")';
+	var i18n_please_select_search_type = '$encoder.jsEscape( $i18n.getString( "please_select_search_type" ) , "'")';
+	var i18n_please_select_identifier_type = '$encoder.jsEscape( $i18n.getString( "please_select_identifier_type" ) , "'")';
+	var i18n_please_select_attribute_type = '$encoder.jsEscape( $i18n.getString( "please_select_attribute_type" ) , "'")';
+	var i18n_add_person_successfully = '$encoder.jsEscape( $i18n.getString( "add_person_successfully" ) , "'")';
+	var i18n_please_select_relationshipType = '$encoder.jsEscape( $i18n.getString( "please_select_relationshipType" ) , "'")';
+	var i18n_no_patients_found = '$encoder.jsEscape( $i18n.getString( "no_patients_found" ) , "'")';
+	var i18n_search_result = '$encoder.jsEscape( $i18n.getString( "search_result" ) , "'")';
 </script>