=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java 2010-11-11 17:36:25 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/FormAction.java 1970-01-01 00:00:00 +0000 @@ -1,395 +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 static org.hisp.dhis.options.SystemSettingManager.KEY_ZERO_VALUE_SAVE_MODE; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hisp.dhis.customvalue.CustomValue; -import org.hisp.dhis.customvalue.CustomValueService; -import org.hisp.dhis.dataelement.CalculatedDataElement; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.dataelement.DataElementCategoryService; -import org.hisp.dhis.dataentryform.DataEntryForm; -import org.hisp.dhis.datalock.DataSetLock; -import org.hisp.dhis.datalock.DataSetLockService; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.de.comments.StandardCommentsManager; -import org.hisp.dhis.de.screen.DataEntryScreenManager; -import org.hisp.dhis.de.state.SelectedStateManager; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.minmax.MinMaxDataElement; -import org.hisp.dhis.minmax.MinMaxDataElementService; -import org.hisp.dhis.options.SystemSettingManager; -import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.period.Period; - -import com.opensymphony.xwork2.Action; - -/** - * @author Torgeir Lorange Ostby - * @version $Id: FormAction.java 6216 2008-11-06 18:06:42Z eivindwa $ - */ -public class FormAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private CustomValueService customValueService; - - public CustomValueService getCustomValueService() - { - return customValueService; - } - - public void setCustomValueService( CustomValueService customValueService ) - { - this.customValueService = customValueService; - } - - private SystemSettingManager systemSettingManager; - - public void setSystemSettingManager( SystemSettingManager systemSettingManager ) - { - this.systemSettingManager = systemSettingManager; - } - - private DataValueService dataValueService; - - public void setDataValueService( DataValueService dataValueService ) - { - this.dataValueService = dataValueService; - } - - private StandardCommentsManager standardCommentsManager; - - public void setStandardCommentsManager( StandardCommentsManager standardCommentsManager ) - { - this.standardCommentsManager = standardCommentsManager; - } - - private MinMaxDataElementService minMaxDataElementService; - - public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService ) - { - this.minMaxDataElementService = minMaxDataElementService; - } - - private SelectedStateManager selectedStateManager; - - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - - private DataEntryScreenManager dataEntryScreenManager; - - public void setDataEntryScreenManager( DataEntryScreenManager dataEntryScreenManager ) - { - this.dataEntryScreenManager = dataEntryScreenManager; - } - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - private DataSetLockService dataSetLockService; - - public void setDataSetLockService( DataSetLockService dataSetLockService ) - { - this.dataSetLockService = dataSetLockService; - } - - private DataElementCategoryService categoryService; - - public void setCategoryService( DataElementCategoryService categoryService ) - { - this.categoryService = categoryService; - } - - // ------------------------------------------------------------------------- - // DisplayPropertyHandler - // ------------------------------------------------------------------------- - - private DisplayPropertyHandler displayPropertyHandler; - - public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler ) - { - this.displayPropertyHandler = displayPropertyHandler; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - private List orderedDataElements = new ArrayList(); - - public List getOrderedDataElements() - { - return orderedDataElements; - } - - private Map dataValueMap; - - public Map getDataValueMap() - { - return dataValueMap; - } - - private Map calculatedValueMap; - - public Map getCalculatedValueMap() - { - return calculatedValueMap; - } - - private List standardComments; - - public List getStandardComments() - { - return standardComments; - } - - private Map dataElementValueTypeMap; - - public Map getDataElementValueTypeMap() - { - return dataElementValueTypeMap; - } - - private Map minMaxMap; - - public Map getMinMaxMap() - { - return minMaxMap; - } - - private Integer integer = 0; - - public Integer getInteger() - { - return integer; - } - - private Boolean cdeFormExists; - - private DataEntryForm dataEntryForm; - - public DataEntryForm getDataEntryForm() - { - return this.dataEntryForm; - } - - private String customDataEntryFormCode; - - public String getCustomDataEntryFormCode() - { - return this.customDataEntryFormCode; - } - - private Boolean zeroValueSaveMode; - - public Boolean getZeroValueSaveMode() - { - return zeroValueSaveMode; - } - - // ------------------------------------------------------------------------- - // Input/output - // ------------------------------------------------------------------------- - - private List customValues = new ArrayList(); - - public List getCustomValues() - { - return customValues; - } - - private Integer selectedDataSetId; - - public void setSelectedDataSetId( Integer selectedDataSetId ) - { - this.selectedDataSetId = selectedDataSetId; - } - - public Integer getSelectedDataSetId() - { - return selectedDataSetId; - } - - private Integer selectedPeriodIndex; - - public void setSelectedPeriodIndex( Integer selectedPeriodIndex ) - { - this.selectedPeriodIndex = selectedPeriodIndex; - } - - public Integer getSelectedPeriodIndex() - { - return selectedPeriodIndex; - } - - private String disabled = " "; - - private Integer optionComboId; - - public Integer getOptionComboId() - { - return optionComboId; - } - - private String displayMode; - - public String getDisplayMode() - { - return displayMode; - } - - public void setDisplayMode( String displayMode ) - { - this.displayMode = displayMode; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - zeroValueSaveMode = (Boolean) systemSettingManager.getSystemSetting( KEY_ZERO_VALUE_SAVE_MODE, false ); - - OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit(); - - DataSet dataSet = selectedStateManager.getSelectedDataSet(); - - customValues = (List) customValueService.getCustomValuesByDataSet( dataSet ); - - Period period = selectedStateManager.getSelectedPeriod(); - - DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ); - - if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) ) - { - disabled = "disabled"; - } - - Collection dataElements = dataSet.getDataElements(); - - if ( dataElements.size() == 0 ) - { - return SUCCESS; - } - - DataElementCategoryOptionCombo defaultOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo(); - - optionComboId = defaultOptionCombo.getId(); - - // --------------------------------------------------------------------- - // Get the min/max values - // --------------------------------------------------------------------- - - Collection minMaxDataElements = minMaxDataElementService.getMinMaxDataElements( - organisationUnit, dataElements ); - - minMaxMap = new HashMap( minMaxDataElements.size() ); - - for ( MinMaxDataElement minMaxDataElement : minMaxDataElements ) - { - minMaxMap.put( minMaxDataElement.getDataElement().getId(), minMaxDataElement ); - } - - // --------------------------------------------------------------------- - // Get the DataValues and create a map - // --------------------------------------------------------------------- - - Collection dataValues = dataValueService.getDataValues( organisationUnit, period, dataElements ); - - dataValueMap = new HashMap( dataValues.size() ); - - for ( DataValue dataValue : dataValues ) - { - dataValueMap.put( dataValue.getDataElement().getId(), dataValue ); - } - - // --------------------------------------------------------------------- - // Prepare values for unsaved CalculatedDataElements - // --------------------------------------------------------------------- - - calculatedValueMap = dataEntryScreenManager.populateValuesForCalculatedDataElements( organisationUnit, dataSet, - period ); - - // --------------------------------------------------------------------- - // Make the standard comments available - // --------------------------------------------------------------------- - - standardComments = standardCommentsManager.getStandardComments(); - - // --------------------------------------------------------------------- - // Make the DataElement types available - // --------------------------------------------------------------------- - - dataElementValueTypeMap = new HashMap(); - dataElementValueTypeMap.put( DataElement.VALUE_TYPE_DATE, i18n.getString( "date" ) ); - dataElementValueTypeMap.put( DataElement.VALUE_TYPE_BOOL, i18n.getString( "yes_no" ) ); - dataElementValueTypeMap.put( DataElement.VALUE_TYPE_INT, i18n.getString( "int" ) ); - dataElementValueTypeMap.put( DataElement.VALUE_TYPE_STRING, i18n.getString( "text" ) ); - - // --------------------------------------------------------------------- - // Get the custom data entry form (if any) - // --------------------------------------------------------------------- - - dataEntryForm = dataSet.getDataEntryForm(); - cdeFormExists = (dataEntryForm != null); - - if ( cdeFormExists ) - { - customDataEntryFormCode = dataEntryScreenManager.populateCustomDataEntryScreen( - dataEntryForm.getHtmlCode(), dataValues, calculatedValueMap, minMaxMap, disabled, zeroValueSaveMode, - i18n, dataSet ); - } - - displayPropertyHandler.handle( orderedDataElements ); - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java 2010-11-11 17:25:33 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java 2010-11-11 18:03:00 +0000 @@ -65,6 +65,8 @@ private static final String SECTION_FORM = "sectionform"; private static final String DEFAULT_FORM = "defaultform"; + + private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform"; private static final Log log = LogFactory.getLog( SelectAction.class ); @@ -392,6 +394,6 @@ return SECTION_FORM; } - return dataEntryScreenManager.getScreenType( selectedDataSet ); + return MULTI_DIMENSIONAL_FORM; } } === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java 2010-06-23 12:06:35 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DataEntryScreenManager.java 2010-11-11 18:03:00 +0000 @@ -45,13 +45,7 @@ * @version $Id$ */ public interface DataEntryScreenManager -{ - String getScreenType( DataSet dataSet ); - - boolean hasMixOfDimensions( DataSet dataset ); - - boolean hasMultiDimensionalDataElement( DataSet dataSet ); - +{ boolean hasMultiDimensionalDataElement( Section section ); boolean hasSection( DataSet dataSet ); === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-10-28 09:17:13 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-11-11 18:03:00 +0000 @@ -71,10 +71,6 @@ { private static final Log log = LogFactory.getLog( DefaultDataEntryScreenManager.class ); - private static final String DEFAULT_FORM = "defaultform"; - - private static final String MULTI_DIMENSIONAL_FORM = "multidimensionalform"; - private static final String EMPTY = ""; // ------------------------------------------------------------------------- @@ -112,39 +108,6 @@ // ------------------------------------------------------------------------- // DataEntryScreenManager implementation // ------------------------------------------------------------------------- - - public boolean hasMixOfDimensions( DataSet dataSet ) - { - if ( dataSet.getDataElements().size() > 0 ) - { - Iterator dataElementIterator = dataSet.getDataElements().iterator(); - - DataElementCategoryCombo catCombo = dataElementIterator.next().getCategoryCombo(); - - for ( DataElement de : dataSet.getDataElements() ) - { - if ( catCombo != de.getCategoryCombo() ) - { - return true; - } - } - } - - return false; - } - - public boolean hasMultiDimensionalDataElement( DataSet dataSet ) - { - for ( DataElement element : dataSet.getDataElements() ) - { - if ( element.isMultiDimensional() ) - { - return true; - } - } - - return false; - } public boolean hasMultiDimensionalDataElement( Section section ) { @@ -159,11 +122,6 @@ return false; } - public String getScreenType( DataSet dataSet ) - { - return hasMultiDimensionalDataElement( dataSet ) ? MULTI_DIMENSIONAL_FORM : DEFAULT_FORM; - } - public Collection getAllCalculatedDataElements( DataSet dataSet ) { Collection calculatedDataElementIds = new HashSet(); === 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 2010-11-11 17:36:25 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2010-11-11 18:03:00 +0000 @@ -69,23 +69,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-11 17:25:33 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-11-11 18:03:00 +0000 @@ -16,12 +16,8 @@ - defaultform - - sectionform - - multidimensionalform - + sectionform + multidimensionalform /main.vm /dhis-web-dataentry/select.vm /dhis-web-dataentry/menu.vm @@ -44,22 +40,6 @@ - - - /main.vm - /dhis-web-dataentry/form.vm - /dhis-web-dataentry/menu.vm - 420 - - ../dhis-web-commons/ouwt/ouwt.js, - javascript/general.js,javascript/form.js, - ../dhis-web-commons/calendar/calendar.js, - ../dhis-web-commons/calendar/calendar-lang.js, - ../dhis-web-commons/calendar/calendar-setup.js - - style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css - - /main.vm === removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm 2010-10-28 09:17:13 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm 1970-01-01 00:00:00 +0000 @@ -1,220 +0,0 @@ - - -#parse( "/dhis-web-dataentry/select.vm" ) - -
- -#if ( $customDataEntryFormExists && $displayMode=="customform" ) - - #foreach( $optionCombo in $orderdCategoryOptionCombos ) - - - - - - #end - - $customDataEntryFormCode - -#else - - - - - - - - - - - - - - - - - -#set( $count = 0 ) -#set( $mark = 0 ) -#set( $tabIndex = 1 ) -#foreach( $dataElement in $orderedDataElements ) - #set( $count = $count + 1 ) - #if( $mark == 1 ) - #set( $mark = 0 ) - #else - #set( $mark = 1 ) - #end - #set( $dataValue = false ) - #set( $dataValue = $dataValueMap.get( $dataElement.id ) ) - #set( $calculatedValue = false ) - #set( $calculatedValue = $calculatedValueMap.get( $dataElement ) ) - #set( $minMax = false ) - #set( $minMax = $minMaxMap.get( $dataElement.id ) ) - #set( $calculated = false ) - #set( $calculated = ($calculatedDataElementIds.contains($dataElement.id)) ) - - ##count - - - ##data element name - - - ##value type - - - ##min value - - - ##entry - - - ##max value - - - ##comment - - - #set( $tabIndex = $tabIndex + 1 ) -#end -
$i18n.getString( "nr" )$i18n.getString( "data_element" )$i18n.getString( "value_type" )$i18n.getString( "min" )$i18n.getString( "entry" )$i18n.getString( "max" )$i18n.getString( "comment" )
$count - - #if( $dataElement.type == "int" && $auth.hasAccess( "dhis-web-dataentry", "viewHistory" ) ) - - #end - #if( $useShortName ) - $encoder.htmlEncode( $dataElement.shortName ) - #else - $encoder.htmlEncode( $dataElement.name ) - #end - #if( $dataElement.type == "int" && $auth.hasAccess( "dhis-web-dataentry", "viewHistory" ) ) - - #end - - $dataElementValueTypeMap.get( $dataElement.type ) - #if( $dataElement.type == "int" ) -
$!minMax.min
- #end -
- - #if( $dataElement.type == "bool" ) - - - #elseif( $dataElement.type == "date" ) - - $i18n.getString( - - #else - #if( $dataElement.type == "string" ) - #set( $dataEntryId = "value[$dataElement.id].value:value[$optionComboId].value" ) - #set( $coun = 0 ) - #foreach($customValue in $customValues) - #if($dataElement.id == $customValue.dataElement.id && $optionComboId == $customValue.optionCombo.id) - #set( $coun = $coun +1 ) - #end - #end - #if($coun>0) - - #else - - #end - #end - - #set( $minMaxError = false ) - #if( $dataElement.type == "int" && $dataValue && $minMax ) - #if( $integer.parseInt( $dataValue.value ) < $minMax.min || $integer.parseInt( $dataValue.value ) > $minMax.max ) - #set( $minMaxError = true ) - #end - #end - #if ( $calculated ) - - #else - #set( $dataEntryId = "value[$dataElement.id].value:value[$optionComboId].value" ) - #if( $dataElement.aggregationOperator == "sum" && $dataElement.type != "string") - - #elseif( $dataElement.type != "string") - - #end - #end - #end - - #if( $dataElement.type == "int" ) -
$!minMax.max
- #end -
- - -
-#end -
-#parse( "/dhis-web-dataentry/completeRegistration.vm" ) - - \ No newline at end of file