← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2579: DatEntry Part Completed for DataElement Target Module

 

------------------------------------------------------------
revno: 2579
committer: Neeraj <neeraj.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-01-15 17:05:42 +0530
message:
  DatEntry Part Completed for DataElement Target Module
removed:
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/DelMappingAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GenerateTargetAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetDataElementsAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetMesageAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java
added:
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelMappingAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/FormAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GenerateTargetAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDataElementsAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetMesageAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/LoadNextPreviousPeriodsAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SaveMappingAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SavetargetValueAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SelectAction.java
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTreeForDeTarget.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/selectTarget.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/targetForm.vm
modified:
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/DefaultSelectedStateManager.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/SelectedStateManager.java
  local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties
  local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties
  local/in/dhis-web-survey/src/main/resources/struts.xml
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/form.js
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/general.js
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm


--
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
=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelMappingAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelMappingAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelMappingAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,133 @@
+package org.hisp.dhis.detarget.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.target.DeTargetMapping;
+import org.hisp.dhis.target.DeTargetMappingService;
+
+import com.opensymphony.xwork2.Action;
+
+public class DelMappingAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private DeTargetMappingService deTargetMappingService;
+
+    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
+    {
+        this.deTargetMappingService = deTargetMappingService;
+    }
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private String deID;
+
+    public void setDeID( String deID )
+    {
+        this.deID = deID;
+    }
+
+    @SuppressWarnings( "unused" )
+    private String detargetID;
+
+    public void setDetargetID( String detargetID )
+    {
+        this.detargetID = detargetID;
+    }
+
+    private String targetname;
+
+    public String getTargetname()
+    {
+        return targetname;
+    }
+
+    private String targetid;
+
+    public String getTargetid()
+    {
+        return targetid;
+    }
+
+    private String dename;
+
+    public String getDename()
+    {
+        return dename;
+    }
+
+    public String execute()
+        throws Exception
+    {
+        String[] de_option = deID.split( ":" );
+        int dataelementId = Integer.parseInt( de_option[0] );
+        int dataelementoptioncombo = Integer.parseInt( de_option[1] );
+
+        DataElement dataElement = dataElementService.getDataElement( dataelementId );
+
+        DataElementCategoryOptionCombo deoptioncombo = dataElementCategoryService
+            .getDataElementCategoryOptionCombo( dataelementoptioncombo );
+
+        DeTargetMapping deTargetMapping = deTargetMappingService.getDeTargetMapping( dataElement, deoptioncombo );
+
+        if( deTargetMapping != null )
+        {
+            deTargetMappingService.deleteDeTargetMapping( deTargetMapping );
+        }
+        
+        dename = dataElement.getName() + ":" + deoptioncombo.getName();
+
+        targetname = "None";
+        targetid = "-1";
+
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/FormAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/FormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/FormAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,209 @@
+package org.hisp.dhis.detarget.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.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.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementSortOrderComparator;
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetMember;
+import org.hisp.dhis.detarget.DeTargetService;
+import org.hisp.dhis.detargetdatavalue.DeTargetDataValue;
+import org.hisp.dhis.detargetdatavalue.DeTargetDataValueService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.survey.state.SelectedStateManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class FormAction
+implements Action
+{
+    //--------------------------------------------------------------------------
+    //Dependencies
+    //--------------------------------------------------------------------------
+ 
+    private SelectedStateManager selectedStateManager;
+    
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+    
+    private DeTargetDataValueService deTargetDataValueService;
+    
+    public void setDeTargetDataValueService( DeTargetDataValueService deTargetDataValueService )
+    {
+        this.deTargetDataValueService = deTargetDataValueService;
+    }
+    
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+
+    private PeriodService periodService;
+    
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+
+    @SuppressWarnings("unused")
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    } 
+   
+    // -------------------------------------------------------------------------
+    // DisplayPropertyHandler
+    // -------------------------------------------------------------------------
+   
+    @SuppressWarnings("unused")
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+    
+    //--------------------------------------------------------------------------
+    //Input/Output
+    //--------------------------------------------------------------------------
+    
+    
+    private Integer selectedDeTargetId;
+    
+    public Integer getSelectedDeTargetId()
+    {
+        return selectedDeTargetId;
+    }
+
+    public void setSelectedDeTargetId( Integer selectedDeTargetId )
+    {
+        this.selectedDeTargetId = selectedDeTargetId;
+    }
+
+    private List<DataElementCategoryCombo> orderedCategoryCombos = new ArrayList<DataElementCategoryCombo>();
+
+    public List<DataElementCategoryCombo> getOrderedCategoryCombos()
+    {
+        return orderedCategoryCombos;
+    }
+    
+    private Collection<DataElementCategoryOptionCombo> allOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+
+    public Collection<DataElementCategoryOptionCombo> getAllOptionCombos()
+    {
+        return allOptionCombos;
+    }
+    
+    private Map<Integer, Collection<DataElementCategoryOptionCombo>> orderdCategoryOptionCombos = new HashMap<Integer, Collection<DataElementCategoryOptionCombo>>();
+
+    public Map<Integer, Collection<DataElementCategoryOptionCombo>> getOrderdCategoryOptionCombos()
+    {
+        return orderdCategoryOptionCombos;
+    }
+    
+    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, Collection<DataElementCategory>> orderedCategories = new HashMap<Integer, Collection<DataElementCategory>>();
+
+    public Map<Integer, Collection<DataElementCategory>> getOrderedCategories()
+    {
+        return orderedCategories;
+    }
+
+    private Map<Integer, Integer> numberOfTotalColumns = new HashMap<Integer, Integer>();
+
+    public Map<Integer, Integer> getNumberOfTotalColumns()
+    {
+        return numberOfTotalColumns;
+    }
+    
+    private Map<String, DeTargetDataValue> deTargetDataValueMap;
+    
+    public Map<String, DeTargetDataValue> getDeTargetDataValueMap()
+    {
+        return deTargetDataValueMap;
+    }
+
+    private List<DeTargetMember> deTargetmembers;
+    
+    public List<DeTargetMember> getDeTargetmembers()
+    {
+        return deTargetmembers;
+    }
+    
+    private Integer selectedPeriodIndex;
+
+    public Integer getSelectedPeriodIndex()
+    {
+        return selectedPeriodIndex;
+    }
+
+    public void setSelectedPeriodIndex( Integer selectedPeriodIndex )
+    {
+        this.selectedPeriodIndex = selectedPeriodIndex;
+    }
+    
+    
+    //--------------------------------------------------------------------------
+    //Action Implementation
+    //--------------------------------------------------------------------------
+
+    public String execute()
+    {
+        deTargetDataValueMap = new HashMap<String, DeTargetDataValue>();
+        
+        OrganisationUnit orgUnit = selectedStateManager.getSelectedOrganisationUnit();
+        
+        DeTarget deTarget = selectedStateManager.getSelectedDeTarget();
+        
+        Period period = selectedStateManager.getSelectedPeriod();
+        
+        period = periodService.reloadPeriod( period );
+        
+        deTargetmembers = new ArrayList<DeTargetMember> ( deTargetService.getDeTargetMembers( deTarget ) );
+ 
+        // ---------------------------------------------------------------------
+        // Get the target Value and create a map
+        // ---------------------------------------------------------------------
+
+        Collection<DeTargetDataValue> deTargetDataValues = deTargetDataValueService.getDeTargetDataValues( deTarget, orgUnit, period );
+        
+        
+        for( DeTargetDataValue deTargetDataValue : deTargetDataValues)
+        {
+            String deOptionCombiId = deTargetDataValue.getDataelement().getId() + ":" + deTargetDataValue.getDecategoryOptionCombo().getId();
+            
+            deTargetDataValueMap.put( deOptionCombiId, deTargetDataValue );
+        }
+        
+        return SUCCESS;
+    }
+
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GenerateTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GenerateTargetAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GenerateTargetAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,138 @@
+package org.hisp.dhis.detarget.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
+import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+public class GenerateTargetAction
+    implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Comparator
+    // -------------------------------------------------------------------------
+
+    @SuppressWarnings("unused")
+	private Comparator<DataElementGroup> dataElementGroupComparator;
+
+    public void setDataElementGroupComparator( Comparator<DataElementGroup> dataElementGroupComparator )
+    {
+        this.dataElementGroupComparator = dataElementGroupComparator;
+    }
+
+    // -------------------------------------------------------------------------
+    // Parameters
+    // -------------------------------------------------------------------------
+    private List<DataElementGroup> dataElementGroups;
+
+    public List<DataElementGroup> getDataElementGroups()
+    {
+        return dataElementGroups;
+    }
+
+    public void setDataElementGroups( List<DataElementGroup> dataElementGroups )
+    {
+        this.dataElementGroups = dataElementGroups;
+    }
+
+    public void setDataElements( List<DataElement> dataElements )
+    {
+        this.dataElements = dataElements;
+    }
+
+    private List<DataElement> dataElements;
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+
+    private DataElementCategoryOptionCombo defaultoptioncombo;
+
+    public DataElementCategoryOptionCombo getDefaultoptioncombo()
+    {
+        return defaultoptioncombo;
+    }
+
+    private List<String> optionComboNames;
+
+    public List<String> getOptionComboNames()
+    {
+        return optionComboNames;
+    }
+
+    private List<String> optionComboIds;
+
+    public List<String> getOptionComboIds()
+    {
+        return optionComboIds;
+    }
+
+    public String execute()
+        throws Exception
+    {
+        optionComboIds = new ArrayList<String>();
+        optionComboNames = new ArrayList<String>();
+
+        /* DataElements and Groups */
+        dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
+        dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+
+        defaultoptioncombo = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
+
+        Collections.sort( dataElements, new DataElementNameComparator() );
+        Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
+
+        Iterator<DataElement> deIterator = dataElements.iterator();
+        while ( deIterator.hasNext() )
+        {
+            DataElement de = deIterator.next();
+            DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
+            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                dataElementCategoryCombo.getOptionCombos() );
+
+            Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+            while ( optionComboIterator.hasNext() )
+            {
+                DataElementCategoryOptionCombo decoc = optionComboIterator.next();
+                optionComboIds.add( de.getId() + ":" + decoc.getId() );
+
+                optionComboNames
+                    .add( de.getName() + ":" + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() );
+
+            }
+        }
+
+        return SUCCESS;
+    }
+}
\ No newline at end of file

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDataElementsAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDataElementsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDataElementsAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,197 @@
+package org.hisp.dhis.detarget.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+@SuppressWarnings("serial")
+public class GetDataElementsAction
+    extends ActionSupport
+{
+    private final static int ALL = 0;
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+    
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Comparator
+    // -------------------------------------------------------------------------
+
+    private Comparator<DataElement> dataElementComparator;
+
+    public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
+    {
+        this.dataElementComparator = dataElementComparator;
+    }
+
+    // -------------------------------------------------------------------------
+    // DisplayPropertyHandler
+    // -------------------------------------------------------------------------
+
+    private DisplayPropertyHandler displayPropertyHandler;
+
+    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
+    {
+        this.displayPropertyHandler = displayPropertyHandler;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    private String deOptionValue;
+
+    public void setDeOptionValue( String deOptionValue )
+    {
+        this.deOptionValue = deOptionValue;
+    }
+
+    public String getDeOptionValue()
+    {
+        return deOptionValue;
+    }
+
+    private List<DataElement> dataElements;
+
+    public List<DataElement> getDataElements()
+    {
+        return dataElements;
+    }
+    
+    private List<String> optionComboNames;
+
+    public List<String> getOptionComboNames()
+    {
+        return optionComboNames;
+    }
+
+    private List<String> optionComboIds;
+    
+    public List<String> getOptionComboIds()
+    {
+        return optionComboIds;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        optionComboIds = new ArrayList<String>();
+        optionComboNames = new ArrayList<String>();
+        
+        if ( id == null || id == ALL )
+        {            
+            dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );            
+        }
+        else
+        {
+            DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( id );
+
+            if ( dataElementGroup != null )
+            {
+                dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
+            }
+            else
+            {
+                dataElements = new ArrayList<DataElement>();
+            }
+        }
+         
+        Collections.sort( dataElements, dataElementComparator );
+
+        displayPropertyHandler.handle( dataElements );
+        
+        if ( deOptionValue != null )
+        {
+        	if( deOptionValue.equalsIgnoreCase( "optioncombo" ))
+            {
+                Iterator<DataElement> deIterator = dataElements.iterator();
+                while(deIterator.hasNext())
+                {
+                    DataElement de = deIterator.next();
+                    DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
+                    List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+                        dataElementCategoryCombo.getOptionCombos() );
+
+                    Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+                    while ( optionComboIterator.hasNext() )
+                    {
+                        DataElementCategoryOptionCombo decoc = optionComboIterator.next();
+                        optionComboIds.add( de.getId()+":"+decoc.getId());
+                        optionComboNames.add( de.getName()+":"+dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() );
+                        
+                    }   
+                }
+            }        	
+        }                     
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetMesageAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetMesageAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetMesageAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,145 @@
+package org.hisp.dhis.detarget.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.target.DeTargetMapping;
+import org.hisp.dhis.target.DeTargetMappingService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetMesageAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    
+    private DeTargetMappingService deTargetMappingService;
+    
+    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
+    {
+        this.deTargetMappingService = deTargetMappingService;
+    }
+    
+    
+    /*
+    private DeTargetMappingService deTargetMappingService;
+
+    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
+    {
+        this.deTargetMappingService = deTargetMappingService;
+    }
+    */
+    
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+    
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+
+    private String id;
+    
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+    
+    private String dename;
+    
+    public String getDename()
+    {
+        return dename;
+    }
+    
+    private String targetname;
+    
+    public String getTargetname()
+    {
+        return targetname;
+    }
+    
+    private String targetid;
+    
+    public String getTargetid()
+    {
+        return targetid;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        System.out.println("Inside GetMessage Action");
+        
+        String[] de_option = id.split( ":" );
+        int deid = Integer.parseInt( de_option[0] );
+        int optioncomboid = Integer.parseInt( de_option[1] );
+        
+        DataElement de = dataElementService.getDataElement( deid );
+        DataElementCategoryOptionCombo deoptioncombo = dataElementCategoryService.getDataElementCategoryOptionCombo( optioncomboid );
+                
+        DeTargetMapping deTargetMapping = deTargetMappingService.getDeTargetMapping( de, deoptioncombo );
+                
+        dename = de.getName() + ":" + deoptioncombo.getName();
+               
+        if ( deTargetMapping == null )
+        {
+         
+            targetname = "None";
+            targetid = "-1";
+        }
+        else
+        {
+            targetname = deTargetMapping.getTargetDataelement().getName();
+            targetid = "" + deTargetMapping.getTargetDataelement().getId() + ":" + deTargetMapping.getTargetoptioncombo().getId();
+        }
+        
+        System.out.println(dename + " : " + targetname);
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/LoadNextPreviousPeriodsAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/LoadNextPreviousPeriodsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/LoadNextPreviousPeriodsAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,87 @@
+package org.hisp.dhis.detarget.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.survey.state.SelectedStateManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class LoadNextPreviousPeriodsAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private boolean next;
+
+    public void setNext( boolean next )
+    {
+        this.next = next;
+    }
+
+    private boolean previous;
+
+    public void setPrevious( boolean previous )
+    {
+        this.previous = previous;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<Period> periods = new ArrayList<Period>();
+
+    public Collection<Period> getPeriods()
+    {
+        return periods;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        if ( next )
+        {
+            selectedStateManager.nextPeriodSpan();
+        }
+        else if ( previous )
+        {
+            selectedStateManager.previousPeriodSpan();
+        }
+
+        periods = selectedStateManager.getPeriodList();
+        
+        for ( Period period : periods )
+        {
+            period.setName( format.formatPeriod( period ) );
+        }
+        
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SaveMappingAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SaveMappingAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SaveMappingAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,206 @@
+package org.hisp.dhis.detarget.action;
+
+/*
+ * Copyright (c) 2004-2007, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.target.DeTargetMapping;
+import org.hisp.dhis.target.DeTargetMappingService;
+
+import com.opensymphony.xwork2.Action;
+
+public class SaveMappingAction
+    implements Action
+{
+    @SuppressWarnings("unused")
+	private static final Log LOG = LogFactory.getLog( SaveMappingAction.class );
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    private DeTargetMappingService deTargetMappingService;
+
+    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
+    {
+        this.deTargetMappingService = deTargetMappingService;
+    }
+
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/output
+    // -------------------------------------------------------------------------
+    
+    private int dataelementId;
+
+    public int getDataelementId()
+    {
+        return dataelementId;
+    }
+
+    private String deID;
+
+    public void setDeID( String deID )
+    {
+        this.deID = deID;
+    }
+
+    private String detargetID;
+
+    public void setDetargetID( String detargetID )
+    {
+        this.detargetID = detargetID;
+    }
+
+    public void setDataelementId( int dataelementId )
+    {
+        this.dataelementId = dataelementId;
+    }
+
+    private int detargetId;
+
+    public int getDetargetId()
+    {
+        return detargetId;
+    }
+
+    public void setDetargetId( int detargetId )
+    {
+        this.detargetId = detargetId;
+    }
+
+    private int dataelementoptioncombo;
+
+    public int getDataelementoptioncombo()
+    {
+        return dataelementoptioncombo;
+    }
+
+    public void setDataelementoptioncombo( int dataelementoptioncombo )
+    {
+        this.dataelementoptioncombo = dataelementoptioncombo;
+    }
+
+    private int targetoptioncombo;
+
+    public int getTargetoptioncombo()
+    {
+        return targetoptioncombo;
+    }
+
+    public void setTargetoptioncombo( int targetoptioncombo )
+    {
+        this.targetoptioncombo = targetoptioncombo;
+    }
+
+    private String dename;
+
+    public String getDename()
+    {
+        return dename;
+    }
+
+    private String targetname;
+
+    public String getTargetname()
+    {
+        return targetname;
+    }
+
+    private String targetid;
+
+    public String getTargetid()
+    {
+        return targetid;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        String[] de_option = deID.split( ":" );
+        int dataelementId = Integer.parseInt( de_option[0] );
+        int dataelementoptioncombo = Integer.parseInt( de_option[1] );
+
+        String[] de_option1 = detargetID.split( ":" );
+        int detargetId = Integer.parseInt( de_option1[0] );
+        int targetoptioncombo = Integer.parseInt( de_option1[1] );
+
+        DataElement dataElement = dataElementService.getDataElement( dataelementId );
+
+        DataElement target = dataElementService.getDataElement( detargetId );
+
+        DataElementCategoryOptionCombo deoptioncombo = dataElementCategoryService
+            .getDataElementCategoryOptionCombo( dataelementoptioncombo );
+
+        DataElementCategoryOptionCombo detargetoptioncombo = dataElementCategoryService
+            .getDataElementCategoryOptionCombo( targetoptioncombo );
+
+        DeTargetMapping deTargetMapping = deTargetMappingService.getDeTargetMapping( dataElement, deoptioncombo );
+
+        if ( deTargetMapping == null )
+        {
+            deTargetMapping = new DeTargetMapping( dataElement, deoptioncombo, target, detargetoptioncombo );
+
+            deTargetMappingService.addDeTargetMapping( deTargetMapping );
+        }
+        else
+        {
+            deTargetMapping.setTargetDataelement( target );
+            deTargetMapping.setTargetoptioncombo( detargetoptioncombo );
+            deTargetMappingService.updateDeTargetMapping( deTargetMapping );
+        }
+        dename = dataElement.getName() + ":" + deoptioncombo.getName();
+
+        targetname = deTargetMapping.getTargetDataelement().getName();
+        targetid = "" + deTargetMapping.getTargetDataelement().getId() + ":"
+        + deTargetMapping.getTargetoptioncombo().getId();
+
+        // dataElementCategoryOptionComboService.getDefaultDataElementCategoryOptionCombo();
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SavetargetValueAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SavetargetValueAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SavetargetValueAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,198 @@
+package org.hisp.dhis.detarget.action;
+
+import java.util.Date;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detargetdatavalue.DeTargetDataValue;
+import org.hisp.dhis.detargetdatavalue.DeTargetDataValueService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.survey.action.SaveValueAction;
+import org.hisp.dhis.survey.state.SelectedStateManager;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+public class SavetargetValueAction
+implements Action
+{
+    private static final Log LOG = LogFactory.getLog( SaveValueAction.class );
+    
+    //--------------------------------------------------------------------------
+    //Dependencies
+    //--------------------------------------------------------------------------
+    
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+        
+    private SelectedStateManager selectedStateManager;
+
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }    
+    
+    private DataElementService dataElementService;
+    
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+    
+    private DataElementCategoryService categoryService;
+
+    public void setCategoryService( DataElementCategoryService categoryService )
+    {
+        this.categoryService = categoryService;
+    }
+    
+    private DeTargetDataValueService deTargetdataValueService;
+    
+    public void setDeTargetdataValueService( DeTargetDataValueService deTargetdataValueService )
+    {
+        this.deTargetdataValueService = deTargetdataValueService;
+    }
+    
+    private PeriodService periodService;
+    
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
+    
+    //--------------------------------------------------------------------------
+    //Input/Output
+    //--------------------------------------------------------------------------
+    
+    private String value;
+
+    public void setValue( String value )
+    {
+        this.value = value;
+    }
+
+    private int dataElementId;
+
+    public void setDataElementId( int dataElementId )
+    {
+        this.dataElementId = dataElementId;
+    }
+
+    public int getDataElementId()
+    {
+        return dataElementId;
+    }
+
+    private int optionComboId;
+
+    public void setOptionComboId( int optionComboId )
+    {
+        this.optionComboId = optionComboId;
+    }
+
+    public int getOptionComboId()
+    {
+        return optionComboId;
+    }
+
+    private Date timestamp;
+
+    public Date getTimestamp()
+    {
+        return timestamp;
+    }
+
+    private String storedBy;
+
+    public String getStoredBy()
+    {
+        return storedBy;
+    }
+    
+    private int detargetid;
+    
+    public int getDetargetid()
+    {
+        return detargetid;
+    }
+
+    public void setDetargetid( int detargetid )
+    {
+        this.detargetid = detargetid;
+    }
+    
+    //--------------------------------------------------------------------------
+    //Action Implementation
+    //--------------------------------------------------------------------------
+    
+    public String execute()
+    {
+        OrganisationUnit orgUnit = selectedStateManager.getSelectedOrganisationUnit();
+        
+        Period period = selectedStateManager.getSelectedPeriod();
+        
+        period = periodService.reloadPeriod( period );
+        
+        DataElement dataElement = dataElementService.getDataElement( dataElementId );
+        
+        storedBy = currentUserService.getCurrentUsername();
+        
+        DeTarget deTarget = selectedStateManager.getSelectedDeTarget();
+        
+        DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
+        
+        if ( storedBy == null )
+        {
+            storedBy = "[unknown]";
+        }
+
+        if ( value != null && value.trim().length() == 0 )
+        {
+            value = null;
+        }
+
+        if ( value != null )
+        {
+            value = value.trim();
+        }
+        
+        DeTargetDataValue dataValue = deTargetdataValueService.getDeTargetDataValue( orgUnit, deTarget, period, dataElement, optionCombo );
+        if ( dataValue == null )
+        {
+            if ( value != null )
+            {
+                LOG.debug( "Adding DataValue, value added" );
+
+                dataValue = new DeTargetDataValue( deTarget, dataElement, optionCombo, orgUnit, period, value, storedBy, new Date() );
+
+                deTargetdataValueService.addDeTargetDataValue( dataValue );
+                
+            }
+        }
+        else
+            {       
+                    LOG.debug( "Updating DataValue, value added/changed" );
+            
+                    dataValue.setValue( value );
+                    dataValue.setTimestamp( new Date() );
+                    dataValue.setStoredBy( storedBy );
+            
+                    deTargetdataValueService.updateDeTargetDataValue( dataValue );
+                    
+            }
+            
+        return SUCCESS;
+    }
+
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SelectAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SelectAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SelectAction.java	2011-01-15 11:35:42 +0000
@@ -0,0 +1,184 @@
+package org.hisp.dhis.detarget.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.survey.state.SelectedStateManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class SelectAction
+implements Action
+{
+    //--------------------------------------------------------------------------
+    //Dependencies
+    //--------------------------------------------------------------------------
+    
+    private SelectedStateManager selectedStateManager;
+    
+    public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+    {
+        this.selectedStateManager = selectedStateManager;
+    }
+    
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+    
+    private I18nFormat format;
+
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+    
+    //--------------------------------------------------------------------------
+    //Input/Output
+    //--------------------------------------------------------------------------
+    
+    private OrganisationUnit orgUnit;
+    
+    public OrganisationUnit getOrgUnit()
+    {
+        return orgUnit;
+    }
+
+    private List<DeTarget> deTargets = new ArrayList<DeTarget>();
+    
+    public List<DeTarget> getDeTargets()
+    {
+        return deTargets;
+    }
+    
+    private Period period;
+    
+    public Period getPeriod()
+    {
+        return period;
+    }
+    
+    private Integer selectedDeTargetId;
+    
+    public Integer getSelectedDeTargetId()
+    {
+        return selectedDeTargetId;
+    }
+
+    public void setSelectedDeTargetId( Integer selectedDeTargetId )
+    {
+        this.selectedDeTargetId = selectedDeTargetId;
+    }
+    
+    private Integer selectedPeriodIndex;
+
+    public Integer getSelectedPeriodIndex()
+    {
+        return selectedPeriodIndex;
+    }
+
+    public void setSelectedPeriodIndex( Integer selectedPeriodIndex )
+    {
+        this.selectedPeriodIndex = selectedPeriodIndex;
+    }
+
+    private List<Period> periods = new ArrayList<Period>();
+
+    public Collection<Period> getPeriods()
+    {
+        return periods;
+    }
+
+
+    //--------------------------------------------------------------------------
+    //Action Implementation
+    //--------------------------------------------------------------------------
+
+    public String execute()
+    {
+        orgUnit = selectedStateManager.getSelectedOrganisationUnit();
+        
+        if( orgUnit == null )
+        {
+            selectedDeTargetId = null;
+            
+            selectedStateManager.clearSelectedDeTarget();
+            
+            return SUCCESS;
+        }
+        
+        // ---------------------------------------------------------------------
+        // Load Targets
+        // ---------------------------------------------------------------------
+        
+        deTargets = selectedStateManager.loadDeTargetsForSelectedOrgUnit( orgUnit );
+        
+        DeTarget selectedDeTarget;
+        
+        if( selectedDeTargetId != null )
+        {
+            selectedDeTarget = deTargetService.getDeTarget( selectedDeTargetId );
+        }
+        else
+        {
+            selectedDeTarget = selectedStateManager.getSelectedDeTarget();
+        }
+        
+        if( selectedDeTarget != null && deTargets.contains( selectedDeTarget ) )
+        {
+            selectedDeTargetId = selectedDeTarget.getId();
+            
+            selectedStateManager.setSelectedDeTarget( selectedDeTarget );
+            
+            periods = selectedStateManager.getPeriodList();
+            
+            for ( Period period : periods )
+            {
+                period.setName( format.formatPeriod( period ) );
+            }
+        }
+        else
+        {
+            selectedDeTargetId = null;
+            
+            selectedStateManager.clearSelectedDeTarget();
+            
+            return SUCCESS;
+        }
+        
+        // ---------------------------------------------------------------------
+        // Validate selected period
+        // ---------------------------------------------------------------------
+
+        if ( selectedPeriodIndex == null )
+        {
+            selectedPeriodIndex = selectedStateManager.getSelectedPeriodIndex();
+            
+        }
+
+        if ( selectedPeriodIndex != null && selectedPeriodIndex >= 0 )
+        {
+            selectedStateManager.setSelectedPeriodIndex( selectedPeriodIndex );
+            
+            period = selectedStateManager.getSelectedPeriod();
+        }
+        
+        
+        else
+        {
+            selectedStateManager.clearSelectedPeriod();
+
+            return SUCCESS;
+        }
+        return "defaulttargetform";
+    }
+
+}

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/DefaultSelectedStateManager.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/DefaultSelectedStateManager.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/DefaultSelectedStateManager.java	2011-01-15 11:35:42 +0000
@@ -28,11 +28,22 @@
  */
 
 import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+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.period.YearlyPeriodType;
 import org.hisp.dhis.survey.Survey;
 import org.hisp.dhis.survey.SurveyService;
 
@@ -47,7 +58,15 @@
     implements SelectedStateManager
 {
 
+    private static final Log log = LogFactory.getLog( DefaultSelectedStateManager.class );
+    
     public static final String SESSION_KEY_SELECTED_SURVEY_ID = "data_entry_selected_survey_id";
+    
+    public static final String SESSION_KEY_SELECTED_DETARGET_ID = "data_entry_selected_deTarget_id";
+    
+    public static final String SESSION_KEY_SELECTED_PERIOD_INDEX = "data_entry_selected_period_index";
+    
+    public static final String SESSION_KEY_BASE_PERIOD = "data_entry_base_period";
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -60,12 +79,26 @@
         this.surveyService = surveyService;
     }
     
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+
     private OrganisationUnitSelectionManager selectionManager;
 
     public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
     {
         this.selectionManager = selectionManager;
     }
+    
+    private PeriodService periodService;
+    
+    public void setPeriodService( PeriodService periodService )
+    {
+        this.periodService = periodService;
+    }
 
     // -------------------------------------------------------------------------
     // SelectedStateManager implementation
@@ -107,11 +140,159 @@
 
         return surveys;
     }
+    
+    //--------------------------------------------------------------------------
+    //DeTarget
+    //--------------------------------------------------------------------------
+    
+    public void setSelectedDeTarget( DeTarget deTarget )
+    {
+        getSession().put( SESSION_KEY_SELECTED_DETARGET_ID, deTarget.getId() );
+    }
+    
+    public DeTarget getSelectedDeTarget()
+    {
+        Integer deTargetId = (Integer) getSession().get( SESSION_KEY_SELECTED_DETARGET_ID );
+        
+        return deTargetId != null ? deTargetService.getDeTarget( deTargetId ) : null;
+    }
+    
+    public void clearSelectedDeTarget()
+    {
+        getSession().remove( SESSION_KEY_SELECTED_DETARGET_ID );
+    }
+    
+    public List<DeTarget> loadDeTargetsForSelectedOrgUnit( OrganisationUnit organisationUnit )
+    {
+        List<DeTarget> deTargets = new ArrayList<DeTarget>( deTargetService.getDeTargetBySource( organisationUnit ) );
+        
+        return deTargets;
+    }
+    
+    
+    // -------------------------------------------------------------------------
+    // Period
+    // -------------------------------------------------------------------------
+    
+    public void setSelectedPeriodIndex( Integer index )
+    {
+        getSession().put( SESSION_KEY_SELECTED_PERIOD_INDEX, index );
+    }
+
+    public Integer getSelectedPeriodIndex()
+    {
+        return (Integer) getSession().get( SESSION_KEY_SELECTED_PERIOD_INDEX );
+    }
+
+    public Period getSelectedPeriod()
+    {
+        Integer index = getSelectedPeriodIndex();
+        
+        if ( index == null )
+        {
+            return null;
+        }
+
+        List<Period> periods = getPeriodList();
+        
+        if ( index >= 0 && index < periods.size() )
+        {
+            return periods.get( index );
+        }
+
+        return null;
+    }
+
+    public void clearSelectedPeriod()
+    {
+        getSession().remove( SESSION_KEY_SELECTED_PERIOD_INDEX );
+    }
+
+    public List<Period> getPeriodList()
+    {
+        Period basePeriod = getBasePeriod();
+        CalendarPeriodType periodType = (CalendarPeriodType) getPeriodType();
+        List<Period> periods = periodType.generatePeriods( basePeriod );
+
+        Date now = new Date();
+
+        Iterator<Period> iterator = periods.iterator();
+        
+        while ( iterator.hasNext() )
+        {
+            if ( iterator.next().getStartDate().after( now ) )
+            {
+                iterator.remove();
+            }
+        }
+        
+        return periods;
+    }
+    
+    public void nextPeriodSpan()
+    {
+        List<Period> periods = getPeriodList();
+
+        Period basePeriod = periods.get( periods.size() - 1 );
+        CalendarPeriodType periodType = (CalendarPeriodType) getPeriodType();
+        Period newBasePeriod = periodType.getNextPeriod( basePeriod );
+
+        if ( newBasePeriod.getStartDate().before( new Date() ) ) // Future periods not allowed
+        {
+            getSession().put( SESSION_KEY_BASE_PERIOD, newBasePeriod );
+        }
+    }
+
+    public void previousPeriodSpan()
+    {
+        List<Period> periods = getPeriodList();
+
+        CalendarPeriodType periodType = (CalendarPeriodType) getPeriodType();
+        Period basePeriod = periods.get( 0 );
+        Period newBasePeriod = periodType.getPreviousPeriod( basePeriod );
+
+        getSession().put( SESSION_KEY_BASE_PERIOD, newBasePeriod );
+    }
+
+    public Period reloadPeriod(){
+        
+        Period period = getSelectedPeriod();
+
+        return periodService.reloadPeriod( period );
+    }
 
     // -------------------------------------------------------------------------
     // Support methods
     // -------------------------------------------------------------------------
-
+    private PeriodType getPeriodType()
+    {
+        return new YearlyPeriodType();
+    }
+    
+    private Period getBasePeriod()
+    {
+        Period basePeriod = (Period) getSession().get( SESSION_KEY_BASE_PERIOD );
+        
+        PeriodType periodType = new YearlyPeriodType();
+
+        if ( basePeriod == null )
+        {
+            log.debug( "Base period is null, creating new" );
+
+            basePeriod = periodType.createPeriod();
+            getSession().put( SESSION_KEY_BASE_PERIOD, basePeriod );
+        }
+        else if ( !basePeriod.getPeriodType().equals( periodType ) )
+        {
+            log.debug( "Wrong type of base period, transforming" );
+
+            basePeriod = periodType.createPeriod( basePeriod.getStartDate() );
+            getSession().put( SESSION_KEY_BASE_PERIOD, basePeriod );
+        }
+
+        return basePeriod;
+    }
+    
     private static final Map<String, Object> getSession()
     {
         return ActionContext.getContext().getSession();

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/SelectedStateManager.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/SelectedStateManager.java	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/survey/state/SelectedStateManager.java	2011-01-15 11:35:42 +0000
@@ -29,7 +29,9 @@
 
 import java.util.List;
 
+import org.hisp.dhis.detarget.DeTarget;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
 import org.hisp.dhis.survey.Survey;
 
 /**
@@ -54,6 +56,39 @@
 
     void clearSelectedSurvey();
     
-    List<Survey> loadSurveysForSelectedOrgUnit( OrganisationUnit organisationUnit );    
+    List<Survey> loadSurveysForSelectedOrgUnit( OrganisationUnit organisationUnit ); 
+    
+    //--------------------------------------------------------------------------
+    //DeTarget
+    //--------------------------------------------------------------------------
+    
+    void setSelectedDeTarget( DeTarget deTarget );
+    
+    DeTarget getSelectedDeTarget();
+    
+    void clearSelectedDeTarget();
+    
+    List<DeTarget> loadDeTargetsForSelectedOrgUnit( OrganisationUnit organisationUnit );
+    
+    //--------------------------------------------------------------------------
+    //Period
+    //--------------------------------------------------------------------------
+    
+    void setSelectedPeriodIndex( Integer index );
+
+    Integer getSelectedPeriodIndex();
+
+    Period getSelectedPeriod();
+
+    void clearSelectedPeriod();
+
+    List<Period> getPeriodList();
+
+    void nextPeriodSpan();
+
+    void previousPeriodSpan();
+    
+    Period reloadPeriod();
+    
    
 }

=== removed directory 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target'
=== removed directory 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action'
=== removed file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/DelMappingAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/DelMappingAction.java	2010-06-16 11:17:12 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/DelMappingAction.java	1970-01-01 00:00:00 +0000
@@ -1,133 +0,0 @@
-package org.hisp.dhis.target.action;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.target.DeTargetMapping;
-import org.hisp.dhis.target.DeTargetMappingService;
-
-import com.opensymphony.xwork2.Action;
-
-public class DelMappingAction
-    implements Action
-{
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    private DeTargetMappingService deTargetMappingService;
-
-    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
-    {
-        this.deTargetMappingService = deTargetMappingService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
-    private String deID;
-
-    public void setDeID( String deID )
-    {
-        this.deID = deID;
-    }
-
-    @SuppressWarnings( "unused" )
-    private String detargetID;
-
-    public void setDetargetID( String detargetID )
-    {
-        this.detargetID = detargetID;
-    }
-
-    private String targetname;
-
-    public String getTargetname()
-    {
-        return targetname;
-    }
-
-    private String targetid;
-
-    public String getTargetid()
-    {
-        return targetid;
-    }
-
-    private String dename;
-
-    public String getDename()
-    {
-        return dename;
-    }
-
-    public String execute()
-        throws Exception
-    {
-        String[] de_option = deID.split( ":" );
-        int dataelementId = Integer.parseInt( de_option[0] );
-        int dataelementoptioncombo = Integer.parseInt( de_option[1] );
-
-        DataElement dataElement = dataElementService.getDataElement( dataelementId );
-
-        DataElementCategoryOptionCombo deoptioncombo = dataElementCategoryService
-            .getDataElementCategoryOptionCombo( dataelementoptioncombo );
-
-        DeTargetMapping deTargetMapping = deTargetMappingService.getDeTargetMapping( dataElement, deoptioncombo );
-
-        if( deTargetMapping != null )
-        {
-            deTargetMappingService.deleteDeTargetMapping( deTargetMapping );
-        }
-        
-        dename = dataElement.getName() + ":" + deoptioncombo.getName();
-
-        targetname = "None";
-        targetid = "-1";
-
-        return SUCCESS;
-    }
-}

=== removed file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GenerateTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GenerateTargetAction.java	2010-06-16 11:17:12 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GenerateTargetAction.java	1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
-package org.hisp.dhis.target.action;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
-import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
-
-import com.opensymphony.xwork2.Action;
-
-public class GenerateTargetAction
-    implements Action
-{
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Comparator
-    // -------------------------------------------------------------------------
-
-    @SuppressWarnings("unused")
-	private Comparator<DataElementGroup> dataElementGroupComparator;
-
-    public void setDataElementGroupComparator( Comparator<DataElementGroup> dataElementGroupComparator )
-    {
-        this.dataElementGroupComparator = dataElementGroupComparator;
-    }
-
-    // -------------------------------------------------------------------------
-    // Parameters
-    // -------------------------------------------------------------------------
-    private List<DataElementGroup> dataElementGroups;
-
-    public List<DataElementGroup> getDataElementGroups()
-    {
-        return dataElementGroups;
-    }
-
-    public void setDataElementGroups( List<DataElementGroup> dataElementGroups )
-    {
-        this.dataElementGroups = dataElementGroups;
-    }
-
-    public void setDataElements( List<DataElement> dataElements )
-    {
-        this.dataElements = dataElements;
-    }
-
-    private List<DataElement> dataElements;
-
-    public List<DataElement> getDataElements()
-    {
-        return dataElements;
-    }
-
-    private DataElementCategoryOptionCombo defaultoptioncombo;
-
-    public DataElementCategoryOptionCombo getDefaultoptioncombo()
-    {
-        return defaultoptioncombo;
-    }
-
-    private List<String> optionComboNames;
-
-    public List<String> getOptionComboNames()
-    {
-        return optionComboNames;
-    }
-
-    private List<String> optionComboIds;
-
-    public List<String> getOptionComboIds()
-    {
-        return optionComboIds;
-    }
-
-    public String execute()
-        throws Exception
-    {
-        optionComboIds = new ArrayList<String>();
-        optionComboNames = new ArrayList<String>();
-
-        /* DataElements and Groups */
-        dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
-        dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
-
-        defaultoptioncombo = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-
-        Collections.sort( dataElements, new DataElementNameComparator() );
-        Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
-
-        Iterator<DataElement> deIterator = dataElements.iterator();
-        while ( deIterator.hasNext() )
-        {
-            DataElement de = deIterator.next();
-            DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
-            List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
-                dataElementCategoryCombo.getOptionCombos() );
-
-            Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-            while ( optionComboIterator.hasNext() )
-            {
-                DataElementCategoryOptionCombo decoc = optionComboIterator.next();
-                optionComboIds.add( de.getId() + ":" + decoc.getId() );
-
-                optionComboNames
-                    .add( de.getName() + ":" + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() );
-
-            }
-        }
-
-        return SUCCESS;
-    }
-}
\ No newline at end of file

=== removed file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetDataElementsAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetDataElementsAction.java	2010-06-16 11:17:12 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetDataElementsAction.java	1970-01-01 00:00:00 +0000
@@ -1,197 +0,0 @@
-package org.hisp.dhis.target.action;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-@SuppressWarnings("serial")
-public class GetDataElementsAction
-    extends ActionSupport
-{
-    private final static int ALL = 0;
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-    
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Comparator
-    // -------------------------------------------------------------------------
-
-    private Comparator<DataElement> dataElementComparator;
-
-    public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
-    {
-        this.dataElementComparator = dataElementComparator;
-    }
-
-    // -------------------------------------------------------------------------
-    // DisplayPropertyHandler
-    // -------------------------------------------------------------------------
-
-    private DisplayPropertyHandler displayPropertyHandler;
-
-    public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
-    {
-        this.displayPropertyHandler = displayPropertyHandler;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input & output
-    // -------------------------------------------------------------------------
-
-    private Integer id;
-
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-
-    private String deOptionValue;
-
-    public void setDeOptionValue( String deOptionValue )
-    {
-        this.deOptionValue = deOptionValue;
-    }
-
-    public String getDeOptionValue()
-    {
-        return deOptionValue;
-    }
-
-    private List<DataElement> dataElements;
-
-    public List<DataElement> getDataElements()
-    {
-        return dataElements;
-    }
-    
-    private List<String> optionComboNames;
-
-    public List<String> getOptionComboNames()
-    {
-        return optionComboNames;
-    }
-
-    private List<String> optionComboIds;
-    
-    public List<String> getOptionComboIds()
-    {
-        return optionComboIds;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        optionComboIds = new ArrayList<String>();
-        optionComboNames = new ArrayList<String>();
-        
-        if ( id == null || id == ALL )
-        {            
-            dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );            
-        }
-        else
-        {
-            DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( id );
-
-            if ( dataElementGroup != null )
-            {
-                dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
-            }
-            else
-            {
-                dataElements = new ArrayList<DataElement>();
-            }
-        }
-         
-        Collections.sort( dataElements, dataElementComparator );
-
-        displayPropertyHandler.handle( dataElements );
-        
-        if ( deOptionValue != null )
-        {
-        	if( deOptionValue.equalsIgnoreCase( "optioncombo" ))
-            {
-                Iterator<DataElement> deIterator = dataElements.iterator();
-                while(deIterator.hasNext())
-                {
-                    DataElement de = deIterator.next();
-                    DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
-                    List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
-                        dataElementCategoryCombo.getOptionCombos() );
-
-                    Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
-                    while ( optionComboIterator.hasNext() )
-                    {
-                        DataElementCategoryOptionCombo decoc = optionComboIterator.next();
-                        optionComboIds.add( de.getId()+":"+decoc.getId());
-                        optionComboNames.add( de.getName()+":"+dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() );
-                        
-                    }   
-                }
-            }        	
-        }                     
-        return SUCCESS;
-    }
-}

