=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java 2012-04-03 03:17:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ProcessingSendSMSAction.java 2012-05-09 02:52:11 +0000 @@ -34,6 +34,8 @@ import org.hisp.dhis.i18n.I18n; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientService; import org.hisp.dhis.sms.MessageSender; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.user.User; @@ -59,6 +61,9 @@ private CurrentUserService currentUserService; @Autowired + private PatientService patientService; + + @Autowired private MessageSender messageSender; // ------------------------------------------------------------------------- @@ -86,6 +91,13 @@ this.smsMessage = smsMessage; } + private String sendTarget; + + public void setSendTarget( String sendTarget ) + { + this.sendTarget = sendTarget; + } + private Set recipients = new HashSet(); public void setRecipients( Set recipients ) @@ -124,67 +136,72 @@ return ERROR; } - if ( smsMessage != null && !smsMessage.isEmpty() ) - { - if ( recipients != null && !recipients.isEmpty() ) - { - message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), true, - recipients, gatewayId ); - - if ( message != null && !message.equals( "success" ) ) - { - message = i18n.getString( message ); - - return ERROR; - } - } - else - { - Collection units = selectionTreeManager.getReloadedSelectedOrganisationUnits(); - - if ( units != null && !units.isEmpty() ) - { - recipients.clear(); - Set users = new HashSet(); - - for ( OrganisationUnit unit : units ) - { - if ( unit.getUsers() == null || unit.getUsers().isEmpty() ) - { - if ( unit.getPhoneNumber() != null && !unit.getPhoneNumber().isEmpty() ) - { - recipients.add( unit.getPhoneNumber() ); - } - } - else - { - users.addAll( unit.getUsers() ); - } - } - - message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), - true, recipients, gatewayId ); - - if ( message != null && (message.equals( "no_recipient" ) || message.equals( "success" )) ) - { - message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService - .getCurrentUser(), false, users, gatewayId ); - - if ( message != null && !message.equals( "success" ) ) - { - message = i18n.getString( message ); - - return ERROR; - } - } - else - { - message = i18n.getString( message ); - - return ERROR; - } - } - } + if ( smsMessage == null || smsMessage.trim().length() == 0 ) + { + message = i18n.getString( "no_message" ); + + return ERROR; + } + + if ( sendTarget != null && sendTarget.equals( "phone" ) ) + { + message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), true, + recipients, gatewayId ); + } + else if ( sendTarget.equals( "user" ) ) + { + Collection units = selectionTreeManager.getReloadedSelectedOrganisationUnits(); + + if ( units != null && !units.isEmpty() ) + { + Set users = new HashSet(); + + for ( OrganisationUnit unit : units ) + { + users.addAll( unit.getUsers() ); + } + + message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), + false, users, gatewayId ); + } + } + else if ( sendTarget.equals( "unit" ) ) + { + for ( OrganisationUnit unit : selectionTreeManager.getSelectedOrganisationUnits() ) + { + if ( unit.getPhoneNumber() != null && !unit.getPhoneNumber().isEmpty() ) + { + recipients.add( unit.getPhoneNumber() ); + } + } + + message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), true, + recipients, gatewayId ); + } + else + { + Patient patient = null; + Set phones = new HashSet(); + + for ( String patientId : recipients ) + { + patient = patientService.getPatient( Integer.parseInt( patientId ) ); + + if ( patient != null && patient.getPhoneNumber() != null && !patient.getPhoneNumber().isEmpty() ) + { + phones.add( patient.getPhoneNumber() ); + } + } + + message = messageSender.sendMessage( smsSubject, smsMessage, currentUserService.getCurrentUser(), true, + phones, gatewayId ); + } + + if ( message != null && !message.equals( "success" ) ) + { + message = i18n.getString( message ); + + return ERROR; } return SUCCESS; === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/SearchPatientAction.java 2012-05-09 02:52:11 +0000 @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2004-2009, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.mobile.action; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hisp.dhis.mobile.caseentry.state.SelectedStateManager; +import org.hisp.dhis.organisationunit.OrganisationUnit; +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.patientattributevalue.PatientAttributeValue; +import org.hisp.dhis.patientattributevalue.PatientAttributeValueService; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @author Abyot Asalefew Gizaw + * @version $Id$ + */ +public class SearchPatientAction + extends ActionPagingSupport +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + @Autowired + private SelectedStateManager selectedStateManager; + + @Autowired + private PatientService patientService; + + @Autowired + private PatientAttributeValueService patientAttributeValueService; + + @Autowired + private PatientAttributeService patientAttributeService; + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private List searchText = new ArrayList(); + + private Boolean listAll; + + private List searchingAttributeId = new ArrayList(); + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private Integer total; + + private Collection patients = new ArrayList(); + + private Map mapPatientPatientAttr = new HashMap(); + + private Map mapPatientOrgunit = new HashMap(); + + private List patientAttributes = new ArrayList(); + + // ------------------------------------------------------------------------- + // Getters/Setters + // ------------------------------------------------------------------------- + + public List getPatientAttributes() + { + return patientAttributes; + } + + public Map getMapPatientOrgunit() + { + return mapPatientOrgunit; + } + + public void setSearchText( List searchText ) + { + this.searchText = searchText; + } + + public void setListAll( Boolean listAll ) + { + this.listAll = listAll; + } + + public Boolean getListAll() + { + return listAll; + } + + public void setSearchingAttributeId( List searchingAttributeId ) + { + this.searchingAttributeId = searchingAttributeId; + } + + public Collection getPatients() + { + return patients; + } + + public Integer getTotal() + { + return total; + } + + public Map getMapPatientPatientAttr() + { + return mapPatientPatientAttr; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); + + // --------------------------------------------------------------------- + // Get all of patients into the selected organisation unit + // --------------------------------------------------------------------- + + if ( listAll != null && listAll ) + { + listAllPatient( organisationUnit ); + + return SUCCESS; + } + + // --------------------------------------------------------------------- + // Search patients by attributes + // --------------------------------------------------------------------- + + for ( Integer attributeId : searchingAttributeId ) + { + if ( attributeId != null && attributeId > 0 ) + { + patientAttributes.add( patientAttributeService.getPatientAttribute( attributeId ) ); + } + } + + searchPatientByAttributes( searchingAttributeId, searchText ); + + return SUCCESS; + + } + + // ------------------------------------------------------------------------- + // Supporting methods + // ------------------------------------------------------------------------- + + private void listAllPatient( OrganisationUnit organisationUnit ) + { + total = patientService.countGetPatientsByOrgUnit( organisationUnit ); + this.paging = createPaging( total ); + + patients = new ArrayList( patientService.getPatients( organisationUnit, paging.getStartPos(), paging + .getPageSize() ) ); + } + + private void searchPatientByAttributes( List searchingAttributeId, List searchText ) + { + total = patientAttributeValueService.countSearchPatients( searchingAttributeId, searchText ); + + this.paging = createPaging( total ); + + patients = patientAttributeValueService.searchPatients( searchingAttributeId, searchText, paging.getStartPos(), + paging.getPageSize() ); + + Collection attributeValues = patientAttributeValueService + .getPatientAttributeValues( patients ); + + for ( Patient patient : patients ) + { + mapPatientOrgunit.put( patient.getId(), getHierarchyOrgunit( patient.getOrganisationUnit() ) ); + + for ( PatientAttributeValue attributeValue : attributeValues ) + { + mapPatientPatientAttr.put( patient.getId() + "-" + attributeValue.getPatientAttribute().getId(), + attributeValue.getValue() ); + } + } + } + + private String getHierarchyOrgunit( OrganisationUnit orgunit ) + { + String hierarchyOrgunit = orgunit.getName(); + + while ( orgunit.getParent() != null ) + { + hierarchyOrgunit = orgunit.getParent().getName() + " / " + hierarchyOrgunit; + + orgunit = orgunit.getParent(); + } + + return hierarchyOrgunit; + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSendSMSBeneficiaryFormAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSendSMSBeneficiaryFormAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/ShowSendSMSBeneficiaryFormAction.java 2012-05-09 02:52:11 +0000 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2004-2009, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package org.hisp.dhis.mobile.action; + +import java.util.Collection; +import java.util.Map; + +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.program.Program; +import org.hisp.dhis.program.ProgramService; +import org.hisp.dhis.sms.outbound.OutboundSmsTransportService; +import org.springframework.beans.factory.annotation.Autowired; + +import com.opensymphony.xwork2.Action; + +/** + * @author Abyot Asalefew Gizaw + * @version $Id$ + */ +public class ShowSendSMSBeneficiaryFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + @Autowired + private OutboundSmsTransportService transportService; + + @Autowired + private OrganisationUnitSelectionManager selectionManager; + + @Autowired + private PatientAttributeService patientAttributeService; + + @Autowired + private ProgramService programService; + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private Collection patientAttributes; + + public Collection getPatientAttributes() + { + return patientAttributes; + } + + private Collection programs; + + public Collection getPrograms() + { + return programs; + } + + private OrganisationUnit organisationUnit; + + public OrganisationUnit getOrganisationUnit() + { + return organisationUnit; + } + + private int status; + + public int getStatus() + { + return status; + } + + public Map getGatewayMap() + { + return transportService.getGatewayMap(); + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + patientAttributes = patientAttributeService.getAllPatientAttributes(); + + programs = programService.getAllPrograms(); + + organisationUnit = selectionManager.getSelectedOrganisationUnit(); + + if ( organisationUnit == null ) + { + status = 1; + } + else if ( !organisationUnit.isHasPatients() ) + { + status = 2; + } + + return SUCCESS; + } +} === added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry' === added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state' === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state/DefaultSelectedStateManager.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state/DefaultSelectedStateManager.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state/DefaultSelectedStateManager.java 2012-05-09 02:52:11 +0000 @@ -0,0 +1,255 @@ +package org.hisp.dhis.mobile.caseentry.state; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.Map; + +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.patient.PatientService; +import org.hisp.dhis.program.ProgramInstance; +import org.hisp.dhis.program.ProgramInstanceService; +import org.hisp.dhis.program.ProgramStageInstance; +import org.hisp.dhis.program.ProgramStageInstanceService; + +import com.opensymphony.xwork2.ActionContext; + +/** + * @author Abyot Asalefew + * @version $Id$ + */ +public class DefaultSelectedStateManager + implements SelectedStateManager +{ + public static final String SESSION_KEY_SELECTED_PATIENT_ID = "selected_patient_id"; + + public static final String SESSION_KEY_SELECTED_PROGRAM_INSTANCE_ID = "selected_program_instance_id"; + + public static final String SESSION_KEY_SELECTED_PROGRAM_STAGE_INSTANCE_ID = "selected_program_stage_instance_id"; + + public static final String SESSION_KEY_SELECTED_PROGRAM_ID = "selected_program_id"; + + public static final String SESSION_KEY_SELECTED_PROGRAMSTAGE_ID = "selected_program_stage_id"; + + public static final String SESSION_KEY_LISTALL = "list_all_value"; + + public static final String SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID = "selected_searching_attribute_id"; + + public static final String SESSION_KEY_SPECIFIED_SEARCH_TEXT = "specified_search_text"; + + public static final String SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID = "selected_sort_attribute_id"; + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitSelectionManager selectionManager; + + public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) + { + this.selectionManager = selectionManager; + } + + private PatientService patientService; + + public void setPatientService( PatientService patientService ) + { + this.patientService = patientService; + } + + private ProgramInstanceService programInstanceService; + + public void setProgramInstanceService( ProgramInstanceService programInstanceService ) + { + this.programInstanceService = programInstanceService; + } + + private ProgramStageInstanceService programStageInstanceService; + + public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) + { + this.programStageInstanceService = programStageInstanceService; + } + + // ------------------------------------------------------------------------- + // Implementation methods + // ------------------------------------------------------------------------- + + public OrganisationUnit getSelectedOrganisationUnit() + { + return selectionManager.getSelectedOrganisationUnit(); + } + + public void setSelectedPatient( Patient patient ) + { + getSession().put( SESSION_KEY_SELECTED_PATIENT_ID, patient.getId() ); + } + + public Patient getSelectedPatient() + { + Integer id = (Integer) getSession().get( SESSION_KEY_SELECTED_PATIENT_ID ); + + if ( id == null ) + { + return null; + } + + return patientService.getPatient( id ); + } + + public void clearSelectedPatient() + { + getSession().remove( SESSION_KEY_SELECTED_PATIENT_ID ); + } + + public void setSelectedProgramInstance( ProgramInstance programInstance ) + { + getSession().put( SESSION_KEY_SELECTED_PROGRAM_INSTANCE_ID, programInstance.getId() ); + } + + public ProgramInstance getSelectedProgramInstance() + { + Integer id = (Integer) getSession().get( SESSION_KEY_SELECTED_PROGRAM_INSTANCE_ID ); + + if ( id == null ) + { + return null; + } + + return programInstanceService.getProgramInstance( id ); + } + + public void clearSelectedProgramInstance() + { + getSession().remove( SESSION_KEY_SELECTED_PROGRAM_INSTANCE_ID ); + } + + public void setSelectedProgramStageInstance( ProgramStageInstance programStageInstance ) + { + getSession().put( SESSION_KEY_SELECTED_PROGRAM_STAGE_INSTANCE_ID, programStageInstance.getId() ); + } + + public ProgramStageInstance getSelectedProgramStageInstance() + { + Integer id = (Integer) getSession().get( SESSION_KEY_SELECTED_PROGRAM_STAGE_INSTANCE_ID ); + + if ( id == null ) + { + return null; + } + + return programStageInstanceService.getProgramStageInstance( id ); + } + + public void clearSelectedProgramStageInstance() + { + getSession().remove( SESSION_KEY_SELECTED_PROGRAM_STAGE_INSTANCE_ID ); + } + + public void clearListAll() + { + getSession().remove( SESSION_KEY_LISTALL ); + } + + public void clearSearchTest() + { + getSession().remove( SESSION_KEY_SPECIFIED_SEARCH_TEXT ); + } + + public void clearSearchingAttributeId() + { + getSession().remove( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID ); + } + + public boolean getListAll() + { + if ( getSession().get( SESSION_KEY_LISTALL ) != null ) + { + return (Boolean) getSession().get( SESSION_KEY_LISTALL ); + } + + else + { + return false; + } + } + + public String getSearchText() + { + return (String) getSession().get( SESSION_KEY_SPECIFIED_SEARCH_TEXT ); + } + + public Integer getSearchingAttributeId() + { + return (Integer) getSession().get( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID ); + } + + public void setListAll( boolean listAll ) + { + getSession().put( SESSION_KEY_LISTALL, listAll ); + } + + public void setSearchText( String searchText ) + { + getSession().put( SESSION_KEY_SPECIFIED_SEARCH_TEXT, searchText ); + } + + public void setSearchingAttributeId( int searchingAttributeId ) + { + getSession().put( SESSION_KEY_SELECTED_SEARCHING_ATTRIBUTE_ID, searchingAttributeId ); + } + + // ------------------------------------------------------------------------- + // Sort by patient-attribute + // ------------------------------------------------------------------------- + + public void setSortingAttributeId( int sortAttributeId ) + { + getSession().put( SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID, sortAttributeId ); + } + + public Integer getSortAttributeId() + { + return (Integer) getSession().get( SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID ); + } + + public void clearSortingAttributeId() + { + getSession().remove( SESSION_KEY_SELECTED_SORT_ATTRIBUTE_ID ); + } + + // ------------------------------------------------------------------------- + // Support methods + // ------------------------------------------------------------------------- + + private static final Map getSession() + { + return ActionContext.getContext().getSession(); + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state/SelectedStateManager.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state/SelectedStateManager.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/caseentry/state/SelectedStateManager.java 2012-05-09 02:52:11 +0000 @@ -0,0 +1,104 @@ +package org.hisp.dhis.mobile.caseentry.state; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.patient.Patient; +import org.hisp.dhis.program.ProgramInstance; +import org.hisp.dhis.program.ProgramStageInstance; + +/** + * @author Abyot Asalefew + * @version $Id$ + */ +public interface SelectedStateManager +{ + OrganisationUnit getSelectedOrganisationUnit(); + + // ------------------------------------------------------------------------- + // Patient + // ------------------------------------------------------------------------- + + void setSelectedPatient( Patient patient ); + + Patient getSelectedPatient(); + + void clearSelectedPatient(); + + // ------------------------------------------------------------------------- + // Program-instance + // ------------------------------------------------------------------------- + + void setSelectedProgramInstance( ProgramInstance programInstance ); + + ProgramInstance getSelectedProgramInstance(); + + void clearSelectedProgramInstance(); + + // ------------------------------------------------------------------------- + // Program-stage-instance + // ------------------------------------------------------------------------- + + void setSelectedProgramStageInstance( ProgramStageInstance programStageInstance ); + + ProgramStageInstance getSelectedProgramStageInstance(); + + void clearSelectedProgramStageInstance(); + + // ------------------------------------------------------------------------- + // for searching patients + // ------------------------------------------------------------------------- + + void setListAll( boolean listAll ); + + boolean getListAll(); + + void clearListAll(); + + void setSearchingAttributeId( int searchingAttributeId ); + + Integer getSearchingAttributeId(); + + void clearSearchingAttributeId(); + + void setSearchText( String searchText ); + + String getSearchText(); + + void clearSearchTest(); + + // ------------------------------------------------------------------------- + // for Sorting patients - Sort by patient-attribute + // ------------------------------------------------------------------------- + + void setSortingAttributeId( int sortAttributeId ); + + Integer getSortAttributeId(); + + void clearSortingAttributeId(); +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-03-23 04:01:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2012-05-09 02:52:11 +0000 @@ -3,14 +3,30 @@ xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> + + + + + + + + + + + === 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 2012-05-02 13:50:14 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2012-05-09 02:52:11 +0000 @@ -25,6 +25,7 @@ operation=Operation gateway_type=Gateway Type send_sms=Send SMS +send_sms_beneficiary=Send SMS to Beneficiary add_gateway=Add Gateway gateway_type=Gateway Type type=Type @@ -62,9 +63,19 @@ service_stopping=SMS Service is stopping message_not_sent=Message not sent message=Message +send_sms_to_target=Send SMS to phone_number=Phone number +raw_phone_number=Raw phone numbers +assigned_user_number=User assigned to organisation unit +selected_unit_number=Selected organisation unit +patient_number=Beneficiary/Patient +programs=Programs +organisation_unit_level=Organisation unit level +chidren_only=Children only +please_select_a_program=Please select a program +there_is_no_program=There is no program selected, won't send SMS to any Beneficiary please_select_a_gateway_type_to_send_sms=Please specify a gateway to send the SMS -service_stopped_cannot_send_sms=Service is stopped.SMS cannot be sent. +service_stopped_cannot_send_sms=Service is stopped. SMS cannot be sent. please_verify_phone=Please verify the phone number(s). Separate each number with a semicolon (;) please_select_orgunit=Please select at least one organisation unit no_recipient=There is no recipient. SMS cannot be sent.\nNotes: Make sure that "Message sms notification" Setting is activated. @@ -72,4 +83,8 @@ unable_start_smslib_service=Unable to start smsLib service unable_stop_smslib_service=Unable to stop smsLib service sms_unable_or_there_is_no_gateway_service_not_started=SMS Service is not enabled or no gateway has been specified.\nSMS Service will not be started. -unable_load_configuration_cause_of_there_is_no_gateway=Unable to load the configuration because there is no gateway. \ No newline at end of file +unable_load_configuration_cause_of_there_is_no_gateway=Unable to load the configuration because there is no gateway. +registering_unit=Registering Unit +search_by_name_identifier=Search by name or identifier +search_by_program=Search by program +please_select_village=Please select village \ No newline at end of file === 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 2012-04-25 15:07: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 2012-05-09 02:52:11 +0000 @@ -40,4 +40,9 @@ outbound=Ngo\u00e0i gi\u1edbi h\u1ea1n api_id=Giao ti\u1ebfp ID save_settings=L\u01b0u c\u00e0i \u0111\u1eb7t -show_send_sms_form=Hi\u1ec3n th\u1ecb m\u1eabu g\u1eedi SMS +show_send_sms_form=G\u1eedi SMS +send_sms_to_target=G\u1eedi SMS t\u1edbi +phone_number=S\u1ed1 \u0111i\u1ec7n tho\u1ea1i +raw_phone_number=S\u1ed1 nh\u1eadp tay +assigned_user_number=Ng\u01b0\u1eddi d\u00f9ng \u0111\u01b0\u1ee3c g\u00e1n v\u00e0o \u0111\u01a1n v\u1ecb ch\u1ecdn +selected_unit_number=\u0110\u01a1n v\u1ecb \u0111\u01b0\u1ee3c ch\u1ecdn === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-03-26 04:42:44 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2012-05-09 02:52:11 +0000 @@ -32,12 +32,40 @@ ../dhis-web-commons/oust/oust.js,javascript/sendSMS.js F_MOBILE_SENDSMS + + + /main.vm + /dhis-web-maintenance-mobile/sendBeneficiarySMSPage.vm + /dhis-web-maintenance-mobile/menuWithTree.vm + ../dhis-web-commons/ouwt/ouwt.js + F_MOBILE_SENDSMS + + + + ../dhis-web-commons/ajax/jsonPrograms.vm + plainTextError + ../dhis-web-commons/ajax/jsonResponseSuccess.vm ../dhis-web-commons/ajax/jsonResponseError.vm plainTextError + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + /dhis-web-commons/ajax/jsonResponseInput.vm + + + + /content.vm + /dhis-web-maintenance-mobile/patientRegistrationList.vm + F_PATIENT_MANAGEMENT + === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/caseentry-patient.css' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/css/caseentry-patient.css 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/css/caseentry-patient.css 2012-05-09 02:52:11 +0000 @@ -0,0 +1,80 @@ +table +{ + margin-bottom:10px; + font-size: 13px; + line-height:18px; +} + +input.button +{ + width: 150px; + padding-left:5px; + padding-right:5px; +} + +input.imgButton +{ + width:20px; + height:20px; + cursor: pointer; +} + +.hidden +{ + display:none; +} + +.text-column +{ + text-align:left; + padding-right:20px; + padding-left:5px; +} + +.infor +{ + border:1px solid #808080; + vertical-align:top; + padding:10px; +} + +.buttons +{ + text-align:right; + padding-bottom:10px; + width:100%; +} + +.list-table +{ + width:100%; +} + +.heading-column { width : 450px;} +td.input-column { width : 390px;} +td.input-column input[type="text"]{ width: 360px;} +td.input-column select { width: 367px;} +td.error {padding-left:1em} + +.infor td{vertical-align: top;} + +.focusCell{background-color: #AFCCFF} +.errorCell{background-color: #FFCFCF} +.sectionOpen {display: true} +.sectionClose{ display: none} +.togglePanel.open {height:25px;padding-left:25px; background-image: url(../images/open.gif) ; background-repeat: no-repeat; background-position: top left} +.togglePanel.close {height:25px;padding-left:25px; background-image: url(../images/close.gif) ; background-repeat: no-repeat; background-position: top left} + +.warnmessage { + color: red; +} + +#facilityCol +{ + width: 130px; +} + +fieldset +{ + border: 1px solid #3f5d8e; +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-commons.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-commons.js 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/javascript/caseentry-commons.js 2012-05-09 02:52:11 +0000 @@ -0,0 +1,235 @@ + +function verifiedOnchange( container ){ + + var checked = byId( 'verified' ).checked; + if( checked ) + { + disable( 'age' ); + } + else + { + enable( 'age' ); + } +} + +// ---------------------------------------------------------------------------- +// Search patients by name +// ---------------------------------------------------------------------------- + +function getPatientsByName( divname ) +{ + var fullName = jQuery('#' + divname + ' [id=fullName]').val().replace(/^\s+|\s+$/g,""); + if( fullName.length > 0) + { + contentDiv = 'resultSearchDiv'; + $('#resultSearchDiv' ).load("getPatientsByName.action", + { + fullName: fullName + }).dialog({ + title: i18n_search_result, + maximize: true, + closable: true, + modal:true, + overlay:{ background:'#000000', opacity: 0.8}, + width: 800, + height: 400 + }); + } + else + { + alert( i18n_no_patients_found ); + } +} + +// ----------------------------------------------------------------------------- +// Advanced search +// ----------------------------------------------------------------------------- + +function addAttributeOption() +{ + var rowId = 'advSearchBox' + jQuery('#advancedSearchTB select[name=searchingAttributeId]').length + 1; + var contend = '' + getInnerHTML('searchingAttributeIdTD') + ''; + contend += '' + searchTextBox ; + contend += ''; + contend = '' + contend + ''; + + jQuery('#advancedSearchTB > tbody:last').append( contend ); +} + +function removeAttributeOption( rowId ) +{ + jQuery( '#' + rowId ).remove(); +} + +//------------------------------------------------------------------------------ +// Search patients by selected attribute +//------------------------------------------------------------------------------ + +function searchingAttributeOnChange( this_ ) +{ + var container = jQuery(this_).parent().parent().attr('id'); + var attributeId = jQuery('#' + container+ ' [id=searchingAttributeId]').val(); + var element = jQuery('#' + container+ ' [id=searchText]'); + var valueType = jQuery('#' + container+ ' [id=searchingAttributeId] option:selected').attr('valueType'); + + if( attributeId == '-1' ) + { + element.replaceWith( getDateField( container ) ); + datePickerValid( 'searchDateField-' + container + ' [id=searchText]' ); + } + else if( attributeId == '0' ) + { + element.replaceWith( programComboBox ); + } + else if ( valueType=='YES/NO' ) + { + element.replaceWith( trueFalseBox ); + } + else + { + element.replaceWith( searchTextBox ); + } +} + +function getDateField( container ) +{ + var dateField = '
'; + return dateField; +} + +//----------------------------------------------------------------------------- +// Search Patient +//----------------------------------------------------------------------------- + +function searchPatientsOnKeyUp( event ) +{ + var key = getKeyCode( event ); + + if ( key==13 )// Enter + { + searchAdvancedPatients()(); + } +} + +function getKeyCode(e) +{ + if (window.event) + return window.event.keyCode; + return (e)? e.which : null; +} + +function searchAdvancedPatients() +{ + hideById( 'listPatientDiv' ); + var searchTextFields = jQuery('[name=searchText]'); + var flag = true; + jQuery( searchTextFields ).each( function( i, item ) + { + if( jQuery( item ).val() == '' ) + { + showWarningMessage( i18n_specify_search_criteria ); + flag = false; + } + }); + + if(!flag) return; + + contentDiv = 'listPatientDiv'; + jQuery( "#loaderDiv" ).show(); + searchPatient(); + +} + +// ---------------------------------------------------------------------------- +// Show patients +// ---------------------------------------------------------------------------- + +function isDeathOnChange() +{ + var isDeath = byId('isDead').checked; + if(isDeath) + { + showById('deathDateTR'); + } + else + { + hideById('deathDateTR'); + } +} + +// ---------------------------------------------------------------- +// Get Params form Div +// ---------------------------------------------------------------- + +function getParamsForDiv( patientDiv) +{ + var params = ''; + jQuery("#" + patientDiv + " :input").each(function() + { + var elementId = $(this).attr('id'); + + if( $(this).attr('type') == 'checkbox' ) + { + var checked = jQuery(this).attr('checked') ? true : false; + params += elementId + "=" + checked + "&"; + } + else if( $(this).attr('type') != 'button' ) + { + var value = ""; + if( jQuery(this).val() != '' ) + { + value = htmlEncode(jQuery(this).val()); + } + params += elementId + "="+ value + "&"; + } + }); + + return params; +} + +// ----------------------------------------------------------------------------- +// View patient details +// ----------------------------------------------------------------------------- + +function showPatientDetails( patientId ) +{ + $('#detailsInfo').load("getPatientDetails.action", + { + id:patientId + } + , function( ){ + }).dialog({ + title: i18n_patient_details, + maximize: true, + closable: true, + modal:false, + overlay:{background:'#000000', opacity:0.1}, + width: 450, + height: 300 + }); +} + +function showPatientHistory( patientId ) +{ + $('#detailsInfo').load("getPatientHistory.action", + { + patientId:patientId + } + , function( ){ + + }).dialog({ + title: i18n_patient_details_and_history, + maximize: true, + closable: true, + modal:false, + overlay:{background:'#000000', opacity:0.1}, + width: 800, + height: 520 + }); +} + +function exportPatientHistory( patientId, type ) +{ + var url = "getPatientHistory.action?patientId=" + patientId + "&type=" + type; + window.location.href = url; +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-patient.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/caseentry-patient.js 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/javascript/caseentry-patient.js 2012-05-09 02:52:11 +0000 @@ -0,0 +1,911 @@ +var COLOR_GREEN = '#b9ffb9'; +var COLOR_YELLOW = '#fffe8c'; +var COLOR_WHITE = '#ffffff'; +var COLOR_ORANGE = '#ff6600'; +var COLOR_RED = '#ff8a8a'; +var COLOR_GREY = '#cccccc'; + +function organisationUnitSelected( orgUnits ) +{ + showById('selectDiv'); + disable('listPatientBtn'); + hideById('listPatientDiv'); + + $.getJSON( 'organisationUnitHasPatients.action', {orgunitId:orgUnits[0]} + , function( json ) + { + var type = json.response; + setFieldValue('selectedOrgunitText', json.message ); + + if( type == 'success' ) + { + showById('searchPatientDiv'); + enable('listPatientBtn'); + setInnerHTML('warnmessage',''); + setFieldValue('selectedOrgunitText', json.message ); + } + else if( type == 'input' ) + { + setInnerHTML('warnmessage', i18n_can_not_register_patient_for_orgunit); + disable('listPatientBtn'); + } + } ); +} + +selection.setListenerFunction( organisationUnitSelected ); + +// ----------------------------------------------------------------------------- +// Remove patient +// ----------------------------------------------------------------------------- + +function removePatient( patientId, fullName ) +{ + removeItem( patientId, fullName, i18n_confirm_delete, 'removePatient.action' ); +} + +function sortPatients() +{ + hideById( 'listPatientDiv' ); + + contentDiv = 'listPatientDiv'; + jQuery( "#loaderDiv" ).show(); + jQuery('#listPatientDiv').load("searchRegistrationPatient.action", + { + sortPatientAttributeId: getFieldValue('sortPatientAttributeId') + } + , function(){ + showById('listPatientDiv'); + jQuery( "#loaderDiv" ).hide(); + }); +} + +// ----------------------------------------------------------------------------- +// Add Patient +// ----------------------------------------------------------------------------- + +function validateAddPatient() +{ + $("#editPatientDiv :input").attr("disabled", true); + $.ajax({ + type: "POST", + url: 'validatePatient.action', + data: getParamsForDiv('editPatientDiv'), + success:addValidationCompleted + }); +} + +function addValidationCompleted( data ) +{ + var type = jQuery(data).find('message').attr('type'); + var message = jQuery(data).find('message').text(); + + if ( type == 'success' ) + { + removeDisabledIdentifier( ); + addPatient( ); + } + else + { + $("#editPatientDiv :input").attr("disabled", true); + if ( type == 'error' ) + { + showErrorMessage( i18n_adding_patient_failed + ':' + '\n' + message ); + } + else if ( type == 'input' ) + { + showWarningMessage( message ); + } + else if( type == 'duplicate' ) + { + showListPatientDuplicate(data, false); + } + + $("#editPatientDiv :input").attr("disabled", false); + } +} + + +// ----------------------------------------------------------------------------- +// Update Patient +// ----------------------------------------------------------------------------- + +function validateUpdatePatient() +{ + $("#editPatientDiv :input").attr("disabled", true); + $.ajax({ + type: "POST", + url: 'validatePatient.action', + data: getParamsForDiv('editPatientDiv'), + success:updateValidationCompleted + }); +} + +function updateValidationCompleted( messageElement ) +{ + var type = jQuery(messageElement).find('message').attr('type'); + var message = jQuery(messageElement).find('message').text(); + + if ( type == 'success' ) + { + removeDisabledIdentifier(); + updatePatient(); + } + else + { + $("#editPatientDiv :input").attr("disabled", true); + if ( type == 'error' ) + { + showErrorMessage( i18n_saving_patient_failed + ':' + '\n' + message ); + } + else if ( type == 'input' ) + { + showWarningMessage( message ); + } + else if( type == 'duplicate' ) + { + showListPatientDuplicate(messageElement, true); + } + $("#editPatientDiv :input").attr("disabled", false); + } +} +// get and build a param String of all the identifierType id and its value +// excluding inherited identifiers +function getIdParams() +{ + var params = ""; + jQuery("input.idfield").each(function(){ + if( jQuery(this).val() && !jQuery(this).is(":disabled") ) + params += "&" + jQuery(this).attr("name") +"="+ jQuery(this).val(); + }); + return params; +} + +// ----------------------------------------------------------------------------- +// check duplicate patient +// ----------------------------------------------------------------------------- + +function checkDuplicate( divname ) +{ + $.postUTF8( 'validatePatient.action', + { + fullName: jQuery( '#' + divname + ' [id=fullName]' ).val(), + dobType: jQuery( '#' + divname + ' [id=dobType]' ).val(), + gender: jQuery( '#' + divname + ' [id=gender]' ).val(), + birthDate: jQuery( '#' + divname + ' [id=birthDate]' ).val(), + age: jQuery( '#' + divname + ' [id=age]' ).val() + }, function( xmlObject, divname ) + { + checkDuplicateCompleted( xmlObject, divname ); + }); +} + +function checkDuplicateCompleted( messageElement, divname ) +{ + checkedDuplicate = true; + var type = jQuery(messageElement).find('message').attr('type'); + var message = jQuery(messageElement).find('message').text(); + + if( type == 'success') + { + showSuccessMessage(i18n_no_duplicate_found); + } + if ( type == 'input' ) + { + showWarningMessage(message); + } + else if( type == 'duplicate' ) + { + showListPatientDuplicate( messageElement, true ); + } +} +/** + * Show list patient duplicate by jQuery thickbox plugin + * @param rootElement : root element of the response xml + * @param validate : is TRUE if this method is called from validation method + */ +function showListPatientDuplicate( rootElement, validate ) +{ + var message = jQuery(rootElement).find('message').text(); + var patients = jQuery(rootElement).find('patient'); + + var sPatient = ""; + jQuery( patients ).each( function( i, patient ) + { + sPatient += "
"; + sPatient += "" ; + sPatient += "" ; + sPatient += "" ; + sPatient += "" ; + sPatient += "" ; + sPatient += ""; + sPatient += ""; + + var identifiers = jQuery(patient).find('identifier'); + if( identifiers.length > 0 ) + { + sPatient += ""; + + jQuery( identifiers ).each( function( i, identifier ) + { + sPatient +="" + +"" + +" " + +""; + }); + } + + var attributes = jQuery(patient).find('attribute'); + if( attributes.length > 0 ) + { + sPatient += ""; + + jQuery( attributes ).each( function( i, attribute ) + { + sPatient +="" + +"" + +" " + +""; + }); + } + sPatient += ""; + sPatient += "
" + i18n_patient_system_id + "" + jQuery(patient).find('systemIdentifier').text() + "
" + i18n_patient_full_name + "" + jQuery(patient).find('fullName').text() + "
" + i18n_patient_gender + "" + jQuery(patient).find('gender').text() + "
" + i18n_patient_date_of_birth + "" + jQuery(patient).find('dateOfBirth').text() + "
" + i18n_patient_age + "" + jQuery(patient).find('age').text() + "
" + i18n_patient_blood_group + "" + jQuery(patient).find('bloodGroup').text() + "
" + i18n_patient_phone_number + "" + jQuery(patient).find('phoneNumber').text() + "
" + i18n_patient_identifiers + "
" + jQuery(identifier).find('name').text() + "" + jQuery(identifier).find('value').text() + "
" + i18n_patient_attributes + "
" + jQuery(attribute).find('name').text() + "" + jQuery(attribute).find('value').text() + "
"; + }); + + var result = i18n_duplicate_warning; + if( !validate ) + { + result += ""; + result += "

