← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2586: Added DeTarget Module

 

------------------------------------------------------------
revno: 2586
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-01-17 13:15:29 +0530
message:
  Added DeTarget Module
added:
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java
  local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java
  local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java
  local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.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/addDeTarget.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm
  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/menu.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm
  local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTreeForDeTarget.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
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java	2011-01-14 11:48:48 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetService.java	2011-01-17 07:45:29 +0000
@@ -38,6 +38,7 @@
  *
  * @version DeTargetService.java Jan 12, 2011 12:46:10 PM
  */
+
 public interface DeTargetService
 {
     String ID = DeTargetService.class.getName();
@@ -144,7 +145,16 @@
      * 
      * @param DeTargetMember The DeTargetMember to delete.
      */
-    int deleteDeTargetMember( DeTarget deTargetr,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo );
+    //int deleteDeTargetMember( DeTarget deTargetr,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo );
+    
+    /**
+     * Deletes a DeTarget.
+     * 
+     * @param survey The Survey to delete.
+     */
+    int deleteDeTargetMember( DeTargetMember  deTargetMember );
+    
+    void deleteDeTargetMembers( DeTarget deTarget );
     
     /**
      * Returns Collection of DeTarget members.

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java	2011-01-14 11:48:48 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/detarget/DeTargetStore.java	2011-01-17 07:45:29 +0000
@@ -135,7 +135,14 @@
      * 
      * @param DeTargetMember The DeTargetMember to delete.
      */
-    int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo );
+   // int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo );
+    
+    /**
+     * Deletes a DeTarget.
+     * 
+     * @param survey The Survey to delete.
+     */
+    int deleteDeTargetMember( DeTargetMember  deTargetMember );
     
     /**
      * Returns Collection of DeTarget members.

=== modified file 'local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java'
--- local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java	2011-01-15 09:32:11 +0000
+++ local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/DefaultDeTargetService.java	2011-01-17 07:45:29 +0000
@@ -26,7 +26,9 @@
  */
 package org.hisp.dhis.detarget;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -121,10 +123,32 @@
     {
         deTargetStore.updateDeTargetMember( deTargetMember );
     }
-   
+ /*  
     public int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo )
      {
          return deTargetStore.deleteDeTargetMember( deTarget , dataelement, deoptioncombo );
      }
+ */   
+    
+    public int deleteDeTargetMember( DeTargetMember  deTargetMember )
+    {
+        return deTargetStore.deleteDeTargetMember( deTargetMember );
+    }
+    
+    public void deleteDeTargetMembers( DeTarget deTarget )
+    {
+        List<DeTargetMember>  deTargetMemberList = new ArrayList<DeTargetMember>( getDeTargetMembers( deTarget ));
+        
+        for( DeTargetMember dataElementTarget : deTargetMemberList )
+        {
+            
+            deleteDeTargetMember( dataElementTarget );
+            //deTargetService.
+            //selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() );
+        }
+        
+    }
+    
+    
 }
 

=== modified file 'local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java'
--- local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java	2011-01-15 09:32:11 +0000
+++ local/in/dhis-in-services/dhis-in-service-survey/src/main/java/org/hisp/dhis/detarget/hibernate/HibernateDeTargetStore.java	2011-01-17 07:45:29 +0000
@@ -186,7 +186,7 @@
 
        session.update( deTargetMember );
    }
-
+/*
    public int deleteDeTargetMember( DeTarget deTarget ,DataElement dataelement ,DataElementCategoryOptionCombo deoptioncombo )
    {
        Session session = sessionFactory.getCurrentSession();
@@ -204,6 +204,28 @@
        
        return 0;
    }
+   */
+   
+   public int deleteDeTargetMember( DeTargetMember  deTargetMember )
+   {
+       Session session = sessionFactory.getCurrentSession();
+
+       List<DeTargetDataValue> deTargetDataValueList = new ArrayList<DeTargetDataValue>( deTargetDataValueService.getDeTargetDataValues(  deTargetMember.getDetarget() , deTargetMember.getDataelements() , deTargetMember.getDecategoryOptionCombo()  ) );
+       
+       if( deTargetDataValueList == null || deTargetDataValueList.isEmpty() )        
+       {
+           session.delete( deTargetMember );
+       }
+       else
+       {            
+           return -1;
+       }
+       
+       return 0;
+   }
+   
+   
+   
    @SuppressWarnings( "unchecked" )
    public  List<DeTargetMember> getDeTargetMembers( DeTarget deTarget )
    {

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/AddDeTargetAction.java	2011-01-17 07:45:29 +0000
@@ -140,7 +140,7 @@
             DeTargetMember deTargetMember = new DeTargetMember( deTarget, dataElement, decoc);
             
             deTargetService.addDeTargetMember( deTargetMember );
-            System.out.println( dataElement + ":" +  decoc );
+           // System.out.println( dataElement + ":" +  decoc );
             
            
         }

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementGroupListAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DataElementGroupListAction.java Jan 15, 2011 1:40:28 PM
+ */
+public class DataElementGroupListAction implements Action
+{
+   
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters & Setters
+    // -------------------------------------------------------------------------
+
+    private List<DataElementGroup> dataElementGroups;
+    
+    public List<DataElementGroup> getDataElementGroups()
+    {
+        return dataElementGroups;
+    }
+   
+    
+    // -------------------------------------------------------------------------
+    // Action
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+
+        Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
+
+        return SUCCESS;
+    }
+}
+

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DataElementListFilterByGroupAction.java	2011-01-17 07:45:29 +0000
@@ -36,6 +36,9 @@
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetMember;
+import org.hisp.dhis.detarget.DeTargetService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -57,14 +60,14 @@
     {
         this.dataElementService = dataElementService;
     }
-/*
+
     private DeTargetService deTargetService;
     
     public void setDeTargetService( DeTargetService deTargetService )
     {
         this.deTargetService = deTargetService;
     }
-*/    
+   
     private DataElementCategoryService dataElementCategoryService;
 
     public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
@@ -77,7 +80,7 @@
     // Getters & Setters
     // -------------------------------------------------------------------------
 
-   
+ 
     private String dataElementGroupId;
     
     public void setDataElementGroupId( String dataElementGroupId )
@@ -85,6 +88,8 @@
         this.dataElementGroupId = dataElementGroupId;
     }
 
+    
+    /*
     private String selectedDataElements[];
 
 
@@ -92,7 +97,15 @@
     {
         this.selectedDataElements = selectedDataElements;
     }
+    */
+ /*  
+    private List<String> selectedList;
     
+    public void setSelectedList( List<String> selectedList )
+    {
+        this.selectedList = selectedList;
+    }
+    */
     private List<DataElement> dataElements;
     
     public List<DataElement> getDataElements()