=== removed file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetMesageAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetMesageAction.java	2010-06-16 11:17:12 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/GetMesageAction.java	1970-01-01 00:00:00 +0000
@@ -1,145 +0,0 @@
-package org.hisp.dhis.target.action;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.target.DeTargetMapping;
-import org.hisp.dhis.target.DeTargetMappingService;
-
-import com.opensymphony.xwork2.Action;
-
-public class GetMesageAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    
-    private DeTargetMappingService deTargetMappingService;
-    
-    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
-    {
-        this.deTargetMappingService = deTargetMappingService;
-    }
-    
-    
-    /*
-    private DeTargetMappingService deTargetMappingService;
-
-    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
-    {
-        this.deTargetMappingService = deTargetMappingService;
-    }
-    */
-    
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-    
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
-    private String id;
-    
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-    
-    private String dename;
-    
-    public String getDename()
-    {
-        return dename;
-    }
-    
-    private String targetname;
-    
-    public String getTargetname()
-    {
-        return targetname;
-    }
-    
-    private String targetid;
-    
-    public String getTargetid()
-    {
-        return targetid;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        System.out.println("Inside GetMessage Action");
-        
-        String[] de_option = id.split( ":" );
-        int deid = Integer.parseInt( de_option[0] );
-        int optioncomboid = Integer.parseInt( de_option[1] );
-        
-        DataElement de = dataElementService.getDataElement( deid );
-        DataElementCategoryOptionCombo deoptioncombo = dataElementCategoryService.getDataElementCategoryOptionCombo( optioncomboid );
-                
-        DeTargetMapping deTargetMapping = deTargetMappingService.getDeTargetMapping( de, deoptioncombo );
-                
-        dename = de.getName() + ":" + deoptioncombo.getName();
-               
-        if ( deTargetMapping == null )
-        {
-         
-            targetname = "None";
-            targetid = "-1";
-        }
-        else
-        {
-            targetname = deTargetMapping.getTargetDataelement().getName();
-            targetid = "" + deTargetMapping.getTargetDataelement().getId() + ":" + deTargetMapping.getTargetoptioncombo().getId();
-        }
-        
-        System.out.println(dename + " : " + targetname);
-        return SUCCESS;
-    }
-}

