← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9890: (mobile) Fixed sending SMS to the list of patient

 

------------------------------------------------------------
revno: 9890
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-02-25 11:28:51 +0700
message:
  (mobile) Fixed sending SMS to the list of patient
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/searchPatientCritetia.vm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SearchPatientAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.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-mobile/src/main/java/org/hisp/dhis/mobile/action/SearchPatientAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SearchPatientAction.java	2012-07-06 13:10:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SearchPatientAction.java	2013-02-25 04:28:51 +0000
@@ -37,7 +37,10 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.paging.ActionPagingSupport;
 import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientIdentifierType;
 import org.hisp.dhis.patient.PatientService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 /**
@@ -57,6 +60,9 @@
     @Autowired
     private PatientService patientService;
 
+    @Autowired
+    private ProgramService programService;
+
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
@@ -78,16 +84,6 @@
         this.searchBySelectedOrgunit = searchBySelectedOrgunit;
     }
 
-    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
-    {
-        this.selectedStateManager = selectedStateManager;
-    }
-
-    public void setPatientService( PatientService patientService )
-    {
-        this.patientService = patientService;
-    }
-
     public void setSearchTexts( List<String> searchTexts )
     {
         this.searchTexts = searchTexts;
@@ -98,6 +94,13 @@
         this.listAll = listAll;
     }
 
+    private List<Integer> programIds;
+
+    public void setProgramIds( List<Integer> programIds )
+    {
+        this.programIds = programIds;
+    }
+
     public Collection<Patient> getPatients()
     {
         return patients;
@@ -117,6 +120,13 @@
         return mapPatientOrgunit;
     }
 
+    private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
+
+    public List<PatientIdentifierType> getIdentifierTypes()
+    {
+        return identifierTypes;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -143,12 +153,24 @@
 
             total = patientService.countSearchPatients( searchTexts, organisationUnit );
             this.paging = createPaging( total );
-            patients = patientService.searchPatients( searchTexts, organisationUnit, paging.getStartPos(),
-                paging.getPageSize() );
-
-            for ( Patient patient : patients )
-            {
-                mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
+            patients = patientService.searchPatients( searchTexts, organisationUnit, paging.getStartPos(), paging
+                .getPageSize() );
+
+            if ( !searchBySelectedOrgunit )
+            {
+                for ( Patient patient : patients )
+                {
+                    mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) );
+                }
+            }
+
+            if ( programIds != null )
+            {
+                for ( Integer programId : programIds )
+                {
+                    Program program = programService.getProgram( programId );
+                    identifierTypes.addAll( program.getPatientIdentifierTypes() );
+                }
             }
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties	2013-02-22 19:59:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties	2013-02-25 04:28:51 +0000
@@ -147,6 +147,10 @@
 selected_user_group_is_unavailable=The selected user group is unavailable
 selected_user_group_has_no_member=The selected user group has no member
 person_list_empty=List should not be empty
+search_in_all_facilities=Search in all facilities
+dblick_to_unselect=Double-click to remove
+advance_search=Advance search
+program=Program
 
 # ------------------------------------------------------------------------------
 # SMS COMMAND LOCALIZATION 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties	2013-02-22 19:59:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module_vi_VN.properties	2013-02-25 04:28:51 +0000
@@ -83,6 +83,10 @@
 selected_user_group_is_unavailable=Nh\u00f3m ng\u01b0\u1eddi d\u00f9ng \u0111\u01b0\u1ee3c ch\u1ecdn hi\u1ec7n kh\u00f4ng t\u1ed3n t\u1ea1i
 selected_user_group_has_no_member=Nh\u00f3m ng\u01b0\u1eddi d\u00f9ng \u0111\u01b0\u1ee3c ch\u1ecdn hi\u1ec7n kh\u00f4ng c\u00f3 th\u00e0nh vi\u00ean
 person_list_empty=Danh s\u00e1ch ng\u01b0\u1eddi nh\u1eadn SMS kh\u00f4ng th\u1ec3 tr\u1ed1ng
+search_in_all_facilities=T\u00ecm trong t\u1ea5t c\u1ea3 c\u00e1c \u0111\u01a1n v\u1ecb con
+dblick_to_unselect=Nh\u1ea5p \u0111\u00f4i chu\u1ed9t \u0111\u1ec3 h\u1ee7y ch\u1ecdn
+advance_search=T\u00ecm ki\u1ebfm n\u00e2ng cao
+program=Ch\u01b0\u01a1ng tr\u00ecnh
 
 # ------------------------------------------------------------------------------
 # SMS COMMAND LOCALIZATION 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js	2012-08-02 08:28:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/patient.js	2013-02-25 04:28:51 +0000
@@ -5,11 +5,36 @@
 	showById('selectDiv');
 	hideById('listPatientDiv');
 
+	enable('advancedSearchBtn');
+	
 	setFieldValue( "selectedOrgunitText", orgUnitNames[0] );
 }
 
 selection.setListenerFunction( organisationUnitSelected );
 
+function enableBtn()
+{
+	if(registration==undefined || !registration)
+	{
+		var programIdAddPatient = getFieldValue('programIdAddPatient');
+		if( programIdAddPatient!='' ){
+			enable('listPatientBtn');
+			enable('advancedSearchBtn');
+			jQuery('#advanced-search :input').each( function( idx, item ){
+				enable(this.id);
+			});
+		}
+		else
+		{
+			disable('listPatientBtn');
+			disable('advancedSearchBtn');
+			jQuery('#advanced-search :input').each( function( idx, item ){
+				disable(this.id);
+			});
+		}
+	}
+}
+
 // ----------------------------------------------------------------------------
 // Search patients by name
 // ----------------------------------------------------------------------------
@@ -45,31 +70,37 @@
 
 function addAttributeOption()
 {
-	var rowId = 'advSearchBox' + jQuery('#advancedSearchTB select[name=searchingAttributeId]').length + 1;
+	jQuery('#advancedSearchTB [name=clearSearchBtn]').attr('disabled', false);
+	var rowId = 'advSearchBox' + jQuery('#advancedSearchTB select[name=searchObjectId]').length + 1;
 	var contend  = '<td>' + getInnerHTML('searchingAttributeIdTD') + '</td>';
 		contend += '<td>' + searchTextBox ;
-		contend += '<input type="button" value="-" onclick="removeAttributeOption(' + "'" + rowId + "'" + ');"></td>';
+		contend += '&nbsp;<input type="button" name="clearSearchBtn" class="large-button" value="' + i18n_clear + '" onclick="removeAttributeOption(' + "'" + rowId + "'" + ');"></td>';
 		contend = '<tr id="' + rowId + '">' + contend + '</tr>';
 
-	jQuery('#advancedSearchTB > tbody:last').append( contend );
+	jQuery('#advancedSearchTB').append( contend );
 }	
 
 function removeAttributeOption( rowId )
 {
 	jQuery( '#' + rowId ).remove();
-}		
+	if( jQuery( '#advancedSearchTB tr' ).length == 3 ){
+		jQuery('#advancedSearchTB [name=clearSearchBtn]').attr('disabled', true);
+	}	
+}	
 
 //------------------------------------------------------------------------------
 // Search patients by selected attribute
 //------------------------------------------------------------------------------
 
-function searchingAttributeOnChange( this_ )
+function searchObjectOnChange( this_ )
 {	
 	var container = jQuery(this_).parent().parent().attr('id');
 	var attributeId = jQuery('#' + container + ' [id=searchObjectId]').val(); 
-	var element = jQuery('#' + container + ' [id=searchText]');
+	var element = jQuery('#' + container + ' [name=searchText]');
 	var valueType = jQuery('#' + container+ ' [id=searchObjectId] option:selected').attr('valueType');
 	
+	jQuery('#searchText_' + container).removeAttr('readonly', false);
+	jQuery('#searchText_' + container).val("");
 	if( attributeId == 'fixedAttr_birthDate' )
 	{
 		element.replaceWith( getDateField( container ) );
@@ -122,15 +153,15 @@
 
 function getAgeTextBox( container )
 {
-	var ageField = '<select id="dateOperator" style="width:40px;" name="dateOperator" ><option value="="> = </option><option value="<"> < </option><option value="<="> <= </option><option value=">"> > </option><option value=">="> >= </option></select>';
-	ageField += '<input type="text" id="searchText_' + container + '" name="searchText" style="width:200px;">';
+	var ageField = '<select id="dateOperator" name="dateOperator" style="width:40px"><option value=">"> > </option><option value=">="> >= </option><option value="="> = </option><option value="<"> < </option><option value="<="> <= </option></select>';
+	ageField += '<input type="text" id="searchText_' + container + '" name="searchText" style="width:220px;">';
 	return ageField;
 }
 
 function getDateField( container )
 {
-	var dateField = '<select id="dateOperator" name="dateOperator" style="width:30px"><option value=">"> > </option><option value=">="> >= </option><option value="="> = </option><option value="<"> < </option><option value="<="> <= </option></select>';
-	dateField += '<input type="text" id="searchText_' + container + '" name="searchText" maxlength="30" style="width:18em" onkeyup="searchPatientsOnKeyUp( event );">';
+	var dateField = '<select id="dateOperator" name="dateOperator" style="width:40px"><option value=">"> > </option><option value=">="> >= </option><option value="="> = </option><option value="<"> < </option><option value="<="> <= </option></select>';
+	dateField += '<input type="text" id="searchText_' + container + '" name="searchText" style="width:200px;" onkeyup="searchPatientsOnKeyUp( event );">';
 	return dateField;
 }
 
@@ -159,46 +190,102 @@
 {
 	hideById( 'listPatientDiv' );
 	var flag = true;
-	var params = '';
 	var dateOperator = '';
-	jQuery("#searchDiv :input").each( function( i, item )
-    {
-		var elementName = $(this).attr('name');
-		if( elementName=='searchText' && jQuery( item ).val() == '' )
+	
+	if (getFieldValue('searchByProgramStage') == "false" 
+		|| ( getFieldValue('searchByProgramStage') == "true"  
+			&& jQuery( '#advancedSearchTB tr' ).length > 2) ){
+		jQuery("#searchDiv :input").each( function( i, item )
 		{
-			showWarningMessage( i18n_specify_search_criteria );
-			flag = false;
-		}
-	});
+			var elementName = $(this).attr('name');
+			if( elementName=='searchText' && jQuery( item ).val() == '')
+			{
+				showWarningMessage( i18n_specify_search_criteria );
+				flag = false;
+			}
+		});
+	}
 	
 	if(flag){
-		jQuery( '#advancedSearchTB tbody tr' ).each( function( i, row ){
-			var dateOperator = "";
-			jQuery( this ).find(':input').each( function( idx, item ){
+		contentDiv = 'listPatientDiv';
+		jQuery( "#loaderDiv" ).show();
+		advancedSearch( getSearchParams() );
+	}
+}
+
+function getSearchParams()
+{
+	var params = "";
+	var programIds = "";
+	var programStageId = jQuery('#programStageAddPatient').val();
+	if( getFieldValue('searchByProgramStage') == "true" ){
+		var statusEvent = jQuery('#programStageAddPatientTR [id=statusEvent]').val();
+		var startDueDate = getFieldValue('startDueDate');
+		var endDueDate = getFieldValue('endDueDate');
+		params = '&searchTexts=stat_' + getFieldValue('programIdAddPatient') 
+			   + '_' + startDueDate + '_' + endDueDate
+			   + "_" + getFieldValue('orgunitId')
+			   + '_false_' + statusEvent;
+	}
+	
+	var flag = false;
+	jQuery( '#advancedSearchTB tr' ).each( function( i, row ){
+		var dateOperator = "";
+		var p = "";
+		jQuery( this ).find(':input').each( function( idx, item ){
+			if(item.type!="button"){
 				if( idx == 0){
-					params += "&searchTexts=" + item.value;
+					p = "&searchTexts=" + item.value;
+					if(item.value=='prg'){
+						programIds += '&programIds=';
+						flag = true;
+					}
 				}
 				else if( item.name == 'dateOperator'){
 					dateOperator = item.value;
 				}
 				else if( item.name == 'searchText'){
-					params += "_";
-					if ( dateOperator.length >0 ) {
-						params += dateOperator + "'" +  item.value.toLowerCase() + "'";
+					if( item.value!='')
+					{
+						p += "_";
+						if ( dateOperator.length >0 ) {
+							p += dateOperator + "'" +  item.value.toLowerCase() + "'";
+						}
+						else{
+							p += htmlEncode( item.value.toLowerCase().replace(/^\s*/, "").replace(/\s*$/, "") );
+						}
+						
+						if( flag ){
+							programIds += item.value;
+							flag = false;
+						}
 					}