@@ -115,35 +128,48 @@
         return optionComboIds;
     }
     
-    
-    
-    
+  
+    private Integer deTargetId;
+    
+    public void setDeTargetId( Integer deTargetId )
+    {
+        this.deTargetId = deTargetId;
+    }
+    
+    private List<String> selectedDeTargetMember;
+    
+    public List<String> getSelectedDeTargetMember()
+    {
+        return selectedDeTargetMember;
+    }
     // -------------------------------------------------------------------------
     // Action
     // -------------------------------------------------------------------------
 
+
     public String execute() throws Exception
     {
         
         optionComboIds = new ArrayList<String>();
         optionComboNames = new ArrayList<String>();
-        
-        
-        
+        selectedDeTargetMember = new ArrayList<String>();
+        
+        //System.out.println(" deTarget Id is    : " + deTargetId  );
         
         if (  dataElementGroupId == null || dataElementGroupId.equalsIgnoreCase( "ALL" ) )
         {
-            System.out.println("\n\n +++ \n Inside dataElementGroupId null dataElementGroup Id is   : " + dataElementGroupId  );
+            //System.out.println("\n\n +++ \n Inside dataElementGroupId null dataElementGroup Id is   : " + dataElementGroupId  );
             dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
         }
         else
         {
-                DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroupId ) );
+            //System.out.println("\n\n +++ \n Inside dataElementGroupId " + dataElementGroupId  );    
+            DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroupId ) );
 
-                dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
+            dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
         }
        
-        
+ /*       
         if ( selectedDataElements != null && selectedDataElements.length > 0 )
         {
             Iterator<DataElement> iter = dataElements.iterator();
@@ -163,6 +189,24 @@
                 }
             }
         }
+*/        
+    
+        if ( deTargetId != null )
+        {
+             DeTarget deTarget = deTargetService.getDeTarget( deTargetId );
+        
+             List<DeTargetMember>  deTargetMemberList = new ArrayList<DeTargetMember>(deTargetService.getDeTargetMembers( deTarget ));
+             for( DeTargetMember dataElementTarget : deTargetMemberList )
+             {
+                 selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() );
+             }
+                //indicators.removeAll( survey.getIndicators() );
+        }
+
+      //  Collections.sort( indicators, indicatorComparator );
+
+      //  displayPropertyHandler.handle( indicators );
+
         
        
         Iterator<DataElement> deIterator = dataElements.iterator();
@@ -177,24 +221,21 @@
             while ( optionComboIterator.hasNext() )
             {
                 DataElementCategoryOptionCombo decoc = optionComboIterator.next();
+                
+                String deOptComboId = de.getId() + ":" + decoc.getId();
+        
+       
+        
+            if( !selectedDeTargetMember.contains( deOptComboId ) )
+            {
                 optionComboIds.add( de.getId() + ":" + decoc.getId() );
                 optionComboNames.add( de.getName() + ":" + dataElementCategoryService.getDataElementCategoryOptionCombo( decoc ).getName() );
             }
+               
+            }
 
         }
        
