=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patient/SearchPatientAction.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/patient/SearchPatientAction.java 2011-07-19 03:48:05 +0000 @@ -33,12 +33,12 @@ import java.util.Map; import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.paging.ActionPagingSupport; import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttribute; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientService; +import org.hisp.dhis.patient.state.SelectedStateManager; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import org.hisp.dhis.program.Program; @@ -60,7 +60,7 @@ // Dependencies // ------------------------------------------------------------------------- - private OrganisationUnitSelectionManager selectionManager; + private SelectedStateManager selectedStateManager; private PatientService patientService; @@ -99,16 +99,16 @@ private PatientAttribute sortingPatientAttribute = null; private PatientAttribute searchingPatientAttribute = null; - + private Program program; - + // ------------------------------------------------------------------------- // Getters/Setters // ------------------------------------------------------------------------- - public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) + public void setSelectedStateManager( SelectedStateManager selectedStateManager ) { - this.selectionManager = selectionManager; + this.selectedStateManager = selectedStateManager; } public void setProgramService( ProgramService programService ) @@ -125,7 +125,7 @@ { return mapPatientOrgunit; } - + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) { this.patientAttributeService = patientAttributeService; @@ -156,6 +156,16 @@ this.searchingAttributeId = searchingAttributeId; } + public String getSearchText() + { + return searchText; + } + + public Program getProgram() + { + return program; + } + public Collection getPatients() { return patients; @@ -183,16 +193,22 @@ public String execute() throws Exception { - OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit(); - - setParamsToSearch(); + OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); + + setParamsToSearch(); // --------------------------------------------------------------------- // Get all of patient into the selected organisation unit // --------------------------------------------------------------------- - + if ( listAll != null && listAll ) { + selectedStateManager.clearSearchingAttributeId(); + selectedStateManager.clearSortingAttributeId(); + selectedStateManager.clearSearchText(); + selectedStateManager.clearSelectedProgram(); + selectedStateManager.setListAll( listAll ); + listAllPatient( organisationUnit, sortingPatientAttribute ); return SUCCESS; @@ -201,11 +217,22 @@ // --------------------------------------------------------------------- // Get patients by the selected program // --------------------------------------------------------------------- - + if ( searchingAttributeId != null && searchingAttributeId == 0 && programId != null ) { program = programService.getProgram( programId ); + if ( sortPatientAttributeId != null ) + { + selectedStateManager.setSortingAttributeId( sortPatientAttributeId ); + } + else + { + selectedStateManager.clearSortingAttributeId(); + } + selectedStateManager.setSelectedProgram( program ); + selectedStateManager.setSearchingAttributeId( searchingAttributeId ); + searchPatientByProgram( organisationUnit, program, sortingPatientAttribute ); return SUCCESS; @@ -215,19 +242,97 @@ // Get patients by searchingAttributeId and searchText // and sort result by sortingAttributeId // --------------------------------------------------------------------- - + if ( searchingPatientAttribute != null && searchText != null ) { + + selectedStateManager.clearListAll(); + selectedStateManager.setSearchingAttributeId( searchingAttributeId ); + if ( sortPatientAttributeId != null ) + { + selectedStateManager.setSortingAttributeId( sortPatientAttributeId ); + } + else + { + selectedStateManager.clearSortingAttributeId(); + } + + if ( programId != null ) + { + selectedStateManager.clearSortingAttributeId(); + } + selectedStateManager.setSearchText( searchText ); + searchPatientByAttribute( searchingPatientAttribute, searchText, sortingPatientAttribute ); return SUCCESS; } - - // searchingPatientAttribute == null && searchText != null - - searchPatientByAttribute( searchText, sortingPatientAttribute ); - + + if ( searchingPatientAttribute == null && searchText != null ) + { + selectedStateManager.clearListAll(); + selectedStateManager.clearSearchingAttributeId(); + + if ( sortPatientAttributeId != null ) + { + selectedStateManager.setSortingAttributeId( sortPatientAttributeId ); + } + else + { + selectedStateManager.clearSortingAttributeId(); + } + + if ( programId != null ) + { + selectedStateManager.clearSortingAttributeId(); + } + selectedStateManager.setSearchText( searchText ); + + searchPatientByAttribute( searchText, sortingPatientAttribute ); + + return SUCCESS; + } + + // --------------------------------------------------------------------- + // Search patients by values into section + // --------------------------------------------------------------------- + + listAll = selectedStateManager.getListAll(); + searchingAttributeId = selectedStateManager.getSearchingAttributeId(); + sortPatientAttributeId = selectedStateManager.getSortAttributeId(); + searchText = selectedStateManager.getSearchText(); + program = selectedStateManager.getSelectedProgram(); + + setParamsToSearch(); + + if ( listAll ) + { + listAllPatient( organisationUnit, sortingPatientAttribute ); + + return SUCCESS; + + } + + if ( searchingAttributeId != null && searchingAttributeId == 0 && program != null ) + { + searchPatientByProgram( organisationUnit, program, sortingPatientAttribute ); + return SUCCESS; + } + + if ( searchingAttributeId != null && searchText != null ) + { + searchPatientByAttribute( searchText, sortingPatientAttribute ); + return SUCCESS; + } + + if ( searchingAttributeId == null && searchText != null ) + { + searchPatientByAttribute( searchText, sortingPatientAttribute ); + return SUCCESS; + } + return SUCCESS; + } // ------------------------------------------------------------------------- @@ -239,7 +344,7 @@ // --------------------------------------------------------------------- // Get sorting patient-attribute // --------------------------------------------------------------------- - + if ( sortPatientAttributeId != null ) { sortingPatientAttribute = patientAttributeService.getPatientAttribute( sortPatientAttributeId ); @@ -259,7 +364,7 @@ { total = patientService.countGetPatientsByOrgUnit( organisationUnit ); this.paging = createPaging( total ); - + patients = new ArrayList( patientService.getPatients( organisationUnit, paging.getStartPos(), paging .getPageSize() ) ); @@ -292,7 +397,8 @@ { for ( Patient patient : patients ) { - // mapRelationShip.put( patient.getId(), relationshipService.getRelationshipsForPatient( patient ) ); + // mapRelationShip.put( patient.getId(), + // relationshipService.getRelationshipsForPatient( patient ) ); if ( sortingPatientAttribute != null ) { @@ -349,9 +455,17 @@ private void searchPatientByAttribute( String searchText, PatientAttribute sortingPatientAttribute ) { + int index = searchText.indexOf( ' ' ); + + if ( index != -1 && index == searchText.lastIndexOf( ' ' ) ) + { + String[] keys = searchText.split( " " ); + searchText = keys[0] + " " + keys[1]; + } + total = patientService.countGetPatients( searchText ); this.paging = createPaging( total ); - + patients = patientService.getPatients( searchText, paging.getStartPos(), paging.getPageSize() ); if ( patients != null && patients.size() > 0 ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/RemoveRelationshipAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/RemoveRelationshipAction.java 2009-11-14 14:29:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/RemoveRelationshipAction.java 2011-07-19 03:48:05 +0000 @@ -54,11 +54,11 @@ // Input/Output // ------------------------------------------------------------------------- - private int relationshipId; + private int id; - public void setRelationshipId( int relationshipId ) + public void setId( int id ) { - this.relationshipId = relationshipId; + this.id = id; } // ------------------------------------------------------------------------- @@ -68,7 +68,7 @@ public String execute() throws Exception { - Relationship relationship = relationshipService.getRelationship( relationshipId ); + Relationship relationship = relationshipService.getRelationship( id ); relationshipService.deleteRelationship( relationship ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/RemoveRepresentativeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/RemoveRepresentativeAction.java 2011-03-31 01:42:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/RemoveRepresentativeAction.java 2011-07-19 03:48:05 +0000 @@ -28,7 +28,6 @@ import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.patient.state.SelectedStateManager; import com.opensymphony.xwork2.Action; @@ -43,13 +42,6 @@ // Dependencies // ------------------------------------------------------------------------- - private SelectedStateManager selectedStateManager; - - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - private PatientService patientService; public void setPatientService( PatientService patientService ) @@ -61,11 +53,11 @@ // Input/Output // ------------------------------------------------------------------------- - private Patient patient; + private Integer patientId; - public Patient getPatient() + public void setPatientId( Integer patientId ) { - return patient; + this.patientId = patientId; } // ------------------------------------------------------------------------- @@ -75,7 +67,7 @@ public String execute() throws Exception { - patient = selectedStateManager.getSelectedPatient(); + Patient patient = patientService.getPatient( patientId ); patient.setRepresentative( null ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRepresentativeAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRepresentativeAction.java 2011-03-20 18:15:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/relationship/SaveRepresentativeAction.java 2011-07-19 03:48:05 +0000 @@ -28,7 +28,6 @@ import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientService; -import org.hisp.dhis.patient.state.SelectedStateManager; import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; import com.opensymphony.xwork2.Action; @@ -50,14 +49,7 @@ { this.patientService = patientService; } - - private SelectedStateManager selectedStateManager; - - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - + private PatientAttributeValueService patientAttributeValueService; public void setPatientAttributeValueService( PatientAttributeValueService patientAttributeValueService ) @@ -69,11 +61,11 @@ // Input/Output // ------------------------------------------------------------------------- - private Patient patient; + private Integer patientId; - public Patient getPatient() + public void setPatientId( Integer patientId ) { - return patient; + this.patientId = patientId; } private Integer representativeId; @@ -90,6 +82,13 @@ this.copyAttribute = copyAttribute; } + private Patient patient; + + public Patient getPatient() + { + return patient; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -99,7 +98,7 @@ { Patient representative = patientService.getPatient( representativeId ); - patient = selectedStateManager.getSelectedPatient(); + patient = patientService.getPatient( patientId ); patient.setRepresentative( representative ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java 2011-03-31 01:42:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/state/SelectedStateManager.java 2011-07-19 03:48:05 +0000 @@ -89,7 +89,7 @@ boolean getListAll(); void clearListAll(); - + // ------------------------------------------------------------------------- // for Sorting patients - Sort by patient-attribute // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2011-07-07 08:03:22 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2011-07-19 03:48:05 +0000 @@ -132,8 +132,6 @@ id="org.hisp.dhis.patient.action.relationship.SaveRepresentativeAction" class="org.hisp.dhis.patient.action.relationship.SaveRepresentativeAction" scope="prototype"> - @@ -144,8 +142,6 @@ class="org.hisp.dhis.patient.action.relationship.RemoveRepresentativeAction" scope="prototype"> - - + === 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-07-08 05:52:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2011-07-19 03:48:05 +0000 @@ -468,4 +468,5 @@ save_success = Save successfully configuration_xml_file_null = Configuration of folder where contains xml file is null there_is_no_defination_xml_file_in_user_home = There is no any definition related XML file in the user home -patient_attribute_group_sort_order = Beneficiary Attribute Group Sort Order \ No newline at end of file +patient_attribute_group_sort_order = Beneficiary Attribute Group Sort Order +enrol_success = Enrol successfully. \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2011-07-08 05:52:59 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2011-07-19 03:48:05 +0000 @@ -135,8 +135,8 @@ - getRelationshipList.action - + + /dhis-web-commons/ajax/jsonResponseSuccess.vm F_RELATIONSHIP_DELETE === 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-07-11 03:52:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm 2011-07-19 03:48:05 +0000 @@ -31,7 +31,7 @@