-					else{
-						params += htmlEncode( item.value.toLowerCase().replace(/^\s*/, "").replace(/\s*$/, "") );
+					else {
+						p = "";
 					}
 				}
-			})
+			}
 		});
-		params += '&listAll=false';
-		params += '&searchBySelectedOrgunit=' + byId('searchBySelectedOrgunit').checked;
-		
-		contentDiv = 'listPatientDiv';
-		jQuery( "#loaderDiv" ).show();
-		advancedSearch( params );
-	}
+		
+		var searchInAllFacility = byId('searchInAllFacility').checked;
+		if( getFieldValue('searchByProgramStage') == "false" && !searchInAllFacility ){
+			p += "_" + getFieldValue('orgunitId');
+		}
+		params += p;
+	});
+		
+	params += '&listAll=false';
+	if( getFieldValue('searchByProgramStage') == "false"){
+		var searchInAllFacility = byId('searchInAllFacility').checked;
+		params += '&searchBySelectedOrgunit=' + !searchInAllFacility;
+	}
+	else
+	{
+		params += '&searchBySelectedOrgunit=false';
+	}
+	params += programIds;
+	
+	return params;
 }
 
 function advancedSearch( params )
@@ -224,35 +311,34 @@
 {
 	var params = '';
 	var dateOperator = '';
-
 	jQuery("#" + patientDiv + " :input").each(function()
-	{
-		var elementId = $(this).attr('id');
-		
-		if( $(this).attr('type') == 'checkbox' )
-		{
-			var checked = jQuery(this).is( ':checked' );
-			params += elementId + "=" + checked + "&";
-		}
-		else if( elementId == 'dateOperator' )
-		{
-			dateOperator = jQuery(this).val();
-		}
-		else if( $(this).attr('type') != 'button' )
-		{
-			var value = "";
-			if( jQuery(this).val() != '' )
-			{
-				value = htmlEncode(jQuery(this).val());
-			}
-			if( dateOperator != '' )
-			{
-				value = dateOperator + "'" + value + "'";
-				dateOperator = "";
-			}
-			params += elementId + "="+ value + "&";
-		}
-	} );
+		{
+			var elementId = $(this).attr('id');
+			
+			if( $(this).attr('type') == 'checkbox' )
+			{
+				var checked = jQuery(this).attr('checked') ? true : false;
+				params += elementId + "=" + checked + "&";
+			}
+			else if( elementId =='dateOperator' )
+			{
+				dateOperator = jQuery(this).val();
+			}
+			else if( $(this).attr('type') != 'button' )
+			{
+				var value = "";
+				if( jQuery(this).val()!= null && jQuery(this).val() != '' )
+				{
+					value = htmlEncode(jQuery(this).val());
+				}
+				if( dateOperator != '' )
+				{
+					value = dateOperator + "'" + value + "'";
+					dateOperator = "";
+				}
+				params += elementId + "="+ value + "&";
+			}
+		});
 		
 	return params;
 }