-/*
-        if ( surveyId != null )
-        {
-                Survey survey = surveyService.getSurvey( surveyId );
-
-                indicators.removeAll( survey.getIndicators() );
-        }
-
-      //  Collections.sort( indicators, indicatorComparator );
-
-      //  displayPropertyHandler.handle( indicators );
-*/
         return SUCCESS;
     }
 }

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DefineDeTargetAssociationsAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.source.Source;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DefineDeTargetAssociationsAction.java Jan 15, 2011 11:21:06 AM
+ */
+public class DefineDeTargetAssociationsAction implements Action
+{
+   
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectionTreeManager selectionTreeManager;
+
+    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+    {
+        this.selectionTreeManager = selectionTreeManager;
+    }
+
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+    
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+ 
+    // -------------------------------------------------------------------------
+    // Getters & Setters
+    // -------------------------------------------------------------------------
+
+    private int deTargetId;
+    
+    public void setDeTargetId( int deTargetId )
+    {
+        this.deTargetId = deTargetId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        
+        Collection<OrganisationUnit> rootUnits = selectionTreeManager.getRootOrganisationUnits(); 
+        
+        Set<OrganisationUnit> unitsInTheTree = new HashSet<OrganisationUnit>();        
+        
+        organisationUnitService.getUnitsInTheTree( rootUnits, unitsInTheTree );          
+        
+        DeTarget deTarget = deTargetService.getDeTarget( deTargetId );            
+        
+        System.out.println( " DeTarget Id : "  + deTarget.getId() + " DETarget Name "  + deTarget.getName() );
+        
+        Set<Source> assignedSources = deTarget.getSources();
+        
+        assignedSources.removeAll( convert( unitsInTheTree ) );        
+
+        Collection<OrganisationUnit> selectedOrganisationUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+        
+        assignedSources.addAll( organisationUnitService.convert( selectedOrganisationUnits ) );         
+        
+        deTarget.setSources( assignedSources );
+        
+        System.out.println( " size of selected Organisation Units : "  + selectedOrganisationUnits.size() + " Size of assigned Sources "  + assignedSources.size() );
+        
+        deTargetService.updateDeTarget( deTarget );
+        
+        return SUCCESS;
+    }
+
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
+    private Set<Source> convert( Collection<OrganisationUnit> organisationUnits )
+    {
+        Set<Source> sources = new HashSet<Source>();
+        
+        sources.addAll( organisationUnits );
+        
+        return sources;
+    }   
+ /*   
+    private void getUnitsInTheTree( Collection<OrganisationUnit> rootUnits, Set<OrganisationUnit> unitsInTheTree )
+    {
+        for( OrganisationUnit root : rootUnits )
+        {
+                unitsInTheTree.add( root );
+                getUnitsInTheTree( root.getChildren(), unitsInTheTree );                
+        }
+    }*/
+}
+

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/DelDeTargetAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DelDeTargetAction.java Jan 15, 2011 5:07:57 PM
+ */
+public class DelDeTargetAction implements Action
+{
+   
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+  
+    // -------------------------------------------------------------------------
+    // Getters & setters
+    // -------------------------------------------------------------------------
+
+   
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
+    
+    private int deTargetId;
+
+    public void setDeTargetId( int deTargetId )
+    {
+        this.deTargetId = deTargetId;
+    }
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    private String status;
+
+    public String getStatus()
+    {
+        return status;
+    }
+    /*
+    private List<DeTargetMember>  deTargetMemberList;
+    
+    public List<DeTargetMember> getDeTargetMemberList()
+    {
+        return deTargetMemberList;
+    }*/
+    // -------------------------------------------------------------------------
+    // Action
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+
+        status = "success";
+        
+        
+        
+        DeTarget deTarget = deTargetService.getDeTarget( deTargetId );
+        
+        deTargetService.deleteDeTargetMembers( deTarget );//delete target Members(that is delete dataElements )
+       
+        //deTargetMemberList = new ArrayList<DeTargetMember>(deTargetService.getDeTargetMembers( deTarget ));
+       
+        /*
+        for( DeTargetMember dataElementTarget : deTargetMemberList )
+        {
+            
+            deTargetService.deleteDeTargetMember( dataElementTarget );
+            //deTargetService.
+            //selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() );
+        }
+        
+        */
+        
+       // DeTarget deTarget = deTargetService.getDeTarget( deTargetId );
+        
+        
+        int flag = deTargetService.deleteDeTarget( deTarget ); // delete deTarget
+       
+        System.out.println( " Delete flag is flag is " + flag );
+        if ( flag < 0 )
+        {
+            status = "error";
+            String delMseg = i18n.getString( "not_del_contain_data" );
+            message = deTarget.getName() + " : "+  delMseg;
+
+            return ERROR;
+        }
+        
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetMember;
+import org.hisp.dhis.detarget.DeTargetService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GetDeTargetAction.java Jan 15, 2011 1:16:51 PM
+ */
+public class GetDeTargetAction  implements Action
+{
+   
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+    
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+    // -------------------------------------------------------------------------
+    // Getters & Setters
+    // -------------------------------------------------------------------------
+
+    private List<DataElementGroup> dataElementGroups;
+    
+    public List<DataElementGroup> getDataElementGroups()
+    {
+        return dataElementGroups;
+    }
+    
+    private int deTargetId;
+
+    public void setDeTargetId( int deTargetId )
+    {
+        this.deTargetId = deTargetId;
+    }
+    
+    private DeTarget deTarget;
+    
+    public DeTarget getDeTarget()
+    {
+        return deTarget;
+    }
+
+    private List<DataElement> deTargetDataElement;
+
+
+    public List<DataElement> getDeTargetDataElement()
+    {
+        return deTargetDataElement;
+    }
+
+    private String description;
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+    
+    public String getDescription()
+    {
+        return description;
+    }
+    private List<DeTargetMember>  deTargetMemberList;
+    
+    public List<DeTargetMember> getDeTargetMemberList()
+    {
+        return deTargetMemberList;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action
+    // -------------------------------------------------------------------------
+
+ 
+
+    public String execute()
+        throws Exception
+    {
+        deTarget = deTargetService.getDeTarget( deTargetId );
+        
+        deTargetMemberList = new ArrayList<DeTargetMember>(deTargetService.getDeTargetMembers( deTarget ));
+        
+        dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+
+        Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
+        
+        
+        
+        
+        
+        //deTargetDataElement = new ArrayList<DataElement>( deTarget. );
+        
+        //Collections.sort( surveyIndicators, dataElementComparator );       
+                        
+        //displayPropertyHandler.handle( dataSetDataElements );
+
+        //dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet );
+        
+        return SUCCESS;
+    }
+}

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetDeTargetDetailsAction.java	2011-01-17 07:45:29 +0000
@@ -111,7 +111,7 @@
     public String execute()
         throws Exception
     {
-        System.out.println( " DeTarget ID : "  + deTargetId );
+        //System.out.println( " DeTarget ID : "  + deTargetId );
         
         deTarget = deTargetService.getDeTarget( deTargetId );
        // survey = surveyService.getSurvey( surveyId );
@@ -128,8 +128,8 @@
            
         }
         
-        System.out.println( " DeTarget Id : "  + deTarget.getId() + " DETarget Name "  + deTarget.getName() + " DETarget Description "  + deTarget.getDescription()  );
-        System.out.println( " DeTarget URL : "  + deTarget.getUrl() + " dataElementSize "  +dataElementSize );
+       // System.out.println( " DeTarget Id : "  + deTarget.getId() + " DETarget Name "  + deTarget.getName() + " DETarget Description "  + deTarget.getDescription()  );
+       // System.out.println( " DeTarget URL : "  + deTarget.getUrl() + " dataElementSize "  +dataElementSize );
         
         //surveyIndicators = new ArrayList<Indicator>( survey.getIndicators() );
         

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/GetNumberOfLevelsAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version GetNumberOfLevelsAction.java Jan 15, 2011 10:59:21 AM
+ */
+public class GetNumberOfLevelsAction  implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private List<OrganisationUnitLevel> levels;
+    
+    public List<OrganisationUnitLevel> getLevels()
+    {
+        return levels;
+    }
+
+    // -------------------------------------------------------------------------
+    // ActionSupport implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        levels = organisationUnitService.getOrganisationUnitLevels();
+        
+        return SUCCESS;
+    }
+}

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/SetupAssociationsTreeAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.detarget.DeTarget;
+import org.hisp.dhis.detarget.DeTargetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.source.Source;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version SetupAssociationsTreeAction.java Jan 15, 2011 11:08:15 AM
+ */
+public class SetupAssociationsTreeAction implements Action
+{
+    
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private SelectionTreeManager selectionTreeManager;
+
+    public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+    {
+        this.selectionTreeManager = selectionTreeManager;
+    }
+
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters & Setters
+    // -------------------------------------------------------------------------
+
+    private int deTargetId;
+    
+   
+    
+    public int getDeTargetId()
+    {
+        return deTargetId;
+    }
+
+    public void setDeTargetId( int deTargetId )
+    {
+        this.deTargetId = deTargetId;
+    }
+   
+    private DeTarget deTarget;
+    
+    public DeTarget getDeTarget()
+    {
+        return deTarget;
+    }
+
+    public void setDeTarget( DeTarget deTarget )
+    {
+        this.deTarget = deTarget;
+    }
+   
+
+    // -------------------------------------------------------------------------
+    // Execute
+    // -------------------------------------------------------------------------
+
+
+
+    public String execute() throws Exception
+    {
+        deTarget = deTargetService.getDeTarget( deTargetId );
+        
+        selectionTreeManager.setSelectedOrganisationUnits( convert( deTarget.getSources() ) );
+
+        return SUCCESS;
+    }
+
+    // -------------------------------------------------------------------------
+    // Supportive methods
+    // -------------------------------------------------------------------------
+
+    private Set<OrganisationUnit> convert( Collection<Source> sources )
+    {
+        Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
+        
+        for ( Source source : sources )
+        {               
+            organisationUnits.add( (OrganisationUnit) source );
+        }       
+        
+        return organisationUnits;
+    }
+}
+

