=== added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveCoordinatesEventAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveCoordinatesEventAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveCoordinatesEventAction.java 2013-03-02 06:07:36 +0000 @@ -0,0 +1,115 @@ +/* + * 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.caseentry.action.caseentry; + +import org.hisp.dhis.program.ProgramStageInstance; +import org.hisp.dhis.program.ProgramStageInstanceService; +import org.hisp.dhis.system.util.ValidationUtils; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version SaveCoordinatesEventAction.java 7:39:48 PM Mar 1, 2013 $ + */ +public class SaveCoordinatesEventAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private ProgramStageInstanceService programStageInstanceService; + + public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService ) + { + this.programStageInstanceService = programStageInstanceService; + } + + // -------------------------------------------------------------------------- + // Input/Output + // -------------------------------------------------------------------------- + + private Integer programStageInstanceId; + + public void setProgramStageInstanceId( Integer programStageInstanceId ) + { + this.programStageInstanceId = programStageInstanceId; + } + + private String longitude; + + public void setLongitude( String longitude ) + { + this.longitude = longitude; + } + + private String latitude; + + public void setLatitude( String latitude ) + { + this.latitude = latitude; + } + + // -------------------------------------------------------------------------- + // Action implementation + // -------------------------------------------------------------------------- + + public String execute() + throws Exception + { + longitude = (longitude == null || longitude.isEmpty() ) ? null : longitude; + latitude = (latitude == null || latitude.isEmpty() ) ? null : latitude; + + // --------------------------------------------------------------------- + // Set coordinates and feature type to point if valid + // --------------------------------------------------------------------- + + ProgramStageInstance programStageInstance = programStageInstanceService + .getProgramStageInstance( programStageInstanceId ); + + if ( longitude != null && latitude != null ) + { + String coordinates = ValidationUtils.getCoordinate( longitude, latitude ); + + if ( ValidationUtils.coordinateIsValid( coordinates ) ) + { + programStageInstance.setCoordinates( coordinates ); + } + } + else + { + programStageInstance.setCoordinates( null ); + } + + programStageInstanceService.updateProgramStageInstance( programStageInstance ); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-03-02 05:09:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2013-03-02 06:07:36 +0000 @@ -566,4 +566,5 @@ enter_a_value_less_than_or_equal_to_90 = Please enter a value less than or equal to 90. enter_a_value_greater_than_or_equal_to_nagetive_90 = Please enter a value greater than or equal to -90. enter_values_for_longitude_and_latitude_fields = Please enter values for both longitude and latitude fields -enter_a_valid_number = Please enter a valid number. \ No newline at end of file +enter_a_valid_number = Please enter a valid number. +enter_a_number = Enter a number \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm 2013-03-02 05:09:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/cacheManifest.vm 2013-03-02 06:07:36 +0000 @@ -1,5 +1,5 @@ CACHE MANIFEST -# 2.11-SNAPSHOT V22 +# 2.11-SNAPSHOT V23 NETWORK: * CACHE: === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2013-03-02 05:09:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2013-03-02 06:07:36 +0000 @@ -37,8 +37,10 @@ - - + + + + #end === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/save.png' Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/save.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/images/save.png 2013-03-02 06:07:36 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-03-02 05:09:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js 2013-03-02 06:07:36 +0000 @@ -1921,7 +1921,10 @@ var latitude = jQuery.trim(getFieldValue('latitude')); var isValid = true; - if(longitude=='' || latitude==''){ + if(longitude=='' && latitude==''){ + isValid = true; + } + else if(longitude=='' || latitude==''){ alert(i18n_enter_values_for_longitude_and_latitude_fields); isValid = false; } === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2013-03-02 05:09:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentForm.vm 2013-03-02 06:07:36 +0000 @@ -40,7 +40,6 @@ - === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-03-02 05:09:13 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/reportDataEntryForm.vm 2013-03-02 06:07:36 +0000 @@ -46,7 +46,6 @@ - #end