dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17537
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7009: CCEM work in progress
------------------------------------------------------------
revno: 7009
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-23 12:05:17 +0530
message:
CCEM work in progress
removed:
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetMetaDataAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadFormAction.java
added:
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadDataEntryFormAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadNextPrePeriodsAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadPeriodsAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/SaveEquipmentDataValueAction.java
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonPeriods.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadDataEntryForm.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDataValueService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDataValueStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentDataEntryFormAction.java
local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties
local/in/dhis-web-coldchain/src/main/resources/struts.xml
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/equipmentDataentry.css
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentDataEntry.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipmentDataEntry.js
local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueService.java 2012-05-16 11:24:58 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueService.java 2012-05-23 06:35:17 +0000
@@ -20,5 +20,7 @@
void deleteEquipmentDataValue( EquipmentDataValue equipmentDataValue );
Collection<EquipmentDataValue> getEquipmentDataValues( EquipmentInstance equipmentInstance, Period period, Collection<DataElement> dataElements );
-
+
+ EquipmentDataValue getEquipmentDataValue( EquipmentInstance equipmentInstance, Period period, DataElement dataElement );
+
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueStore.java 2012-05-16 11:24:58 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDataValueStore.java 2012-05-23 06:35:17 +0000
@@ -21,4 +21,5 @@
Collection<EquipmentDataValue> getEquipmentDataValues( EquipmentInstance equipmentInstance, Period period, Collection<DataElement> dataElements );
+ EquipmentDataValue getEquipmentDataValue( EquipmentInstance equipmentInstance, Period period, DataElement dataElement );
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDataValueService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDataValueService.java 2012-05-16 11:24:58 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDataValueService.java 2012-05-23 06:35:17 +0000
@@ -47,4 +47,11 @@
{
return equipmentDataValueStore.getEquipmentDataValues( equipmentInstance, period, dataElements );
}
+
+ public EquipmentDataValue getEquipmentDataValue( EquipmentInstance equipmentInstance, Period period, DataElement dataElement )
+ {
+ return equipmentDataValueStore.getEquipmentDataValue( equipmentInstance, period, dataElement );
+ }
+
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDataValueStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDataValueStore.java 2012-05-16 11:24:58 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDataValueStore.java 2012-05-23 06:35:17 +0000
@@ -3,7 +3,6 @@
import java.util.Collection;
import java.util.Collections;
-import org.amplecode.quick.StatementManager;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
@@ -12,7 +11,6 @@
import org.hisp.dhis.coldchain.inventory.EquipmentDataValueStore;
import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodStore;
@@ -65,7 +63,7 @@
session.delete( equipmentDataValue );
}
-
+ @SuppressWarnings( "unchecked" )
public Collection<EquipmentDataValue> getEquipmentDataValues( EquipmentInstance equipmentInstance, Period period, Collection<DataElement> dataElements )
{
Period storedPeriod = periodStore.reloadPeriod( period );
@@ -77,11 +75,34 @@
Session session = sessionFactory.getCurrentSession();
- Criteria criteria = session.createCriteria( DataValue.class );
+ Criteria criteria = session.createCriteria( EquipmentDataValue.class );
criteria.add( Restrictions.eq( "equipmentInstance", equipmentInstance ) );
criteria.add( Restrictions.eq( "period", storedPeriod ) );
criteria.add( Restrictions.in( "dataElement", dataElements ) );
return criteria.list();
}
+
+ public EquipmentDataValue getEquipmentDataValue( EquipmentInstance equipmentInstance, Period period, DataElement dataElement )
+ {
+ Period storedPeriod = periodStore.reloadPeriod( period );
+
+ if ( storedPeriod == null || dataElement == null )
+ {
+ return null;
+ }
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( EquipmentDataValue.class );
+ criteria.add( Restrictions.eq( "equipmentInstance", equipmentInstance ) );
+ criteria.add( Restrictions.eq( "period", storedPeriod ) );
+ criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+
+ return (EquipmentDataValue) criteria.uniqueResult();
+ }
+
+
+
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-15 12:19:04 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-23 06:35:17 +0000
@@ -170,6 +170,17 @@
<property name="inventoryTypeStore" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeStore"/>
<property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
</bean>
+
+ <bean id="org.hisp.dhis.coldchain.inventory.EquipmentDataValueService"
+ class="org.hisp.dhis.coldchain.inventory.DefaultEquipmentDataValueService">
+ <property name="equipmentDataValueStore" ref="org.hisp.dhis.coldchain.inventory.EquipmentDataValueStore"/>
+ </bean>
+
+ <bean id="org.hisp.dhis.coldchain.inventory.EquipmentDataValueStore"
+ class="org.hisp.dhis.coldchain.inventory.hibernate.HibernateEquipmentDataValueStore">
+ <property name="sessionFactory" ref="sessionFactory"/>
+ <property name="periodStore" ref="org.hisp.dhis.period.PeriodStore"/>
+ </bean>
<!-- DeletionHandlers -->
=== removed file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetMetaDataAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetMetaDataAction.java 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetMetaDataAction.java 1970-01-01 00:00:00 +0000
@@ -1,131 +0,0 @@
-package org.hisp.dhis.coldchain.equipment.action;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.organisationunit.OrganisationUnitDataSetAssociationSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-
-import com.opensymphony.xwork2.Action;
-
-public class GetMetaDataAction implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private ExpressionService expressionService;
-
- public void setExpressionService( ExpressionService expressionService )
- {
- this.expressionService = expressionService;
- }
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private Collection<DataElement> significantZeros;
-
- public Collection<DataElement> getSignificantZeros()
- {
- return significantZeros;
- }
-
- private Collection<DataElement> dataElements;
-
- public Collection<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- private Collection<Indicator> indicators;
-
- public Collection<Indicator> getIndicators()
- {
- return indicators;
- }
-
- private Collection<DataSet> dataSets;
-
- public Collection<DataSet> getDataSets()
- {
- return dataSets;
- }
-
- private List<Set<Integer>> dataSetAssociationSets;
-
- public List<Set<Integer>> getDataSetAssociationSets()
- {
- return dataSetAssociationSets;
- }
-
- private Map<Integer, Integer> organisationUnitAssociationSetMap;
-
- public Map<Integer, Integer> getOrganisationUnitAssociationSetMap()
- {
- return organisationUnitAssociationSetMap;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- significantZeros = dataElementService.getDataElementsByZeroIsSignificant( true );
-
- dataElements = dataElementService.getDataElementsWithDataSets();
-
- indicators = indicatorService.getIndicatorsWithDataSets();
-
- expressionService.explodeAndSubstituteExpressions( indicators, null );
-
- OrganisationUnitDataSetAssociationSet organisationUnitSet = organisationUnitService.getOrganisationUnitDataSetAssociationSet();
-
- dataSetAssociationSets = organisationUnitSet.getDataSetAssociationSets();
-
- organisationUnitAssociationSetMap = organisationUnitSet.getOrganisationUnitAssociationSetMap();
-
- dataSets = dataSetService.getDataSets( organisationUnitSet.getDistinctDataSets() );
-
- return SUCCESS;
- }
-}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadDataEntryFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadDataEntryFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadDataEntryFormAction.java 2012-05-23 06:35:17 +0000
@@ -0,0 +1,160 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.coldchain.inventory.EquipmentDataValue;
+import org.hisp.dhis.coldchain.inventory.EquipmentDataValueService;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadDataEntryFormAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private EquipmentInstanceService equipmentInstanceService;
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private EquipmentDataValueService equipmentDataValueService;
+
+ public void setEquipmentDataValueService( EquipmentDataValueService equipmentDataValueService )
+ {
+ this.equipmentDataValueService = equipmentDataValueService;
+ }
+ // -------------------------------------------------------------------------
+ // Comparator
+ // -------------------------------------------------------------------------
+
+ private Comparator<DataElement> dataElementComparator;
+
+ public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+ {
+ this.dataElementComparator = dataElementComparator;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int dataSetId;
+
+ public void setDataSetId( int dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ private int equipmentInstanceId;
+
+ public void setEquipmentInstanceId( int equipmentInstanceId )
+ {
+ this.equipmentInstanceId = equipmentInstanceId;
+ }
+
+ private String selectedPeriodId;
+
+ public void setSelectedPeriodId( String selectedPeriodId )
+ {
+ this.selectedPeriodId = selectedPeriodId;
+ }
+
+ private List<DataElement> dataElements = new ArrayList<DataElement>();
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ private Map<Integer, String> equipmentDataValueMap;
+
+ public Map<Integer, String> getEquipmentDataValueMap()
+ {
+ return equipmentDataValueMap;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+
+ public String execute()
+ {
+ //equipmentDataValueMap = null;
+
+ EquipmentInstance equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+
+ //OrganisationUnit organisationUnit = equipmentInstance.getOrganisationUnit();
+ //InventoryType inventoryType = equipmentInstance.getInventoryType();
+
+ Period period = PeriodType.createPeriodExternalId( selectedPeriodId );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ //DataSet dataSet = dataSetService.getDataSet( dataSetId, true, false, false );
+
+ dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
+
+ Collections.sort( dataElements, dataElementComparator );
+
+ //Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() );
+
+ List<EquipmentDataValue> equipmentDataValues = new ArrayList<EquipmentDataValue>( equipmentDataValueService.getEquipmentDataValues( equipmentInstance, period, dataElements ) );
+
+ //System.out.println( " Size of equipmentDataValues List is ====== :" + equipmentDataValues.size() );
+
+ if ( equipmentDataValues != null && equipmentDataValues.size() > 0 )
+ {
+
+ equipmentDataValueMap = new HashMap<Integer, String>();
+
+ for( EquipmentDataValue equipmentDataValue : equipmentDataValues )
+ {
+ equipmentDataValueMap.put( equipmentDataValue.getDataElement().getId(), equipmentDataValue.getValue() );
+ }
+ }
+
+ //System.out.println( " Size of equipmentDataValues Map is List is ====== :" + equipmentDataValueMap.size() );
+ /*
+ System.out.println( " equipmentInstance Id is ====== :" + equipmentInstance.getId() );
+ System.out.println( " Name of organisationUnit is ==== :" + organisationUnit.getName());
+ System.out.println( " Name of inventoryType is ==== :" + inventoryType.getName());
+ System.out.println( " Name of dataSet is ==== :" + dataSet.getName());
+ System.out.println( " Name of period is ==== :" + selectedPeriodId );
+ System.out.println( " Size of dataElements is ==== :" + dataElements.size() );
+
+
+ for( DataElement dataElement : dataElements )
+ {
+ System.out.println( "DataElement Name :" + dataElement.getName() + "-- And value is : " + equipmentDataValueMap.get( dataElement.getId() ));
+ }
+ */
+ return SUCCESS;
+ }
+
+
+}
=== removed file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadFormAction.java 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadFormAction.java 1970-01-01 00:00:00 +0000
@@ -1,302 +0,0 @@
-package org.hisp.dhis.coldchain.equipment.action;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategory;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataentryform.DataEntryForm;
-import org.hisp.dhis.dataentryform.DataEntryFormService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.i18n.I18n;
-
-import com.opensymphony.xwork2.Action;
-
-public class LoadFormAction implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private DataEntryFormService dataEntryFormService;
-
- public void setDataEntryFormService( DataEntryFormService dataEntryFormService )
- {
- this.dataEntryFormService = dataEntryFormService;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- // -------------------------------------------------------------------------
- // Comparator
- // -------------------------------------------------------------------------
-
- private Comparator<DataElement> dataElementComparator;
-
- public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
- {
- this.dataElementComparator = dataElementComparator;
- }
-
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer dataSetId;
-
- public void setDataSetId( Integer dataSetId )
- {
- this.dataSetId = dataSetId;
- }
-
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private Map<DataElementCategoryCombo, List<DataElement>> orderedDataElements = new HashMap<DataElementCategoryCombo, List<DataElement>>();
-
- public Map<DataElementCategoryCombo, List<DataElement>> getOrderedDataElements()
- {
- return orderedDataElements;
- }
-
- private List<DataElementCategoryCombo> orderedCategoryCombos = new ArrayList<DataElementCategoryCombo>();
-
- public List<DataElementCategoryCombo> getOrderedCategoryCombos()
- {
- return orderedCategoryCombos;
- }
-
-
- private Map<Integer, Integer> numberOfTotalColumns = new HashMap<Integer, Integer>();
-
- public Map<Integer, Integer> getNumberOfTotalColumns()
- {
- return numberOfTotalColumns;
- }
-
- private Map<Integer, Collection<DataElementCategoryOptionCombo>> orderdCategoryOptionCombos = new HashMap<Integer, Collection<DataElementCategoryOptionCombo>>();
-
- public Map<Integer, Collection<DataElementCategoryOptionCombo>> getOrderdCategoryOptionCombos()
- {
- return orderdCategoryOptionCombos;
- }
-
- private Map<Integer, Collection<DataElementCategory>> orderedCategories = new HashMap<Integer, Collection<DataElementCategory>>();
-
- public Map<Integer, Collection<DataElementCategory>> getOrderedCategories()
- {
- return orderedCategories;
- }
-
- private Map<Integer, Map<Integer, Collection<DataElementCategoryOption>>> orderedOptionsMap = new HashMap<Integer, Map<Integer, Collection<DataElementCategoryOption>>>();
-
- public Map<Integer, Map<Integer, Collection<DataElementCategoryOption>>> getOrderedOptionsMap()
- {
- return orderedOptionsMap;
- }
-
- private Map<Integer, Map<Integer, Collection<Integer>>> catColRepeat = new HashMap<Integer, Map<Integer, Collection<Integer>>>();
-
- public Map<Integer, Map<Integer, Collection<Integer>>> getCatColRepeat()
- {
- return catColRepeat;
- }
-
- private String customDataEntryFormCode;
-
- public String getCustomDataEntryFormCode()
- {
- return this.customDataEntryFormCode;
- }
-
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute() throws Exception
- {
-
- DataSet dataSet = dataSetService.getDataSet( dataSetId, true, false, false );
-
- List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
-
- if ( dataElements.isEmpty() )
- {
- return INPUT;
- }
-
- Collections.sort( dataElements, dataElementComparator );
-
- orderedDataElements = dataElementService.getGroupedDataElementsByCategoryCombo( dataElements );
-
- orderedCategoryCombos = dataElementService.getDataElementCategoryCombos( dataElements );
-
-
- for ( DataElementCategoryCombo categoryCombo : orderedCategoryCombos )
- {
- List<DataElementCategoryOptionCombo> optionCombos = categoryCombo.getSortedOptionCombos();
-
- orderdCategoryOptionCombos.put( categoryCombo.getId(), optionCombos );
-
- // -----------------------------------------------------------------
- // Perform ordering of categories and their options so that they
- // could be displayed as in the paper form. Note that the total
- // number of entry cells to be generated are the multiple of options
- // from each category.
- // -----------------------------------------------------------------
-
- numberOfTotalColumns.put( categoryCombo.getId(), optionCombos.size() );
-
- orderedCategories.put( categoryCombo.getId(), categoryCombo.getCategories() );
-
- Map<Integer, Collection<DataElementCategoryOption>> optionsMap = new HashMap<Integer, Collection<DataElementCategoryOption>>();
-
- for ( DataElementCategory dec : categoryCombo.getCategories() )
- {
- optionsMap.put( dec.getId(), dec.getCategoryOptions() );
- }
-
- orderedOptionsMap.put( categoryCombo.getId(), optionsMap );
-
- // -----------------------------------------------------------------
- // Calculating the number of times each category should be repeated
- // -----------------------------------------------------------------
-
- Map<Integer, Integer> catRepeat = new HashMap<Integer, Integer>();
-
- Map<Integer, Collection<Integer>> colRepeat = new HashMap<Integer, Collection<Integer>>();
-
- int catColSpan = optionCombos.size();
-
- for ( DataElementCategory cat : categoryCombo.getCategories() )
- {
- int categoryOptionSize = cat.getCategoryOptions().size();
-
- if ( catColSpan > 0 && categoryOptionSize > 0 )
- {
- catColSpan = catColSpan / categoryOptionSize;
- int total = optionCombos.size() / (catColSpan * categoryOptionSize);
- Collection<Integer> cols = new ArrayList<Integer>( total );
-
- for ( int i = 0; i < total; i++ )
- {
- cols.add( i );
- }
-
- colRepeat.put( cat.getId(), cols );
-
- catRepeat.put( cat.getId(), catColSpan );
- }
- }
-
- catColRepeat.put( categoryCombo.getId(), colRepeat );
- }
-
- // ---------------------------------------------------------------------
- // Get data entry form
- // ---------------------------------------------------------------------
-
- String displayMode = dataSet.getDataSetType();
-
- if ( displayMode.equals( DataSet.TYPE_SECTION ) )
- {
- //getSectionForm( dataElements, dataSet );
- }
- else
- {
- getOtherDataEntryForm( dataElements, dataSet );
- }
-
-
- System.out.println( displayMode );
-
- return displayMode;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
- /*
- private void getSectionForm( Collection<DataElement> dataElements, DataSet dataSet )
- {
- sections = new ArrayList<Section>( dataSet.getSections() );
-
- Collections.sort( sections, new SectionOrderComparator() );
-
- for ( Section section : sections )
- {
- DataElementCategoryCombo sectionCategoryCombo = section.getCategoryCombo();
-
- if ( sectionCategoryCombo != null )
- {
- orderedCategoryCombos.add( sectionCategoryCombo );
-
- sectionCombos.put( section.getId(), sectionCategoryCombo.getId() );
- }
-
- for ( DataElementOperand operand : section.getGreyedFields() )
- {
- greyedFields.put( operand.getDataElement().getId() + ":" +
- operand.getCategoryOptionCombo().getId(), true );
- }
- }
- }
- */
- private void getOtherDataEntryForm( List<DataElement> dataElements, DataSet dataSet )
- {
- DataEntryForm dataEntryForm = dataSet.getDataEntryForm();
-
- if ( dataEntryForm != null )
- {
- customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEntry( dataEntryForm.getHtmlCode(),
- i18n, dataSet );
- }
-
- List<DataElement> des = new ArrayList<DataElement>();
-
- for ( DataElementCategoryCombo categoryCombo : orderedCategoryCombos )
- {
- des = (List<DataElement>) orderedDataElements.get( categoryCombo );
-
- Collections.sort( des, IdentifiableObjectNameComparator.INSTANCE );
-
- orderedDataElements.put( categoryCombo, des );
- }
- }
-
-}
-
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadNextPrePeriodsAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadNextPrePeriodsAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadNextPrePeriodsAction.java 2012-05-23 06:35:17 +0000
@@ -0,0 +1,117 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.CalendarPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+import org.hisp.dhis.util.SessionUtils;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadNextPrePeriodsAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private int dataSetId;
+
+ public void setDataSetId( int dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ private int year;
+
+ public void setYear( int year )
+ {
+ this.year = year;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private List<Period> periods;
+
+ public List<Period> getPeriods()
+ {
+ return periods;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+
+ DataSet dataset = dataSetService.getDataSet( dataSetId );
+
+ String periodType = dataset.getPeriodType().getName();
+
+
+ //periodType = periodType != null && !periodType.isEmpty() ? periodType : MonthlyPeriodType.NAME;
+
+ CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodType );
+
+ int thisYear = Calendar.getInstance().get( Calendar.YEAR );
+
+ int currentYear = (Integer) SessionUtils.getSessionVar( SessionUtils.KEY_CURRENT_YEAR, thisYear );
+
+ Calendar cal = PeriodType.createCalendarInstance();
+
+ // Cannot go to next year if current year equals this year
+
+ if ( !( currentYear == thisYear && year > 0 ) )
+ {
+ cal.set( Calendar.YEAR, currentYear );
+ cal.add( Calendar.YEAR, year );
+
+ SessionUtils.setSessionVar( SessionUtils.KEY_CURRENT_YEAR, cal.get( Calendar.YEAR ) );
+ }
+
+ periods = _periodType.generatePeriods( cal.getTime() );
+
+ FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
+
+ Collections.reverse( periods );
+
+
+ for ( Period period : periods )
+ {
+ period.setName( format.formatPeriod( period ) );
+ }
+
+ return SUCCESS;
+ }
+
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadPeriodsAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadPeriodsAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadPeriodsAction.java 2012-05-23 06:35:17 +0000
@@ -0,0 +1,101 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.CalendarPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
+import org.hisp.dhis.system.util.FilterUtils;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadPeriodsAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ private I18nFormat format;
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private int dataSetId;
+
+ public void setDataSetId( int dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+
+ private List<Period> periods = new ArrayList<Period>();
+
+ public Collection<Period> getPeriods()
+ {
+ return periods;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+
+ DataSet dataset = dataSetService.getDataSet( dataSetId );
+
+ String periodType = dataset.getPeriodType().getName();
+
+ CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodType );
+
+ Calendar cal = PeriodType.createCalendarInstance();
+
+ periods = _periodType.generatePeriods( cal.getTime() );
+
+ //periods = new ArrayList<Period>( periodService.getPeriodsByPeriodType( periodType ) );
+
+ FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() );
+
+ //Collections.reverse( periods );
+ //Collections.sort( periods );
+ for ( Period period : periods )
+ {
+ period.setName( format.formatPeriod( period ) );
+ }
+
+ return SUCCESS;
+ }
+}
+
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/SaveEquipmentDataValueAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/SaveEquipmentDataValueAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/SaveEquipmentDataValueAction.java 2012-05-23 06:35:17 +0000
@@ -0,0 +1,213 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.inventory.EquipmentDataValue;
+import org.hisp.dhis.coldchain.inventory.EquipmentDataValueService;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+public class SaveEquipmentDataValueAction implements Action
+{
+ private static final Log log = LogFactory.getLog( SaveEquipmentDataValueAction.class );
+
+ public static final String PREFIX_DATAELEMENT = "dataelement";
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private EquipmentInstanceService equipmentInstanceService;
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private EquipmentDataValueService equipmentDataValueService;
+
+ public void setEquipmentDataValueService( EquipmentDataValueService equipmentDataValueService )
+ {
+ this.equipmentDataValueService = equipmentDataValueService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+
+ private int selectedDataSetId;
+
+ public void setSelectedDataSetId( int selectedDataSetId )
+ {
+ this.selectedDataSetId = selectedDataSetId;
+ }
+
+ private int equipmentInstanceId;
+
+ public void setEquipmentInstanceId( int equipmentInstanceId )
+ {
+ this.equipmentInstanceId = equipmentInstanceId;
+ }
+
+ private String selectedPeriodId;
+
+ public void setSelectedPeriodId( String selectedPeriodId )
+ {
+ this.selectedPeriodId = selectedPeriodId;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private int statusCode = 0;
+
+ public int getStatusCode()
+ {
+ return statusCode;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ Period period = PeriodType.createPeriodExternalId( selectedPeriodId );
+
+ if ( period == null )
+ {
+ return logError( "Illegal period identifier: " + selectedPeriodId );
+ }
+
+ EquipmentInstance equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+ OrganisationUnit organisationUnit = equipmentInstance.getOrganisationUnit();
+
+ DataSet dataSet = dataSetService.getDataSet( selectedDataSetId );
+
+
+ if ( dataSetService.isLocked( dataSet, period, organisationUnit, null ) )
+ {
+ return logError( "Entry locked for combination: " + dataSet + ", " + period + ", " + organisationUnit, 2 );
+ }
+
+
+
+ List<DataElement> dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
+
+ String storedBy = currentUserService.getCurrentUsername();
+
+ Date timestamp = new Date();
+
+ if ( storedBy == null )
+ {
+ storedBy = "[unknown]";
+ }
+
+
+ // ---------------------------------------------------------------------
+ // Add / Update data
+ // ---------------------------------------------------------------------
+ HttpServletRequest request = ServletActionContext.getRequest();
+
+ //String value = null;
+
+ if ( dataElements != null && dataElements.size() > 0 )
+ {
+ for ( DataElement dataElement : dataElements )
+ {
+ EquipmentDataValue equipmentDataValue = equipmentDataValueService.getEquipmentDataValue( equipmentInstance, period, dataElement );
+
+ String value = request.getParameter( PREFIX_DATAELEMENT + dataElement.getId() );
+
+ if ( value != null && value.trim().length() == 0 )
+ {
+ value = null;
+ }
+
+ if ( value != null )
+ {
+ value = value.trim();
+ }
+
+ if ( equipmentDataValue == null && value != null )
+ {
+ equipmentDataValue = new EquipmentDataValue();
+
+ equipmentDataValue.setValue( value );
+ equipmentDataValue.setDataElement( dataElement );
+ equipmentDataValue.setEquipmentInstance( equipmentInstance );
+ equipmentDataValue.setPeriod( period );
+ equipmentDataValue.setStoredBy( storedBy );
+ equipmentDataValue.setTimestamp( timestamp );
+ equipmentDataValueService.addEquipmentDataValue( equipmentDataValue );
+ }
+ else
+ {
+ equipmentDataValue.setDataElement( dataElement );
+ equipmentDataValue.setValue( value );
+ equipmentDataValue.setEquipmentInstance( equipmentInstance );
+ equipmentDataValue.setPeriod( period );
+ equipmentDataValue.setStoredBy( storedBy );
+ equipmentDataValue.setTimestamp( timestamp );
+ equipmentDataValueService.updateEquipmentDataValue( equipmentDataValue );
+ }
+ }
+
+ }
+
+ return SUCCESS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private String logError( String message )
+ {
+ return logError( message, 1 );
+ }
+
+ private String logError( String message, int statusCode )
+ {
+ log.info( message );
+
+ this.statusCode = statusCode;
+
+ return SUCCESS;
+ }
+
+
+}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentDataEntryFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentDataEntryFormAction.java 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentDataEntryFormAction.java 2012-05-23 06:35:17 +0000
@@ -2,13 +2,10 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.hisp.dhis.coldchain.inventory.Equipment;
-import org.hisp.dhis.coldchain.inventory.EquipmentDataValueService;
import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
import org.hisp.dhis.coldchain.inventory.EquipmentService;
@@ -28,14 +25,14 @@
// -------------------------------------------------------------------------
// Dependency
// -------------------------------------------------------------------------
-
+ /*
private EquipmentDataValueService equipmentDataValueService;
public void setEquipmentDataValueService( EquipmentDataValueService equipmentDataValueService )
{
this.equipmentDataValueService = equipmentDataValueService;
}
-
+ */
private EquipmentInstanceService equipmentInstanceService;
public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
@@ -66,21 +63,26 @@
{
this.equipmentInstanceId = equipmentInstanceId;
}
-
+
+ public Integer getEquipmentInstanceId()
+ {
+ return equipmentInstanceId;
+ }
+ /*
private Integer dataSetId;
public void setDataSetId( Integer dataSetId )
{
this.dataSetId = dataSetId;
}
-
+
private Integer periodId;
public void setPeriodId( Integer periodId )
{
this.periodId = periodId;
}
-
+ */
private List<DataSet> dataSetList;
public List<DataSet> getDataSetList()
@@ -155,12 +157,12 @@
dataSetList = new ArrayList<DataSet>( equipmentInstance.getInventoryType().getDataSets() );
Collections.sort( dataSetList, IdentifiableObjectNameComparator.INSTANCE );
-
+ /*
for( DataSet dataSet : dataSetList )
{
System.out.println( dataSet.getPeriodType().getId() +"--------" +dataSet.getPeriodType().getName());
}
-
+ */
inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryTypeService.getAllInventoryTypeAttributesForDisplay( inventoryType ));
@@ -197,7 +199,7 @@
inventoryTypeAttributeValue = tempNameValue[1];
- System.out.println( inventoryTypeAttributeName + "---" + inventoryTypeAttributeValue );
+ //System.out.println( inventoryTypeAttributeName + "---" + inventoryTypeAttributeValue );
/*
for( InventoryTypeAttribute inventoryTypeAttribute : inventoryTypeAttributeList )
@@ -237,6 +239,33 @@
}
*/
+ // data entry parts
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
return SUCCESS;
}
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-23 06:35:17 +0000
@@ -460,7 +460,8 @@
<property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
</bean>
-
+<!-- Equipment Data Entry related actions -->
+
<bean id="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentDataEntryFormAction"
class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentDataEntryFormAction"
scope="prototype">
@@ -468,22 +469,33 @@
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
<property name="equipmentService" ref="org.hisp.dhis.coldchain.inventory.EquipmentService" />
</bean>
-
- <bean id="org.hisp.dhis.coldchain.equipment.action.GetMetaDataAction" class="org.hisp.dhis.coldchain.equipment.action.GetMetaDataAction"
- scope="prototype">
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+<!--
+-->
+ <bean id="org.hisp.dhis.coldchain.equipment.action.LoadPeriodsAction" class="org.hisp.dhis.coldchain.equipment.action.LoadPeriodsAction" scope="prototype">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService"/>
</bean>
-
- <bean id="org.hisp.dhis.coldchain.equipment.action.LoadFormAction" class="org.hisp.dhis.coldchain.equipment.action.LoadFormAction"
- scope="prototype">
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
- <property name="dataEntryFormService" ref="org.hisp.dhis.dataentryform.DataEntryFormService" />
- </bean>
-
-
+
+
+ <bean id="org.hisp.dhis.coldchain.equipment.action.LoadNextPrePeriodsAction" class="org.hisp.dhis.coldchain.equipment.action.LoadNextPrePeriodsAction" scope="prototype">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService"/>
+ </bean>
+
+ <bean id="org.hisp.dhis.coldchain.equipment.action.LoadDataEntryFormAction"
+ class="org.hisp.dhis.coldchain.equipment.action.LoadDataEntryFormAction" scope="prototype">
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService"/>
+ <property name="equipmentDataValueService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDataValueService"/>
+ </bean>
+
+ <bean id="org.hisp.dhis.coldchain.equipment.action.SaveEquipmentDataValueAction"
+ class="org.hisp.dhis.coldchain.equipment.action.SaveEquipmentDataValueAction" scope="prototype">
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService"/>
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService"/>
+ <property name="equipmentDataValueService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDataValueService"/>
+
+ </bean>
+
+
+
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties'
--- local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-05-23 06:35:17 +0000
@@ -105,4 +105,8 @@
equipment_dataentry = Equipment dataentry
period = Period
prev_year = Prev year
-next_year = Next year
\ No newline at end of file
+next_year = Next year
+data_element = Dataelement
+entry = Entry
+earlier_periods = Earlier periods
+later_periods = Later periods
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml'
--- local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-05-23 06:35:17 +0000
@@ -464,6 +464,7 @@
<param name="requiredAuthorities">F_EQUIPMENT_DELETE</param>
</action>
+<!-- Equipment Data Entry related actions -->
<action name="showEquipmentDataEntryForm"
class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentDataEntryFormAction">
@@ -472,21 +473,33 @@
<param name="menu">/dhis-web-coldchain/menu.vm</param>
<param name="stylesheets">css/equipmentDataentry.css</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/equipment.js,javascript/equipmentDataEntry.js</param>
- <!--<param name="requiredAuthorities">F_EQUIPMENT_MANAGEMENT</param>
- <interceptor-ref name="organisationUnitTreeStack" />-->
- </action>
-
- <action name="getMetaData" class="org.hisp.dhis.coldchain.equipment.action.GetMetaDataAction">
- <result name="success" type="velocity-json">/dhis-web-coldchain/responseMetaData.vm</result>
- </action>
-
- <action name="loadForm" class="org.hisp.dhis.coldchain.equipment.action.LoadFormAction">
- <result name="custom" type="velocity">/dhis-web-coldchain/customForm.vm</result>
- <!--<result name="section" type="velocity">/dhis-web-coldchain/sectionForm.vm</result>-->
- <result name="default" type="velocity">/dhis-web-coldchain/defaultForm.vm</result>
- <result name="input" type="velocity">/dhis-web-coldchain/responseVoid.vm</result>
- </action>
-
-
+ <param name="requiredAuthorities">F_EQUIPMENT_DATAENTRY</param>
+ <!--<interceptor-ref name="organisationUnitTreeStack" />-->
+ </action>
+ <!--
+ -->
+ <action name="loadPeriods" class="org.hisp.dhis.coldchain.equipment.action.LoadPeriodsAction">
+ <result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonPeriods.vm</result>
+ </action>
+
+ <action name="getAvailableNextPrePeriods" class="org.hisp.dhis.coldchain.equipment.action.LoadNextPrePeriodsAction">
+ <result name="success" type="velocity-json">/dhis-web-coldchain/jsonPeriods.vm</result>
+ </action>
+
+ <!-- Load DataEntry Form -->
+ <action name="loadDataEntryForm" class="org.hisp.dhis.coldchain.equipment.action.LoadDataEntryFormAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-coldchain/loadDataEntryForm.vm</param>
+ <param name="requiredAuthorities">F_EQUIPMENT_DATAENTRY</param>
+ </action>
+
+
+ <!-- Save DataEntry Form -->
+ <action name="saveDataEntryForm" class="org.hisp.dhis.coldchain.equipment.action.SaveEquipmentDataValueAction">
+ <result name="success" type="redirect">enquipmentSelect.action</result>
+ <param name="requiredAuthorities">F_EQUIPMENT_DATAENTRY</param>
+ </action>
+
+
</package>
</struts>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/equipmentDataentry.css'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/equipmentDataentry.css 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/equipmentDataentry.css 2012-05-23 06:35:17 +0000
@@ -31,3 +31,9 @@
{
display: none;
}
+input[type="button"], input[type="submit"]
+{
+ width: 160px;
+ padding-left:5px;
+ padding-right:5px;
+}
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentDataEntry.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentDataEntry.vm 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentDataEntry.vm 2012-05-23 06:35:17 +0000
@@ -1,7 +1,7 @@
<script type="text/javascript">
//loadMetaData();
-var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ) , "'")';
+ var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ) , "'")';
</script>
<h3>$i18n.getString( "equipment_dataentry" ) #openHelp( "equipmentDataEntry" )</h3>
@@ -18,6 +18,12 @@
<br>
#end
-->
+<form id="dataEntryForm" name="dataEntryForm" action="saveDataEntryForm.action" method="post" >
+<div>
+ <input type="hidden" id="organisationUnitId" name="organisationUnitId" value="$organisationUnit.id">
+ <input type="hidden" id="inventoryTypeId" name="inventoryTypeId" value="$inventoryType.name">
+ <input type="hidden" id="equipmentInstanceId" name="equipmentInstanceId" value="$equipmentInstanceId">
+</div>
<div class="inputCriteria" style="width:600px;height:150px;">
<table>
<tr>
@@ -38,68 +44,37 @@
</tr>
<tr>
<td><label for="selectedDataSetId">$i18n.getString( "dataset" )</label></td>
- <td><select id="selectedDataSetId" name="selectedDataSetId" style="width:371px" onchange="getPeriods( 'periodType', 'periodId', 'periodId', '0' )">
+ <td><select id="selectedDataSetId" name="selectedDataSetId" style="width:371px" onchange="getPeriods()">
<option value="0">$i18n.getString( "please_select" )</option>
#foreach( $dataSet in $dataSetList )
<!--$dataSet.periodtype.id --------- $dataSet.periodtype.name-->
- <option value="$dataSet.id:$dataSet.PeriodType.name">$dataSet.name</option>
+ <!--<option value="$dataSet.id:$dataSet.PeriodType.name">$dataSet.name</option>-->
+ <option value="$dataSet.id">$dataSet.name</option>
#end
</select>
<span id="loaderSpan" style="display:none"><img src='../images/ajax-loader-bar.gif'></span></td>
</tr>
<tr>
<td><label for="selectedPeriodId">$i18n.getString( "period" )</label></td>
- <td><select id="periodId" name="periodId" style="width:220px" disabled="disabled" onchange="dataEntryForm()"></select>
- <input type="button" id="prevButton" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="getAvailablePeriodsPre( 'selectedDataSetId', 'periodId', 'periodId', '-1' )" disabled="disabled">
- <input type="button" id="nextButton" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="getAvailablePeriodsNext( 'selectedDataSetId', 'periodId', 'periodId', '1' )" disabled="disabled">
+ <td><select id="selectedPeriodId" name="selectedPeriodId" style="width:220px" disabled="disabled" onchange="loadDataEntryForm()">
+ <option value="-1">[$i18n.getString( "select" )]</option>
+ #foreach( $period in $periods )
+ <option value="$period.id">$encoder.htmlEncode( $period.name )</option>
+ #end
+ </select>
+ <input type="button" id="prevButton" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="getAvailablePeriodsTemp( 'selectedPeriodId', 'selectedPeriodId', '-1' )" disabled="disabled">
+ <input type="button" id="nextButton" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="getAvailablePeriodsTemp( 'selectedPeriodId', 'selectedPeriodId', '1' )" disabled="disabled">
</td>
</tr>
</table>
</div>
-
-#parse( "dhis-web-commons/loader/loader.vm" )
-
-<div id="contentDiv" class="page" style="margin-left:2px;margin-bottom:8px;"></div>
-
-<div id="historyDiv" class="page"></div>
-
-<div id="validationDiv" class="page"></div>
-
-<div id="completenessDiv" class="page inputCriteria" style="display:none;width:386px;height:29px;">
-<input type="button" id="completeButton" name="completeButton" value="$i18n.getString( 'complete' )" onclick="validateCompleteDataSet()" style="width:120px">
-<input type="button" id="undoButton" name="undoButton" value="$i18n.getString( 'incomplete' )" onclick="undoCompleteDataSet()" style="width:120px">
-<input type="button" value="$i18n.getString( 'run_validation' )" onclick="validate()" style="width:120px">
-</div>
-
-<div id="infoDiv" class="page inputCriteria" style="display:none;width:386px;height:20px;">
-<span style="color:#505050">$i18n.getString( "completed_by" ): </span><span id="completedBy"></span>
-<span style="color:#505050"> $i18n.getString( "at" ): </span><span id="completedDate"></span>
-<a href="javascript:displayUserDetails()">$i18n.getString( "see_details" )</a>
-</div>
-
-
-<div id="completedByDiv" style="display:none" class="page">
-<h3><span id="userFullName"></span></h3>
-<table>
- <tr>
- <td><label>$i18n.getString( "username" ):</label></td>
- <td><span id="userUsername"></span></td>
- </tr>
- <tr>
- <td><label>$i18n.getString( "email" ):</label></td>
- <td><span id="userEmail"></span></td>
- </tr>
- <tr>
- <td><label>$i18n.getString( "phone_number" ):</label></td>
- <td><span id="userPhoneNumber"></span></td>
- </tr>
- <tr>
- <td><label>$i18n.getString( "organisation_units" ):</label></td>
- <td><span id="userOrganisationUnits"></span></td>
- </tr>
- <tr>
- <td><label>$i18n.getString( "user_roles" ):</label></td>
- <td><span id="userUserRoles"></span></td>
- </tr>
-</table>
-</div>
+#parse( "/dhis-web-commons/loader/loader.vm" )
+<div id='dataEntryFormDiv'></div> <!-- DataEntry Form -->
+
+
+<p>
+ <input type="submit" class="button" value="$i18n.getString( 'save' )"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='enquipmentSelect.action'" />
+</p>
+
+</form>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipmentDataEntry.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipmentDataEntry.js 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipmentDataEntry.js 2012-05-23 06:35:17 +0000
@@ -1,131 +1,56 @@
-// Identifiers for which zero values are insignificant, also used in entry.js
-var significantZeros = [];
-
-// Array with associative arrays for each data element, populated in select.vm
-var dataElements = [];
-
-// Associative array with [indicator id, expression] for indicators in form,
-// also used in entry.js
-var indicatorFormulas = [];
-
-// Array with associative arrays for each data set, populated in select.vm
-var dataSets = [];
-
-// Associative array with identifier and array of assigned data sets
-var dataSetAssociationSets = [];
-
-// Associate array with mapping between organisation unit identifier and data
-// set association set identifier
-var organisationUnitAssociationSetMap = [];
-
-// Array with keys on form {dataelementid}-{optioncomboid}-min/max with min/max
-// values
-var currentMinMaxValueMap = [];
-
-// Indicates whether any data entry form has been loaded
-var dataEntryFormIsLoaded = false;
-
-// Indicates whether meta data is loaded
-var metaDataIsLoaded = false;
-
-// Currently selected organisation unit identifier
-var currentOrganisationUnitId = null;
-
-// Currently selected data set identifier
-var currentDataSetId = null;
-
-// Current offset, next or previous corresponding to increasing or decreasing
-// value with one
-var currentPeriodOffset = 0;
-
-// Username of user who marked the current data set as complete if any
-var currentCompletedByUser = null;
-
-// Period type object
-var periodTypeFactory = new PeriodType();
-
-
-var COLOR_GREEN = '#b9ffb9';
-var COLOR_YELLOW = '#fffe8c';
-var COLOR_RED = '#ff8a8a';
-var COLOR_ORANGE = '#ff6600';
-var COLOR_WHITE = '#ffffff';
-var COLOR_GREY = '#cccccc';
-
-var DEFAULT_TYPE = 'int';
-var DEFAULT_NAME = '[unknown]';
-
-var FORMTYPE_CUSTOM = 'custom';
-var FORMTYPE_SECTION = 'section';
-var FORMTYPE_DEFAULT = 'default';
-
-
-
-//dataSets = dataSets
-
-
-
-function loadMetaData()
-{
- var KEY_METADATA = 'metadata';
-
- $.ajax( {
- url: 'getMetaData.action',
- dataType: 'json',
- success: function( json )
- {
- sessionStorage[KEY_METADATA] = JSON.stringify( json.metaData );
- },
- complete: function()
- {
- var metaData = JSON.parse( sessionStorage[KEY_METADATA] );
-
- significantZeros = metaData.significantZeros;
- dataElements = metaData.dataElements;
- indicatorFormulas = metaData.indicatorFormulas;
- dataSets = metaData.dataSets;
- dataSetAssociationSets = metaData.dataSetAssociationSets;
- organisationUnitAssociationSetMap = metaData.organisationUnitAssociationSetMap;
-
- metaDataIsLoaded = true;
- selection.responseReceived(); // Notify that meta data is loaded
- $( '#loaderSpan' ).hide();
- log( 'Meta-data loaded' );
-
- updateForms();
- }
- } );
-}
-
-
// -----------------------------------------------------------------------------
-// DataSet Selection
+// Periods Selection
// -----------------------------------------------------------------------------
//function dataSetSelected()
-function getPeriods( periodType, periodId, periodId, timespan )
+//function getPeriods( periodType, periodId, periodId, timespan )
+function getPeriods()
{
- $( '#selectedPeriodId' ).removeAttr( 'disabled' );
+ $( '#dataEntryFormDiv' ).html( '' );
+
+ $( '#selectedPeriodId' ).removeAttr( 'disabled' );
$( '#prevButton' ).removeAttr( 'disabled' );
$( '#nextButton' ).removeAttr( 'disabled' );
-
+
+ //hideById('dataEntryFormDiv');
+ //setInnerHTML('dataEntryFormDiv', '');
+
+
var dataSetId = $( '#selectedDataSetId' ).val();
- var dataSetPeriod = dataSetId.split(":");
+ //var dataSetPeriod = dataSetId.split(":");
- var dataSetId = dataSetPeriod[0];
- var periodTypeId = dataSetPeriod[1];
+ //var dataSetId = dataSetPeriod[0];
+ //var periodTypeId = dataSetPeriod[1];
// var periodId = $( '#selectedPeriodId' ).val();
$( "#periodId" ).removeAttr( "disabled" );
+ var url = 'loadPeriods.action?dataSetId=' + dataSetId;
+
+ var list = document.getElementById( 'selectedPeriodId' );
+
+ clearList( list );
+
+ addOptionToList( list, '-1', '[ Select ]' );
+
+ $.getJSON( url, function( json ) {
+ for ( i in json.periods ) {
+ //addOptionToList( list, i, json.periods[i].name );
+ addOptionToList( list, json.periods[i].externalId, json.periods[i].name );
+ }
+ } );
+
+
//var periodId = "";
//alert( periodId );
//var periodId = $( '#periodId' );
- getAvailablePeriodsTemp( periodTypeId, periodId, periodId, timespan );
+
+
+ //getAvailablePeriodsTemp( periodTypeId, periodId, periodId, timespan );
//var periodType = dataSets[dataSetId].periodType;
@@ -162,7 +87,7 @@
}
*/
}
-
+/*
function getAvailablePeriodsPre( selectedDataSetId, periodId, periodId, timespan )
{
var dataSetId = $( '#selectedDataSetId' ).val();
@@ -188,17 +113,29 @@
getAvailablePeriodsTemp( periodTypeId, periodId, periodId, timespan );
}
-
-function getAvailablePeriodsTemp( periodTypeId, availablePeriodsId, selectedPeriodsId, year )
-{
- $.getJSON( "../dhis-web-commons-ajax-json/getAvailablePeriods.action", {
- "periodType": periodTypeId ,
+*/
+// next and pre periods
+function getAvailablePeriodsTemp( availablePeriodsId, selectedPeriodsId, year )
+{
+ $( '#dataEntryFormDiv' ).html( '' );
+ //clearEntryForm();
+ var dataSetId = $( '#selectedDataSetId' ).val();
+
+ //var dataSetPeriod = dataSetId.split(":");
+
+ //var dataSetId = dataSetPeriod[0];
+ //var periodTypeId = dataSetPeriod[1];
+
+ /*
+ $.getJSON( "getAvailableNextPrePeriods.action", {
+ "dataSetId": dataSetId ,
"year": year },
function( json ) {
var availableList = document.getElementById( availablePeriodsId );
var selectedList = document.getElementById( selectedPeriodsId );
clearList( availableList );
+ //addOptionById( 'availableList', '-1', '[ ' + i18n_select_period + ' ]' );
for ( var i = 0; i < json.periods.length; i++ )
{
if ( listContains( selectedList, json.periods[i].externalId ) == false )
@@ -207,77 +144,29 @@
}
}
} );
-}
-
-
-function dataEntryForm()
-{
-
- var tempDataSetId = $( '#selectedDataSetId' ).val();
-
- var dataSetPeriod = tempDataSetId.split(":");
-
- var dataSetId = dataSetPeriod[0];
- var periodTypeId = dataSetPeriod[1];
-
- var periodId = $( '#periodId' ).val();
-
- if ( periodId && periodId != -1 )
- {
- showLoader();
-
- //if ( dataEntryFormIsLoaded )
- //{
- //loadDataValues();
- //}
- //else
- //{
- loadForm( dataSetId );
- //}
- }
-}
-
-function loadForm( dataSetId )
-{
- //window.location.href = "loadForm.action?dataSetId=" + dataSetId;
-
-
- $( '#contentDiv' ).load( 'loadForm.action', {
- dataSetId : dataSetId
- } );
-
-
-
-
- /*
- if ( storageManager.formExists( dataSetId ) )
- {
- log( 'Loading form locally: ' + dataSetId );
-
- var html = storageManager.getForm( dataSetId );
-
- $( '#contentDiv' ).html( html );
-
- loadDataValues();
- }
- else
- {
- log( 'Loading form remotely: ' + dataSetId );
-
- $( '#contentDiv' ).load( 'loadForm.action', {
- dataSetId : dataSetId
- }, loadDataValues );
- }
- */
-}
-
-
-
-
-
-
-
-
+
+ loadDataEntryForm();
+ */
+
+ var availableList = document.getElementById( availablePeriodsId );
+ var selectedList = document.getElementById( selectedPeriodsId );
+
+ clearList( selectedList );
+
+ addOptionToList( selectedList, '-1', '[ Select ]' );
+
+ $.getJSON( "getAvailableNextPrePeriods.action", {
+ "dataSetId": dataSetId ,
+ "year": year },
+ function( json ) {
+
+ for ( i in json.periods ) {
+ //addOptionToList( list, i, json.periods[i].name );
+ addOptionToList( selectedList, json.periods[i].externalId, json.periods[i].name );
+ }
+
+ } );
+}
/*
@@ -301,3 +190,56 @@
} );
}
*/
+
+
+function loadDataEntryForm()
+{
+ //alert("mmmmm");
+
+ $( '#dataEntryFormDiv' ).html('');
+ //alert("mmmmm");
+ //setInnerHTML('dataEntryFormDiv', '');
+ //hideById('dataEntryFormDiv');
+ var dataSetId = $( '#selectedDataSetId' ).val();
+
+ //var dataSetPeriod = dataSetId.split(":");
+
+ //var dataSetId = dataSetPeriod[0];
+ //var periodTypeId = dataSetPeriod[1];
+
+ var organisationUnitId = $( '#organisationUnitId' ).val();
+ var inventoryTypeId = $( '#inventoryTypeId' ).val();
+ var equipmentInstanceId = $( '#equipmentInstanceId' ).val();
+
+ var selectedPeriodId = $( '#selectedPeriodId' ).val();
+
+ //setInnerHTML('dataEntryFormDiv', '');
+ //alert( dataSetId +"---"+ selectedPeriodId +"----"+ equipmentInstanceId );
+
+ //hideById('dataEntryFormDiv');
+ jQuery('#loaderDiv').show();
+
+ //contentDiv = 'dataEntryFormDiv';
+
+ jQuery('#dataEntryFormDiv').load('loadDataEntryForm.action',
+ {
+ dataSetId:dataSetId,
+ selectedPeriodId:selectedPeriodId,
+ equipmentInstanceId:equipmentInstanceId
+ }, function()
+ {
+ showById('dataEntryFormDiv');
+ jQuery('#loaderDiv').hide();
+ });
+ hideLoader();
+}
+
+
+function clearEntryForm()
+{
+ //$( '#contentDiv' ).html( '' );
+ $( '#dataEntryFormDiv' ).html( '' );
+ setInnerHTML('dataEntryFormDiv', '');
+ //$( '#completenessDiv' ).hide();
+ //$( '#infoDiv' ).hide();
+}
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonPeriods.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonPeriods.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonPeriods.vm 2012-05-23 06:35:17 +0000
@@ -0,0 +1,12 @@
+#set( $size = $periods.size() )
+{ "periods": [
+#foreach( $period in $periods )
+ {
+ "id": $!{period.id},
+ "startDate": "$!format.formatDate( ${period.startDate} )",
+ "endDate": "$!format.formatDate( ${period.endDate} )",
+ "name": "$!format.formatPeriod( ${period} )",
+ "externalId": "$!{period.externalId}"
+ }#if( $velocityCount < $size ),#end
+#end
+] }
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadDataEntryForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadDataEntryForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/loadDataEntryForm.vm 2012-05-23 06:35:17 +0000
@@ -0,0 +1,40 @@
+
+<!-- DATAELEMENTS -->
+<table>
+ <table id="dataEntryScreen" class='entryScreen formSection'>
+ <col id="deCol">
+ <col id="entryCol">
+ <tr>
+ <th>$i18n.getString( "data_element" )</th>
+ <th>$i18n.getString( "entry" )</th>
+ </tr>
+<tr><td> </td></tr>
+#set( $tabIndex = 1 )
+#if ( $dataElements.size() > 0)
+ #foreach($dataElement in $dataElements )
+ #set( $equipmentDataValue = "" )
+ #set( $equipmentDataValue = $!equipmentDataValueMap.get( $dataElement.id ) )
+ <tr>
+ <!--#set( $dataEntryId = "${dataElement.id}" )-->
+ <td class='text-column'><label>$dataElement.getFormNameFallback()</label></td>
+ <td class="input-column">
+ #if( $dataElement.type == "bool" )
+ <select name="dataelement$dataElement.id" id="dataelement$dataElement.id" tabindex="$tabIndex" style="width:300px">
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ <option value="true" #if( $equipmentDataValue == "true" ) selected="selected" #end >$i18n.getString( "yes" )</option>
+ <option value="false" #if( $equipmentDataValue == "false") selected="selected" #end >$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $dataElement.type == "date" )
+ <input type="text" id="dataelement$dataElement.id" name="dataelement$dataElement.id" value="$!equipmentDataValue" tabindex="$tabIndex" style="width:300px" />
+ <script type="text/javascript">
+ datePickerValid( 'dataelement${dataElement.id}' );
+ </script>
+ #else
+ <input type="text" id="dataelement$dataElement.id" name="dataelement$dataElement.id" value="$!equipmentDataValue" tabindex="$tabIndex" style="width:300px" />
+ #end
+ </td>
+ </tr>
+ #set( $tabIndex = $tabIndex + 1 )
+ #end
+#end
+</table>
=== modified file 'local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml 2012-02-17 11:32:11 +0000
+++ local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml 2012-05-23 06:35:17 +0000
@@ -350,9 +350,7 @@
<property name="dataElementCategoryService"
ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</bean>
-
-
-
+
<!-- DataElement Targets -->
<bean id="org.hisp.dhis.detarget.action.DeTargetListAction"
class="org.hisp.dhis.detarget.action.DeTargetListAction"