=== added file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/UpdateDeTargetAction.java	2011-01-17 07:45:29 +0000
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.hisp.dhis.detarget.action;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+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.detarget.DeTargetMember;
+import org.hisp.dhis.detarget.DeTargetService;
+
+
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version UpdateDeTargetAction.java Jan 15, 2011 4:04:58 PM
+ */
+public class UpdateDeTargetAction implements Action
+{
+    
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private DeTargetService deTargetService;
+    
+    public void setDeTargetService( DeTargetService deTargetService )
+    {
+        this.deTargetService = deTargetService;
+    }
+    
+    private DataElementService dataElementService;
+
+    public void setDataElementService( DataElementService dataElementService )
+    {
+        this.dataElementService = dataElementService;
+    }
+    
+    private DataElementCategoryService dataElementCategoryService;
+
+    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+    {
+        this.dataElementCategoryService = dataElementCategoryService;
+    }
+    // -------------------------------------------------------------------------
+    // Getters & Setters
+    // -------------------------------------------------------------------------
+    
+    private int deTargetId;
+    
+    
+    public void setDeTargetId( int deTargetId )
+    {
+        this.deTargetId = deTargetId;
+    }
+
+    private String name;
+    
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+    
+    private String shortName;
+    
+    public void setShortName( String shortName )
+    {
+        this.shortName = shortName;
+    }
+    
+    private String url;
+    
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }    
+       
+    private String description;
+    
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+    
+    public String getDescription()
+    {
+        return description;
+    }
+    
+    private Collection<String> selectedList = new HashSet<String>();
+    
+    public void setSelectedList( Collection<String> selectedList )
+    {
+        this.selectedList = selectedList;
+    }
+    
+    
+    private List<DeTargetMember>  deTargetMemberList;
+    
+    public List<DeTargetMember> getDeTargetMemberList()
+    {
+        return deTargetMemberList;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Action
+    // -------------------------------------------------------------------------
+    
+    public String execute()
+        throws Exception
+    {
+        // ---------------------------------------------------------------------
+        // Prepare values
+        // ---------------------------------------------------------------------
+    
+        if ( shortName != null && shortName.trim().length() == 0 )
+        {
+                shortName = null;
+        }
+        
+        System.out.println( " \n+++++++++ deTarget Id:" +  deTargetId );
+       
+        DeTarget deTarget = deTargetService.getDeTarget( deTargetId );
+        //deTargetService.getDeTarget( deTargetId );
+        deTarget.setName( name );
+        deTarget.setShortName( shortName );
+        deTarget.setUrl( url );
+        deTarget.setDescription( description );
+        
+        deTargetMemberList = new ArrayList<DeTargetMember>(deTargetService.getDeTargetMembers( deTarget ));
+        
+        
+        //Collection<Indicator> updatedIndicatorList = new HashSet<Indicator>();
+        
+        deTargetService.deleteDeTargetMembers( deTarget );
+       
+        /*
+        for( DeTargetMember dataElementTarget : deTargetMemberList )
+        {
+            
+            deTargetService.deleteDeTargetMember( dataElementTarget );
+            //deTargetService.
+            //selectedDeTargetMember.add( dataElementTarget.getDataelements().getId()+":" + dataElementTarget.getDecategoryOptionCombo().getId() );
+        }
+        */
+        
+        
+        for ( String selectedId : selectedList )
+        {
+            String[] parts = selectedId.split( ":" );
+            DataElement dataElement = dataElementService.getDataElement(  Integer.parseInt( parts[0] ) );
+            DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( parts[1] ));
+            
+            DeTargetMember deTargetMember = new DeTargetMember( deTarget, dataElement, decoc);
+            
+            deTargetService.addDeTargetMember( deTargetMember );
+            //System.out.println( dataElement + ":" +  decoc );
+            
+           
+        }
+        return SUCCESS;
+    }
+}
+

=== modified file 'local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java'
--- local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/java/org/hisp/dhis/detarget/action/ValidateDeTargetAction.java	2011-01-17 07:45:29 +0000
@@ -44,14 +44,14 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-/*
+
     private DeTargetService deTargetService;
     
     public void setDeTargetService( DeTargetService deTargetService )
     {
         this.deTargetService = deTargetService;
     }
- */   
+  
     // -------------------------------------------------------------------------
     // I18n
     // -------------------------------------------------------------------------
@@ -63,14 +63,14 @@
     {
         this.i18n = i18n;
     }
-/*    
-    private Integer surveyId;
+    
+    private Integer deTargetId;
 
-    public void setSurveyId( Integer surveyId )
+    public void setDeTargetId( Integer deTargetId )
     {
-        this.surveyId = surveyId;
+        this.deTargetId = deTargetId;
     }
-*/
+
     private String name;
 
     public void setName( String name )
@@ -123,17 +123,17 @@
 
                 return INPUT;
             }
-/*
+
             DeTarget match = deTargetService.getDeTargetByName( name );
     
-            if ( match != null && ( surveyId == null || match.getId() != surveyId ) )
+            if ( match != null && ( deTargetId == null || match.getId() != deTargetId ) )
             {
                 message = i18n.getString( "duplicate_names" );
     
                 return INPUT;
-            }*/
+           
+            }
         }
-        
         // ---------------------------------------------------------------------
         // Short name
         // ---------------------------------------------------------------------
@@ -155,17 +155,17 @@
                 return INPUT;
             }
 
-            //DeTarget match = deTargetService.getDeTargetByName( shortName );
-    /*
-            if ( match != null && ( surveyId == null || match.getId() != surveyId ) )
+            DeTarget match = deTargetService.getDeTargetByShortName( shortName );
+   
+            if ( match != null && ( deTargetId == null || match.getId() != deTargetId ) )
             {
                 message = i18n.getString( "duplicate_short_names" );
     
                 return INPUT;
-            }*/
+            }
         }
    
         message = "validation success";
         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-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/resources/META-INF/dhis/beans.xml	2011-01-17 07:45:29 +0000
@@ -228,7 +228,7 @@
     <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">
@@ -236,45 +236,45 @@
       ref="org.hisp.dhis.survey.state.SelectedStateManager"/>
     <property name="deTargetDataValueService"
       ref="org.hisp.dhis.detargetdatavalue.DeTargetDataValueService"/>  
-	<property name="deTargetService"
+    <property name="deTargetService"
       ref="org.hisp.dhis.detarget.DeTargetService"/> 
-	 <property name="periodService"
+     <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"
+      class="org.hisp.dhis.detarget.action.SavetargetValueAction"
+      scope="prototype">
+      <property name="selectedStateManager"
         ref="org.hisp.dhis.survey.state.SelectedStateManager"/>
-	  <property name="currentUserService"
+      <property name="currentUserService"
         ref="org.hisp.dhis.user.CurrentUserService"/>
