=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MinMaxGeneratingAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MinMaxGeneratingAction.java 2010-04-29 04:33:47 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/MinMaxGeneratingAction.java 1970-01-01 00:00:00 +0000 @@ -1,143 +0,0 @@ -package org.hisp.dhis.de.action; - -/* - * Copyright (c) 2004-2010, 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.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.de.state.SelectedStateManager; -import org.hisp.dhis.minmax.MinMaxDataElement; -import org.hisp.dhis.minmax.MinMaxDataElementService; -import org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService; -import org.hisp.dhis.options.SystemSettingManager; -import org.hisp.dhis.organisationunit.OrganisationUnit; - -import com.opensymphony.xwork2.Action; - -/** - * @author Margrethe Store - * @version $Id: MinMaxGeneratingAction.java 5568 2008-08-21 13:47:11Z larshelg $ - * @version $Id: MinMaxGeneratingAction.java 2010-04-16 13:47:11Z Chau Thu Tran $ - */ -public class MinMaxGeneratingAction implements Action { - private static final Log log = LogFactory.getLog( MinMaxGeneratingAction.class ); - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private MinMaxDataElementService minMaxDataElementService; - - public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService ) - { - this.minMaxDataElementService = minMaxDataElementService; - } - - private SelectedStateManager selectedStateManager; - - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - - private MinMaxValuesGenerationService minMaxValuesGenerationService; - - public void setMinMaxValuesGenerationService( MinMaxValuesGenerationService minMaxValuesGenerationService ) - { - this.minMaxValuesGenerationService = minMaxValuesGenerationService; - } - - private SystemSettingManager systemSettingManager; - - public void setSystemSettingManager( SystemSettingManager systemSettingManager ) - { - this.systemSettingManager = systemSettingManager; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private List minMaxDataElements; - - public List getMinMaxDataElements() - { - return minMaxDataElements; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - log.info( "Starting min-max limits generation" ); - - minMaxDataElements = new ArrayList(); - - OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); - - DataSet dataSet = selectedStateManager.getSelectedDataSet(); - - Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION, - 2.0 ); - - // Get min/max values for dataelements into dataset - Collection minMaxDataElements = (Collection) minMaxValuesGenerationService - .getMinMaxValues( organisationUnit, dataSet.getDataElements(), factor ); - - // Save min / max value - for ( MinMaxDataElement minMaxDataElement : minMaxDataElements ) - { - MinMaxDataElement minMaxValue = minMaxDataElementService.getMinMaxDataElement( minMaxDataElement - .getSource(), minMaxDataElement.getDataElement(), minMaxDataElement.getOptionCombo() ); - - if ( minMaxValue != null ) - { - minMaxValue.setMax( minMaxDataElement.getMax() ); - minMaxValue.setMin( minMaxDataElement.getMin() ); - minMaxDataElementService.updateMinMaxDataElement( minMaxValue ); - } - else - { - minMaxDataElement.setGenerated( true ); - minMaxDataElementService.addMinMaxDataElement( minMaxDataElement ); - } - } - - log.info( "Generated min-max limits" ); - - return SUCCESS; - } - -} === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java 2010-12-30 09:13:41 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultSelectedStateManager.java 2011-01-17 12:03:26 +0000 @@ -152,7 +152,7 @@ // Retain only DataSets from current user's authority groups // --------------------------------------------------------------------- - if ( !currentUserService.currentUserIsSuper() ) + if ( currentUserService.getCurrentUser() != null && !currentUserService.currentUserIsSuper() ) { UserCredentials userCredentials = userService.getUserCredentials( currentUserService.getCurrentUser() ); === 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 2011-01-06 16:37:59 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2011-01-17 12:03:26 +0000 @@ -141,13 +141,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 2010-11-26 21:48:38 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2011-01-17 12:03:26 +0000 @@ -103,12 +103,6 @@ javascript/history.js - - responseMinMaxGeneration.vm - plainTextError - F_DATAELEMENT_MINMAX_ADD,F_DATAELEMENT_MINMAX_UPDATE - - /dhis-web-dataentry/responseVoid.vm /dhis-web-dataentry/responseInput.vm === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2010-11-26 19:56:18 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-01-17 12:03:26 +0000 @@ -367,69 +367,6 @@ } // ----------------------------------------------------------------------------- -// Min max -// ----------------------------------------------------------------------------- - -/** - * Set min/max limits for dataelements that has one or more values, and no - * manually entred min/max limits. - */ -function SetGeneratedMinMaxValues() -{ - this.save = function() - { - var request = new Request(); - request.setCallbackSuccess( handleResponse ); - request.setCallbackError( handleHttpError ); - request.setResponseTypeXML( 'minmax' ); - request.send( 'minMaxGeneration.action' ); - }; - - function handleResponse( rootElement ) - { - var dataElements = rootElement.getElementsByTagName( 'dataelement' ); - - for( i = 0; i < dataElements.length; i++ ) - { - var deId = getElementValue( dataElements[i], 'dataelementId' ); - var ocId = getElementValue( dataElements[i], 'optionComboId' ); - - setInnerHTML('value[' + deId + ':' + ocId + '].min', getElementValue( dataElements[i], 'minLimit')); - setInnerHTML('value[' + deId + ':' + ocId + '].max', getElementValue( dataElements[i], 'maxLimit')); - } - } - - function handleHttpError( errorCode ) - { - window.alert( i18n_saving_minmax_failed_error_code + '\n\n' + errorCode ); - } - - function getElementValue( parentElement, childElementName ) - { - var textNode = parentElement.getElementsByTagName( childElementName )[0].firstChild; - - if ( textNode ) - { - return textNode.nodeValue; - } - else - { - return null; - } - } -} - -function generateMinMaxValues() -{ - lockScreen(); - var setGeneratedMinMaxValues = new SetGeneratedMinMaxValues(); - setGeneratedMinMaxValues.save(); - - unLockScreen(); - setHeaderDelayMessage(i18n_generate_min_max_success); -} - -// ----------------------------------------------------------------------------- // Data completeness // ----------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2011-01-06 16:37:59 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm 2011-01-17 12:03:26 +0000 @@ -9,7 +9,6 @@
-