@@ -261,31 +347,55 @@
 // Load all patients
 // -----------------------------------------------------------------------------
 
-function loadAllPatients()
+function listAllPatient()
 {
 	hideById( 'listPatientDiv' );
 	
-	var sortPatientAttributeId = getFieldValue('sortPatientAttributeId');
-	
 	jQuery('#loaderDiv').show();
 	contentDiv = 'listPatientDiv';
-	jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{
-			listAll:true,
-			sortPatientAttributeId: (sortPatientAttributeId ? sortPatientAttributeId : "")
+	
+	var programId = getFieldValue('programIdAddPatient');
+
+	if ( programId || programId == '' )
+	{
+		jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{ listAll:true },
+			function(){
+				setTableStyles();
+				statusSearching = 0;
+				showById('listPatientDiv');
+				jQuery('#loaderDiv').hide();
+			});
+	}
+	else
+	{
+		jQuery('#listPatientDiv').load('searchRegistrationPatient.action',
+		{
+			listAll:false,
+			searchBySelectedOrgunit: true,
+			programIds: programId,
+			searchTexts: 'prg_' + programId
 		},
-		function(){
+		function()
+		{
+			setTableStyles();
 			statusSearching = 0;
 			showById('listPatientDiv');
 			jQuery('#loaderDiv').hide();
 		});
+	}
+
 	hideLoader();
 }
 
 function addPhoneToList( elementList, _id, _patientName, _phoneNo )
 {
 	var list = jQuery( "#" + elementList );
-	list.append( "<option value='" + _id + "'>\"" + _patientName + " <" + _phoneNo + ">" + "\"</option>" );
 	
+	if ( list.find( "option[value='" + _id + "']").val() == undefined )
+	{
+		list.append( "<option title='" + i18n_dblick_to_unselect + "' value='" + _id + "'>\"" + _patientName + " <" + _phoneNo + ">" + "\"</option>" );
+	}
+
 	jQuery( "tr#tr" + _id ).hide();
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm	2013-01-08 05:45:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/patientRegistrationList.vm	2013-02-25 04:28:51 +0000
@@ -26,7 +26,7 @@
 		</tr>	
 		
 		<tr>
-			<td class='text-column' ><strong>$i18n.getString( "total_result" )</strong></td>
+			<td class='text-column' ><strong>$i18n.getString( "total_result" ):</strong></td>
 			<td>&nbsp;</td>
 			<td>&nbsp;</td>
 			<td>$!total</td>
@@ -57,27 +57,26 @@
 		  #if($mapPatientOrgunit.size()!=0)
           <col/>
 		  #end
-          <col width="20"/>    
-		  
+          <col width="100"/>    
+
 		  <thead>
 			<tr>
 				<th>#</th>
 				#foreach( $attribute in $patientAttributes )
 					#if($attribute)
-					<th id="patientAttributeName">$!encoder.htmlEncode( $attribute.name )</th>
+						<th id="patientAttributeName">$!encoder.htmlEncode( $attribute.displayName )</th>
 					#end
 				#end
 
 				#foreach( $identifierType in $identifierTypes)
-					<th>$encoder.htmlEncode($identifierType.name)</th>
+					<th>$encoder.htmlEncode($identifierType.displayName)</th>
 				#end
-				#if( $identifierTypes.size()==0 )
+				#if( $identifierTypes.size() == 0 )
 					<th>$i18n.getString( "full_name" )</th>
 				#end
 				<th>$i18n.getString( "gender" )</th>
 				<th>$i18n.getString( "date_of_birth" )</th> 
-				<th class="{sorter: false}">$i18n.getString( "age" )</th>
-				<th class="{sorter: false}">$i18n.getString( "phone_number" )</th>
+				<th class="{sorter: false}">$i18n.getString( "age" )</th><th class="{sorter: false}">$i18n.getString( "phone_number" )</th>
 				#if($mapPatientOrgunit.size()!=0)
 				<th>$i18n.getString( "hierachy_orgunit" )</th>
 				#end
@@ -85,10 +84,9 @@
 			  </tr>
           </thead>
 		  
-          <tbody id="list">	
-		  #set( $mark = false )
+          <tbody id="list">
           #foreach( $patient in $patients )
-          	<tr id="tr${patient.id}" #alternate($mark) >
+          	<tr id="tr${patient.id}">
 				
 				<td>
 					#set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
@@ -109,7 +107,7 @@
 				#end
 				
 				#set($value="")
-				#foreach( $identifierType in $identifierTypes)
+				#foreach( $identifierType in $identifierTypes )
 					#foreach( $identifier in $patient.identifiers)
 						#if($identifier.identifierType.id==$identifierType.id)
 							#set($value=$identifier.identifier)
@@ -119,11 +117,11 @@
 				#if($value=="")
 					#set($value=$patient.getFullName())
 				#end
-				<td>$encoder.htmlEncode($value)</td>
+				<td>$!encoder.htmlEncode($value)</td>
 				
 				<td>$i18n.getString($!patient.gender)</td>
 				
-				<td>$format.formatDate( $!patient.birthDate)</td>
+				<td>$!format.formatDate( $!patient.birthDate)</td>
 				
 				<td>$!patient.getAge()</td>
 				
@@ -132,7 +130,7 @@
 				#end
 
 				<td>
-					#if ( $!patient.phoneNumber() && $!patient.phoneNumber() != "" )					
+					#if ( $!patient.phoneNumber && $!patient.phoneNumber != "" )					
 					<a href="javascript:addPhoneToList( 'recipients', '$patient.id', '$patient.getFullName()', '$!patient.phoneNumber' )" title='$i18n.getString( "add_phone_to_list" )'>
 					<img src="../images/move_down.png" alt='$i18n.getString( "add_phone_to_list" )' /></a>
 					#else
@@ -141,7 +139,6 @@
 				</td>
 				
 			</tr>
-			#set( $mark = !$mark)
     	#end
     	</tbody>
     
@@ -194,4 +191,5 @@
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
 	var i18n_create_new_encounter = '$encoder.jsEscape( $i18n.getString( "create_new_encounter" ) , "'")';
 	var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
+	var i18n_dblick_to_unselect = '$encoder.jsEscape( $i18n.getString( "dblick_to_unselect" ) , "'")';
 </script>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/searchPatientCritetia.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/searchPatientCritetia.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/searchPatientCritetia.vm	2013-02-25 04:28:51 +0000
@@ -0,0 +1,114 @@
+<table>
+	<tbody>
+		<tr>
+			<th colspan="5">$i18n.getString( "search_details" )</th>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "registering_unit" )</label></td>
+			<td><input type="text" id='selectedOrgunitText' readonly style="min-width:16em"></td>
+			<td><input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick='listAllPatient();'/>
+			<input type="button" class='large-button' id='advancedSearchBtn' value='$i18n.getString( "advance_search" )' onclick="jQuery('#advanced-search').toggle();" disabled="true" /></td>
+			<td><span id='warnmessage' style='color:red'></span></td>
+		</tr>
+		<tr id='programAddPatientTR'>
+			<td>$i18n.getString('program')</td>
+			<td>
+				<select id='programIdAddPatient' name='programIdAddPatient' onchange='enableBtn();'>
+					<option value='' type='2'>[$i18n.getString("please_select")]</option>
+					#foreach($program in $programs)
+						<option value="$program.id" type='$program.type'>$program.displayName</option>
+					#end
+				</select>
+			</td>
+		</tr>
+	</tbody>
+</table>
+
+<div id="advanced-search" class='hidden'>
+	<table>
+		<tr id='programStageAddPatientTR' class='hidden'>
+			<td>$i18n.getString('status')</td>
+			<td>
+				<select id="statusEvent" name="statusEvent">
+					<option value='4'>$i18n.getString("overdue")</option>
+					<option value='2'>$i18n.getString("incomplete")</option>
+					<option value='1'>$i18n.getString("completed")</option>
+					<option value='3'>$i18n.getString("scheduled_in_future")</option> 
+				</select>
+			</td>
+		</tr>
+		<tr id='dueDateTR' class='hidden'>
+			<td>$i18n.getString('due_date_from_to')</td>
+			<td>
+				<input type='text' id='startDueDate' name='startDueDate' style='width:105px;'>
+				<input type='text' id='endDueDate' name='endDueDate' style='width:105px;'>
+			</td>
+		</tr>
+		#if( $auth.hasAccess( "dhis-web-caseentry", "searchAllFacilities" ) )
+			<tr id='searchBySelectedUnitTD'>
+				<td>
+					$i18n.getString('search_in_all_facilities') 
+					<input type='checkbox' id='searchInAllFacility' name='searchInAllFacility' />&nbsp;&nbsp;&nbsp;
+				</td>
+			</tr>
+		#else
+			<input type='checkbox' class='hidden' id='searchInAllFacility' name='searchInAllFacility' />
+		#end
+		<tr>	       
+			<td id='searchingAttributeIdTD' class="hidden">
+				<select class='search-field' id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
+					<option value="iden">$i18n.getString( "search_by_name_identifier" )</option>
+					<option value="prg">$i18n.getString( "search_by_program" )</option>
+					<option value="fixedAttr_birthDate">$i18n.getString( "date_of_birth" )</option>
+					<option value="fixedAttr_age">$i18n.getString( "age_year" )</option>
+					<option value="fixedAttr_gender">$i18n.getString( "gender" )</option>
+					<option value="fixedAttr_phoneNumber">$i18n.getString( "phone_number" )</option>
+					#foreach( $attribute in $patientAttributes )
+					<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
+					#end
+				</select>
+				<em title="$i18n.getString( 'required' )" class="required">*</em></label>
+			</td>
+		</tr>
+		<tbody id='advancedSearchTB'>
+			<tr>
+				<td></td>
+				<td></td>
+				<td rowspan='30' valign='bottom'>
+					<input type="button" class='large-button' value='$i18n.getString( "add" )' onclick='addAttributeOption();'>
+				</td>
+				<td rowspan='30' valign='bottom' align="right" >
+					<input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='validateAdvancedSearch();' id='searchPatientBtn'>
+				</td>
+				<td rowspan='30' valign='bottom' align="right" >
+					<input type="button" class='large-button hidden' id='sendSmsToListBtn' value="$i18n.getString('send_message')" onclick="setFieldValue('sendToList', true);showSendSmsForm();" >
+				</td>
+			</tr>
+			<tr id='advSearchBox0'>	       
+				<td>
+				  <select class='search-field' id="searchObjectId" name="searchObjectId" #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchObjectOnChange(this)">
+					<option value="iden">$i18n.getString( "search_by_name_identifier" )</option>
+					<option value="prg">$i18n.getString( "search_by_program" )</option>
+					<option value="fixedAttr_birthDate">$i18n.getString( "date_of_birth" )</option>
+					<option value="fixedAttr_age">$i18n.getString( "age_year" )</option>
+					<option value="fixedAttr_gender">$i18n.getString( "gender" )</option>
+					<option value="fixedAttr_phoneNumber">$i18n.getString( "phone_number" )</option>
+					#foreach( $attribute in $patientAttributes )
+						<option value="attr_$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.displayName )</option>
+					#end
+				  </select>
+				  <em title="$i18n.getString( 'required' )" class="required">*</em></label>
+				</td>		
+				<td>
+					<input type="text" id="searchText" name="searchText" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );'>
+					<input type="button" class='large-button' name="clearSearchBtn" value='$i18n.getString( "clear" )' onclick="removeAttributeOption('advSearchBox0');" disabled>
+				</td>
+			</tr>
+			<tr>
+				<td></td>
+				<td></td>
+				
+			</tr>
+		</tbody>
+	</table>
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm	2013-02-21 06:44:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm	2013-02-25 04:28:51 +0000
@@ -62,48 +62,8 @@
 		</tbody>
 	</table>
 