-	  <property name="dataElementService"
+      <property name="dataElementService"
         ref="org.hisp.dhis.dataelement.DataElementService"/>
-	  <property name="categoryService"
+      <property name="categoryService"
         ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
-	  <property name="deTargetdataValueService"
+      <property name="deTargetdataValueService"
         ref="org.hisp.dhis.detargetdatavalue.DeTargetDataValueService"/>
-	  <property name="periodService"
+      <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"
+      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"
+    
+    <bean id="org.hisp.dhis.detarget.action.GenerateTargetAction"
     class="org.hisp.dhis.target.action.GenerateTargetAction" 
     scope="prototype">
     <property name="dataElementService"
       ref="org.hisp.dhis.dataelement.DataElementService"/> 
      <property name="dataElementCategoryService"
-      	ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>  	 
+        ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>     
   </bean>
-	  
+      
    <bean id="org.hisp.dhis.detarget.action.SaveMappingAction"
       class="org.hisp.dhis.detarget.action.SaveMappingAction" 
       scope="prototype">
@@ -282,10 +282,10 @@
         ref="org.hisp.dhis.dataelement.DataElementService"/>  
       <property name="deTargetMappingService"
         ref="org.hisp.dhis.target.DeTargetMappingService"/>  
-	  <property name="dataElementCategoryService"
-      	ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>         
+      <property name="dataElementCategoryService"
+        ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>         
   </bean> 
-	
+    
     <bean id="org.hisp.dhis.detarget.action.GetDataElementsAction"
     class="org.hisp.dhis.detarget.action.GetDataElementsAction" 
     scope="prototype">
@@ -294,18 +294,18 @@
     <property name="dataElementCategoryService"
       ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>       
   </bean>
-		
-	<bean id="org.hisp.dhis.detarget.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"/>   
-	<property name="dataElementCategoryService"
-      	ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>  
+    <property name="dataElementCategoryService"
+        ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>  
     <property name="deTargetMappingService"
       ref="org.hisp.dhis.target.DeTargetMappingService"/>          
   </bean> 
-	
+    
    <bean id="org.hisp.dhis.detarget.action.DelMappingAction"
       class="org.hisp.dhis.detarget.action.DelMappingAction" 
       scope="prototype">
@@ -314,10 +314,12 @@
       <property name="deTargetMappingService"
         ref="org.hisp.dhis.target.DeTargetMappingService"/>  
       <property name="dataElementCategoryService"
-      	ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>     
+        ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>     
   </bean>
 	
-	<!-- DataElement Targets -->
+	
+	
+   <!-- DataElement Targets -->
    <bean id="org.hisp.dhis.detarget.action.DeTargetListAction"
       class="org.hisp.dhis.detarget.action.DeTargetListAction" 
       scope="prototype">
@@ -347,6 +349,13 @@
 	 </property>
    </bean>
 	
+<!-- Validation for Adding DataElement Target  -->
+	<bean id="org.hisp.dhis.detarget.action.ValidateDeTargetAction"
+    class="org.hisp.dhis.detarget.action.ValidateDeTargetAction"
+    scope="prototype">
+    <property name="deTargetService" ref="org.hisp.dhis.detarget.DeTargetService">
+    </property>
+   </bean>
 	
    <!-- Show Details DataElement Target  -->  
    <bean id="org.hisp.dhis.detarget.action.GetDeTargetDetailsAction"
@@ -367,9 +376,73 @@
 	<property name="dataElementCategoryService">
 		<ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
 	</property>
-   </bean>  
+	<property name="deTargetService" ref="org.hisp.dhis.detarget.DeTargetService"></property>
+   </bean>
 
-	
-	
+	<!-- DeTarget Association -->
+	
+	<bean id="org.hisp.dhis.detarget.action.GetNumberOfLevelsAction"
+    class="org.hisp.dhis.detarget.action.GetNumberOfLevelsAction" scope="prototype">
+      <property name="organisationUnitService">
+      <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+    </property>     
+    </bean>	
+	
+	<bean id="org.hisp.dhis.detarget.action.SetupAssociationsTreeAction"
+    class="org.hisp.dhis.detarget.action.SetupAssociationsTreeAction"
+    scope="prototype">
+      <property name="selectionTreeManager">
+      <ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
+    </property>
+    <property name="deTargetService">
+      <ref bean="org.hisp.dhis.detarget.DeTargetService"/>
+    </property> 
+    </bean>
+			
+	
+	<bean id="org.hisp.dhis.detarget.action.DefineDeTargetAssociationsAction"
+    class="org.hisp.dhis.detarget.action.DefineDeTargetAssociationsAction"
+    scope="prototype">
+      <property name="selectionTreeManager">
+      <ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
+    </property>
+    <property name="deTargetService">
+      <ref bean="org.hisp.dhis.detarget.DeTargetService"/>
+    </property>
+	<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService">
+	</property>
+    </bean>
+	
+	<!-- Edit DeTarget Form  -->
+	<bean id="org.hisp.dhis.detarget.action.GetDeTargetAction"
+    class="org.hisp.dhis.detarget.action.GetDeTargetAction"
+    scope="prototype">
+      <property name="dataElementService">
+      <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
+    </property>
+	<property name="deTargetService" ref="org.hisp.dhis.detarget.DeTargetService">
+	</property>
+    </bean>
+	
+	<bean id="org.hisp.dhis.detarget.action.UpdateDeTargetAction"
+    class="org.hisp.dhis.detarget.action.UpdateDeTargetAction"
+    scope="prototype">
+      <property name="dataElementService">
+      <ref bean="org.hisp.dhis.dataelement.DataElementService"/>
+    </property>
+	<property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService">
+	</property>	
+    <property name="deTargetService" ref="org.hisp.dhis.detarget.DeTargetService">
+    </property>
+    </bean>
+	
+	<!-- Delete DeTarget Form  -->
+    <bean id="org.hisp.dhis.detarget.action.DelDeTargetAction"
+    class="org.hisp.dhis.detarget.action.DelDeTargetAction"
+    scope="prototype">
+ 
+    <property name="deTargetService" ref="org.hisp.dhis.detarget.DeTargetService">
+    </property>
+    </bean>
   
 </beans>

=== 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-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/detarget/i18n_module.properties	2011-01-17 07:45:29 +0000
@@ -3,8 +3,6 @@
 survey_data_entry = Survey Data Entry
 survey = Survey
 de_target = DataElement Target
-
-
 add_new				=	Add New
 name				=	Name
 operations			=	Operations
@@ -55,15 +53,19 @@
 not_del_contain_data = Not Deleted Its Contains Data
 confirm_delete_survey = Are you sure you want to Remove Survey?
 number_of_dataelements = Number of DataElements