=== removed file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java	2010-12-29 16:17:28 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/target/action/SaveMappingAction.java	1970-01-01 00:00:00 +0000
@@ -1,206 +0,0 @@
-package org.hisp.dhis.target.action;
-
-/*
- * Copyright (c) 2004-2007, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.target.DeTargetMapping;
-import org.hisp.dhis.target.DeTargetMappingService;
-
-import com.opensymphony.xwork2.Action;
-
-public class SaveMappingAction
-    implements Action
-{
-    @SuppressWarnings("unused")
-	private static final Log LOG = LogFactory.getLog( SaveMappingAction.class );
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    private DeTargetMappingService deTargetMappingService;
-
-    public void setDeTargetMappingService( DeTargetMappingService deTargetMappingService )
-    {
-        this.deTargetMappingService = deTargetMappingService;
-    }
-
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-    
-    private int dataelementId;
-
-    public int getDataelementId()
-    {
-        return dataelementId;
-    }
-
-    private String deID;
-
-    public void setDeID( String deID )
-    {
-        this.deID = deID;
-    }
-
-    private String detargetID;
-
-    public void setDetargetID( String detargetID )
-    {
-        this.detargetID = detargetID;
-    }
-
-    public void setDataelementId( int dataelementId )
-    {
-        this.dataelementId = dataelementId;
-    }
-
-    private int detargetId;
-
-    public int getDetargetId()
-    {
-        return detargetId;
-    }
-
-    public void setDetargetId( int detargetId )
-    {
-        this.detargetId = detargetId;
-    }
-
-    private int dataelementoptioncombo;
-
-    public int getDataelementoptioncombo()
-    {
-        return dataelementoptioncombo;
-    }
-
-    public void setDataelementoptioncombo( int dataelementoptioncombo )
-    {
-        this.dataelementoptioncombo = dataelementoptioncombo;
-    }
-
-    private int targetoptioncombo;
-
-    public int getTargetoptioncombo()
-    {
-        return targetoptioncombo;
-    }
-
-    public void setTargetoptioncombo( int targetoptioncombo )
-    {
-        this.targetoptioncombo = targetoptioncombo;
-    }
-
-    private String dename;
-
-    public String getDename()
-    {
-        return dename;
-    }
-
-    private String targetname;
-
-    public String getTargetname()
-    {
-        return targetname;
-    }
-
-    private String targetid;
-
-    public String getTargetid()
-    {
-        return targetid;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        String[] de_option = deID.split( ":" );
-        int dataelementId = Integer.parseInt( de_option[0] );
-        int dataelementoptioncombo = Integer.parseInt( de_option[1] );
-
-        String[] de_option1 = detargetID.split( ":" );
-        int detargetId = Integer.parseInt( de_option1[0] );
-        int targetoptioncombo = Integer.parseInt( de_option1[1] );
-
-        DataElement dataElement = dataElementService.getDataElement( dataelementId );
-
-        DataElement target = dataElementService.getDataElement( detargetId );
-
-        DataElementCategoryOptionCombo deoptioncombo = dataElementCategoryService
-            .getDataElementCategoryOptionCombo( dataelementoptioncombo );
-
-        DataElementCategoryOptionCombo detargetoptioncombo = dataElementCategoryService
-            .getDataElementCategoryOptionCombo( targetoptioncombo );
-
-        DeTargetMapping deTargetMapping = deTargetMappingService.getDeTargetMapping( dataElement, deoptioncombo );
-
-        if ( deTargetMapping == null )
-        {
-            deTargetMapping = new DeTargetMapping( dataElement, deoptioncombo, target, detargetoptioncombo );
-
-            deTargetMappingService.addDeTargetMapping( deTargetMapping );
-        }
-        else
-        {
-            deTargetMapping.setTargetDataelement( target );
-            deTargetMapping.setTargetoptioncombo( detargetoptioncombo );
-            deTargetMappingService.updateDeTargetMapping( deTargetMapping );
-        }
-        dename = dataElement.getName() + ":" + deoptioncombo.getName();
-
-        targetname = deTargetMapping.getTargetDataelement().getName();
-        targetid = "" + deTargetMapping.getTargetDataelement().getId() + ":"
-        + deTargetMapping.getTargetoptioncombo().getId();
-
-        // dataElementCategoryOptionComboService.getDefaultDataElementCategoryOptionCombo();
-        return SUCCESS;
-    }
-}

=== 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	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml	2011-01-15 11:35:42 +0000
@@ -12,7 +12,12 @@
     <property name="selectionManager"
       ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager"/>
     <property name="surveyService"
-      ref="org.hisp.dhis.survey.SurveyService"/>   
+      ref="org.hisp.dhis.survey.SurveyService"/>
+	<property name="deTargetService"
+      ref="org.hisp.dhis.detarget.DeTargetService"/> 
+	<property name="periodService"
+      ref="org.hisp.dhis.period.PeriodService"/>   
+	  
   </bean>
  
   <!-- Actions -->
@@ -215,7 +220,53 @@
 	
   <!-- Target -->
   
-  <bean id="org.hisp.dhis.target.action.GenerateTargetAction"
+  <bean id="org.hisp.dhis.detarget.action.SelectAction"
+    class="org.hisp.dhis.detarget.action.SelectAction" 
+    scope="prototype">
+    <property name="selectedStateManager"
+      ref="org.hisp.dhis.survey.state.SelectedStateManager"/>
+    <property name="deTargetService"
+      ref="org.hisp.dhis.detarget.DeTargetService"/>       
+  </bean> 
+	
+  <bean id="org.hisp.dhis.detarget.action.FormAction"
+    class="org.hisp.dhis.detarget.action.FormAction" 
+    scope="prototype">
+    <property name="selectedStateManager"
+      ref="org.hisp.dhis.survey.state.SelectedStateManager"/>
+    <property name="deTargetDataValueService"
+      ref="org.hisp.dhis.detargetdatavalue.DeTargetDataValueService"/>  
+	<property name="deTargetService"
+      ref="org.hisp.dhis.detarget.DeTargetService"/> 
+	 <property name="periodService"
+      ref="org.hisp.dhis.period.PeriodService"/> 
+  </bean> 
+	
+  <bean id="org.hisp.dhis.detarget.action.SavetargetValueAction"
+	  class="org.hisp.dhis.detarget.action.SavetargetValueAction"
+	  scope="prototype">
+	  <property name="selectedStateManager"
+        ref="org.hisp.dhis.survey.state.SelectedStateManager"/>
+	  <property name="currentUserService"
+        ref="org.hisp.dhis.user.CurrentUserService"/>
+	  <property name="dataElementService"
+        ref="org.hisp.dhis.dataelement.DataElementService"/>
+	  <property name="categoryService"
+        ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+	  <property name="deTargetdataValueService"
+        ref="org.hisp.dhis.detargetdatavalue.DeTargetDataValueService"/>
+	  <property name="periodService"
+      ref="org.hisp.dhis.period.PeriodService"/> 
+  </bean>
+	
+  <bean id="org.hisp.dhis.detarget.action.LoadNextPreviousPeriodsAction"
+	  class="org.hisp.dhis.detarget.action.LoadNextPreviousPeriodsAction"
+	  scope="prototype">
+	  <property name="selectedStateManager"
+        ref="org.hisp.dhis.survey.state.SelectedStateManager"/>
+  </bean>
+	
+	<bean id="org.hisp.dhis.detarget.action.GenerateTargetAction"
     class="org.hisp.dhis.target.action.GenerateTargetAction" 
     scope="prototype">
     <property name="dataElementService"
@@ -224,8 +275,8 @@
       	ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>  	 
   </bean>
 	  
-   <bean id="org.hisp.dhis.target.action.SaveMappingAction"
-      class="org.hisp.dhis.target.action.SaveMappingAction" 
+   <bean id="org.hisp.dhis.detarget.action.SaveMappingAction"
+      class="org.hisp.dhis.detarget.action.SaveMappingAction" 
       scope="prototype">
       <property name="dataElementService"
         ref="org.hisp.dhis.dataelement.DataElementService"/>  
@@ -235,8 +286,8 @@
       	ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>         
   </bean> 
 	
-    <bean id="org.hisp.dhis.target.action.GetDataElementsAction"
-    class="org.hisp.dhis.target.action.GetDataElementsAction" 
+    <bean id="org.hisp.dhis.detarget.action.GetDataElementsAction"
+    class="org.hisp.dhis.detarget.action.GetDataElementsAction" 
     scope="prototype">
     <property name="dataElementService"
       ref="org.hisp.dhis.dataelement.DataElementService"/>   
@@ -244,8 +295,8 @@
       ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>       
   </bean>
 		
-	<bean id="org.hisp.dhis.target.action.GetMesageAction"
-    class="org.hisp.dhis.target.action.GetMesageAction" 
+	<bean id="org.hisp.dhis.detarget.action.GetMesageAction"
+    class="org.hisp.dhis.target.deaction.GetMesageAction" 
     scope="prototype">
     <property name="dataElementService"
       ref="org.hisp.dhis.dataelement.DataElementService"/>   
@@ -255,8 +306,8 @@
       ref="org.hisp.dhis.target.DeTargetMappingService"/>          
   </bean> 
 	
-   <bean id="org.hisp.dhis.target.action.DelMappingAction"
-      class="org.hisp.dhis.target.action.DelMappingAction" 
+   <bean id="org.hisp.dhis.detarget.action.DelMappingAction"
+      class="org.hisp.dhis.detarget.action.DelMappingAction" 
       scope="prototype">
       <property name="dataElementService"
         ref="org.hisp.dhis.dataelement.DataElementService"/>  

=== modified file 'local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties'
--- local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties	2011-01-15 11:35:42 +0000
@@ -63,4 +63,7 @@
 selected_dataElements = Selected DataElements
 group = Group
 select_deGroup_all = Select DataElementGroup / All
-
+detarget_data_entry = DeTarget Data Entry
+sl_no = Sl. No.
+dataelement = DataElement
+value = Value

=== modified file 'local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties'
--- local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties	2011-01-15 11:35:42 +0000
@@ -54,6 +54,7 @@
 none = NONE
 not_del_contain_data = Not Deleted Its Contains Data
 confirm_delete_survey = Are you sure you want to Remove Survey?
+detarget_data_entry = DeTarget Data Entry
 
 detarget_mamagement = DE Target Management
 de_target_mamagement = DataElement Target Management

=== modified file 'local/in/dhis-web-survey/src/main/resources/struts.xml'
--- local/in/dhis-web-survey/src/main/resources/struts.xml	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/resources/struts.xml	2011-01-15 11:35:42 +0000
@@ -212,7 +212,7 @@
 		<!--Target Mapping-->
 		
 		<action name="generateTarget"
-			class="org.hisp.dhis.target.action.GenerateTargetAction">
+			class="org.hisp.dhis.detarget.action.GenerateTargetAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-survey/targetFront.vm</param>
 			<param name="menu">/dhis-web-survey/menu.vm</param>
@@ -221,30 +221,78 @@
 		</action>
 		
 		<action name="saveMapping"
-			class="org.hisp.dhis.target.action.SaveMappingAction">
+			class="org.hisp.dhis.detarget.action.SaveMappingAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-survey/responseDe.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
 		<action name="delMapping"
-			class="org.hisp.dhis.target.action.DelMappingAction">
+			class="org.hisp.dhis.detarget.action.DelMappingAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-survey/responseDe.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
+		<!-- Target DataEntry -->
+		
+		<action name="targetDataEntry"
+			class="org.hisp.dhis.survey.action.EmptyAction">
+			<result name="success" type="redirect">selectTarget.action</result>
+		</action>
+		
+		<action name="selectTarget" class="org.hisp.dhis.detarget.action.SelectAction">
+			<interceptor-ref name="organisationUnitTreeStack"/>
+			<result name="defaulttargetform" type="chain">defaulttargetform</result>
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-survey/selectTarget.vm</param>
+			<param name="menu">/dhis-web-survey/menuWithTreeForDeTarget.vm</param>
+			<param name="menuTreeHeight">350</param>
+			<param name="javascripts">
+				../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/form.js</param>
+			<param name="stylesheets">
+				style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css</param>
+		</action>	
+		
+		<action name="defaulttargetform" class="org.hisp.dhis.detarget.action.FormAction">
+			<interceptor-ref name="organisationUnitTreeStack"/>
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-survey/targetForm.vm</param>
+			<param name="menu">/dhis-web-survey/menuWithTreeForDeTarget.vm</param>
+			<param name="menuTreeHeight">350</param>
+			<param name="javascripts"> ../dhis-web-commons/ouwt/ouwt.js,
+				javascript/general.js,javascript/form.js,
+				javascript/form.js,../dhis-web-commons/calendar/calendar.js,
+				../dhis-web-commons/calendar/calendar-lang.js,
+				../dhis-web-commons/calendar/calendar-setup.js </param>
+			<param name="stylesheets">
+				style/dhis-web-dataentry.css,style/custom_data_entry_form_styles.css</param>
+		</action>
+		
+		<action name="saveTargetValue"
+			class="org.hisp.dhis.detarget.action.SavetargetValueAction">
+			<result name="success" type="velocity-xml">status.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+			<!--<param name="requiredAuthorities">
+			F_DATAVALUE_ADD,F_DATAVALUE_UPDATE,F_DATAVALUE_DELETE</param>-->
+		</action>
+		
+		<action name="loadNextPreviousPeriods" class="org.hisp.dhis.detarget.action.LoadNextPreviousPeriodsAction">
+			<result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonPeriods.vm</result>
+		</action>
+		
+		
 		<!-- Ajax requests -->
 		
 		<action name="getDataElements"
-			class="org.hisp.dhis.target.action.GetDataElementsAction">
+			class="org.hisp.dhis.detarget.action.GetDataElementsAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-survey/responseDataElement.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
 		<action name="getmessage"
-			class="org.hisp.dhis.target.action.GetMesageAction">
+			class="org.hisp.dhis.detarget.action.GetMesageAction">
 			<result name="success" type="velocity-xml">
 				/dhis-web-survey/responseDe.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js	2011-01-15 11:35:42 +0000
@@ -124,27 +124,6 @@
 // ----------------------------------------------------------------------
 // List
 // ----------------------------------------------------------------------
-/*
-function initLists()
-{
-    var id;
-	
-	var list = document.getElementById( 'selectedList' );
-	
-    for ( id in deTargetMembers )
-    {
-        list.add( new Option( deTargetMembers[id], id ), null );
-    }	
-	
-    list = document.getElementById( 'availableList' );
-    
-    for ( id in availableDataElements )
-    {
-        list.add( new Option( availableDataElements[id], id ), null );
-    }
-}
-*/
-// complette
 function filterDeTargetMembers()
 {
 	var filter = document.getElementById( 'deTargetMembersFilter' ).value;
@@ -224,61 +203,31 @@
 {
   var selectedList = document.getElementById( 'selectedList' );
 
- // var list = new Array();
   
   var params = 'dataElementGroupId=' + selectedDataElementGroup;
   
   for ( var i = 0; i < selectedList.options.length; ++i)
   {
-  	//params += '&selectedIndicators=' + selectedList.options[i].value;
   	params += '&selectedDataElements=' + selectedList.options[i].value;
-	//list[i] = selectedList.options[i].value;
   }
   // Clear the list
   var availableList = document.getElementById( 'availableList' );
 
   availableList.options.length = 0;
   
- // alert(list);
-  //alert(list.length);
   
   var request = new Request();
   request.setResponseTypeXML( 'indicatorgroup' );
   request.setCallbackSuccess( filterByDataElementGroupCompleted );
-  //request.send( url );
 
   var requestString = "filterAvailableDataElementsByDataElementGroup.action";
- // var params = "indicatorGroupId=" + selectedIndicatorGroup + "&selectedIndicators=" + list;
   request.sendAsPost( params );
   request.send( requestString ); 
   
- /* 
-  
-   $.post("filterAvailableIndicatorsByIndicatorGroup.action",
-		{
-			indicatorGroupId : selectedIndicatorGroup,
-			selectedIndicators : list
-		},
-		function (data)
-		{
-			filterByIndicatorGroupCompleted(data);
-		},'xml');
-		*/
 }
 
 function filterByDataElementGroupCompleted( xmlObject )
 {
- //var indicators = indicatorGroup.getElementsByTagName( 'indicators' )[0];
- // var indicatorList = indicators.getElementsByTagName( 'indicator' );
-
-  var availableList = document.getElementById( 'availableList' );
-  
-  
- // var availableDataElements = document.getElementById("availableDataElements");
-  //var selectedDataElements = document.getElementById("selectedServices");
-
-  //clearList(availableList);
-
   var dataElements = xmlObject.getElementsByTagName("dataElement");
   alert( "DataElement Group Received lent of Group member " + dataElements.length );
   for ( var i = 0; i < dataElements.length; i++ )

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/form.js'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/form.js	2010-09-10 11:35:58 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/form.js	2011-01-15 11:35:42 +0000
@@ -342,3 +342,45 @@
     document.getElementById( "dateField" ).disabled = false;
     document.getElementById( "dateDiv" ).style.display = "inline";
 }
+
+function periodSelected()
+{
+	var periodName = $( '#selectedPeriodIndex :selected' ).text();
+	
+	$( '#currentPeriod' ).html( periodName );
+		
+	var periodIndex = $( '#selectedPeriodIndex' ).val();
+	
+	if ( periodIndex && periodIndex != -1 )	{
+		showLoader();
+		var url = 'selectTarget.action?selectedPeriodIndex=' + periodIndex;
+		$( '#contentDiv' ).load( url, setDisplayModes );
+	}
+}
+
+function nextPeriodsSelected()
+{
+	displayPeriodsInternal( true, false );
+}
+
+function previousPeriodsSelected()
+{
+	displayPeriodsInternal( false, true );
+}
+
+function displayPeriodsInternal( next, previous ) 
+{
+	var url = 'loadNextPreviousPeriods.action?next=' + next + '&previous=' + previous;
+	
+	var list = document.getElementById( 'selectedPeriodIndex' );
+		
+	clearList( list );
+	    
+	addOptionToList( list, '-1', '[ Select ]' );
+	
+    $.getJSON( url, function( json ) {
+    	for ( i in json.periods ) {
+    		addOptionToList( list, i, json.periods[i].name );
+    	}
+    } );
+}

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/general.js'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/general.js	2010-09-10 11:35:58 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/general.js	2011-01-15 11:35:42 +0000
@@ -5,13 +5,6 @@
 // Selection
 // -----------------------------------------------------------------------------
 
-function organisationUnitSelected( orgUnits )
-{
-    window.location.href = 'select.action';
-}
-
-selection.setListenerFunction( organisationUnitSelected );
-
 function changeOrder()
 {
     window.open( 'getDataElementOrder.action', '_blank', 'width=700,height=500,scrollbars=yes' );
@@ -66,6 +59,41 @@
     }
 }
 
