← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4840: wip, groupset ui for data elements / indicators

 

------------------------------------------------------------
revno: 4840
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-10-05 17:00:45 +0200
message:
  wip, groupset ui for data elements / indicators
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java


--
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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java	2011-10-05 10:06:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java	2011-10-05 15:00:45 +0000
@@ -29,9 +29,11 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.common.AbstractIdentifiableObject;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
 
 /**
  * DataElementGroupSet is a set of DataElementGroups. It is by default
@@ -128,6 +130,15 @@
         return members != null && members.size() > 0;
     }
 
+    public List<DataElementGroup> getSortedGroups()
+    {
+        List<DataElementGroup> sortedGroups = new ArrayList<DataElementGroup>( members );
+
+        Collections.sort( sortedGroups, new DataElementGroupNameComparator() );
+
+        return sortedGroups;
+    }
+
     // -------------------------------------------------------------------------
     // equals and hashCode
     // -------------------------------------------------------------------------
@@ -183,6 +194,11 @@
 
     public Boolean isCompulsory()
     {
+        if ( compulsory == null )
+        {
+            return false;
+        }
+
         return compulsory;
     }
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java	2011-10-05 10:06:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorGroupSet.java	2011-10-05 15:00:45 +0000
@@ -29,9 +29,11 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import org.hisp.dhis.common.AbstractIdentifiableObject;
+import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
 
 /**
  * An IndicatorGroupSet is a set of IndicatorGroups. It is by default exclusive,
@@ -128,6 +130,15 @@
         return members != null && members.size() > 0;
     }
 
+    public List<IndicatorGroup> getSortedGroups()
+    {
+        List<IndicatorGroup> sortedGroups = new ArrayList<IndicatorGroup>( members );
+
+        Collections.sort( sortedGroups, new IndicatorGroupNameComparator() );
+
+        return sortedGroups;
+    }
+
     // -------------------------------------------------------------------------
     // equals and hashCode
     // -------------------------------------------------------------------------
@@ -183,6 +194,11 @@
 
     public Boolean isCompulsory()
     {
+        if ( compulsory == null )
+        {
+            return false;
+        }
+
         return compulsory;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java	2011-09-22 10:32:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java	2011-10-05 15:00:45 +0000
@@ -29,12 +29,14 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroup;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.system.util.AttributeUtils;
 import org.hisp.dhis.system.util.ConversionUtils;
@@ -181,6 +183,13 @@
         this.jsonAttributeValues = jsonAttributeValues;
     }
 
+    private Collection<String> selectedGroups = new HashSet<String>();
+
+    public void setSelectedGroups( Collection<String> selectedGroups )
+    {
+        this.selectedGroups = selectedGroups;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -238,9 +247,22 @@
             AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues,
                 attributeService );
         }
-
+        
         dataElementService.addDataElement( dataElement );
-
+        
+        for ( String id : selectedGroups )
+        {
+            DataElementGroup group = dataElementService.getDataElementGroup( Integer.parseInt( id ) );
+
+            if ( group != null )
+            {
+                group.addDataElement( dataElement );
+                dataElementService.updateDataElementGroup( group );
+            }
+        }
+
+        dataElementService.updateDataElement( dataElement );
+        
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java	2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java	2011-10-05 15:00:45 +0000
@@ -38,8 +38,10 @@
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataelement.comparator.DataElementCategoryComboNameComparator;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupSetNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
@@ -116,6 +118,13 @@
         return organisationUnitLevels;
     }
 
+    private List<DataElementGroupSet> groupSets;
+
+    public List<DataElementGroupSet> getGroupSets()
+    {
+        return groupSets;
+    }
+
     private List<Attribute> attributes;
 
     public List<Attribute> getAttributes()
@@ -137,14 +146,17 @@
         dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>(
             dataElementCategoryService.getAllDataElementCategoryCombos() );
 
-        Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
-
         organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
 
+        groupSets = new ArrayList<DataElementGroupSet>(
+            dataElementService.getCompulsoryDataElementGroupSetsWithMembers() );
+
         attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
 
+        Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
+        Collections.sort( groupSets, new DataElementGroupSetNameComparator() );
         Collections.sort( attributes, new AttributeSortOrderComparator() );
-        
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java	2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java	2011-10-05 15:00:45 +0000
@@ -41,8 +41,10 @@
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataelement.comparator.DataElementCategoryComboNameComparator;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupSetNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -141,6 +143,13 @@
         return defaultCategoryCombo;
     }
 
+    private List<DataElementGroupSet> groupSets;
+
+    public List<DataElementGroupSet> getGroupSets()
+    {
+        return groupSets;
+    }
+
     private List<Attribute> attributes;
 
     public List<Attribute> getAttributes()
@@ -167,8 +176,6 @@
         dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>(
             dataElementCategoryService.getAllDataElementCategoryCombos() );
 
-        Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
-
         dataElement = dataElementService.getDataElement( id );
 
         organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
@@ -182,12 +189,17 @@
 
         organisationUnitLevels.removeAll( aggregationLevels );
 
+        groupSets = new ArrayList<DataElementGroupSet>(
+            dataElementService.getCompulsoryDataElementGroupSetsWithMembers() );
+
         attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
 
+        attributeValues = AttributeUtils.getAttributeValueMap( dataElement.getAttributeValues() );
+
+        Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
+        Collections.sort( groupSets, new DataElementGroupSetNameComparator() );
         Collections.sort( attributes, new AttributeSortOrderComparator() );
 
-        attributeValues = AttributeUtils.getAttributeValueMap( dataElement.getAttributeValues() );
-
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java	2011-09-27 11:46:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java	2011-10-05 15:00:45 +0000
@@ -36,6 +36,8 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
@@ -198,6 +200,20 @@
         this.zeroIsSignificant = zeroIsSignificant;
     }
 
+    private List<String> dataElementGroupSets = new ArrayList<String>();
+
+    public void setDataElementGroupSets( List<String> dataElementGroupSets )
+    {
+        this.dataElementGroupSets = dataElementGroupSets;
+    }
+
+    private List<String> dataElementGroups = new ArrayList<String>();
+
+    public void setDataElementGroups( List<String> dataElementGroups )
+    {
+        this.dataElementGroups = dataElementGroups;
+    }
+
     private List<String> jsonAttributeValues;
 
     public void setJsonAttributeValues( List<String> jsonAttributeValues )
@@ -268,6 +284,28 @@
             dataSetService.updateDataSet( dataSet.increaseVersion() );
         }
 
+        for ( int i = 0; i < dataElementGroupSets.size(); i++ )
+        {
+            DataElementGroupSet groupSet = dataElementService.getDataElementGroupSet( Integer
+                .parseInt( dataElementGroupSets.get( i ) ) );
+
+            DataElementGroup oldGroup = groupSet.getGroup( dataElement );
+            DataElementGroup newGroup = dataElementService.getDataElementGroup( Integer.parseInt( dataElementGroups
+                .get( i ) ) );
+
+            if ( oldGroup != null && oldGroup.getMembers().remove( dataElement ) )
+            {
+                oldGroup.removeDataElement( dataElement );
+                dataElementService.updateDataElementGroup( oldGroup );
+            }
+
+            if ( newGroup != null && newGroup.getMembers().add( dataElement ) )
+            {
+                newGroup.addDataElement( dataElement );
+                dataElementService.updateDataElementGroup( newGroup );
+            }
+        }
+
         if ( jsonAttributeValues != null )
         {
             AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues,

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java	2011-09-24 11:35:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/AddIndicatorAction.java	2011-10-05 15:00:45 +0000
@@ -27,10 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -156,6 +159,13 @@
         this.jsonAttributeValues = jsonAttributeValues;
     }
 
+    private Collection<String> selectedGroups = new HashSet<String>();
+
+    public void setSelectedGroups( Collection<String> selectedGroups )
+    {
+        this.selectedGroups = selectedGroups;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -199,9 +209,22 @@
             AttributeUtils.updateAttributeValuesFromJson( indicator.getAttributeValues(), jsonAttributeValues,
                 attributeService );
         }
-
+        
         indicatorService.addIndicator( indicator );
 
+        for ( String id : selectedGroups )
+        {
+            IndicatorGroup group = indicatorService.getIndicatorGroup( Integer.parseInt( id ) );
+
+            if ( group != null )
+            {
+                group.addIndicator( indicator );
+                indicatorService.updateIndicatorGroup( group );
+            }
+        }
+
+        indicatorService.updateIndicator( indicator );
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java	2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java	2011-10-05 15:00:45 +0000
@@ -37,8 +37,10 @@
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
+import org.hisp.dhis.indicator.comparator.IndicatorGroupSetNameComparator;
 import org.hisp.dhis.indicator.comparator.IndicatorTypeNameComparator;
 import org.hisp.dhis.system.util.AttributeUtils;
 
@@ -109,6 +111,13 @@
         return indicatorTypes;
     }
 
+    private List<IndicatorGroupSet> groupSets;
+
+    public List<IndicatorGroupSet> getGroupSets()
+    {
+        return groupSets;
+    }
+
     private List<Attribute> attributes;
 
     public List<Attribute> getAttributes()
@@ -140,14 +149,16 @@
 
         indicatorTypes = new ArrayList<IndicatorType>( indicatorService.getAllIndicatorTypes() );
 
+        groupSets = new ArrayList<IndicatorGroupSet>( indicatorService.getCompulsoryIndicatorGroupSetsWithMembers() );
+
+        attributes = new ArrayList<Attribute>( attributeService.getIndicatorAttributes() );
+
+        attributeValues = AttributeUtils.getAttributeValueMap( indicator.getAttributeValues() );
+
         Collections.sort( indicatorTypes, new IndicatorTypeNameComparator() );
-
-        attributes = new ArrayList<Attribute>( attributeService.getIndicatorAttributes() );
-
+        Collections.sort( groupSets, new IndicatorGroupSetNameComparator() );
         Collections.sort( attributes, new AttributeSortOrderComparator() );
 
-        attributeValues = AttributeUtils.getAttributeValueMap( indicator.getAttributeValues() );
-
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java	2011-09-24 11:35:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/UpdateIndicatorAction.java	2011-10-05 15:00:45 +0000
@@ -27,10 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -156,6 +159,20 @@
         this.denominatorDescription = denominatorDescription;
     }
 
+    private List<String> indicatorGroupSets = new ArrayList<String>();
+
+    public void setIndicatorGroupSets( List<String> indicatorGroupSets )
+    {
+        this.indicatorGroupSets = indicatorGroupSets;
+    }
+
+    private List<String> indicatorGroups = new ArrayList<String>();
+
+    public void setIndicatorGroups( List<String> indicatorGroups )
+    {
+        this.indicatorGroups = indicatorGroups;
+    }
+
     private List<String> jsonAttributeValues;
 
     public void setJsonAttributeValues( List<String> jsonAttributeValues )
@@ -201,6 +218,27 @@
         indicator.setDenominator( denominator );
         indicator.setDenominatorDescription( denominatorDescription );
 
+        for ( int i = 0; i < indicatorGroupSets.size(); i++ )
+        {
+            IndicatorGroupSet groupSet = indicatorService.getIndicatorGroupSet( Integer.parseInt( indicatorGroupSets
+                .get( i ) ) );
+
+            IndicatorGroup oldGroup = groupSet.getGroup( indicator );
+            IndicatorGroup newGroup = indicatorService.getIndicatorGroup( Integer.parseInt( indicatorGroups.get( i ) ) );
+
+            if ( oldGroup != null && oldGroup.getMembers().remove( indicator ) )
+            {
+                oldGroup.removeIndicator( indicator );
+                indicatorService.updateIndicatorGroup( oldGroup );
+            }
+
+            if ( newGroup != null && newGroup.getMembers().add( indicator ) )
+            {
+                newGroup.addIndicator( indicator );
+                indicatorService.updateIndicatorGroup( newGroup );
+            }
+        }
+
         if ( jsonAttributeValues != null )
         {
             AttributeUtils.updateAttributeValuesFromJson( indicator.getAttributeValues(), jsonAttributeValues,

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java	2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java	2011-10-05 15:00:45 +0000
@@ -36,6 +36,7 @@
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.indicator.comparator.IndicatorTypeNameComparator;
@@ -88,8 +89,15 @@
         this.key = key;
     }
 
+    private List<IndicatorGroupSet> groupSets;
+
+    public List<IndicatorGroupSet> getGroupSets()
+    {
+        return groupSets;
+    }
+
     private List<Attribute> attributes;
-    
+
     public List<Attribute> getAttributes()
     {
         return attributes;
@@ -116,12 +124,13 @@
                 paging.getStartPos(), paging.getPageSize() ) );
         }
 
+        groupSets = new ArrayList<IndicatorGroupSet>( indicatorService.getCompulsoryIndicatorGroupSetsWithMembers() );
+
+        attributes = new ArrayList<Attribute>( attributeService.getIndicatorAttributes() );
+
         Collections.sort( indicatorTypes, new IndicatorTypeNameComparator() );
-
-        attributes = new ArrayList<Attribute>( attributeService.getIndicatorAttributes() );
-
         Collections.sort( attributes, new AttributeSortOrderComparator() );
-        
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2011-10-05 10:06:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2011-10-05 15:00:45 +0000
@@ -58,12 +58,14 @@
 select											= Select
 data_element									= Data Element
 data_element_group								= Data Element Group
+data_element_groups								= Data Element Groups
 list_of_data_elements							= Data elements
 list_of_calculated_data_elements				= Calculated data elements
 select_from_data_elements						= Select from data elements
 select_from_calculated_data_elements			= Select from calculated data elements
 indicator										= Indicator
 indicator_group									= Indicator Group
+indicator_groups								= Indicator Groups
 create_new_data_element							= Create new data element
 domain_type										= Domain Type
 value_type										= Value Type

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm	2011-10-03 15:14:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm	2011-10-05 15:00:45 +0000
@@ -29,38 +29,42 @@
 <form id="addDataElementForm" action="addDataElement.action" method="POST" >
 <input type="hidden" id="defaultCategoryCombo" value="$defaultCategoryCombo.id"/>
 <select name="factors" id="factorsSubmit" multiple="multiple" style="display:none"></select>
+
 <table>
+	<col width="200px" />
+	<col width="240px" />
+
 	<tr>
 		<th colspan="2">$i18n.getString( "details" )</th>
 	</tr>
 	<tr>
-		<td style="width:200px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="name" name="name" style="width:20em"/></td>
+		<td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td><input type="text" id="name" name="name" style="width:240px" /></td>
 	</tr>
 	<tr>
 		<td><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="shortName" name="shortName" style="width:20em"/></td>
+		<td><input type="text" id="shortName" name="shortName" style="width:240px" /></td>
 	</tr>
 	<tr>
 		<td><label for="alternativeName">$i18n.getString( "alternative_name" )</label></td>
-		<td><input type="text" id="alternativeName" name="alternativeName" style="width:20em"/></td>
+		<td><input type="text" id="alternativeName" name="alternativeName" style="width:240px" /></td>
 	</tr>
 	<tr>
 		<td><label for="code">$i18n.getString( "code" )</label></td>
-		<td><input type="text" id="code" name="code" style="width:20em"/></td>
+		<td><input type="text" id="code" name="code" style="width:240px" /></td>
 	</tr>
 	<tr>
 		<td><label for="description">$i18n.getString( "description" )</label></td>
-		<td><textarea id="description" name="description" style="width:20em; height:8em"></textarea></td>
+		<td><textarea id="description" name="description" style="width: 240px; height:8em;"></textarea></td>
 	</tr>
 	<tr>
 		<td><label for="formName">$i18n.getString( "form_name" )</label></td>
-		<td><input type="text" id="formName" name="formName" style="width:20em"/></td>
+		<td><input type="text" id="formName" name="formName" style="width:240px" /></td>
 	</tr>
 	<tr>
 		<td><label for="domainType">$i18n.getString( "domain_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select id="domainType" name="domainType" style="min-width:20em">
+			<select id="domainType" name="domainType" style="min-width:244px">
 				<option value="aggregate" selected="selected">$i18n.getString( "aggregate" )</option>
 				<option value="patient">$i18n.getString( "patient" )</option>				
 			</select>
@@ -69,7 +73,7 @@
 	<tr>
 		<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select id="valueType" style="min-width:20em"  onchange="changeValueType( this.value )">
+			<select id="valueType" style="min-width:244px"  onchange="changeValueType( this.value )">
 				<option value="int" selected="selected" onclick="enable('numberType');">$i18n.getString( "number" )</option>
 				<option value="string"onclick="disable('numberType');">$i18n.getString( "text" )</option>
 				<option value="bool"onclick="disable('numberType');">$i18n.getString( "yes_no" )</option>
@@ -81,7 +85,7 @@
 	<tr>
 		<td><label for="numberValueType">$i18n.getString( "number_value_type" )</label></td>
 		<td>
-			<select id="numberType" name="numberType" style="min-width:20em">
+			<select id="numberType" name="numberType" style="min-width:244px">
 				<option value="number">$i18n.getString( "number" )</option>
 				<option value="int" >$i18n.getString( "int" )</option>
 				<option value="positiveNumber">$i18n.getString( "positiveNumber" )</option>
@@ -92,7 +96,7 @@
 	<tr>
 		<td><label for="zeroIsSignificant ">$i18n.getString( "store_zero_data_values" )</label></td>
 		<td>
-			<select id="zeroIsSignificant" name="zeroIsSignificant" style="min-width:20em">
+			<select id="zeroIsSignificant" name="zeroIsSignificant" style="min-width:244px">
 				<option value="false" selected="selected">$i18n.getString( "no" )</option>
 				<option value="true" >$i18n.getString( "yes" )</option>
 			</select>
@@ -101,7 +105,7 @@
 	<tr id="aggregationOperator">
 		<td><label for="aggregationOperator">$i18n.getString( "aggregation_operator" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select name="aggregationOperator" style="min-width:20em">
+			<select name="aggregationOperator" style="min-width:244px">
 				<option value="sum" selected="selected">$i18n.getString( "sum" )</option>
 				<option value="average">$i18n.getString( "average" )</option>
 			</select>
@@ -109,12 +113,12 @@
 	</tr>
     <tr>
         <td><label for="url">$i18n.getString( "url" )</label></td>
-        <td><input type="text" id="url" name="url" style="width:20em"/></td>
+        <td><input type="text" id="url" name="url" style="width:240px" /></td>
     </tr>
 	<tr>	
 		<td><label for="selectedCategoryComboId">$i18n.getString( "category_combo" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select id="selectedCategoryComboId" style="min-width:20em">				
+			<select id="selectedCategoryComboId" style="min-width:244px">				
 			#foreach( $dataElementCategoryCombo in $dataElementCategoryCombos )
 				<option value="$dataElementCategoryCombo.id" #if( $dataElementCategoryCombo.id == $defaultCategoryCombo.id ) selected="selected" #end>$encoder.htmlEncode( $dataElementCategoryCombo.name )</option>
 			#end
@@ -123,50 +127,79 @@
 		</td>
 	</tr>
 	<tr>
-		<td style="height:10px" colspan="2"></td>
-	</tr>
-	<tr>
 		<td style="width:200px">$i18n.getString( "aggregation_levels" )</td>
 		<td><input type="checkbox" onclick="toggleById( 'aggregationLevelsContainer' )"/></td>
 	</tr>
 </table>
 
 <div id="aggregationLevelsContainer" style="border:1px solid #808080; padding:10px; width:465px; display:none;">
-
 <table>
+	<col width="440px" />
+
 	<tr>
-		<th style="width:450px">$i18n.getString( "available_aggregation_levels" )</th>
+		<th>$i18n.getString( "available_aggregation_levels" )</th>
 	</tr>
+
 	<tr>
 		<td>
-			<select multiple size="4" id="organisationUnitLevels" style="width:450px" ondblclick="moveSelectedById( 'organisationUnitLevels', 'aggregationLevels' )">
+			<select multiple size="4" id="organisationUnitLevels" style="width:440px" ondblclick="moveSelectedById( 'organisationUnitLevels', 'aggregationLevels' )">
 			#foreach( $level in $organisationUnitLevels )
 				<option value="$level.level">$level.name</option>
 			#end
 			</select>
 		</td>
     </tr>
+
     <tr>
     	<td>
-		    <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add' )" style="width:120px" onclick="moveSelectedById( 'organisationUnitLevels', 'aggregationLevels' )"/><input 
-		           type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove' )" style="width:120px" onclick="moveSelectedById( 'aggregationLevels', 'organisationUnitLevels' )"/>
+		    <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add' )" style="width:120px" onclick="moveSelectedById( 'organisationUnitLevels', 'aggregationLevels' )"/>
+		    <input type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove' )" style="width:120px" onclick="moveSelectedById( 'aggregationLevels', 'organisationUnitLevels' )"/>
         </td>
     </tr>
+
     <tr>
-        <th style="width:450px">$i18n.getString( "selected_aggregation_levels" )</th>
+        <th>$i18n.getString( "selected_aggregation_levels" )</th>
     </tr>
+
     </tr>
         <td>
-        	<select multiple size="4" id="aggregationLevels" name="aggregationLevels" style="width:450px" ondblclick="moveSelectedById( 'aggregationLevels', 'organisationUnitLevels' )">
-            </select>
+        	<select multiple size="4" id="aggregationLevels" name="aggregationLevels" style="width:450px" ondblclick="moveSelectedById( 'aggregationLevels', 'organisationUnitLevels' )"></select>
         </td>
 	</tr>
 </table>
-
 </div>
 
 #tblDynamicAttributes( { "attributes": $attributes } )
 
+#if( $groupSets.size() > 0 )
+<table>
+	<col width="200px" />
+	<col width="240px" />
+
+	<tr>
+		<td style="height:15px" colspan="2">
+	</tr>
+
+    <tr>
+		<th colspan="2">$i18n.getString( "data_element_groups" )</th>
+    </tr>
+
+	#foreach ( $groupSet in $groupSets )
+    <tr>
+		<td>$encoder.htmlEncode( $groupSet.name )</td>			
+		<td>
+			<select id="selectedGroups" name="selectedGroups" style="min-width: 244px;">
+				<option value="-1">[ $i18n.getString( "select_group" ) ]</option>
+				#foreach ( $group in $groupSet.getSortedGroups() )
+				<option value="$group.id">$group.name</option>
+				#end
+			</select>
+		</td>
+    </tr>
+	#end
+</table>
+#end
+
 <p>
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
 	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='dataElement.action'" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm	2011-10-03 09:25:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorForm.vm	2011-10-05 15:00:45 +0000
@@ -28,33 +28,33 @@
 <input type="hidden" id="denominatorDescription" name="denominatorDescription" value=""/>
 
 <table>
-	<tr>
+	<tr style="width: 450px;">
 		<th colspan="2">$i18n.getString( "details" )</th>
 	</tr>
 	<tr>
 		<td style="width:200px"><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="name" name="name" onchange="nameChanged()" style="width:20em"/></td>
+		<td><input type="text" id="name" name="name" onchange="nameChanged()" style="width:240px"/></td>
 	</tr>
 	<tr>
 		<td><label for="shortName">$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="shortName" name="shortName" style="width:20em"/></td>
+		<td><input type="text" id="shortName" name="shortName" style="width:240px"/></td>
 	</tr>
 	<tr>
 		<td><label for="alternativeName">$i18n.getString( "alternative_name" )</label></td>
-		<td><input type="text" id="alternativeName" name="alternativeName" style="width:20em"/></td>
+		<td><input type="text" id="alternativeName" name="alternativeName" style="width:240px"/></td>
 	</tr>
 	<tr>
 		<td><label for="code">$i18n.getString( "code" )</label></td>
-		<td><input type="text" id="code" name="code" style="width:20em"/></td>
+		<td><input type="text" id="code" name="code" style="width:240px"/></td>
 	</tr>
 	<tr>
 		<td><label for="description">$i18n.getString( "description" )</label></td>
-		<td><textarea id="description" name="description" style="width:20em; height:8em"></textarea></td>
+		<td><textarea id="description" name="description" style="width:240px; height:8em"></textarea></td>
 	</tr>
 	<tr>
 		<td><label for="annualized">$i18n.getString( "annualized" )</label></td>
 		<td>
-			<select id="annualized" name="annualized" style="width:20em">
+			<select id="annualized" name="annualized" style="width:240px">
 				<option value="false">$i18n.getString( "no" )</option>
 				<option value="true">$i18n.getString( "yes" )</option>
 			</select>
@@ -63,7 +63,7 @@
 	<tr>
 		<td><label for="indicatorTypeId">$i18n.getString( "indicator_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select id="indicatorTypeId" name="indicatorTypeId" style="min-width:20em" onchange='indicatorTypeChanged();'>				
+			<select id="indicatorTypeId" name="indicatorTypeId" style="min-width:240px" onchange='indicatorTypeChanged();'>				
 				<option value="">[ $i18n.getString('select') ]</option>
 			#foreach( $indicatorType in $indicatorTypes )
 				<option value="$indicatorType.id" number="$indicatorType.number">$encoder.htmlEncode( $indicatorType.name )</option>
@@ -73,19 +73,19 @@
 	</tr>
     <tr>
         <td><label for="url">$i18n.getString( "url" )</label></td>
-        <td><input type="text" id="url" name="url" style="width:20em"/></td>
+        <td><input type="text" id="url" name="url" style="width:240px"/></td>
     </tr>
 	<tr>
 		<td></td>
 		<td>
-			<input type="button" value="$i18n.getString( 'edit_numerator' )" onclick="indicatorNumeratorForm()" style="width:20em"/>
+			<input type="button" value="$i18n.getString( 'edit_numerator' )" onclick="indicatorNumeratorForm()" style="width:240px"/>
 			<input type="hidden" id="numerator" name="numerator"/>
 		</td>	
 	</tr>
 	<tr>
 		<td></td>
 		<td>
-			<input type="button" id="denominatorButton" name="denominatorButton" value="$i18n.getString( 'edit_denominator' )" onclick="indicatorDenominatorForm()" style="width:20em"/>
+			<input type="button" id="denominatorButton" name="denominatorButton" value="$i18n.getString( 'edit_denominator' )" onclick="indicatorDenominatorForm()" style="width:240px"/>
 			<input type="hidden" id="denominator" name="denominator" class="{validate:{required:true}}"/>
 		</td>
 	</tr>
@@ -93,6 +93,35 @@
 
 #tblDynamicAttributes( { "attributes": $attributes } )
 
+#if( $groupSets.size() > 0 )
+<table>
+	<col width="200px" />
+	<col width="240px" />
+
+	<tr>
+		<td style="height:15px" colspan="2">
+	</tr>
+
+    <tr>
+		<th colspan="2">$i18n.getString( "indicator_groups" )</th>
+    </tr>
+
+	#foreach ( $groupSet in $groupSets )
+    <tr>
+		<td>$encoder.htmlEncode( $groupSet.name )</td>			
+		<td>
+			<select id="selectedGroups" name="selectedGroups" style="min-width: 244px;">
+				<option value="-1">[ $i18n.getString( "select_group" ) ]</option>
+				#foreach ( $group in $groupSet.getSortedGroups() )
+				<option value="$group.id">$group.name</option>
+				#end
+			</select>
+		</td>
+    </tr>
+	#end
+</table>
+#end
+
 <p>
 	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em" />
 	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicator.action'" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm	2011-10-03 15:14:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm	2011-10-05 15:00:45 +0000
@@ -194,6 +194,35 @@
 
 #tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
 
+#if( $groupSets.size() > 0 )
+<table>
+	<col width="200px" />
+	<col width="240px" />
+
+	<tr>
+		<td style="height:15px" colspan="2">
+	</tr>
+	<tr>
+		<th colspan="2">$i18n.getString( "data_element_groups" )</th>
+    </tr>
+    
+	#foreach ( $groupSet in $groupSets )
+    <tr>
+		<td>$encoder.htmlEncode( $groupSet.name )</td>
+		<td>
+			<select id="dataElementGroups" name="dataElementGroups" style="min-width: 244px;">
+				<option value="-1">[ $i18n.getString( "select_group" ) ]</option>
+				#foreach ( $group in $groupSet.getSortedGroups() )
+				<option value="$group.id" #if( $group.members.contains( $dataElement ) ) selected="selected" #end>$group.name</option>
+				#end
+			</select>
+		</td>
+		<td><input type="hidden" name="dataElementGroupSets" value="$groupSet.id"/></td>
+    </tr>
+	#end
+</table>
+#end
+
 <p>
 	<input type="submit" value="$i18n.getString( 'save' )" style="width:10em" />
 	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='dataElement.action'" style="width:10em" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm	2011-10-03 09:25:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm	2011-10-05 15:00:45 +0000
@@ -93,6 +93,37 @@
 
 #tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
 
+#if( $groupSets.size() > 0 )
+<table>
+	<col width="200px" />
+	<col width="240px" />
+
+	<tr>
+		<td style="height:15px" colspan="2">
+	</tr>
+	<tr>
+		<th colspan="2">$i18n.getString( "indicator_groups" )</th>
+    </tr>
+
+	#foreach ( $groupSet in $groupSets )
+    <tr>
+		<td>$encoder.htmlEncode( $groupSet.name )</td>
+		<td>
+			<select id="indicatorGroups" name="indicatorGroups" style="min-width: 244px;">
+				<option value="-1">[ $i18n.getString( "select_group" ) ]</option>
+				#foreach ( $group in $groupSet.getSortedGroups() )
+				<option value="$group.id" #if( $group.members.contains( $indicator ) ) selected="selected" #end>$group.name</option>
+				#end
+			</select>
+		</td>
+		<td>
+			<input type="hidden" name="indicatorGroupSets" value="$groupSet.id" />
+		</td>
+    </tr>
+	#end
+</table>
+#end
+
 <p>
 	<input type="submit" value="$i18n.getString( 'save' )" style="width:10em" />
 	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicator.action'" style="width:10em"/>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java	2011-09-23 13:11:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java	2011-10-05 15:00:45 +0000
@@ -167,13 +167,12 @@
 
         attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
 
-        Collections.sort( attributes, new AttributeSortOrderComparator() );
-
         attributeValues = AttributeUtils.getAttributeValueMap( organisationUnit.getAttributeValues() );
 
         Collections.sort( availableDataSets, new DataSetNameComparator() );
         Collections.sort( dataSets, new DataSetNameComparator() );
         Collections.sort( groupSets, new OrganisationUnitGroupSetNameComparator() );
+        Collections.sort( attributes, new AttributeSortOrderComparator() );
 
         return SUCCESS;
     }