-detarget_mamagement = DE Target Management
+detarget_mamagement = DataElement Target Management
 de_target_mamagement = DataElement Target Management
 add_deTarget = Add DataElement Target
 deTarget_details = DataElement Target Details
 available_dataElements = Available DataElements
 selected_dataElements = Selected DataElements
 group = Group
+define_detarget_associations = Define DataElement Target Associations
 select_deGroup_all = Select DataElementGroup / All
-detarget_data_entry = DeTarget Data Entry
+detarget_data_entry = DataElement Target Data Entry
 sl_no = Sl. No.
 dataelement = DataElement
 value = Value
+edit_detarget = Edit DataElement Target
+detarget_details DataElement Target Details
+detarget_dataentry = DataElement Target Data Entry

=== 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-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/resources/org/hisp/dhis/survey/i18n_module.properties	2011-01-17 07:45:29 +0000
@@ -55,9 +55,9 @@
 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
+detarget_mamagement = DataElement Target Management
+detarget_dataentry = DataElement Target Data Entry
 add_deTarget = Add DataElement Target
 deTarget_details = DataElement Target Details
 available_dataElements = Available DataElements

=== modified file 'local/in/dhis-web-survey/src/main/resources/struts.xml'
--- local/in/dhis-web-survey/src/main/resources/struts.xml	2011-01-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/resources/struts.xml	2011-01-17 07:45:29 +0000
@@ -212,7 +212,7 @@
 		<!--Target Mapping-->
 		
 		<action name="generateTarget"
-			class="org.hisp.dhis.detarget.action.GenerateTargetAction">
+			class="org.hisp.dhis.target.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,83 +221,84 @@
 		</action>
 		
 		<action name="saveMapping"
-			class="org.hisp.dhis.detarget.action.SaveMappingAction">
+			class="org.hisp.dhis.target.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.detarget.action.DelMappingAction">
+			class="org.hisp.dhis.target.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.detarget.action.GetDataElementsAction">
+			class="org.hisp.dhis.target.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.detarget.action.GetMesageAction">
+			class="org.hisp.dhis.target.action.GetMesageAction">
 			<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>
+        
+		
 		<!-- DataElement Targets -->
 		<action name="deTargetManagement" class="org.hisp.dhis.detarget.action.DeTargetListAction">
             <result name="success" type="velocity">/main.vm</result>
@@ -342,6 +343,69 @@
             <param name="onExceptionReturn">plainTextError</param>
         </action>
 		
+		<!-- DeTarget Association -->
+        
+       <action name="defineDeTargetAssociationsForm"
+            class="org.hisp.dhis.detarget.action.GetNumberOfLevelsAction">
+            <result name="success" type="chain">defineDeTargetAssociationsFormChain</result>
+            <!--<param name="requiredAuthorities">F_DATASET_ASSIGN</param>-->
+        </action>
+        
+        <action name="defineDeTargetAssociationsFormChain"
+            class="org.hisp.dhis.detarget.action.SetupAssociationsTreeAction">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-survey/deTargetAssociations.vm</param>
+            <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/associations.js</param>
+            <!--<param name="requiredAuthorities">F_DATASET_ASSIGN</param>-->
+        </action>
+        
+        <action name="defineDeTargetAssociations"
+            class="org.hisp.dhis.detarget.action.DefineDeTargetAssociationsAction">
+            <result name="success" type="redirect">deTargetManagement.action</result>
+            <!--<param name="requiredAuthorities">F_DATASET_ASSIGN</param>-->
+        </action>
+		
+	   <!-- Edit DeTarget Form  -->
+        
+<!--        <action name="editDeTargetForm"
+            class="org.hisp.dhis.detarget.action.DataElementListFilterByGroupAction">
+            <result name="success" type="chain">
+                <param name="actionName">deTargetGroupListEditChain</param>
+            </result>
+           
+        </action>-->
+<!--        
+        <action name="deTargetGroupListEditChain"
+            class="org.hisp.dhis.detarget.action.DataElementGroupListAction">
+            <result name="success" type="chain">
+                <param name="actionName">getDeTargetEditChain</param>
+            </result>
+            
+        </action>-->
+        
+        <action name="editDeTargetForm"
+            class="org.hisp.dhis.detarget.action.GetDeTargetAction">
+            <result name="success" type="velocity">/main.vm</result>
+            <param name="page">/dhis-web-survey/editDeTarget.vm</param>
+            <param name="javascripts">javascript/deTarget.js,javascript/filterTable.js</param>
+            <!--<param name="requiredAuthorities">F_SURVEY_UPDATE</param>-->
+        </action>
+        
+        <action name="updateDeTarget"
+            class="org.hisp.dhis.detarget.action.UpdateDeTargetAction">
+            <result name="success" type="redirect">deTargetManagement.action</result>
+            <param name="javascripts">javascript/deTarget.js,javascript/filterTable.js</param>
+            <!--<param name="requiredAuthorities">F_DATASET_UPDATE</param>-->
+        </action>
+	    
+		<!-- Delete DeTarget -->
+        
+        <action name="delDeTarget"
+            class="org.hisp.dhis.detarget.action.DelDeTargetAction">
+            <result name="success" type="velocity-xml">/dhis-web-survey/responseSuccess.vm</result>
+            <result name="error" type="velocity-xml">/dhis-web-survey/responseError.vm</result>
+            <!--<param name="requiredAuthorities">F_DATASET_DELETE</param>-->
+        </action>
 		
 	</package>
 </struts>

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/addDeTarget.vm	2011-01-17 07:45:29 +0000
@@ -38,7 +38,7 @@
     <thead>
       <tr>
         <th>$i18n.getString( "available_dataElements" )</th>
-        <th>$i18n.getString( "filter" )</th>
+        <th>##$i18n.getString( "filter" )</th>
         <th>$i18n.getString( "selected_dataElements" )</th>
       </tr>
     </thead>
@@ -55,14 +55,16 @@
                 #end
           </select>
             </td>       
-        <td>$i18n.getString( "group" )</td>
+        <td>##$i18n.getString( "group" )</td>
         <td></td>
       </tr>
       
       <tr>
-        <td><input type="text" id="availableDataElementFilter" onkeyup="filterValues( this.value )" style="min-width:25em"></td>
-        <td>$i18n.getString( "name" )</td>
-        <td><input type="text" id="deTargetMembersFilter" onkeyup="filterValues( this.value )" style="min-width:25em"></td>
+        <td><!--<input type="text" id="availableDataElementFilter" onkeyup="filterValues( this.value )" style="min-width:25em">--></td>
+        <td><!--<input type="text" id="availableDataElementFilter" onkeyup="filterAvailableDataElements()" style="min-width:25em">--></td>
+        <td>##$i18n.getString( "name" )</td>
+        <td><!--<input type="text" id="deTargetMembersFilter" onkeyup="filterValues( this.value )" style="min-width:25em">--></td> 
+        <td><!--<input type="text" id="deTargetMembersFilter" onkeyup="filterDeTargetMembers()" style="min-width:25em">--></td>
       </tr>
       
       <tr>

