dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17505
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6989: CCEM work in progress
------------------------------------------------------------
revno: 6989
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-05-19 20:12:20 +0530
message:
CCEM work in progress
added:
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
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/customForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/defaultForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentDataEntry.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/data_entry.png
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/responseMetaData.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseVoid.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java
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/equipmentInstanceList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js
--
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/EquipmentService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java 2012-05-15 12:19:04 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentService.java 2012-05-19 14:42:20 +0000
@@ -1,6 +1,7 @@
package org.hisp.dhis.coldchain.inventory;
import java.util.Collection;
+import java.util.List;
public interface EquipmentService
{
@@ -17,4 +18,8 @@
Collection<Equipment> getEquipments( EquipmentInstance equipmentInstance );
Equipment getEquipment( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute );
+
+ //Map<String, String> inventryTypeAttributeAndValue( EquipmentInstance equipmentInstance, List<InventoryTypeAttribute> inventoryTypeAttributeList );
+
+ String inventryTypeAttributeAndValue( EquipmentInstance equipmentInstance, List<InventoryTypeAttribute> inventoryTypeAttributeList );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java 2012-05-02 09:18:42 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/comparator/InventoryTypeAttributeMandatoryComparator.java 2012-05-19 14:42:20 +0000
@@ -8,9 +8,21 @@
{
public int compare( InventoryTypeAttribute inventoryTypeAttribute0, InventoryTypeAttribute inventoryTypeAttribute1 )
{
+ if( ( inventoryTypeAttribute0.isMandatory() ) && ( inventoryTypeAttribute1.isMandatory() ) )
+ {
+ return inventoryTypeAttribute0.getName().compareToIgnoreCase( inventoryTypeAttribute1.getName() );
+ //Boolean boolean1 = inventoryTypeAttribute0.isMandatory();
+ //return boolean1.compareTo( inventoryTypeAttribute1.isMandatory() );
+ }
+ else
+ {
+ return inventoryTypeAttribute0.getName().compareToIgnoreCase( inventoryTypeAttribute1.getName() );
+ }
+ /*
if( inventoryTypeAttribute0.isMandatory() )
return 1;
else
return 0;
+ */
}
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java 2012-05-15 12:19:04 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentService.java 2012-05-19 14:42:20 +0000
@@ -1,6 +1,7 @@
package org.hisp.dhis.coldchain.inventory;
import java.util.Collection;
+import java.util.List;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@@ -51,5 +52,85 @@
{
return equipmentStore.getEquipment( equipmentInstance, inventoryTypeAttribute );
}
+ /*
+ public Map<String, String> inventryTypeAttributeAndValue( EquipmentInstance equipmentInstance, List<InventoryTypeAttribute> inventoryTypeAttributeList )
+ {
+ String inventoryTypeAttributeName = "";
+
+ String inventoryTypeAttributeValue = "";
+
+ String inventoryTypeAttributeNameValue = "";
+
+ Map<String, String> inventryTypeAttributeAndValueMap = new HashMap<String, String>();
+
+ for( InventoryTypeAttribute inventoryTypeAttribute : inventoryTypeAttributeList )
+ {
+ Equipment equipmentDetail = getEquipment( equipmentInstance, inventoryTypeAttribute );
+ if( equipmentDetail != null && equipmentDetail.getValue() != null )
+ {
+
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( equipmentDetail.getInventoryTypeAttribute().getValueType() ) )
+ {
+ inventryTypeAttributeAndValueMap.put( inventoryTypeAttribute.getName(), equipmentDetail.getInventoryTypeAttributeOption().getName() );
+
+ inventoryTypeAttributeName += "--" + inventoryTypeAttribute.getName();
+ inventoryTypeAttributeValue += "--" + equipmentDetail.getInventoryTypeAttributeOption().getName();
+ }
+ else
+ {
+ inventryTypeAttributeAndValueMap.put( inventoryTypeAttribute.getName(), equipmentDetail.getValue() );
+
+ inventoryTypeAttributeName += "--" + inventoryTypeAttribute.getName();
+ inventoryTypeAttributeValue += "--" + equipmentDetail.getValue();
+ }
+
+ inventoryTypeAttributeNameValue = inventoryTypeAttributeName + "#@" + inventoryTypeAttributeValue;
+ }
+ }
+
+
+
+ return inventryTypeAttributeAndValueMap;
+ }
+ */
+ public String inventryTypeAttributeAndValue( EquipmentInstance equipmentInstance, List<InventoryTypeAttribute> inventoryTypeAttributeList )
+ {
+ String inventoryTypeAttributeName = "";
+
+ String inventoryTypeAttributeValue = "";
+
+ String inventoryTypeAttributeNameValue = "";
+
+ //Map<String, String> inventryTypeAttributeAndValueMap = new HashMap<String, String>();
+
+ for( InventoryTypeAttribute inventoryTypeAttribute : inventoryTypeAttributeList )
+ {
+ Equipment equipmentDetail = getEquipment( equipmentInstance, inventoryTypeAttribute );
+ if( equipmentDetail != null && equipmentDetail.getValue() != null )
+ {
+
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( equipmentDetail.getInventoryTypeAttribute().getValueType() ) )
+ {
+ //inventryTypeAttributeAndValueMap.put( inventoryTypeAttribute.getName(), equipmentDetail.getInventoryTypeAttributeOption().getName() );
+
+ inventoryTypeAttributeName += "--" + inventoryTypeAttribute.getName();
+ inventoryTypeAttributeValue += "--" + equipmentDetail.getInventoryTypeAttributeOption().getName();
+ }
+ else
+ {
+ //inventryTypeAttributeAndValueMap.put( inventoryTypeAttribute.getName(), equipmentDetail.getValue() );
+
+ inventoryTypeAttributeName += "--" + inventoryTypeAttribute.getName();
+ inventoryTypeAttributeValue += "--" + equipmentDetail.getValue();
+ }
+
+ inventoryTypeAttributeNameValue = inventoryTypeAttributeName.substring( 2 ) + "#@#" + inventoryTypeAttributeValue.substring( 2 );
+ }
+ }
+
+ //System.out.println( inventoryTypeAttributeName + "#@#" + inventoryTypeAttributeValue );
+
+ return inventoryTypeAttributeNameValue;
+ }
}
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetMetaDataAction.java 2012-05-19 14:42:20 +0000
@@ -0,0 +1,131 @@
+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/LoadFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/LoadFormAction.java 2012-05-19 14:42:20 +0000
@@ -0,0 +1,302 @@
+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 );
+ }
+ }
+
+}
+
=== 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-17 09:53:19 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentDataEntryFormAction.java 2012-05-19 14:42:20 +0000
@@ -1,6 +1,24 @@
package org.hisp.dhis.coldchain.equipment.action;
+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;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.coldchain.inventory.comparator.InventoryTypeAttributeMandatoryComparator;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import com.opensymphony.xwork2.Action;
@@ -18,6 +36,26 @@
this.equipmentDataValueService = equipmentDataValueService;
}
+ private EquipmentInstanceService equipmentInstanceService;
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+ private EquipmentService equipmentService;
+
+ public void setEquipmentService( EquipmentService equipmentService )
+ {
+ this.equipmentService = equipmentService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -43,6 +81,64 @@
this.periodId = periodId;
}
+ private List<DataSet> dataSetList;
+
+ public List<DataSet> getDataSetList()
+ {
+ return dataSetList;
+ }
+
+ private OrganisationUnit organisationUnit;
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ private InventoryType inventoryType;
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
+ public List<InventoryTypeAttribute> inventoryTypeAttributeList;
+
+ public List<InventoryTypeAttribute> getInventoryTypeAttributeList()
+ {
+ return inventoryTypeAttributeList;
+ }
+
+ private Map<String, String> inventryTypeAttributeAndValueMap;
+
+
+
+ public Map<String, String> getInventryTypeAttributeAndValueMap()
+ {
+ return inventryTypeAttributeAndValueMap;
+ }
+
+ private String inventoryTypeAttributeNameValue;
+
+ public String getInventoryTypeAttributeNameValue()
+ {
+ return inventoryTypeAttributeNameValue;
+ }
+
+ private String inventoryTypeAttributeName;
+
+ public String getInventoryTypeAttributeName()
+ {
+ return inventoryTypeAttributeName;
+ }
+
+ private String inventoryTypeAttributeValue;
+
+ public String getInventoryTypeAttributeValue()
+ {
+ return inventoryTypeAttributeValue;
+ }
+
@@ -51,7 +147,96 @@
// -------------------------------------------------------------------------
public String execute() throws Exception
{
-
+
+ EquipmentInstance equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+ //equipmentInstance.getInventoryType().getDataSets();
+ organisationUnit = equipmentInstance.getOrganisationUnit();
+ inventoryType = equipmentInstance.getInventoryType();
+ 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 ));
+
+ if( inventoryTypeAttributeList == null || inventoryTypeAttributeList.size() == 0 )
+ {
+ inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+ Collections.sort( inventoryTypeAttributeList, new InventoryTypeAttributeMandatoryComparator() );
+ if( inventoryTypeAttributeList != null && inventoryTypeAttributeList.size() > 3 )
+ {
+ int count = 1;
+ Iterator<InventoryTypeAttribute> iterator = inventoryTypeAttributeList.iterator();
+ while( iterator.hasNext() )
+ {
+ iterator.next();
+
+ if( count > 3 )
+ iterator.remove();
+
+ count++;
+ }
+ }
+
+ }
+ //List<Equipment> equipmentDetailsList = new ArrayList<Equipment>( equipmentService.getEquipments( equipmentInstance ) );
+
+ //inventryTypeAttributeAndValueMap = new HashMap<String, String>();
+
+ //inventryTypeAttributeAndValueMap.putAll( equipmentService.inventryTypeAttributeAndValue( equipmentInstance, inventoryTypeAttributeList ));
+
+ inventoryTypeAttributeNameValue = equipmentService.inventryTypeAttributeAndValue( equipmentInstance, inventoryTypeAttributeList );
+ String[] tempNameValue = inventoryTypeAttributeNameValue.split( "#@#" );
+
+ inventoryTypeAttributeName = tempNameValue[0];
+
+ inventoryTypeAttributeValue = tempNameValue[1];
+
+ System.out.println( inventoryTypeAttributeName + "---" + inventoryTypeAttributeValue );
+
+ /*
+ for( InventoryTypeAttribute inventoryTypeAttribute : inventoryTypeAttributeList )
+ {
+
+ System.out.println( inventoryTypeAttribute.getName() + "---" + inventryTypeAttributeAndValueMap.get( inventoryTypeAttribute.getName()) );
+
+
+ Equipment equipmentDetails = equipmentService.getEquipment( equipmentInstance, inventoryTypeAttribute );
+ if( equipmentDetails != null && equipmentDetails.getValue() != null )
+ {
+ //System.out.println( inventoryTypeAttribute.getName() + "---" + equipmentDetails.getValue() );
+
+
+ //equipmentDetailsMap.put( equipmentInstance.getId()+":"+inventoryTypeAttribute1.getId(), equipmentDetails.getValue() );
+ }
+
+ }
+ */
+
+
+
+
+
+ /*
+
+ for( Equipment equipmentDetails : equipmentDetailsList )
+ {
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( equipmentDetails.getInventoryTypeAttribute().getValueType() ) )
+ {
+ equipmentValueMap.put( equipmentDetails.getInventoryTypeAttribute().getId(), equipmentDetails.getInventoryTypeAttributeOption().getName() );
+ }
+ else
+ {
+ equipmentValueMap.put( equipmentDetails.getInventoryTypeAttribute().getId(), equipmentDetails.getValue() );
+ }
+ }
+ */
+
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-17 07:33:28 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-19 14:42:20 +0000
@@ -461,4 +461,29 @@
</bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentDataEntryFormAction"
+ class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentDataEntryFormAction"
+ scope="prototype">
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ <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>
+
+ <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>
+
+
</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-17 07:33:28 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-05-19 14:42:20 +0000
@@ -100,4 +100,9 @@
display = For display
available_datasets = Available datasets
selected_datasets = Selected datasets
-dataset_inventorytype = Dataset inventorytype
\ No newline at end of file
+dataset_inventorytype = Dataset inventorytype
+dataset = Dataset
+equipment_dataentry = Equipment dataentry
+period = Period
+prev_year = Prev year
+next_year = Next year
\ 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-17 07:33:28 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-05-19 14:42:20 +0000
@@ -463,6 +463,30 @@
<result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
<param name="requiredAuthorities">F_EQUIPMENT_DELETE</param>
</action>
+
+
+ <action name="showEquipmentDataEntryForm"
+ class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentDataEntryFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/equipmentDataEntry.vm</param>
+ <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>
+
</package>
</struts>
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/equipmentDataentry.css 2012-05-19 14:42:20 +0000
@@ -0,0 +1,33 @@
+
+#currentSelection
+{
+ padding: 6px;
+ background-color: #e0e0e0;
+ border: 1px solid #a0a0a0;
+ font-size: 14px;
+ text-align: right;
+ position: fixed;
+ top: 55px;
+ right: 10px;
+ filter: alpha(opacity=85);
+ opacity: 0.85;
+ border-radius: 3px;
+}
+
+.currentRow
+{
+ background-color: #d5ffc5;
+ padding-right: 50px;
+}
+
+#actions
+{
+ float: right;
+ width: 160px;
+ text-align: right;
+}
+
+.hidden
+{
+ display: none;
+}
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/customForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/customForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/customForm.vm 2012-05-19 14:42:20 +0000
@@ -0,0 +1,1 @@
+$customDataEntryFormCode
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/defaultForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/defaultForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/defaultForm.vm 2012-05-19 14:42:20 +0000
@@ -0,0 +1,60 @@
+#set( $tabIndex = 1 )
+##set( $hasAccess = $auth.hasAccess( "dhis-web-dataentry", "saveValue" ) )
+
+#foreach( $categoryCombo in $orderedCategoryCombos )
+<table class="formSection" cellspacing="0">
+ #set( $colCount = $numberOfTotalColumns.get( $categoryCombo.id ) )
+ #set( $categories = $orderedCategories.get( $categoryCombo.id ) )
+ #set( $optionsMap = $orderedOptionsMap.get( $categoryCombo.id ) )
+ #set( $colRepeat = $catColRepeat.get( $categoryCombo.id ) )
+
+ #foreach( $category in $categories )
+ #set( $categoryOptions = $optionsMap.get( $category.id ) )
+ #set( $colCount = $colCount / $categoryOptions.size() )
+ <tr colspan="$colCount">
+ <td></td>
+ #set( $cols = $colRepeat.get( $category.id ) )
+ #foreach( $col in $cols )
+ #foreach( $categoryOption in $categoryOptions )
+ <th colspan="$colCount"><span align="center">#if( $categoryOption.isDefault() )${i18n.getString( "value" )}#else ${encoder.htmlEncode( $categoryOption.name )}#end</span></th>
+ #end
+ #end
+ </tr>
+ #end
+
+ #set( $count = 0 )
+ #set( $dataElements = $orderedDataElements.get( $categoryCombo ) )
+ #set( $optionCombos = $orderdCategoryOptionCombos.get( $categoryCombo.id ) )
+ #set( $mark = 0 )
+ #foreach( $optionCombo in $optionCombos )<span id="${optionCombo.id}-optioncombo" class="hidden">${encoder.htmlEncode( $optionCombo.name )}</span>
+ #end
+ #foreach( $dataElement in $dataElements )
+ #if( $mark == 1 )
+ #set( $mark = 0 )
+ #else
+ #set( $mark = 1 )
+ #end
+ #set( $count = $count + 1 )
+ <tr>
+ <td id="${dataElement.id}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end><span id="${dataElement.id}-dataelement">${encoder.htmlEncode( $dataElement.getFormNameFallback() )}</span></td>
+ #foreach( $optionCombo in $optionCombos )
+ #set( $dataEntryId = "${dataElement.id}-${optionCombo.id}-val" )
+ <td>
+ #if( $dataElement.type == "bool" )
+ <select name="entryselect" id="$dataEntryId" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "no_value" )]</option>
+ <option value="true">$i18n.getString( "yes" )</option>
+ <option value="false">$i18n.getString( "no" )</option>
+ </select>
+ #else
+ <input name="entryfield" id="$dataEntryId" type="text" tabindex="$tabIndex">
+ #end
+ </td>
+ #set( $tabIndex = $tabIndex + 1 )
+ #end
+ </tr>
+ #end
+</table>
+<br>
+<br>
+#end
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentDataEntry.vm 2012-05-19 14:42:20 +0000
@@ -0,0 +1,105 @@
+<script type="text/javascript">
+ //loadMetaData();
+
+var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "equipment_dataentry" ) #openHelp( "equipmentDataEntry" )</h3>
+<!--
+<div id="currentSelection">
+ <span style="float:left;cursor:pointer;margin-right:5px;"><img src="../images/hide.png" title="$i18n.getString( 'close' )" onclick="closeCurrentSelection()"></span>
+ <span id="currentOrganisationUnit">$i18n.getString( "no_organisationunit_selected" )</span> - <span id="currentPeriod">$i18n.getString( "no_period_selected" )</span/><br>
+ <span id="currentDataElement">$i18n.getString( "no_dataelement_selected" )</span>
+</div>
+-->
+<!--
+#foreach( $dataSet in $dataSetList )
+ $dataSet.PeriodType.id --------- $dataSet.PeriodType.name
+ <br>
+#end
+-->
+<div class="inputCriteria" style="width:600px;height:150px;">
+<table>
+ <tr>
+ <td><label for="selectedOrganisationUnit">$i18n.getString( "registering_unit" )</label></td>
+ <td><input type="text" id="selectedOrganisationUnit" readonly="readonly" value="$!organisationUnit.name" style="width:367px"></td>
+ </tr>
+ <tr>
+ <td><label for="selectedInventorytype">$i18n.getString( "inventorytype" )</label></td>
+ <td><input type="text" id="selectedInventorytype" readonly="readonly" value="$!inventoryType.name" style="width:367px"></td>
+ </tr>
+ <tr>
+ <td><label for="inventoryTypeAttribute">$i18n.getString( "inventorytype_attribute" )</label></td>
+ <td>$inventoryTypeAttributeName</td>
+ </tr>
+ <tr>
+ <td><label for="selectedInventorytype">$i18n.getString( "equipment_details" )</label></td>
+ <td>$inventoryTypeAttributeValue</td>
+ </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' )">
+ <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>
+ #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>
+ </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>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 2012-05-17 09:53:19 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 2012-05-19 14:42:20 +0000
@@ -61,7 +61,7 @@
#end
<td>
<a href="javascript:showUpdateEquipmentForm( '$equipmentInstance.id' )" title='$i18n.getString( "edit_equipment" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_equipment" )'></a>
- <a href="javascript:showEquipmentDataEntryForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_dataentry" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "equipment_tracking" )' style='width:25px; height:25px'></a>
+ <a href="javascript:showEquipmentDataEntryForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_dataentry" )'><img src="images/data_entry.png" alt='$i18n.getString( "equipment_tracking" )' style='width:25px; height:25px'></a>
#if( $inventoryType.tracking )
<a href="javascript:showEquipmentStatusForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "equipment_tracking" )' style='width:25px; height:25px'></a>
<a href="javascript:showEquipmentStatusHistoryForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking_history" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "equipment_tracking_history" )' style='width:25px; height:25px'></a>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/data_entry.png'
Binary files local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/data_entry.png 1970-01-01 00:00:00 +0000 and local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/data_entry.png 2012-05-19 14:42:20 +0000 differ
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js 2012-05-17 09:53:19 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js 2012-05-19 14:42:20 +0000
@@ -442,6 +442,9 @@
function showEquipmentDataEntryForm( equipmentInstanceId )
{
+
+ window.location.href = "showEquipmentDataEntryForm.action?equipmentInstanceId=" + equipmentInstanceId;
+ /*
hideById('listEquipmentDiv');
hideById('selectDiv');
hideById('searchEquipmentDiv');
@@ -458,6 +461,7 @@
});
jQuery('#resultSearchDiv').dialog('close');
+ */
}
function updateEquipmentDataEntry()
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipmentDataEntry.js 2012-05-19 14:42:20 +0000
@@ -0,0 +1,303 @@
+// 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
+// -----------------------------------------------------------------------------
+
+//function dataSetSelected()
+function getPeriods( periodType, periodId, periodId, timespan )
+{
+ $( '#selectedPeriodId' ).removeAttr( 'disabled' );
+ $( '#prevButton' ).removeAttr( 'disabled' );
+ $( '#nextButton' ).removeAttr( 'disabled' );
+
+ var dataSetId = $( '#selectedDataSetId' ).val();
+
+ var dataSetPeriod = dataSetId.split(":");
+
+ var dataSetId = dataSetPeriod[0];
+ var periodTypeId = dataSetPeriod[1];
+
+ // var periodId = $( '#selectedPeriodId' ).val();
+
+ $( "#periodId" ).removeAttr( "disabled" );
+
+ //var periodId = "";
+
+ //alert( periodId );
+ //var periodId = $( '#periodId' );
+ getAvailablePeriodsTemp( periodTypeId, periodId, periodId, timespan );
+
+ //var periodType = dataSets[dataSetId].periodType;
+
+ /*
+ var periodType = "monthly";
+ var periods = periodTypeFactory.get( periodType ).generatePeriods( currentPeriodOffset );
+ periods = periodTypeFactory.filterFuturePeriods( periods );
+
+ if ( dataSetId && dataSetId != -1 )
+ {
+ clearListById( 'selectedPeriodId' );
+
+ addOptionById( 'selectedPeriodId', '-1', '[ ' + i18n_select_period + ' ]' );
+
+ for ( i in periods )
+ {
+ addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
+ }
+
+ var previousPeriodType = currentDataSetId ? dataSets[currentDataSetId].periodType : null;
+
+ if ( periodId && periodId != -1 && previousPeriodType && previousPeriodType == periodType )
+ {
+ showLoader();
+ $( '#selectedPeriodId' ).val( periodId );
+ loadForm( dataSetId );
+ }
+ else
+ {
+ clearEntryForm();
+ }
+
+ currentDataSetId = dataSetId;
+ }
+ */
+}
+
+function getAvailablePeriodsPre( selectedDataSetId, periodId, periodId, timespan )
+{
+ var dataSetId = $( '#selectedDataSetId' ).val();
+
+ var dataSetPeriod = dataSetId.split(":");
+
+ var dataSetId = dataSetPeriod[0];
+ var periodTypeId = dataSetPeriod[1];
+
+ getAvailablePeriodsTemp( periodTypeId, periodId, periodId, timespan );
+
+}
+
+function getAvailablePeriodsNext( selectedDataSetId, periodId, periodId, timespan )
+{
+ var dataSetId = $( '#selectedDataSetId' ).val();
+
+ var dataSetPeriod = dataSetId.split(":");
+
+ var dataSetId = dataSetPeriod[0];
+ var periodTypeId = dataSetPeriod[1];
+
+ getAvailablePeriodsTemp( periodTypeId, periodId, periodId, timespan );
+
+}
+
+function getAvailablePeriodsTemp( periodTypeId, availablePeriodsId, selectedPeriodsId, year )
+{
+ $.getJSON( "../dhis-web-commons-ajax-json/getAvailablePeriods.action", {
+ "periodType": periodTypeId ,
+ "year": year },
+ function( json ) {
+ var availableList = document.getElementById( availablePeriodsId );
+ var selectedList = document.getElementById( selectedPeriodsId );
+ clearList( availableList );
+
+ for ( var i = 0; i < json.periods.length; i++ )
+ {
+ if ( listContains( selectedList, json.periods[i].externalId ) == false )
+ {
+ addValue( availableList, json.periods[i].name, json.periods[i].externalId );
+ }
+ }
+ } );
+}
+
+
+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 );
+ }
+ */
+}
+
+
+
+
+
+
+
+
+
+
+/*
+function getAvailablePeriods( periodTypeId, availablePeriodsId, selectedPeriodsId, year )
+{
+ $.getJSON( "../dhis-web-commons-ajax-json/getAvailablePeriods.action", {
+ "periodType": $( "#" + periodTypeId ).val(),
+ "year": year },
+ function( json ) {
+ var availableList = document.getElementById( availablePeriodsId );
+ var selectedList = document.getElementById( selectedPeriodsId );
+ clearList( availableList );
+
+ for ( var i = 0; i < json.periods.length; i++ )
+ {
+ if ( listContains( selectedList, json.periods[i].externalId ) == false )
+ {
+ addValue( availableList, json.periods[i].name, json.periods[i].externalId );
+ }
+ }
+ } );
+}
+*/
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseMetaData.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseMetaData.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseMetaData.vm 2012-05-19 14:42:20 +0000
@@ -0,0 +1,48 @@
+{ "metaData": {
+
+"significantZeros": [
+#set( $size = $significantZeros.size() )
+#foreach( $dataElement in $significantZeros )
+${dataElement.id}#if( $velocityCount < $size ),#end
+#end ],
+
+"dataElements": {
+#set( $size = $dataElements.size() )
+#foreach( $dataElement in $dataElements )
+"${dataElement.id}":"$encoder.jsonEncode( ${dataElement.getDetailedNumberType()} )"
+#if( $velocityCount < $size ),#end
+#end },
+
+"indicatorFormulas": {
+#set( $size = $indicators.size() )
+#foreach( $indicator in $indicators )
+"${indicator.id}":"($!{indicator.explodedNumerator})/($!{indicator.explodedDenominator})*($!{indicator.indicatorType.factor})"
+#if( $velocityCount < $size ),#end
+#end },
+
+"dataSets": {
+#set( $size = $dataSets.size() )
+#foreach( $dataSet in $dataSets )
+"${dataSet.id}":{"name":"$encoder.jsonEncode( ${dataSet.displayName} )","periodType":"$encoder.jsonEncode( ${dataSet.periodType.name} )",
+"version":"${dataSet.version}","type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}"
+}#if( $velocityCount < $size ),#end
+#end },
+
+"dataSetAssociationSets": {
+#set( $size1 = $dataSetAssociationSets.size() )
+#set( $index = 0 )
+#foreach( $associationSet in $dataSetAssociationSets )
+"${index}": [
+#set( $index = $index + 1 )
+#set( $size2 = $associationSet.size() )
+#foreach( $id in $associationSet )
+${id}#if( $velocityCount < $size2 ),#end
+#end ]#if( $velocityCount < $size1 ),#end
+#end },
+
+"organisationUnitAssociationSetMap": {
+#set( $size = $organisationUnitAssociationSetMap.size() )
+#foreach( $orgUnit in $organisationUnitAssociationSetMap.keySet() )
+"${orgUnit}":"$organisationUnitAssociationSetMap.get( ${orgUnit} )"#if( $velocityCount < $size ),#end
+#end }
+} }
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseVoid.vm'