-	<table id='advancedSearchTB'>
-		<tbody>
-			<tr>
-				<th colspan="5">$i18n.getString( "search_details" )</th>
-			</tr>
-			<tr>
-				<td><label>$i18n.getString( "registering_unit" )</label></td>
-				<td><input type="text" id='selectedOrgunitText' readonly style="min-width:16em"></td>
-				<td><input type="button" id='listPatientBtn' value="$i18n.getString( 'list_all_patients' )" onclick='loadAllPatients();'/></td>
-				<td><span id='warnmessage' style='color:red'></span></td>
-			</tr>	
-		
-			<tr id='advSearchBox0'>	       
-				<td id='searchingAttributeIdTD'>
-					<select id="searchingAttributeId" name="searchingAttributeId" style="width:20.2em"  #if( $patientAttributes.size() == 0 ) disabled="disabled" #end onchange="searchingAttributeOnChange(this)">
-						<option value="">$i18n.getString( "search_by_name_identifier" )</option>
-						<option value="0">$i18n.getString( "search_by_program" )</option>
-						<option value="-1">$i18n.getString( "date_of_birth" )</option>
-						<option value="-2">$i18n.getString( "gender" )</option>
-						<option value="-4">$i18n.getString( "phone_number" )</option>
-						#foreach( $attribute in $patientAttributes )
-						<option value="$attribute.id" valueType='$attribute.valueType'>$encoder.htmlEncode( $attribute.name )</option>
-						#end
-					</select> 
-					<em title="$i18n.getString( 'required' )" class="required">*</em></label>
-				</td>		
-				<td>
-					<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );'/>
-				</td>
-				<td>
-					<input type="button" value='+' onclick='addAttributeOption();'/>
-					
-					$i18n.getString( 'search_by_selected_unit' )
-					<input type='checkbox' id='searchBySelectedOrgunit' name='searchBySelectedOrgunit' value='true' />
-					<input type="button" value='$i18n.getString( "search" )' onclick='validateAdvancedSearch();'/>
-				</td>
-				<td>
-				</td>
-			</tr>
-		</tbody>
-	</table>
-
+	#parse( "dhis-web-maintenance-mobile/searchPatientCritetia.vm" )
+	
 	<!-- List searching patients -->
 	#parse( "dhis-web-commons/loader/loader.vm" )
 	<div id='listPatientDiv'></div>