=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetAssociations.vm	2011-01-17 07:45:29 +0000
@@ -0,0 +1,23 @@
+<h3>$i18n.getString( "define_detarget_associations" )</h3>
+
+<h4>$encoder.htmlEncode( $deTarget.name )</h4>
+
+<form id="defineDeTargetAssociationsForm" action="defineDeTargetAssociations.action" method="post">
+  <div style="display:inline">
+    <input type="hidden" name="deTargetId" value="$deTargetId">
+  </div>
+  <table id="selectionTable">
+    <tr>
+      <td>
+        #organisationUnitSelectionTree( false, true, false )
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <input type="submit" id="submitButton" value="$i18n.getString( "save" )" style="width:10em">
+        <input type="button" onclick="window.location.href='deTargetManagement.action'" value="$i18n.getString( "cancel" )" style="width:10em">
+      </td>
+    </tr>
+  </table>
+
+</form>
\ No newline at end of file

=== modified file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm	2011-01-14 12:08:54 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/deTargetList.vm	2011-01-17 07:45:29 +0000
@@ -1,5 +1,5 @@
 
-<h3>$i18n.getString( "de_target_mamagement" )t</h3>
+<h3>$i18n.getString( "de_target_mamagement" )</h3>
 
 <table class="mainPageTable">
   <tr>
@@ -29,13 +29,13 @@
               <tr>
                 <td#alternate( $mark )>$encoder.htmlEncode( $deTarget.name )</td>
                 <td style="text-align:center"#alternate( $mark )>
-                  <a href="defineSurveyAssociationsForm.action?deTargetId=$deTarget.id" title="$i18n.getString( "define_associations" )"><img src="../images/assign.png" alt="$i18n.getString( "define_associations" )"></a>
-                </td>
-                <td style="text-align:center"#alternate( $mark )>
-                  <a href="editSurveyForm.action?deTargetId=$deTarget.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
-                </td>
-                <td style="text-align:center"#alternate( $mark )>
-                  <a href="javascript:removeSurvey( '$deTarget.id', '$encoder.jsEncode( $deTarget.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
+                  <a href="defineDeTargetAssociationsForm.action?deTargetId=$deTarget.id" title="$i18n.getString( "define_associations" )"><img src="../images/assign.png" alt="$i18n.getString( "define_associations" )"></a>
+                </td>
+                <td style="text-align:center"#alternate( $mark )>
+                  <a href="editDeTargetForm.action?deTargetId=$deTarget.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
+                </td>
+                <td style="text-align:center"#alternate( $mark )>
+                  <a href="javascript:removeDeTarget( '$deTarget.id', '$encoder.jsEncode( $deTarget.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
                 </td>            
                 <td style="text-align:center"#alternate( $mark )>
                   <a href="javascript:showDeTargetDetails( $deTarget.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>

=== added file 'local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm'
--- local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/editDeTarget.vm	2011-01-17 07:45:29 +0000
@@ -0,0 +1,105 @@
+
+<h3>$i18n.getString( "edit_detarget" )</h3>
+
+<form id="editDeTargetForm" name="editDeTargetForm" action="updateDeTarget.action" method="post" onsubmit="return validateEditDeTarget()">
+  <div style="display:inline">
+  <input type="hidden" id="deTargetId" name="deTargetId" value="$deTarget.id">
+  </div>
+  
+  <table id="detailsList">
+    <col> ## Labels
+    <col> ## Input
+    <thead>
+      <tr>
+        <th colspan="2">$i18n.getString( "detarget_details" )</th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr>
+        <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+        <td><input type="text" id="name" name="name" style="width:20em" value="$!encoder.htmlEncode( $deTarget.name )"></td>
+      </tr>      
+      <tr>
+        <td><label>$i18n.getString( "short_name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+        <td><input type="text" id="shortName" name="shortName" maxlength="20" style="width:20em" value="$!encoder.htmlEncode( $deTarget.shortName )"></td>
+      </tr>     
+      <tr>
+        <td><label>$i18n.getString( "url" )</label></td>
+        <td><input type="text" id="url" name="url" style="width:20em" value="$!encoder.htmlEncode( $deTarget.url )"></td>
+      </tr>
+       <tr>
+        <td><label>$i18n.getString( "description" )</label></td>
+         <td><textarea id="description" name="description" cols=41 rows=4>$!encoder.htmlEncode( $deTarget.description )</textarea></td>
+      </tr>   
+      <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
+    </tbody>
+  </table>
+
+  <table id="indicatorSelectionArea">
+    <col> ## Available Indicators
+    <col> ## Filter
+    <col> ## Selected Indicators
+    <thead>
+      <tr>
+        <th>$i18n.getString( "available_dataElements" )</th>
+        <th>##$i18n.getString( "filter" )</th>
+        <th>$i18n.getString( "selected_dataElements" )</th>
+      </tr>
+    </thead>
+    <tbody>
+        
+      <tr>
+        <td>
+          <select id="indicatorGroupSelect" name="indicatorGroupSelect" style="min-width:20em"
+             onchange="javascript:filterByDataElementGroup( this.options[this.selectedIndex].value )">
+           <option value="ALL">$i18n.getString( "select_deGroup_all" )</option>
+            #foreach ( $dataElementGroup in $dataElementGroups )
+              <option value="$dataElementGroup.id">$encoder.htmlEncode( $dataElementGroup.name )</option>
+            #end
+          </select>
+        </td>
+        <td>##$i18n.getString( "group" )</td>
+        <td></td>
+      </tr>
+     
+      <tr>
+        <td><!--<input type="text" id="availableDataElementFilter" onkeyup="filterValues( this.value )" style="min-width:20em">--></td>
+        <td>##$i18n.getString( "name" )</td>
+        <td><!--<input type="text" id="deTargetMembersFilter" onkeyup="filterValues( this.value )" style="min-width:20em">--></td>        
+      </tr>
+     
+      <tr>
+        <td>
+          <!-- List of all available DataElements -->
+          <select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'availableList', 'selectedList' )">           
+          </select>
+        </td>
+        <td>
+          <input type="button" value="&gt;" title="$i18n.getString('move_selected')" onClick="moveSelectedById( 'availableList', 'selectedList' )">
+          <br>
+          <input type="button" value="&lt;" title="$i18n.getString('remove_selected')" onClick="moveSelectedById( 'selectedList', 'availableList' )">
+        </td>
+        <td>
+          <!-- List of all selected DataElements -->
+          <select id="selectedList" name="selectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'selectedList', 'availableList' )">
+          #foreach ( $deTargetMember in $deTargetMemberList )
+              <option value="$deTargetMember.dataelements.id:$deTargetMember.decategoryOptionCombo.id">$encoder.htmlEncode( $deTargetMember.dataelements.name ):$encoder.htmlEncode( $deTargetMember.decategoryOptionCombo.name )</option>
+            #end
+          
+          </select>
+        </td>
+      </tr>
+
+      <tr>
+        <td colspan="3">
+          <input type="submit" value="$i18n.getString( "save" )" style="width:10em"><input type="button"
+            onclick="window.location.href='deTargetManagement.action'" value="$i18n.getString( "cancel" )" style="width:10em">
+        </td>
+      </tr>
+      
+    </tbody>
+  </table>
+</form>
+
+<span id="message"></span>
+

