=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java 2013-12-14 14:47:45 +0000 @@ -189,6 +189,18 @@ return comment != null && !comment.isEmpty(); } + public void toggleFollowUp() + { + if ( this.followup == null ) + { + this.followup = true; + } + else + { + this.followup = !this.followup; + } + } + // ------------------------------------------------------------------------- // hashCode and equals // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java 2013-12-14 14:14:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueController.java 2013-12-14 14:47:45 +0000 @@ -86,7 +86,7 @@ public void saveDataValue( @RequestParam String de, @RequestParam String co, @RequestParam String pe, @RequestParam String ou, @RequestParam(required=false) String value, @RequestParam(required=false) String comment, - HttpServletResponse response ) + @RequestParam(required=false) boolean followUp, HttpServletResponse response ) { DataElement dataElement = dataElementService.getDataElement( de ); @@ -176,6 +176,11 @@ dataValue.setComment( StringUtils.trimToNull( comment ) ); } + if ( followUp ) + { + dataValue.toggleFollowUp(); + } + dataValue.setTimestamp( now ); dataValue.setStoredBy( storedBy ); === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java 2013-09-27 12:55:38 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetHistoryChartAction.java 2013-12-14 14:47:45 +0000 @@ -113,9 +113,9 @@ this.periodId = periodId; } - private Integer organisationUnitId; + private String organisationUnitId; - public void setOrganisationUnitId( Integer organisationUnitId ) + public void setOrganisationUnitId( String organisationUnitId ) { this.organisationUnitId = organisationUnitId; } === removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java 2013-09-27 12:55:38 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MarkForFollowupAction.java 1970-01-01 00:00:00 +0000 @@ -1,153 +0,0 @@ -package org.hisp.dhis.de.action; - -/* - * Copyright (c) 2004-2013, 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 com.opensymphony.xwork2.Action; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.dataelement.DataElementCategoryService; -import org.hisp.dhis.dataelement.DataElementService; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.period.PeriodType; - -/** - * @author Lars Helge Overland - */ -public class MarkForFollowupAction - implements Action -{ - private static final Log log = LogFactory.getLog( MarkForFollowupAction.class ); - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataValueService dataValueService; - - public void setDataValueService( DataValueService dataValueService ) - { - this.dataValueService = dataValueService; - } - - private DataElementService dataElementService; - - public void setDataElementService( DataElementService dataElementService ) - { - this.dataElementService = dataElementService; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - private DataElementCategoryService categoryService; - - public void setCategoryService( DataElementCategoryService categoryService ) - { - this.categoryService = categoryService; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private String dataElementId; - - public void setDataElementId( String dataElementId ) - { - this.dataElementId = dataElementId; - } - - private String categoryOptionComboId; - - public void setCategoryOptionComboId( String categoryOptionComboId ) - { - this.categoryOptionComboId = categoryOptionComboId; - } - - private String periodId; - - public void setPeriodId( String periodId ) - { - this.periodId = periodId; - } - - private int organisationUnitId; - - public void setOrganisationUnitId( int organisationUnitId ) - { - this.organisationUnitId = organisationUnitId; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private String message; - - public String getMessage() - { - return message; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - DataElement dataElement = dataElementService.getDataElement( dataElementId ); - DataElementCategoryOptionCombo categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( categoryOptionComboId ); - Period period = PeriodType.getPeriodFromIsoString( periodId ); - OrganisationUnit source = organisationUnitService.getOrganisationUnit( organisationUnitId ); - - DataValue dataValue = dataValueService.getDataValue( source, dataElement, period, categoryOptionCombo ); - - boolean isMarked = dataValue.isFollowup(); - - dataValue.setFollowup( !isMarked ); - - dataValueService.updateDataValue( dataValue ); - - message = !isMarked ? "marked" : "unmarked"; - - log.info( !isMarked ? "Data value marked for follow-up" : "Data value unmarked for follow-up" ); - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveMinMaxLimitsAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveMinMaxLimitsAction.java 2013-08-23 16:05:01 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveMinMaxLimitsAction.java 2013-12-14 14:47:45 +0000 @@ -80,9 +80,9 @@ // Input // ------------------------------------------------------------------------- - private Integer organisationUnitId; + private String organisationUnitId; - public void setOrganisationUnitId( Integer organisationUnitId ) + public void setOrganisationUnitId( String organisationUnitId ) { this.organisationUnitId = organisationUnitId; } === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2013-12-14 14:25:11 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2013-12-14 14:47:45 +0000 @@ -95,14 +95,6 @@ - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2013-12-14 14:14:40 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2013-12-14 14:47:45 +0000 @@ -81,10 +81,6 @@ /dhis-web-dataentry/validationResult.vm - - ../dhis-web-commons/ajax/jsonResponseSuccess.vm - - === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js 2013-12-14 14:14:40 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js 2013-12-14 14:47:45 +0000 @@ -24,12 +24,12 @@ function CommentSaver( de, co, ou, pe, comment ) { var dataValue = { - 'de' : de, - 'co' : co, - 'ou' : ou, - 'pe' : pe, - 'comment' : comment - }; + 'de' : de, + 'co' : co, + 'ou' : ou, + 'pe' : pe, + 'comment' : comment + }; this.save = function() { @@ -170,23 +170,25 @@ { var periodId = $( '#selectedPeriodId' ).val(); - $.ajax( { url: 'markValueForFollowup.action', - data: - { - dataElementId: currentDataElementId, - categoryOptionComboId: currentOptionComboId, - periodId: periodId, - organisationUnitId: currentOrganisationUnitId - }, + var dataValue = { + 'de' : currentDataElementId, + 'co' : currentOptionComboId, + 'ou' : currentOrganisationUnitId, + 'pe' : periodId, + 'followUp' : true + }; + + $.ajax( { url: '../api/dataValues', + data: dataValue, dataType: 'json', success: function( json ) { - if ( json.message == 'marked' ) + if ( $( '#followup' ).attr( 'src' ) == '../images/unmarked.png' ) { $( '#followup' ).attr( 'src', '../images/marked.png' ); $( '#followup' ).attr( 'alt', i18n_unmark_value_for_followup ); } - else if ( json.message == 'unmarked' ) + else { $( '#followup' ).attr( 'src', '../images/unmarked.png' ); $( '#followup' ).attr( 'alt', i18n_mark_value_for_followup );