"; + } + + result += "
" + sPatient; + jQuery('#resultSearchDiv' ).html( result ); + jQuery('#resultSearchDiv' ).dialog({ + title: i18n_duplicated_patient_list, + maximize: true, + closable: true, + modal:true, + overlay:{background:'#000000', opacity:0.1}, + width: 800, + height: 400 + }); +} + +// ----------------------------------------------------------------------------- +// Show representative form +// ----------------------------------------------------------------------------- + +function toggleUnderAge(this_) +{ + if( jQuery(this_).is(":checked")) + { + jQuery('#representativeDiv').dialog('destroy').remove(); + jQuery('
' ).load( 'showAddRepresentative.action' ).dialog({ + title: i18n_child_representative, + maximize: true, + closable: true, + modal:true, + overlay:{background:'#000000', opacity:0.1}, + width: 800, + height: 450 + }); + }else + { + jQuery("#representativeDiv :input.idfield").each(function(){ + if( jQuery(this).is(":disabled")) + { + jQuery(this).removeAttr("disabled").val(""); + } + }); + jQuery("#representativeId").val(""); + jQuery("#relationshipTypeId").val(""); + } +} + +// ---------------------------------------------------------------- +// Add Patient +// ---------------------------------------------------------------- + +function showAddPatientForm() +{ + hideById('listPatientDiv'); + hideById('selectDiv'); + hideById('searchPatientDiv'); + hideById('migrationPatientDiv'); + + jQuery('#loaderDiv').show(); + jQuery('#editPatientDiv').load('showAddPatientForm.action' + , function() + { + showById('editPatientDiv'); + jQuery('#loaderDiv').hide(); + }); + +} + +function addPatient() +{ + $.ajax({ + type: "POST", + url: 'addPatient.action', + data: getParamsForDiv('editPatientDiv'), + success: function(json) { + var type = json.response; + showProgramEnrollmentSelectForm( json.message ); + jQuery('#resultSearchDiv').dialog('close'); + } + }); + return false; +} + +// ---------------------------------------------------------------- +// Update Patient +// ---------------------------------------------------------------- + +function showUpdatePatientForm( patientId ) +{ + hideById('listPatientDiv'); + setInnerHTML('editPatientDiv', ''); + hideById('selectDiv'); + hideById('searchPatientDiv'); + hideById('migrationPatientDiv'); + + jQuery('#loaderDiv').show(); + jQuery('#editPatientDiv').load('showUpdatePatientForm.action', + { + id:patientId + }, function() + { + showById('editPatientDiv'); + jQuery('#searchPatientsDiv').dialog('close'); + jQuery('#loaderDiv').hide(); + }); + + jQuery('#resultSearchDiv').dialog('close'); +} + +function updatePatient() +{ + $.ajax({ + type: "POST", + url: 'updatePatient.action', + data: getParamsForDiv('editPatientDiv'), + success: function( json ) { + showProgramEnrollmentSelectForm( getFieldValue('id') ); + } + }); +} + +// ---------------------------------------------------------------- +// Enrollment program +// ---------------------------------------------------------------- + +function showProgramEnrollmentSelectForm( patientId ) +{ + hideById('listPatientDiv'); + hideById('editPatientDiv'); + hideById('selectDiv'); + hideById('searchPatientDiv'); + hideById('migrationPatientDiv'); + + jQuery('#loaderDiv').show(); + jQuery('#enrollmentDiv').load('showProgramEnrollmentForm.action', + { + id:patientId + }, function() + { + showById('enrollmentDiv'); + + jQuery('#loaderDiv').hide(); + }); +} + +function showProgramEnrollmentForm( patientId, programId ) +{ + if( programId == 0 ) + { + jQuery('#enrollBtn').attr('value',i18n_enroll_to_program); + hideEnrolmentField(); + + hideById('programEnrollmentDiv'); + + return; + } + + jQuery('#loaderDiv').show(); + jQuery('#programEnrollmentDiv').load('enrollmentform.action', + { + patientId:patientId, + programId:programId + }, function() + { + showById('programEnrollmentDiv'); + showEnrolmentField(); + + var singleEvent = jQuery('#enrollmentDiv [name=programId] option:selected').attr('singleevent'); + + if(singleEvent=='true') + { + hideEnrolmentField(); + } + else + { + showEnrolmentField(); + var hideDateOfIncident = jQuery('#programEnrollmentSelectDiv [name=programId] option:selected').attr('hidedateofincident'); + + if( hideDateOfIncident=='true') + { + hideById( 'dateOfIncidentTR'); + } + else + { + showById( 'dateOfIncidentTR'); + } + } + + jQuery('#loaderDiv').hide(); + }); +} + +function validateProgramEnrollment() +{ + $.ajax({ + type: "GET", + url: 'validatePatientProgramEnrollment.action', + data: getParamsForDiv('programEnrollmentSelectDiv'), + success: function(json) { + hideById('message'); + var type = json.response; + if ( type == 'success' ) + { + saveProgramEnrollment(); + } + else if ( type == 'error' ) + { + setMessage( i18n_program_enrollment_failed + ':' + '\n' + message ); + } + else if ( type == 'input' ) + { + setMessage( json.message ); + } + } + }); + return false; +} + +function saveProgramEnrollment() +{ + $.ajax({ + type: "POST", + url: 'saveProgramEnrollment.action', + data: getParamsForDiv('programEnrollmentSelectDiv'), + success: function( html ) { + setInnerHTML('programEnrollmentDiv', html ); + jQuery('#enrollBtn').attr('value',i18n_update); + showSuccessMessage( i18n_enrol_success ); + } + }); + return false; +} + +// ---------------------------------------------------------------- +// Un-Enrollment program +// ---------------------------------------------------------------- + +function showUnenrollmentSelectForm( patientId ) +{ + hideById('listPatientDiv'); + hideById('editPatientDiv'); + hideById('selectDiv'); + hideById('searchPatientDiv'); + hideById('migrationPatientDiv'); + + jQuery('#loaderDiv').show(); + jQuery('#enrollmentDiv').load('showProgramUnEnrollmentForm.action', + { + patientId:patientId + }, function() + { + showById('enrollmentDiv'); + jQuery('#loaderDiv').hide(); + }); +} + +function showUnenrollmentForm( programInstanceId ) +{ + if( programInstanceId == 0 ) + { + hideById( 'unenrollmentFormDiv' ); + return; + } + + jQuery('#loaderDiv').show(); + jQuery.getJSON( "getProgramInstance.action", + { + programInstanceId:programInstanceId + }, + function( json ) + { + showById( 'unenrollmentFormDiv' ); + jQuery( "#loaderDiv" ).hide(); + }); +} + +function unenrollmentForm( programInstanceId ) +{ + if( programInstanceId == 0 ) + { + disable('enrollBtn'); + return; + } + + $.ajax({ + type: "POST", + url: 'removeEnrollment.action', + data: getParamsForDiv('enrollmentDiv'), + success: function( json ) + { + showSuccessMessage( i18n_unenrol_success ); + hideEnrolmentField( 'enrollmentDateTR' ); + jQuery('#enrollmentDiv [name=programId]').val('0'); + hideById( 'programEnrollmentDiv' ); + } + }); +} + +//----------------------------------------------------------------------------- +//Save +//----------------------------------------------------------------------------- + +function saveDueDate( programStageInstanceId, programStageInstanceName ) +{ + var field = document.getElementById( 'value_' + programStageInstanceId + '_date' ); + + var dateOfIncident = new Date( byId('dateOfIncident').value ); + var dueDate = new Date(field.value); + + if( dueDate < dateOfIncident ) + { + field.style.backgroundColor = '#FFCC00'; + alert( i18n_date_less_incident ); + return; + } + + field.style.backgroundColor = '#ffffcc'; + + var dateDueSaver = new DateDueSaver( programStageInstanceId, field.value, '#ccffcc' ); + dateDueSaver.save(); +} + +//---------------------------------------------------- +// Show relationship with new patient +//---------------------------------------------------- + +function showRelationshipList( patientId ) +{ + hideById('addRelationshipDiv'); + + 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 + { + loadPatientList(); + } +} + +// ---------------------------------------------------------------- +// Click Back to Search button +// ---------------------------------------------------------------- + +function onClickBackBtn() +{ + showById('selectDiv'); + showById('searchPatientDiv'); + showById('listPatientDiv'); + + hideById('editPatientDiv'); + hideById('enrollmentDiv'); + hideById('listRelationshipDiv'); + hideById('addRelationshipDiv'); + hideById('migrationPatientDiv'); +} + +function loadPatientList() +{ + hideById('editPatientDiv'); + hideById('enrollmentDiv'); + hideById('listRelationshipDiv'); + hideById('addRelationshipDiv'); + hideById('dataRecordingSelectDiv'); + hideById('dataEntryFormDiv'); + hideById('migrationPatientDiv'); + + showById('selectDiv'); + showById('searchPatientDiv'); + + if( statusSearching == 0) + { + loadAllPatients(); + } + else if( statusSearching == 1 ) + { + searchAdvancedPatients(); + } +} + +// ----------------------------------------------------------------------------- +// Load all patients +// ----------------------------------------------------------------------------- + +function loadAllPatients() +{ + hideById('listPatientDiv'); + + var sortPatientAttributeId = getFieldValue('sortPatientAttributeId'); + + jQuery('#loaderDiv').show(); + contentDiv = 'listPatientDiv'; + jQuery('#listPatientDiv').load('searchRegistrationPatient.action',{ + listAll:true, + sortPatientAttributeId: (sortPatientAttributeId ? sortPatientAttributeId : "") + }, + function(){ + statusSearching = 0; + showById('listPatientDiv'); + jQuery('#loaderDiv').hide(); + }); + hideLoader(); +} + +function addPhoneToList( elementList, _id, _patientName, _phoneNo ) +{ + var list = jQuery( "#" + elementList ); + list.append( "" ); + + jQuery( "tr#tr" + _id ).hide(); +} + + +function removePhoneFromList( elementList, _id ) +{ + var list = jQuery( "#" + elementList + " option[value='" + _id + "']" ).remove(); + + jQuery( "tr#tr" + _id ).show(); +} + +//----------------------------------------------------------------------------- +// Saver objects +//----------------------------------------------------------------------------- + +function DateDueSaver( programStageInstanceId_, dueDate_, resultColor_ ) +{ + var programStageInstanceId = programStageInstanceId_; + var dueDate = dueDate_; + var resultColor = resultColor_; + + this.save = function() + { + var params = 'programStageInstanceId=' + programStageInstanceId + '&dueDate=' + dueDate; + $.ajax({ + type: "POST", + url: "saveDueDate.action", + data: params, + dataType: "xml", + success: function(result){ + handleResponse (result); + }, + error: function(request,status,errorThrown) { + handleHttpError (request); + } + }); + }; + + function handleResponse( rootElement ) + { + var codeElement = rootElement.getElementsByTagName( 'code' )[0]; + var code = parseInt( codeElement.firstChild.nodeValue ); + + if ( code == 0 ) + { + markValue( resultColor ); + } + else + { + markValue( COLOR_GREY ); + window.alert( i18n_saving_value_failed_status_code + '\n\n' + code ); + } + } + + function handleHttpError( errorCode ) + { + markValue( COLOR_GREY ); + window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode ); + } + + function markValue( color ) + { + + var element = document.getElementById( 'value_' + programStageInstanceId + '_date' ); + + element.style.backgroundColor = color; + } +} + + +// ----------------------------------------------------------------------------- +// remove value of all the disabled identifier fields +// an identifier field is disabled when its value is inherited from another person ( underAge is true ) +// we don't save inherited identifiers. Only save the representative id. +// ----------------------------------------------------------------------------- + +function removeDisabledIdentifier() +{ + jQuery("input.idfield").each(function(){ + if( jQuery(this).is(":disabled")) + jQuery(this).val(""); + }); +} + +function addEventForPatientForm( divname ) +{ + jQuery("#" + divname + " [id=searchPatientByNameBtn]").click(function() { + getPatientsByName( divname ); + }); + + jQuery("#" + divname + " [id=checkDuplicateBtn]").click(function() { + checkDuplicate( divname ); + }); + + jQuery("#" + divname + " [id=dobType]").change(function() { + dobTypeOnChange( divname ); + }); +} + +function showRepresentativeInfo( patientId) +{ + jQuery('#representativeInfo' ).dialog({ + title: i18n_representative_info, + maximize: true, + closable: true, + modal:true, + overlay:{background:'#000000', opacity:0.1}, + width: 400, + height: 300 + }); +} + +function hideEnrolmentField() +{ + setFieldValue( 'enrollmentDate', '' ); + setFieldValue( 'dateOfIncident', '' ); + hideById('enrollmentDateTR'); + hideById('dateOfIncidentTR'); + hideById('enrollBtn'); +} + +function showEnrolmentField() +{ + showById('enrollmentDateTR'); + showById('dateOfIncidentTR'); + showById('enrollBtn'); +} + +function saveIdentifierAndAttribute() +{ + $.ajax({ + type: "POST", + url: 'savePatientIdentifierAndAttribute.action', + data: getParamsForDiv('programEnrollmentInforForm'), + success: function(json) + { + showSuccessMessage( i18n_save_success ); + } + }); +} + +//-------------------------------------------------------------------------------------------- +// Show selected data-recording +//-------------------------------------------------------------------------------------------- + +function showSelectedDataRecoding( patientId ) +{ + showLoader(); + hideById('searchPatientDiv'); + hideById('dataEntryFormDiv'); + hideById('migrationPatientDiv'); + jQuery('#dataRecordingSelectDiv').load( 'selectDataRecording.action', + { + patientId: patientId + }, + function() + { + jQuery('#dataRecordingSelectDiv [id=patientInfoDiv]').hide(); + jQuery('#dataRecordingSelectDiv [id=backBtnFromEntry]').hide(); + showById('dataRecordingSelectDiv'); + + var programId = jQuery('#programEnrollmentSelectDiv [id=programId] option:selected').val(); + $('#dataRecordingSelectDiv [id=programId]').val( programId ); + $('#dataRecordingSelectDiv [id=programIdTR]').hide(); + + loadProgramStages(); + hideLoader(); + hideById('contentDiv'); + }); +} + +function searchPatient() +{ + $.ajax({ + url: 'searchRegistrationPatient.action', + type:"POST", + data: getParamsForDiv('searchPatientDiv'), + success: function( html ){ + statusSearching = 1; + setInnerHTML( 'listPatientDiv', html ); + showById('listPatientDiv'); + jQuery( "#loaderDiv" ).hide(); + } + }); +} + +//-------------------------------------------------------------------------------------------- +// Migration patient +//-------------------------------------------------------------------------------------------- + +function getPatientLocation( patientId ) +{ + hideById('listPatientDiv'); + hideById('selectDiv'); + hideById('searchPatientDiv'); + + jQuery('#loaderDiv').show(); + + jQuery('#migrationPatientDiv').load("getPatientLocation.action", + { + patientId: patientId + } + , function(){ + showById( 'migrationPatientDiv' ); + jQuery( "#loaderDiv" ).hide(); + }); +} + +function verifyOrgunitRegistration( patientId ) +{ + $.getJSON( 'verifyOrgunitRegistration.action', {} + , function( json ) + { + var type = json.response; + if( type == 'success' ) + { + registerPatientLocation( patientId ); + } + else if( type == 'input' ) + { + showWarningMessage( i18n_can_not_register_patient_for_orgunit); + } + } ); +} + +function registerPatientLocation( patientId ) +{ + $.getJSON( 'registerPatientLocation.action',{ patientId:patientId } + , function( json ) + { + showSuccessMessage( i18n_save_success ); + } ); +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js 2012-04-03 03:17:19 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/sendSMS.js 2012-05-09 02:52:11 +0000 @@ -1,4 +1,4 @@ -var isChecked = false; +var _target = ""; var isOrgunitSelected = false; function selectedOrganisationUnitSendSMS( unitIds ) @@ -6,27 +6,43 @@ isOrgunitSelected = (unitIds && unitIds.length > 0); } -function toggleSMSGUI( checked ) +function toggleSMSGUI( _value ) { - if ( checked ) { + if ( _value == "phone" ) + { + showById( 'phoneType' ); + hideById( 'orgunitType' ); + } + else if ( _value == "user" || _value == "unit" ) + { selectionTree.clearSelectedOrganisationUnits(); selectionTree.buildSelectionTree(); hideById( 'phoneType' ); showById( 'orgunitType' ); - } else { - showById( 'phoneType' ); - hideById( 'orgunitType' ); - } - - isChecked = checked; + } + else { + window.location.href = "showBeneficiarySMSForm.action"; + } + + _target = _value; +} + +function toggleAll( checked ) +{ + var list = jQuery( "input[type=checkbox][name=patientSMSCheckBox]" ); + + for ( var i in list ) + { + list[i].checked = checked; + } } function sendSMSMessage( _form ) { var params = ""; - if ( !isChecked ) + if ( _target == "phone" ) { var list = getFieldValue( "recipient" ); @@ -48,7 +64,7 @@ params = "?" + params.substring( 0, params.length - 1 ); } - else + else if ( _target == "user" || _target == "unit" ) { if ( !isOrgunitSelected ) { @@ -56,11 +72,20 @@ return; } } + else + { + if ( hasElements( 'recipients' ) ) + { + params = "?" + getParamString( 'recipients', 'recipients' ); + } + else { markInvalid( "recipients", i18n_list_empty ); } + } jQuery.postUTF8( _form.action + params, { gatewayId: getFieldValue( 'gatewayId' ), - smsMessage: getFieldValue( 'smsMessage' ) + smsMessage: getFieldValue( 'smsMessage' ), + sendTarget: getFieldValue( 'sendTarget' ) }, function ( json ) { if ( json.response == "success" ) { === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm 2012-03-14 10:36:55 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menu.vm 2012-05-09 02:52:11 +0000 @@ -1,6 +1,6 @@