=== 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-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/javascript/deTarget.js	2011-01-17 07:45:29 +0000
@@ -3,29 +3,29 @@
 // Delete Survey
 // -----------------------------------------------------------------------------
 
-var tmpSurveyId;
-
-var tmpSource;
-
-function removeSurvey( surveyId, surveyName )
+//var tmpSurveyId;
+
+//var tmpSource;
+
+function removeDeTarget( deTargetId, deTargetName )
 {
-  var result = window.confirm( i18n_confirm_delete + '\n\n' + " Survey Id =" + surveyId + '\n\n' + " Survey Name ="  + surveyName );
+  var result = window.confirm( i18n_confirm_delete + '\n\n' + " DeTarget Id =" + deTargetId + '\n\n' + " DeTarget Name ="  + deTargetName );
 
   if ( result )
   {
-	$.post("delSurvey.action",
+	$.post("delDeTarget.action",
 		{
-			surveyId : surveyId
+		deTargetId : deTargetId
 		},
 		function (data)
 		{
-			removeSurveyCompleted(data);
+			removeDeTargetCompleted(data);
 		},'xml');
 		
   }
 }
 
-function removeSurveyCompleted( messageElement )
+function removeDeTargetCompleted( messageElement )
 {
 	messageElement = messageElement.getElementsByTagName( "message" )[0];
 	var type = messageElement.getAttribute( "type" );
@@ -40,7 +40,7 @@
    }
    else
    {
-		window.location.href = 'index.action';
+		window.location.href = 'deTargetManagement.action';
    }
 }
 
@@ -54,13 +54,13 @@
 		},
 		function (data)
 		{
-			addSurveyValidationCompleted(data);
+			addDeTargetValidationCompleted(data);
 		},'xml');
 		
   return false;
 }
 
-function addSurveyValidationCompleted( messageElement )
+function addDeTargetValidationCompleted( messageElement )
 {
   	messageElement = messageElement.getElementsByTagName( "message" )[0];
 	var type = messageElement.getAttribute( "type" );
@@ -82,38 +82,39 @@
 }
 
 
-function validateEditSurvey()
+function validateEditDeTarget()
 {
-  $.post("validateSurvey.action",
+	//alert("inside update");
+	$.post("validateDeTarget.action",
 		{
 			name :  byId( 'name' ).value,
 			shortName : byId( 'shortName' ).value,
 			url : byId( 'url' ).value,
-			surveyId : byId( 'surveyId' ).value
+			deTargetId : byId( 'deTargetId' ).value
 		},
 		function (data)
 		{
-			editSurveyValidationCompleted(data);
+			editDeTargetValidationCompleted(data);
 		},'xml');
 
   return false;
 }
-function editSurveyValidationCompleted( messageElement )
+function editDeTargetValidationCompleted( messageElement )
 {
+	//alert("inside update result");
   	messageElement = messageElement.getElementsByTagName( "message" )[0];
 	var type = messageElement.getAttribute( "type" );
 	var message = messageElement.firstChild.nodeValue;
 
 	if ( type == 'success' )
 	{
-		// Both edit and add form has id='dataSetForm'
 		var selectedList = document.getElementById( 'selectedList' );
 		for(var k=0;k<selectedList.length;k++)
 		{
 			selectedList.options[k].selected = "true";
 		} 
 		  
-		document.forms['editSurveyForm'].submit();
+		document.forms['editDeTargetForm'].submit();
 	}
 	else if ( type == 'input' )
 	{
@@ -124,6 +125,29 @@
 // ----------------------------------------------------------------------
 // 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;
@@ -141,8 +165,9 @@
         }
     }
 }
-
+*/
 //complette
+/*
 function filterAvailableDataElements()
 {
 	var filter = document.getElementById( 'availableDataElementFilter' ).value;
@@ -160,7 +185,7 @@
         }
     }
 }
-
+*/
 function addDeTargetMembers()
 {
 	var list = document.getElementById( 'availableList' );
@@ -179,7 +204,7 @@
     filterDeTargetMembers();
     filterAvailableDataElements();
 }
-
+/*
 function removeDeTargetMembers()
 {
 	var list = document.getElementById( 'selectedList' );
@@ -198,38 +223,68 @@
     filterSurveyMembers();
     filterAvailableIndicators();
 }
-
+*/
 function filterByDataElementGroup( selectedDataElementGroup )
 {
   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 );
+  //alert( "DataElement Group Received lent of Group member " + dataElements.length );
   for ( var i = 0; i < dataElements.length; i++ )
   {
       var id = dataElements[ i ].getElementsByTagName("id")[0].firstChild.nodeValue;

=== 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-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menu.vm	2011-01-17 07:45:29 +0000
@@ -9,7 +9,7 @@
     <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>
+			<li><a href="targetDataEntry.action">$i18n.getString( "detarget_dataentry" )</a></li>
         
     </ul>
         

=== 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	2011-01-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTree.vm	2011-01-17 07:45:29 +0000
@@ -8,7 +8,8 @@
     <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" )
+##parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
 <script>
 	function organisationUnitSelected( orgUnits )
 	{

=== modified 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	2011-01-15 11:35:42 +0000
+++ local/in/dhis-web-survey/src/main/webapp/dhis-web-survey/menuWithTreeForDeTarget.vm	2011-01-17 07:45:29 +0000
@@ -5,10 +5,10 @@
     <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>
+    <a href="deTargetManagement.action"><img src="images/goback.png" width="36" height="30" alt="$i18n.getString( "go_back" )"></a>
 </div>
-
-#parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
+#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
+##parse( "/dhis-web-commons/ouwt/orgunittree.vm" )
 <script>
 	function organisationUnitSelected( orgUnits )
 	{