+function saveTargetValue( dataElementId, optionComboId )
+{
+    var field = document.getElementById( 'value[' + dataElementId +':' + optionComboId + '].value' );
+    var type = 'int'; 
+    
+    field.style.backgroundColor = '#ffffcc';   
+    
+    
+    //if ( field.value != '' )
+    {
+    	
+        if ( type == 'int' )        
+        {
+        	var value = new Number( field.value );       	        	
+        	 
+            if ( !isInt( field.value ))
+            {
+                field.style.backgroundColor = '#ffcc00';
+
+                window.alert( i18n_value_must_integer );
+
+                field.select();
+                field.focus();
+
+                return;
+            }
+            else
+            {
+                var valueSaver = new targetValueSaver( dataElementId, optionComboId, field.value, '#ccffcc', '' );
+                valueSaver.save();    
+            }
+        }
+    }
+}
+
 
 function isInt( value )
 {
@@ -139,5 +167,60 @@
     }
 }
 
+function targetValueSaver( dataElementId_, optionComboid_, value_, resultColor_, selectedOption_ )
+{
+    var SUCCESS = '#ccffcc';
+    var ERROR = '#ccccff';
+
+    var dataElementId = dataElementId_;
+    var optionComboId = optionComboid_;
+    
+    var value = value_;
+    var resultColor = resultColor_;
+    var selectedOption = selectedOption_; 
+    
+    this.save = function()
+    {
+		$.ajax({
+			   type: "POST",
+			   url: "saveTargetValue.action",
+			   data: "dataElementId=" + dataElementId + "&optionComboId=" +optionComboId + "&value=" + value,
+			   success: function(result){
+					handleResponse (result);
+			   },
+			   error: function(request,status,errorThrown) {
+					handleHttpError (request);
+			   }
+		});
+    };
+    
+    function handleResponse( rootElement )
+    {
+        var codeElement = rootElement.getElementsByTagName( 'code' )[0];
+        var code = parseInt( codeElement.firstChild.nodeValue );
+        if ( code == 0 )
+        {
+            markValue( resultColor );
+        }
+        else
+        {
+        	markValue( ERROR );
+            window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
+        }
+    }
+    
+    function handleHttpError( errorCode )
+    {
+        markValue( ERROR );
+        window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
+    }   
+    
+    function markValue( color )
+    {        
+        var element = document.getElementById( 'value[' + deOptionComboId + '].value' );
+        element.style.backgroundColor = color;
+    }
+}
+
 
 

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm	2011-01-15 11:35:42 +0000
@@ -9,5 +9,8 @@
     <ul>               
      <!--   <li><a href="generateTarget.action">$i18n.getString( "detarget_mamagement" )</a></li> -->
             <li><a href="deTargetManagement.action">$i18n.getString( "detarget_mamagement" )</a></li>