DHIS Mobile Configuration

    - +
  • $i18n.getString( "patient_mobile_setting" )
  • $i18n.getString( "mobile_dataset" ) 
  • $i18n.getString( "sms_service_configuration" )
  • === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menuWithTree.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/menuWithTree.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/menuWithTree.vm 2012-05-09 02:52:11 +0000 @@ -0,0 +1,3 @@ +#parse( "/dhis-web-maintenance-mobile/menu.vm" ) +
    +#parse( "/dhis-web-commons/ouwt/orgunittree.vm" ) \ No newline at end of file === added 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 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/patientRegistrationList.vm 2012-05-09 02:52:11 +0000 @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + +
    $i18n.getString( "search_result_matching_the_search_criteria" ):   + #if($!listAll) + $i18n.getString( "list_all_patients" ) + #else + $i18n.getString( "search_patients_by_attributes" ) + #end +
    $i18n.getString( "total_result" )  $!total
    + +#if( $patients.size() > 0 ) + + + + + + + + +
    + + + #foreach( $attribute in $patientAttributes ) + #if($attribute)#end + #end + + + + + #if($mapPatientOrgunit.size()!=0) + + #end + + + + + + #foreach( $attribute in $patientAttributes ) + #if($attribute) + + #end + #end + + + + + #if($mapPatientOrgunit.size()!=0) + + #end + + + + + + #set( $mark = false ) + #foreach( $patient in $patients ) + + + + + #foreach( $attribute in $patientAttributes ) + #if( $attribute ) + #set ( $key = $patient.id + '-' + $attribute.id ) + + #end + #end + + + + + + + + + + #if($mapPatientOrgunit.size()!=0) + + + + #end + + + + + #set( $mark = !$mark) + #end + + +
    #$attribute.name$i18n.getString( "full_name" )$i18n.getString( "gender" )$i18n.getString( "date_of_birth" )$i18n.getString( "age" )$i18n.getString( "hierachy_orgunit" )$i18n.getString( "operations" )
    + #set( $nr = ( ( $paging.getCurrentPage() - 1 ) * $paging.pageSize ) + $velocityCount ) + $nr + + #if( $attribute.valueType == 'YES/NO') + $i18n.getString( $mapPatientPatientAttr.get($key) ) + #else + $mapPatientPatientAttr.get($key) + #end + $!patient.getFullName()$i18n.getString($!patient.gender)$format.formatDate( $!patient.birthDate)$!patient.getAge()$!mapPatientOrgunit.get($patient.id) + #if ( $!patient.phoneNumber() && $!patient.phoneNumber() != "" ) + $i18n.getString( "add_phone_to_list" ) + #else + $i18n.getString( "no_phone" ) + #end +
    +
    +

    +
    + #parse( "/dhis-web-commons/paging/paging.vm" ) +
    +
    + +
    + +#end + === added 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 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/sendBeneficiarySMSPage.vm 2012-05-09 02:52:11 +0000 @@ -0,0 +1,285 @@ + + + + + + + +

    $i18n.getString( "send_sms_beneficiary" )

    +#if ( $!gatewayMap && $!gatewayMap.size() > 0 ) +
    +
    + + + + + + + + + + + + + + + + + + +
    $i18n.getString( "gateway_type" )
    + #set( $keys = $!gatewayMap.keySet() ) + +
    $i18n.getString( "send_sms_to_target" ) + +
    + + + + + + + + + + + + + + + + + + + +
    $i18n.getString( "search_details" )
    + + * + + + + +
    + + + #parse( "dhis-web-commons/loader/loader.vm" ) +
    + + + + + + + + + + + + + + +
    $i18n.getString( "phone_number" )
    +
    $i18n.getString( "message" )
    +
    +
    + +#else +

    No Sms service available

    +#end + + \ 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/sendSMSPage.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2012-04-04 04:27:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/sendSMSPage.vm 2012-05-09 02:52:11 +0000 @@ -4,8 +4,7 @@ selectionTreeSelection.setListenerFunction( selectedOrganisationUnitSendSMS ); - uncheck( "sendTypeCB" ); - toggleSMSGUI( false ); + toggleSMSGUI( "phone" ); }); var i18n_no_recipient = '$encoder.jsEscape( $i18n.getString( "no_recipient" ) , "'")'; @@ -23,7 +22,7 @@ } -

    Send SMS

    +

    $i18n.getString( "send_sms" )

    #if ( $!gatewayMap && $!gatewayMap.size() > 0 )
    @@ -46,12 +45,19 @@ - - + + - +
    $i18n.getString( "org_unit_tree" )$i18n.getString( "send_sms_to_target" ) + +
    $i18n.getString( "message" )