@@ -181,11 +141,9 @@
 	}
 
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
-	var i18n_can_not_register_patient_for_orgunit = '$encoder.jsEscape( $i18n.getString( "can_not_register_patient_for_orgunit" ), "'")';	
 	var i18n_please_select_village = '[' + '$encoder.jsEscape( $i18n.getString( "please_select_village" ), "'")' + ']';
 	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
 	var i18n_select_program = '[' + '$encoder.jsEscape( $i18n.getString( "select_program" ), "'")' + ']';
-	var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'")';
 	var i18n_list_all_patient = '$encoder.jsEscape( $i18n.getString( "list_all_patient" ) , "'")';
 	var i18n_list_patients_by_program = '$encoder.jsEscape( $i18n.getString( "list_patients_by_program" ) , "'" )';
     var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")'; 
@@ -231,6 +189,7 @@
 
 	var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
 	var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
+	var i18n_clear = '$encoder.jsEscape( $i18n.getString( "clear" ) , "'")';
 
 	// -1: no search anything
 	//  0: show list all patient
@@ -238,12 +197,13 @@
 	var statusSearching = -1;
 	isAjax = true;
 	contentDiv = '';
+	registration = true;
 	
 	// ----------------------------------------------------------------
 	// Search field
 	// ----------------------------------------------------------------
 	