+			<li><a href="targetDataEntry.action">DeTarget Data Entry</a></li>
+        
     </ul>
+        
         
\ No newline at end of file

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm	2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm	2011-01-15 11:35:42 +0000
@@ -9,3 +9,11 @@
 </div>
 
 #parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+<script>
+	function organisationUnitSelected( orgUnits )
+	{
+  	  window.location.href = 'select.action';
+	}
+
+	selection.setListenerFunction( organisationUnitSelected );
+</script>
\ No newline at end of file

=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTreeForDeTarget.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTreeForDeTarget.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTreeForDeTarget.vm	2011-01-15 11:35:42 +0000
@@ -0,0 +1,19 @@
+
+<h2>DeTarget</h2>
+
+<ul>
+    <li>DeTarget Data Entry</a></li>
+</ul>
+<div style=" float:right; font-size:6pt; cursor:pointer; margin-top:-20px; ">
+    <a href="index.action"><img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
+</div>
+
+#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+<script>
+	function organisationUnitSelected( orgUnits )
+	{
+  	  window.location.href = 'selectTarget.action';
+	}
+
+	selection.setListenerFunction( organisationUnitSelected );
+</script>

=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/selectTarget.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/selectTarget.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/selectTarget.vm	2011-01-15 11:35:42 +0000
@@ -0,0 +1,45 @@
+<h3>$i18n.getString( "detarget_data_entry" )</h3>
+
+<br>
+
+<form id="selectForm" name="selectForm" method="post" action="selectTarget.action">
+
+    <table>	
+	   <tr>
+    		<td><label>$i18n.getString( "organisation_unit" )</label></td>
+    		<td><input type="text" readonly="readonly" #if( $orgUnit ) value="$encoder.htmlEncode( $orgUnit.name )" #else value="[$i18n.getString( "select" )]" #end style="min-width:350px"></td>
+	   </tr>
+	   <tr>
+            <td class="NormalB">&nbsp;</td>
+            <td class="NormalB">&nbsp;</td>
+       </tr>
+	   <tr>
+    		<td><label for="selectedDeTargetId">$i18n.getString( "target" )</label></td>
+    		<td>
+    		    <select id="selectedDeTargetId" name="selectedDeTargetId" style="min-width:350px" onchange="document.getElementById( 'selectForm' ).submit();" #if( $deTargets.size() == 0 ) disabled="disabled" #end style="min-width:350px">
+    				<option value="null">[$i18n.getString( "select" )]</option>
+    			    #foreach( $deTarget in $deTargets )
+    				    <option value="$deTarget.id" #if( $selectedDeTargetId && $deTarget.id == $selectedDeTargetId ) selected="selected" #end>$encoder.htmlEncode( $deTarget.name )</option>
+    			    #end
+    			</select>
+    		</td>
+	   </tr>	
+	   <tr>
+	   		<td><label for="selectedPeriodIndex">$i18n.getString( "period" )</label></td>
+	   		<td>
+			<input type="button" value="&lt;&lt;" title="$i18n.getString('earlier_periods')" onclick="previousPeriodsSelected()"/>
+			<input type="button" value="&gt;&gt;" title="$i18n.getString('later_periods')" onclick="nextPeriodsSelected()"/><br/>
+			<select id="selectedPeriodIndex" name="selectedPeriodIndex" style="min-width:350px" onchange="document.getElementById( 'selectForm' ).submit();">
+    				<option value="-1">[$i18n.getString( "select" )]</option>
+    				#set( $count = 0 )
+    			    #foreach( $period in $periods )
+    				    <option value="$count" #if( $selectedPeriodIndex == $count ) selected="selected" #end>$encoder.htmlEncode( $period.name )</option>
+    				    #set( $count = $count + 1 )
+    			    #end				
+			</select>
+		</td>	
+   	   </tr>
+    </table>
+</form>
+
+<hr style="clear:both">