$i18n.getString( "add_new_patient" )

-

+

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipForm.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/addRelationshipForm.vm 2011-07-19 03:48:05 +0000 @@ -4,20 +4,19 @@ jQuery('name').focus(); validation( 'relationshipSelectForm', function(form){ - form.submit(); + validateSearchPartner(); }); });
- +

$i18n.getString( "adding_new_relationship_for" )

- + - - @@ -101,8 +107,8 @@ $i18n.getString( "manage_program_enrollment" )$i18n.getString( "manage_program_unenrollment" )$i18n.getString( "edit_profile" ) - $i18n.getString( "manage_relationship" ) - $i18n.getString( "add_dependent" ) + $i18n.getString( "manage_relationship" ) + $i18n.getString( "add_dependent" )$i18n.getString( "remove" )$i18n.getString( "show_details" ) @@ -128,12 +134,12 @@

$i18n.getString( "update_patient" )

-

+

=== 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-07-11 03:52:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addRelationshipPatientForm.vm 2011-07-19 03:48:05 +0000 @@ -24,7 +24,7 @@ });
- +

$i18n.getString("add_new_relationship_for"): $patient.getFullName()

=== 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-06-23 03:10:28 +0000 +++ 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 @@ -337,7 +337,7 @@ } else if ( type == 'input' ) { - setMessage( message ); + showErrorMessage( message ); } else if( type == 'duplicate' ) { @@ -384,7 +384,7 @@ } else if ( type == 'input' ) { - setMessage( message ); + showErrorMessage( message ); } else if( type == 'duplicate' ) { @@ -692,10 +692,9 @@ jQuery('#loaderDiv').show(); contentDiv = 'listPatientDiv'; - jQuery('#listPatientDiv').load('searchPatient.action?listAll=true', + jQuery('#listPatientDiv').load('searchPatient.action?listAll=true',{}, function(){ showById('listPatientDiv'); - setInnerHTML( 'searchTextInfo', i18n_list_all_patient ); jQuery('#loaderDiv').hide(); }); hideLoader(); @@ -835,11 +834,11 @@ } else if ( type == 'error' ) { - window.alert( i18n_program_enrollment_failed + ':' + '\n' + message ); + showErrorMessage( i18n_program_enrollment_failed + ':' + '\n' + message ); } else if ( type == 'input' ) { - setMessage( json.message ); + showWarningMessage( json.message ); } } }); @@ -855,7 +854,7 @@ success: function( html ) { setInnerHTML('programEnrollmentDiv', html ); jQuery('#enrollBtn').attr('value',i18n_update); - setMessage( i18n_save_success ); + showSuccessMessage( i18n_enrol_success ); } }); return false; @@ -901,6 +900,8 @@ { setFieldValue( 'enrollmentDate', json.dateOfIncident ); setFieldValue( 'dateOfIncident', json.enrollmentDate ); + setFieldValue( 'dateOfEnrollmentDescription', json.dateOfEnrollmentDescription ); + setFieldValue( 'dateOfIncidentDescription', json.dateOfIncidentDescription ); showById( 'unenrollmentFormDiv' ); $( "#loaderDiv" ).hide(); }); @@ -964,19 +965,30 @@ function showRelationshipList( patientId ) { - hideById('selectDiv'); - hideById('searchPatientDiv'); - hideById('listPatientDiv'); + hideById('addRelationshipDiv'); - jQuery('#loaderDiv').show(); - jQuery('#listRelationshipDiv').load('showRelationshipList.action', - { - id:patientId - }, function() - { - showById('listRelationshipDiv'); - jQuery('#loaderDiv').hide(); - }); + if ( getFieldValue('isShowPatientList') == 'false' ) + { + hideById('selectDiv'); + hideById('searchPatientDiv'); + hideById('listPatientDiv'); + + jQuery('#loaderDiv').show(); + jQuery('#listRelationshipDiv').load('showRelationshipList.action', + { + id:patientId + }, function() + { + showById('listRelationshipDiv'); + jQuery('#loaderDiv').hide(); + }); + } + else + { + showById('selectDiv'); + showById('searchPatientDiv'); + showById('listPatientDiv'); + } } // ---------------------------------------------------------------- @@ -996,23 +1008,21 @@ hideById('addRelationshipDiv'); } - -function onClickRelationshipBackBtn() +function loadPatientList() { - if ( byId('listRelationshipDiv').innerHTML == '' ) - { - onClickBackBtn(); - return; - } - - showById('listRelationshipDiv'); - - hideById('selectDiv'); - hideById('searchPatientDiv'); - hideById('listPatientDiv'); + showById('selectDiv'); + showById('searchPatientDiv'); + showById('listPatientDiv'); + hideById('addPatientDiv'); hideById('updatePatientDiv'); hideById('enrollmentDiv'); + hideById('listRelationshipDiv'); hideById('addRelationshipDiv'); + + $('#listPatientDiv').load("searchPatient.action", {} + , function(){ + 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-05-26 03:19:50 +0000 +++ 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 @@ -219,15 +219,15 @@ if( type == 'success' ) { - setMessage( i18n_save_success ); + showSuccessMessage( i18n_save_success ); } else if( type == 'error' ) { - window.alert( i18n_adding_relationship_failed + ':' + '\n' + message ); + showErrorMessage( i18n_adding_relationship_failed + ':' + '\n' + message ); } else if( type == 'input' ) { - setMessage( message ); + showWarningMessage( message ); } jQuery('#loaderDiv').hide(); } @@ -238,46 +238,8 @@ function removeRelationship( relationshipId, patientA, aIsToB, patientB ) { - - var result = window.confirm( i18n_confirm_delete_relationship + '\n\n' + patientA + ' is ' + aIsToB + ' to ' + patientB ); - - if( result ) - { - window.location = 'removeRelationship.action?relationshipId=' + relationshipId; - } -} - - -/*function removeRelationship( relationshipId, patientA, aIsToB, patientB ) -{ - - var result = window.confirm( i18n_confirm_delete_relationship + '\n\n' + patientA + ' is ' + aIsToB + ' to ' + patientB ); - - if( result ) - { - var request = new Request(); - request.setResponseTypeXML( 'message' ); - request.setCallbackSuccess( removeRelationshipCompleted ); - request.send( 'removeRelationship.action?relationshipId=' + relationshipId ); - } -} - -function removeRelationshipCompleted( messageElement ) -{ - var type = messageElement.getAttribute( 'type' ); - var message = messageElement.firstChild.nodeValue; - - if( type == 'success' ) - { - window.location = "getRelationshipList.action"; - } - else if( type = 'error' ) - { - setInnerHTML( 'warningField', message ); - - showWarning(); - } -}*/ + removeItem( relationshipId, patientA + ' is ' + aIsToB + ' to ' + patientB, i18n_confirm_delete_relationship, 'removeRelationship.action' ); +} //------------------------------------------------------------------------------ // Relationship partner @@ -295,7 +257,8 @@ { var partnerIsRepresentative = getElementValue( patientElement, 'partnerIsRepresentative' ); - var partnerId = '
'; + var patientId = getFieldValue('id' ); + var partnerId = getElementValue( patientElement, 'id' ); var labelField; var buttonFirstField; var buttonSecondField; @@ -304,21 +267,20 @@ { labelField = i18n_do_you_want_to_remove_this_one_from_being_representative; - buttonFirstField = ''; + buttonFirstField = ''; buttonSecondField = ' '; } else if( partnerIsRepresentative == 'false' ) { labelField = i18n_do_you_want_to_make_this_one_a_representative; - buttonFirstField = ''; - buttonSecondField= ''; + buttonFirstField = ''; + buttonSecondField= ''; } setInnerHTML( 'labelField', labelField ); setInnerHTML( 'buttonFirstField', buttonFirstField ); setInnerHTML( 'buttonSecondField', buttonSecondField ); - setInnerHTML( 'partnerIdField', partnerId ); setInnerHTML( 'fullNameField', getElementValue( patientElement, 'fullName' ) ); setInnerHTML( 'genderField', getElementValue( patientElement, 'gender' ) ); setInnerHTML( 'dateOfBirthField', getElementValue( patientElement, 'dateOfBirth' ) ); @@ -353,15 +315,18 @@ node.style.display = 'none'; } -function saveRepresentative( copyAttribute ) -{ - var representativeId = document.getElementById( 'partnerId' ); +function saveRepresentative( patientId, representativeId, copyAttribute ) +{ + var url = 'saveRepresentative.action' + var params = 'patientId=' + patientId + params += '&representativeId=' + representativeId; + params += '©Attribute=' + copyAttribute; - var url = 'saveRepresentative.action?representativeId=' + representativeId.value + '©Attribute=' + copyAttribute; var request = new Request(); request.setResponseTypeXML( 'message' ); - request.setCallbackSuccess( saveRepresentativeCompleted ); + request.setCallbackSuccess( saveRepresentativeCompleted ); + request.sendAsPost( params ); request.send( url ); return false; @@ -374,27 +339,28 @@ if( type == 'success' ) { - window.location = "getRelationshipList.action"; + hideById('relationshipPartnerContainer'); } else if( type == 'error' ) { - window.alert( i18n_saving_representative_failed + ':' + '\n' + message ); + showErrorMessage( i18n_saving_representative_failed + ':' + '\n' + message ); } else if( type == 'input' ) { - setHeaderMessage( message ); + showWarningMessage( message ); } } -function removeRepresentative() +function removeRepresentative( patientId, representativeId ) { - var representativeId = document.getElementById( 'partnerId' ); - - var url = 'removeRepresentative.action?representativeId=' + representativeId.value; + var url = 'removeRepresentative.action'; + var params = 'patientId=' + patientId; + params +='&representativeId=' + representativeId; var request = new Request(); request.setResponseTypeXML( 'message' ); - request.setCallbackSuccess( removeRepresentativeCompleted ); + request.setCallbackSuccess( removeRepresentativeCompleted ); + request.sendAsPost( params ); request.send( url ); return false; @@ -408,7 +374,7 @@ if( type == 'success' ) { - window.location = "getRelationshipList.action"; + showRelationshipList( getFieldValue('id') ); } else if( type == 'error' ) { === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js 2011-07-11 03:52:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/relationshipPatient.js 2011-07-19 03:48:05 +0000 @@ -3,7 +3,7 @@ // Add Relationship Patient // ----------------------------------------------------------------------------- -function showAddRelationshipPatient( patientId ) +function showAddRelationshipPatient( patientId, isShowPatientList ) { hideById( 'selectDiv' ); hideById( 'searchPatientDiv' ); @@ -17,6 +17,7 @@ }, function() { showById('addRelationshipDiv'); + setFieldValue( 'isShowPatientList', isShowPatientList ); jQuery('#loaderDiv').hide(); }); } @@ -44,11 +45,11 @@ } else if ( type == 'error' ) { - window.alert( i18n_adding_patient_failed + ':' + '\n' + message ); + showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message ); } else if ( type == 'input' ) { - setHeaderMessage( message ); + showWarningMessage( message ); } else if( type == 'duplicate' ) { @@ -72,6 +73,12 @@ showById('searchPatientDiv'); showById('listPatientDiv'); jQuery('#loaderDiv').hide(); + + var isShowPatientList = setFieldValue( 'isShowPatientList', isShowPatientList ); + if( !isShowPatientList ) + { + showRelationshipList( getFieldValue('id') ); + } } }); return false; === 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-06-14 07:44:43 +0000 +++ 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 @@ -3,8 +3,14 @@
$i18n.getString( "search_result_matching_the_search_criteria" )     - + + #if($!program) + $i18n.getString( "list_patients_by_program") '$program.name' + #elseif($!searchText) + $searchText + #else + $i18n.getString( "list_all_patients" ) + #end