-	var searchTextBox = '<input type="text" id="searchText" name="searchText" maxlength="30" style="width:20em" onkeyup="searchPatientsOnKeyUp( event );">';
+	var searchTextBox = '<input type="text" id="searchText" name="searchText" onkeyup="searchPatientsOnKeyUp( event );">';
 	
 	var trueFalseBox  = '<select id="searchText" name="searchText" style="width:20.2em" >';
 		trueFalseBox += '<option value="true">' + i18n_yes + '</option>';
@@ -255,10 +215,9 @@
 		genderSelector += '<option value="F">$i18n.getString( "female" )</option>';
 		genderSelector += '</select>';
 
-	var programComboBox = '<select id="searchText" name="searchText" style="width:20.2em" >';
-		
-	#foreach ( $program in $programs ) 
-		programComboBox += '<option value="$program.id">$program.name</option>';
+	var programComboBox = '<select class="search-field" id="searchText" name="searchText" >';
+	#foreach ( $program in $programs )
+		programComboBox += '<option value="$program.id">$program.displayName</option>';
 	#end
 	programComboBox += '</select>';
 	
@@ -268,13 +227,10 @@
 	
 	#if( $status == 1 )
 		setFieldValue('selectedOrgunitText', i18n_please_select_village );
-		setInnerHTML('warnmessage', '' );
 	#elseif( $status == 2 )
 		setFieldValue('selectedOrgunitText', '$organisationUnit.name' );
-		setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit);
 	#else
 		setFieldValue('selectedOrgunitText', '$organisationUnit.name' );
-		setInnerHTML('warnmessage', '' );
-		showById('searchPatientDiv');
+		showById('searchDiv');
 	#end	
 </script>
\ No newline at end of file