=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/targetForm.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/targetForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/targetForm.vm	2011-01-15 11:35:42 +0000
@@ -0,0 +1,60 @@
+
+
+#parse( "/dhis-web-survey/selectTarget.vm" )
+
+<table class="mainPageTable">
+	<col id="noCol" width="25">
+	<col id="indCol">	
+    <col id="entryCol" width="75">
+		
+	<tr>
+		<th>$i18n.getString( "sl_no" )</th>
+		<th>$i18n.getString( "dataelement" )</th>		
+		<th>$i18n.getString( "value" )</th>		
+	</tr>
+	
+#set( $count = 0 )
+#set( $mark = 0 )
+#set( $tabIndex = 1 )
+#set( $optionCombos = $orderdCategoryOptionCombos.get( $categoryCombo.id )  )
+
+#foreach( $deTargetMember in $deTargetmembers )
+	#set( $count = $count + 1 )
+	#set( $deOptionComboId = $deTargetMember.dataelements.id + ":" + $deTargetMember.decategoryOptionCombo.id )
+	#set( $deOptionComboName = $deTargetMember.dataelements.name + " " + $deTargetMember.decategoryOptionCombo.name  )	
+	#if( $mark == 1 )
+		#set( $mark = 0 )
+	#else
+		#set( $mark = 1 )
+	#end
+	#set( $dataValue = false )
+	#set( $dataValue = $deTargetDataValueMap.get( $deOptionComboId ) )
+	
+	<tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
+		##count
+		<td style="text-align:center">$count</td>
+		
+		##dataElement name
+		<td>
+			<span id="value[$deOptionComboId].name" >$encoder.htmlEncode( $deOptionComboName )</span>
+		</td>
+	
+		##entry		
+		<td>				
+			<input name="entryfield" id="value[$deOptionComboId].value" size="50" type="text" value="$!encoder.htmlEncode( $dataValue.value )" onchange="saveTargetValue( ${deTargetMember.dataelements.id},${deTargetMember.decategoryOptionCombo.id} )" onkeypress="return keyPress(event, this)" style="width:100%;text-align:center" tabindex="$tabIndex">
+		</td>
+	</tr>
+	#set( $tabIndex = $tabIndex + 1 )
+#end
+</table>
+
+
+
+
+<script type="text/javascript">
+	
+	var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
+	var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
+	var i18n_saving_zero_values_unnecessary = 'saving zero is not necessary';
+	
+</script>
\ No newline at end of file