← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7506: local vn - Separated the AttributeValueGroupOrder GUI into the independent feature.

 

------------------------------------------------------------
revno: 7506
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-07-04 17:12:19 +0700
message:
  local vn - Separated the AttributeValueGroupOrder GUI into the independent feature.
added:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/comparator/AttributeValueGroupOrderSortOrderComparator.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ListAttributeValueGroupOrdersAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderForReportAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrders.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateAttributeValueGroupOrderForReportForm.vm
modified:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java
  local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml
  local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.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/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrder.java	2012-07-04 10:12:19 +0000
@@ -27,7 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.hisp.dhis.attribute.Attribute;
 
@@ -45,6 +47,10 @@
 
     private List<String> attributeValues;
 
+    private Set<ExportReportAttribute> reports;
+
+    private Integer sortOrder;
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -59,6 +65,38 @@
     }
 
     // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public void addReport( ExportReportAttribute report )
+    {
+        reports.add( report );
+        report.getAttributeValueOrders().add( this );
+    }
+
+    public void removeReport( ExportReportAttribute report )
+    {
+        reports.remove( report );
+        report.getAttributeValueOrders().remove( this );
+    }
+
+    public void updateAttributeValueGroupOrders( Set<ExportReportAttribute> updates )
+    {
+        for ( ExportReportAttribute report : new HashSet<ExportReportAttribute>( reports ) )
+        {
+            if ( !updates.contains( report ) )
+            {
+                removeReport( report );
+            }
+        }
+
+        for ( ExportReportAttribute report : updates )
+        {
+            addReport( report );
+        }
+    }
+
+    // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
 
@@ -102,6 +140,26 @@
         this.attributeValues = attributeValues;
     }
 
+    public Set<ExportReportAttribute> getReports()
+    {
+        return reports;
+    }
+
+    public void setReports( Set<ExportReportAttribute> reports )
+    {
+        this.reports = reports;
+    }
+
+    public Integer getSortOrder()
+    {
+        return sortOrder;
+    }
+
+    public void setSortOrder( Integer sortOrder )
+    {
+        this.sortOrder = sortOrder;
+    }
+
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderService.java	2012-07-04 10:12:19 +0000
@@ -1,5 +1,7 @@
 package org.hisp.dhis.reportsheet;
 
+import java.util.Collection;
+
 /*
  * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
@@ -40,9 +42,13 @@
     // -------------------------------------------------------------------------
 
     public AttributeValueGroupOrder getAttributeValueGroupOrder( Integer id );
-    
+
+    public AttributeValueGroupOrder getAttributeValueGroupOrderByName( String name );
+
     public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId );
 
+    public Collection<AttributeValueGroupOrder> getAllAttributeValueGroupOrder();
+
     public void updateAttributeValueGroupOrder( AttributeValueGroupOrder attributeValueGroupOrder );
 
     public void deleteAttributeValueGroupOrder( Integer id );

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/AttributeValueGroupOrderStore.java	2012-07-04 10:12:19 +0000
@@ -1,5 +1,7 @@
 package org.hisp.dhis.reportsheet;
 
+import java.util.Collection;
+
 /*
  * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
@@ -41,10 +43,14 @@
 
     public AttributeValueGroupOrder getAttributeValueGroupOrder( Integer id );
 
+    public AttributeValueGroupOrder getAttributeValueGroupOrderByName( String name );
+
     public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId );
 
     public void updateAttributeValueGroupOrder( AttributeValueGroupOrder attributeValueGroupOrder );
 
     public void deleteAttributeValueGroupOrder( Integer id );
 
+    public Collection<AttributeValueGroupOrder> getAllAttributeValueGroupOrder();
+
 }

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java	2012-05-23 09:36:45 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportAttribute.java	2012-07-04 10:12:19 +0000
@@ -27,7 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * @author Dang Duy Hieu
@@ -48,6 +50,38 @@
     }
 
     // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public void addAttributeValueGroupOrder( AttributeValueGroupOrder group )
+    {
+        attributeValueOrders.add( group );
+        group.getReports().add( this );
+    }
+
+    public void removeAttributeValueGroupOrder( AttributeValueGroupOrder group )
+    {
+        attributeValueOrders.remove( group );
+        group.getReports().remove( this );
+    }
+
+    public void updateAttributeValueGroupOrders( Set<AttributeValueGroupOrder> updates )
+    {
+        for ( AttributeValueGroupOrder group : new HashSet<AttributeValueGroupOrder>( attributeValueOrders ) )
+        {
+            if ( !updates.contains( group ) )
+            {
+                removeAttributeValueGroupOrder( group );
+            }
+        }
+
+        for ( AttributeValueGroupOrder group : updates )
+        {
+            addAttributeValueGroupOrder( group );
+        }
+    }
+
+    // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
 

=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/comparator/AttributeValueGroupOrderSortOrderComparator.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/comparator/AttributeValueGroupOrderSortOrderComparator.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/comparator/AttributeValueGroupOrderSortOrderComparator.java	2012-07-04 10:12:19 +0000
@@ -0,0 +1,54 @@
+package org.hisp.dhis.reportsheet.comparator;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Comparator;
+
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class AttributeValueGroupOrderSortOrderComparator
+    implements Comparator<AttributeValueGroupOrder>
+{
+    public int compare( AttributeValueGroupOrder group0, AttributeValueGroupOrder group1 )
+    {
+        if ( group0.getSortOrder() == null || group0.getSortOrder() == 0 )
+        {
+            return group0.getName().compareTo( group1.getName() );
+        }
+        if ( group1.getSortOrder() == null || group1.getSortOrder() == 0 )
+        {
+            return group0.getName().compareTo( group1.getName() );
+        }
+        
+        return group0.getSortOrder() - group1.getSortOrder();
+    }
+}

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateAttributeValueGroupOrderStore.java	2012-07-04 10:12:19 +0000
@@ -27,9 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+
+import org.hibernate.Criteria;
 import org.hibernate.SQLQuery;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrderStore;
 import org.hisp.dhis.reportsheet.ExportReport;
@@ -65,11 +69,20 @@
         return (AttributeValueGroupOrder) session.get( AttributeValueGroupOrder.class, id );
     }
 
+    public AttributeValueGroupOrder getAttributeValueGroupOrderByName( String name )
+    {
+        Session session = sessionFactory.getCurrentSession();
+        Criteria criteria = session.createCriteria( AttributeValueGroupOrder.class );
+        criteria.add( Restrictions.eq( "name", name ) );
+
+        return (AttributeValueGroupOrder) criteria.uniqueResult();
+    }
+
     public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId )
     {
         Session session = sessionFactory.getCurrentSession();
 
-        String sql = "SELECT * FROM reportexcel_attributevaluegrouporders WHERE lower(name) = :name";
+        String sql = "SELECT * FROM attributevaluegrouporder_reportexcels WHERE lower(name) = :name";
 
         if ( clazzName.equals( ExportReport.class.getSimpleName() ) )
         {
@@ -99,4 +112,12 @@
         Session session = sessionFactory.getCurrentSession();
         session.delete( this.getAttributeValueGroupOrder( id ) );
     }
+
+    @SuppressWarnings( "unchecked" )
+    public Collection<AttributeValueGroupOrder> getAllAttributeValueGroupOrder()
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        return session.createCriteria( AttributeValueGroupOrder.class ).list();
+    }
 }

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultAttributeValueGroupOrderService.java	2012-07-04 10:12:19 +0000
@@ -27,6 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Collection;
+
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrderStore;
@@ -70,8 +72,19 @@
         attributeValueGroupOrderStore.deleteAttributeValueGroupOrder( id );
     }
 
+    public AttributeValueGroupOrder getAttributeValueGroupOrderByName( String name )
+    {
+        return attributeValueGroupOrderStore.getAttributeValueGroupOrderByName( name );
+    }
+
     public AttributeValueGroupOrder getAttributeValueGroupOrder( String name, String clazzName, Integer reportId )
     {
         return attributeValueGroupOrderStore.getAttributeValueGroupOrder( name, clazzName, reportId );
     }
+
+    public Collection<AttributeValueGroupOrder> getAllAttributeValueGroupOrder()
+    {
+        return attributeValueGroupOrderStore.getAllAttributeValueGroupOrder();
+    }
+
 }

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/AttributeGroupOrder.hbm.xml	2012-07-04 10:12:19 +0000
@@ -3,20 +3,27 @@
 	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
 	"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
 <hibernate-mapping>
-  <class name="org.hisp.dhis.reportsheet.AttributeValueGroupOrder" table="reportexcel_attributevaluegrouporders">
-  	    <id name="id" column="id">
+  <class name="org.hisp.dhis.reportsheet.AttributeValueGroupOrder" table="attributevaluegrouporder">
+  	    <id name="id" column="attributevaluegrouporderid">
 			<generator class="native" />
 		</id>
 
 		<property name="name" column="name" />
 
+		<property name="sortOrder" />
+		
 		<many-to-one name="attribute" class="org.hisp.dhis.attribute.Attribute" column="attributeid"
 			foreign-key="fk_attributevalue_attributeid" not-null="true" />
 
-		<list name="attributeValues" table="reportexcel_attributevalueorders" lazy="false">
-			<key column="id" foreign-key="fk_attributevalueorders_attributevaluegrouporderid" />
-			<list-index base="0" column="attributevalueorder" />
+		<list name="attributeValues" table="attributevaluegrouporder_attributevalues" lazy="false">
+			<key column="attributevaluegrouporderid" foreign-key="fk_attributevalueorders_attributevaluegrouporderid" />
+			<list-index column="attributevalueindex" base="0"/>
 			<element type="string" column="attributevalue" />
 		</list>
+		
+		<set name="reports" table="attributevaluegrouporder_reportexcels" inverse="true">
+			<key column="attributevaluegrouporderid" />
+			<many-to-many class="org.hisp.dhis.reportsheet.ExportReportAttribute" column="reportexcelid" />
+		</set>
   </class>
 </hibernate-mapping>
\ No newline at end of file

=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml	2012-04-26 18:25:07 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml	2012-07-04 10:12:19 +0000
@@ -62,7 +62,7 @@
 			<key column="reportexcelid"/>
 			<list name="categoryOptionGroupOrders" table="reportexcel_categoryoptiongrouporders" cascade="all" lazy="false">
 				<key column="reportexcelid"/>
-				<list-index base="0" column="categoryoptiongrouporder"/>
+				<list-index column="categoryoptiongrouporder" base="0"/>
 				<one-to-many class="org.hisp.dhis.reportsheet.CategoryOptionGroupOrder"/>
 		    </list>
 		</joined-subclass>
@@ -70,10 +70,11 @@
 		<!-- ATTRIBUTE -->
 		<joined-subclass name="org.hisp.dhis.reportsheet.ExportReportAttribute" table="reportexcels_attribute">
 			<key column="reportexcelid"/>
-			<list name="attributeValueOrders" table="reportexcel_attributevaluegrouporders" cascade="all" lazy="false">
-				<key column="reportexcelid"/>
-				<list-index base="0" column="attributevaluegrouporder"/>
-				<one-to-many class="org.hisp.dhis.reportsheet.AttributeValueGroupOrder"/>
+			<list name="attributeValueOrders" table="attributevaluegrouporder_reportexcels">
+				<key column="reportexcelid" foreign-key="fk_attributevaluegroupordermembers_reportexcelid"/>
+				<list-index column="attributevaluegrouporderindex" base="0"/>
+				<many-to-many class="org.hisp.dhis.reportsheet.AttributeValueGroupOrder" column="attributevaluegrouporderid"
+				foreign-key="fk_reportexcel_attributevaluegrouporderid"/>
 		    </list>
 		</joined-subclass>
 		

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/GetAttributeValueGroupOrderAction.java	2012-07-04 10:12:19 +0000
@@ -61,30 +61,6 @@
         this.id = id;
     }
 
-    private Integer reportId;
-
-    public Integer getReportId()
-    {
-        return reportId;
-    }
-
-    public void setReportId( Integer reportId )
-    {
-        this.reportId = reportId;
-    }
-
-    private String clazzName;
-
-    public void setClazzName( String clazzName )
-    {
-        this.clazzName = clazzName;
-    }
-
-    public String getClazzName()
-    {
-        return clazzName;
-    }
-
     private AttributeValueGroupOrder attributeValueGroupOrder;
 
     public AttributeValueGroupOrder getAttributeValueGroupOrder()
@@ -103,5 +79,4 @@
 
         return SUCCESS;
     }
-
 }

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ListAttributeValueGroupOrdersAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ListAttributeValueGroupOrdersAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ListAttributeValueGroupOrdersAction.java	2012-07-04 10:12:19 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+import org.hisp.dhis.reportsheet.comparator.AttributeValueGroupOrderSortOrderComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ListAttributeValueGroupOrdersAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    List<AttributeValueGroupOrder> attributeValueGroupOrders;
+
+    public List<AttributeValueGroupOrder> getAttributeValueGroupOrders()
+    {
+        return attributeValueGroupOrders;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        attributeValueGroupOrders = new ArrayList<AttributeValueGroupOrder>( attributeValueGroupOrderService
+            .getAllAttributeValueGroupOrder() );
+        
+        Collections.sort( attributeValueGroupOrders, new AttributeValueGroupOrderSortOrderComparator() );
+
+        return SUCCESS;
+    }
+
+}

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/SaveAttributeValueGroupOrderAction.java	2012-07-04 10:12:19 +0000
@@ -33,9 +33,6 @@
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
-import org.hisp.dhis.reportsheet.ExportReport;
-import org.hisp.dhis.reportsheet.ExportReportAttribute;
-import org.hisp.dhis.reportsheet.ExportReportService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -58,25 +55,14 @@
         this.attributeService = attributeService;
     }
 
-    private ExportReportService exportReportService;
-
-    public void setExportReportService( ExportReportService exportReportService )
-    {
-        this.exportReportService = exportReportService;
-    }
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
 
-    private Integer id;
-
     private Integer attributeId;
 
     private String name;
 
-    private String clazzName;
-
     private List<String> attributeValues = new ArrayList<String>();
 
     // -------------------------------------------------------------------------
@@ -88,26 +74,11 @@
         this.name = name;
     }
 
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-
-    public Integer getId()
-    {
-        return id;
-    }
-
     public void setAttributeId( Integer attributeId )
     {
         this.attributeId = attributeId;
     }
 
-    public void setClazzName( String clazzName )
-    {
-        this.clazzName = clazzName;
-    }
-
     public void setAttributeValues( List<String> attributeValues )
     {
         this.attributeValues = attributeValues;
@@ -133,20 +104,6 @@
         
         attributeValueGroupOrder.setAttributeValues( finalList );
 
-        if ( clazzName.equals( ExportReport.class.getSimpleName() ) )
-        {
-            ExportReportAttribute exportReportAttribute = (ExportReportAttribute) exportReportService
-                .getExportReport( id );
-
-            List<AttributeValueGroupOrder> attributeValueGroupOrders = exportReportAttribute.getAttributeValueOrders();
-
-            attributeValueGroupOrders.add( attributeValueGroupOrder );
-
-            exportReportAttribute.setAttributeValueOrders( attributeValueGroupOrders );
-
-            exportReportService.updateExportReport( exportReportAttribute );
-        }
-
         attributeValues = null;
         
         return SUCCESS;

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderAction.java	2012-07-04 10:12:19 +0000
@@ -66,8 +66,6 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private Integer id;
-
     private Integer attributeId;
 
     private Integer attributeValueGroupOrderId;
@@ -90,16 +88,6 @@
         this.name = name;
     }
 
-    public Integer getId()
-    {
-        return id;
-    }
-
-    public void setId( Integer id )
-    {
-        this.id = id;
-    }
-
     public void setAttributeId( Integer attributeId )
     {
         this.attributeId = attributeId;

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderForReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderForReportAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateAttributeValueGroupOrderForReportAction.java	2012-07-04 10:12:19 +0000
@@ -0,0 +1,116 @@
+package org.hisp.dhis.reportsheet.avgroup.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
+import org.hisp.dhis.reportsheet.ExportReportAttribute;
+import org.hisp.dhis.reportsheet.ExportReportService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class UpdateAttributeValueGroupOrderForReportAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ExportReportService exportReportService;
+
+    public void setExportReportService( ExportReportService exportReportService )
+    {
+        this.exportReportService = exportReportService;
+    }
+
+    private AttributeValueGroupOrderService attributeValueGroupOrderService;
+
+    public void setAttributeValueGroupOrderService( AttributeValueGroupOrderService attributeValueGroupOrderService )
+    {
+        this.attributeValueGroupOrderService = attributeValueGroupOrderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input
+    // -------------------------------------------------------------------------
+
+    private Integer reportId;
+
+    private List<Integer> groupMembers = new ArrayList<Integer>();
+
+    // -------------------------------------------------------------------------
+    // Getter & Setter
+    // -------------------------------------------------------------------------
+
+    public void setReportId( Integer reportId )
+    {
+        this.reportId = reportId;
+    }
+
+    public void setGroupMembers( List<Integer> groupMembers )
+    {
+        this.groupMembers = groupMembers;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        ExportReportAttribute exportReport = (ExportReportAttribute) exportReportService.getExportReport( reportId );
+        List<AttributeValueGroupOrder> newList = new ArrayList<AttributeValueGroupOrder>();
+
+        if ( exportReport != null )
+        {
+            for ( Integer id : groupMembers )
+            {
+                AttributeValueGroupOrder group = attributeValueGroupOrderService.getAttributeValueGroupOrder( id );
+
+                if ( group != null )
+                {
+                    newList.add( group );
+                }
+            }
+
+            exportReport.setAttributeValueOrders( newList );
+
+            exportReportService.updateExportReport( exportReport );
+        }
+
+        return SUCCESS;
+    }
+}

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/UpdateSortedAttributeValueGroupOrderAction.java	2012-07-04 10:12:19 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportsheet.avgroup.action;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,9 +32,6 @@
 
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
 import org.hisp.dhis.reportsheet.AttributeValueGroupOrderService;
-import org.hisp.dhis.reportsheet.ExportReport;
-import org.hisp.dhis.reportsheet.ExportReportAttribute;
-import org.hisp.dhis.reportsheet.ExportReportService;
 import org.hisp.dhis.reportsheet.action.ActionSupport;
 
 /**
@@ -55,41 +52,15 @@
         this.attributeValueGroupOrderService = attributeValueGroupOrderService;
     }
 
-    private ExportReportService exportReportService;
-
-    public void setExportReportService( ExportReportService exportReportService )
-    {
-        this.exportReportService = exportReportService;
-    }
-
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
 
-    private Integer reportId;
-
-    public Integer getReportId()
-    {
-        return reportId;
-    }
-
-    public void setReportId( Integer reportId )
-    {
-        this.reportId = reportId;
-    }
-
-    private String clazzName;
-
-    public void setClazzName( String clazzName )
-    {
-        this.clazzName = clazzName;
-    }
-
-    private List<String> attributeValueGroupOrderId = new ArrayList<String>();
-
-    public void setAttributeValueGroupOrderId( List<String> attributeValueGroupOrderId )
-    {
-        this.attributeValueGroupOrderId = attributeValueGroupOrderId;
+    private List<Integer> groupIds = new ArrayList<Integer>();
+
+    public void setGroupIds( List<Integer> groupIds )
+    {
+        this.groupIds = groupIds;
     }
 
     // -------------------------------------------------------------------------
@@ -99,29 +70,18 @@
     public String execute()
         throws Exception
     {
-        List<AttributeValueGroupOrder> attributeValueGroupOrders = new ArrayList<AttributeValueGroupOrder>();
-
-        for ( String id : this.attributeValueGroupOrderId )
-        {
-            AttributeValueGroupOrder daElementGroupOrder = attributeValueGroupOrderService
-                .getAttributeValueGroupOrder( Integer.parseInt( id ) );
-
-            attributeValueGroupOrders.add( daElementGroupOrder );
-        }
-
-        if ( clazzName.equals( ExportReport.class.getSimpleName() ) )
-        {
-            ExportReportAttribute exportReportAttribute = (ExportReportAttribute) exportReportService
-                .getExportReport( reportId );
-
-            exportReportAttribute.setAttributeValueOrders( attributeValueGroupOrders );
-
-            exportReportService.updateExportReport( exportReportAttribute );
+        for ( int i = 0; i < groupIds.size(); i++ )
+        {
+            AttributeValueGroupOrder group = attributeValueGroupOrderService.getAttributeValueGroupOrder( groupIds
+                .get( i ) );
+
+            group.setSortOrder( i );
+
+            attributeValueGroupOrderService.updateAttributeValueGroupOrder( group );
         }
 
         message = i18n.getString( "update_successful" );
 
         return SUCCESS;
     }
-
 }

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/avgroup/action/ValidateAttributeValueGroupOrderAction.java	2012-07-04 10:12:19 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportsheet.avgroup.action;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -60,20 +60,6 @@
         this.id = id;
     }
 
-    private Integer reportId;
-
-    public void setReportId( Integer reportId )
-    {
-        this.reportId = reportId;
-    }
-
-    private String clazzName;
-
-    public void setClazzName( String clazzName )
-    {
-        this.clazzName = clazzName;
-    }
-
     private String name;
 
     public void setName( String name )
@@ -88,8 +74,7 @@
     public String execute()
         throws Exception
     {
-        AttributeValueGroupOrder match = attributeValueGroupOrderService.getAttributeValueGroupOrder( name, clazzName,
-            reportId );
+        AttributeValueGroupOrder match = attributeValueGroupOrderService.getAttributeValueGroupOrderByName( name );
 
         if ( match != null && (id == null || match.getId() != id) )
         {

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-06-28 08:17:52 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-07-04 10:12:19 +0000
@@ -337,7 +337,6 @@
 		class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction"
 		scope="prototype">
 		<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
-		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
 	</bean>
 
 	<bean
@@ -367,7 +366,6 @@
 		class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueGroupOrderAction"
 		scope="prototype">
 		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
-		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
 	</bean>
 	
 	<bean
@@ -384,6 +382,21 @@
 		<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
 		<property name="localAttributeValueService" ref="org.hisp.dhis.attribute.LocalAttributeValueService" />
 	</bean>
+	
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.ListAttributeValueGroupOrdersAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.ListAttributeValueGroupOrdersAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+	</bean>
+	
+	<bean
+		id="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderForReportAction"
+		class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderForReportAction"
+		scope="prototype">
+		<property name="attributeValueGroupOrderService" ref="org.hisp.dhis.reportsheet.AttributeValueGroupOrderService" />
+		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
+	</bean>
 
 	<!-- REPORT ORGANISATION UNIT GROUP LISTING BEAN -->
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-05-12 15:59:33 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-07-04 10:12:19 +0000
@@ -343,4 +343,7 @@
 categories					= Categories
 specify_periodtype_or_period = Please select a period type then specify a certain period
 show_export_params			= Show export params
-hide_export_params			= Hide export params
\ No newline at end of file
+hide_export_params			= Hide export params
+update_attribute_value_group_order_report = Update attribute value group order report
+available_attribute_value_group_orders = Available attribute value group orders
+group_members				= Group members
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-05-12 15:59:33 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-07-04 10:12:19 +0000
@@ -378,4 +378,7 @@
 categories = Ph\u00e2n lo\u1ea1i
 specify_periodtype_or_period = H\u00e3y ch\u1ecdn lo\u1ea1i th\u1eddi \u0111i\u1ec3m v\u00e0 th\u1eddi \u0111i\u1ec3m t\u01b0\u01a1ng \u1ee9ng
 show_export_params = Hi\u1ec3n th\u1ecb khung ch\u1ecdn
-hide_export_params = \u1ea8n khung ch\u1ecdn
\ No newline at end of file
+hide_export_params = \u1ea8n khung ch\u1ecdn
+update_attribute_value_group_order_report = C\u1eadp nh\u1eadt nh\u00f3m cho b\u00e1o c\u00e1o
+available_attribute_value_group_orders = Nh\u00f3m hi\u1ec7n c\u00f3
+group_members = Nh\u00f3m \u0111\u00e3 ch\u1ecdn
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-05-11 19:42:32 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-07-04 10:12:19 +0000
@@ -430,74 +430,68 @@
 		<!-- ATTRIBUTEVALUE GROUP ORDER FOR ATTRIBUTE VALUE 			   -->
 		<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
+		<action name="attributeValueGroupOrders"
+			class="org.hisp.dhis.reportsheet.avgroup.action.ListAttributeValueGroupOrdersAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="javascripts">javascript/attribute.ajax.js,javascript/attributeValueGroupOrder.js</param>
+			<param name="stylesheets">style/basic.css,style/style.css</param>
+		</action>
+
+		<action name="getAttributeValueGroupOrders"
+			class="org.hisp.dhis.reportsheet.avgroup.action.ListAttributeValueGroupOrdersAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrders.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+
 		<action name="listAttributeValueGroupOrderForExportReport"
 			class="org.hisp.dhis.reportsheet.exportreport.action.GetExportReportAction">
 			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm</param>
+			<param name="page">/dhis-web-spreadsheet-reporting/updateAttributeValueGroupOrderForReportForm.vm</param>
 			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
-			<param name="javascripts">javascript/attribute.ajax.js,javascript/attributeValueGroupOrder.js</param>
 			<param name="stylesheets">style/basic.css,style/style.css</param>
 		</action>
 		
-		<action name="listAttributeValueGroupOrderForImportReport"
-			class="org.hisp.dhis.reportsheet.importreport.action.GetImportReportAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm</param>
-			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
-			<param name="javascripts">javascript/attribute.ajax.js,javascript/attributeValueGroupOrder.js</param>
-			<param name="stylesheets">style/basic.css, style/style.css</param>
-		</action>	
-		
 		<action name="validateAttributeValueGroupOrder"
 			class="org.hisp.dhis.reportsheet.avgroup.action.ValidateAttributeValueGroupOrderAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
-		</action>
-		
-		<action name="addAttributeValueGroupOrderForExportReport"
-			class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction">
-			<result name="success" type="redirect">
-				listAttributeValueGroupOrderForExportReport.action?id=${id}</result>
-		</action>
-		
-		<action name="addAttributeValueGroupOrderForImportReport"
-			class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction">
-			<result name="success" type="redirect">
-				listAttributeValueGroupOrderForImportReport.action?id=${id}
-			</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+		
+		<action name="addAttributeValueGroupOrder"
+			class="org.hisp.dhis.reportsheet.avgroup.action.SaveAttributeValueGroupOrderAction">
+			<result name="success" type="redirect">attributeValueGroupOrders.action</result>
 		</action>
 
-		<action name="updateAttributeValueGroupOrderForExportReport"
-			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction">
-			<result name="success" type="redirect">
-				listAttributeValueGroupOrderForExportReport.action?id=${id}</result>
-		</action>
-		
-		<action name="updateAttributeValueGroupOrderForImportReport"
-			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction">
-			<result name="success" type="redirect">
-				listAttributeValueGroupOrderForImportReport.action?id=${id}
-			</result>
+		<action name="updateAttributeValueGroupOrder"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderAction">
+			<result name="success" type="redirect">attributeValueGroupOrders.action</result>
 		</action>
 		
 		<action name="deleteAttributeValueGroupOrder"
 			class="org.hisp.dhis.reportsheet.avgroup.action.DeleteAttributeValueGroupOrderAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
 		<action name="updateSortAttributeValueGroupOrder"
 			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueGroupOrderAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
 		<action name="getAttributeValueGroupOrder"
 			class="org.hisp.dhis.reportsheet.avgroup.action.GetAttributeValueGroupOrderAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrder.vm</result>
+			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
 		<action name="openSortAttributeValue"
@@ -509,16 +503,9 @@
 			<param name="stylesheets">style/basic.css</param>
 		</action>
 
-		<action name="updateSortedAttributeValuesForExportReport"
-			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction">
-			<result name="success" type="redirect">
-				listAttributeValueGroupOrderForExportReport.action?id=${reportId}</result>
-		</action>
-		
-		<action name="updateSortedAttributeValuesForImportReport"
-			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction">
-			<result name="success" type="redirect">
-				listAttributeValueGroupOrderForImportReport.action?id=${reportId}</result>
+		<action name="updateSortedAttributeValues"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateSortedAttributeValueAction">
+			<result name="success" type="redirect">attributeValueGroupOrders.action</result>
 		</action>
 
 		<action name="getAttributeValuesByAttribute"
@@ -528,6 +515,11 @@
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
+		<action name="updateAttributeValueGroupOrderForReport"
+			class="org.hisp.dhis.reportsheet.avgroup.action.UpdateAttributeValueGroupOrderForReportAction">
+			<result name="success" type="redirect">listAllExportReport.action</result>
+		</action>
+
 		<!-- REPORT ORGANISATION UNIT GROUP LISTING ACTION -->
 
 		<action name="openUpdateOrgUnitGroupListingReport"

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js	2012-04-26 18:25:07 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attributeValueGroupOrder.js	2012-07-04 10:12:19 +0000
@@ -32,9 +32,9 @@
 
 	attributeLib.loadAttributes( "attributeId" );
 
+	jQuery( "#attributeValueGroupsForm" ).attr( "action", "addAttributeValueGroupOrder.action" );
+	
 	dialog.dialog("open");
-	
-	jQuery( "#attributeValueGroupsForm" ).attr( "action", "addAttributeValueGroupOrderFor" + clazzName + ".action?clazzName=" + clazzName );
 }
 
 /*
@@ -44,7 +44,7 @@
 function openUpdateAttributeValueGroupOrder( id )
 {
 	validator.resetForm();
-	setFieldValue("attributeValueGroupOrderId", id );
+	setFieldValue( "attributeValueGroupOrderId", id );
 	
 	jQuery.post( 'getAttributeValueGroupOrder.action', { id: id }, function( json )
 	{
@@ -68,8 +68,9 @@
 		selectedAttributeValueMap[ id + "-" + attributeId ] = items;
 
 		attributeLib.removeDuplicatedItem( "availableAttributeValues", "attributeValues" );
+		
+		jQuery( "#attributeValueGroupsForm" ).attr( "action", "updateAttributeValueGroupOrder.action" );
 
-		jQuery( "#attributeValueGroupsForm" ).attr( "action", "updateAttributeValueGroupOrderFor" + clazzName + ".action" );
 		dialog.dialog( "open" );
 	} );
 }
@@ -82,9 +83,7 @@
 	{
 		jQuery.postUTF8( "validateAttributeValueGroupOrder.action", {
 			name: getFieldValue( 'name' ),
-			id: getFieldValue( 'attributeValueGroupOrderId' ),
-			reportId: reportId,
-			clazzName: clazzName
+			id: getFieldValue( 'attributeValueGroupOrderId' )
 		}, function( json )
 		{
 			if ( json.response == "success" )
@@ -114,23 +113,24 @@
 */
 function updateSortAttributeValueGroupOrder()
 {
-	var attributeValueGroups = document.getElementsByName( 'attributeValueGroupOrder' );
-	var url = "updateSortAttributeValueGroupOrder.action?reportId=" + reportId;
-	url += "&clazzName=" + clazzName;
+	var groups = document.getElementsByName( 'attributeValueGroupOrder' );
+	var url = "updateSortAttributeValueGroupOrder.action?";
 	
-	for ( var i = 0 ; i < attributeValueGroups.length ; i++ )
+	for ( var i = 0 ; i < groups.length ; i++ )
 	{
-		url += "&attributeValueGroupOrderId=" + attributeValueGroups.item(i).value;
+		url += "groupIds=" + groups.item(i).value + "&";
 	}
 	
+	url = url.substring( 0, url.length - 1 );
+	
 	jQuery.postJSON( url, {}, function( json ) {
 		showSuccessMessage( json.message );
 	});
 }
 
-function openSortAttributeValueForGroupOrder( id )
+function openSortAttributeValue( id )
 {
-	window.location = "openSortAttributeValue.action?id="+id+"&reportId="+reportId+"&clazzName="+clazzName;
+	window.location = "openSortAttributeValue.action?id="+id;
 }
 
 /*

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrders.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrders.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonAttributeValueGroupOrders.vm	2012-07-04 10:12:19 +0000
@@ -0,0 +1,12 @@
+#set( $size = $!attributeValueGroupOrders.size() )
+{ "attributeValueGroupOrders": [
+#foreach( $group in $attributeValueGroupOrders )
+#set( $reports = $!group.reports )
+  {
+	"id": "${group.id}",
+    "name": "$!encoder.jsonEncode( ${group.name} )",
+	"attributeId": "$!{group.attribute.id}",
+	"reports": [ #foreach( $report in $reports )${report.id}#if( $velocityCount < $reports.size() ),#end#end ]
+  }#if( $velocityCount < $size ),#end
+#end
+] }
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listAttributeValueGroupOrder.vm	2012-07-04 10:12:19 +0000
@@ -13,7 +13,7 @@
 	<tr>
 		<td colspan=2>
 			<input type="button" onclick="javascript:openAddAttributeValueGroupOrder();" value="$i18n.getString('add')" style="width:100px"/>
-			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location='listAll${clazzSimpleName}.action'" style="width:100px"/>
+			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location='openOptionComboAssociations.action'" style="width:100px"/>
 		</td>
 		<td width="100px">
 			<input type="button" value="$i18n.getString( 'update_order' )" onclick="javascript:updateSortAttributeValueGroupOrder();" style="width:150px"/>
@@ -46,8 +46,8 @@
 	</tr>
 </table>
 
-<ul id="sortable"> 
-#foreach( $group in $!report.attributeValueOrders )
+<ul id="sortable">
+#foreach( $group in $!attributeValueGroupOrders )
 	<li class="ui-state-default" name="attributeValueGroupOrder" value="$group.id" title="$i18n.getString( 'sort_order_help' )">		
 		<table cellspacing="0" cellpadding="0" width="100%">
 			<tr>
@@ -55,18 +55,17 @@
 				<td>
 					<a href="javascript:deleteAttributeValueGroupOrder( '$group.id', '$group.name' );" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
 					<a href="javascript:openUpdateAttributeValueGroupOrder( '$group.id' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
-					<a href="javascript:openSortAttributeValueForGroupOrder( '$group.id' );" title="$i18n.getString( 'sort_attributevalue' )"><img src="../images/sort.png" border="1px"/></a>
+					<a href="javascript:openSortAttributeValue( '$group.id' );" title="$i18n.getString( 'sort_attributevalue' )"><img src="../images/sort.png" border="1px"/></a>
 					<a href="javascript:showAttributeValueGroupOrderDetails( '$group.id' );" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" border="1px" alt="$i18n.getString( 'show_details' )"/></a>
 				</td>
 			</tr>
 		</table>
-	</li> 	
+	</li>
 #end
 </ul>
 
 <div id="attributeValueGroups">
 	<form name="attributeValueGroupsForm" id="attributeValueGroupsForm" method="POST">
-		<input type="hidden" name="id" value="$report.id"/>
 		<input type="hidden" name="attributeValueGroupOrderId" id="attributeValueGroupOrderId"/>
 		<table>
 			<tr>
@@ -119,9 +118,6 @@
 	var i18n_label = '$encoder.jsEscape($i18n.getString( 'select_attribute' ) , "'")';
 	var i18n_verify_attribute = '$encoder.jsEscape($i18n.getString( 'please_select_attribute' ) , "'")';
 	var i18n_selected_list_empty = '$encoder.jsEscape($i18n.getString( 'selected_list_should_not_empty' ) , "'")';
-
-	var reportId = ${report.id};
-	var clazzName = '${clazzSimpleName}';
 	
 	$(function() {
 		$("#sortable").sortable({

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateAttributeValueGroupOrderForReportForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateAttributeValueGroupOrderForReportForm.vm	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/updateAttributeValueGroupOrderForReportForm.vm	2012-07-04 10:12:19 +0000
@@ -0,0 +1,72 @@
+<script type="text/javascript">
+	jQuery(function() {
+		jQuery("#availableList").dhisAjaxSelect({
+			source: "getAttributeValueGroupOrders.action",
+			iterator: "attributeValueGroupOrders",
+			connectedTo: 'groupMembers',
+			sortAvailable: false,
+			sortSelected: false,
+			handler: function(item) {
+				var option = jQuery("<option data-id='" + item.reports + "' />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+
+				return option;
+			}
+		});
+		
+		validation2( 'updateAttributeValueGroupOrderForReportForm', function( form )
+		{
+			form.submit();
+		}, {
+			'beforeValidateHandler' : function()
+			{
+				listValidator( 'memberValidator', 'groupMembers' );
+			}
+		} );
+	});
+</script>
+
+<h3>$i18n.getString( "update_attribute_value_group_order_report" )</h3>
+<h4><font color="green">$!encoder.htmlEncode( $!report.displayName )</font></h4>
+<form id="updateAttributeValueGroupOrderForReportForm" action="updateAttributeValueGroupOrderForReport.action" method="post" >
+<input type="hidden" name="reportId" value="$!report.id" />
+<table>
+    <col style="width: 450px"/>
+    <col/>
+    <col style="width: 450px"/>
+
+	<tr>
+		<th>$i18n.getString( "available_attribute_value_group_orders" )</th>
+		<th></th>
+		<th>$i18n.getString( "group_members" )</th>
+	</tr>
+
+	<tr>
+		<td>
+			<select id="availableList" name="availableList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+		</td>
+		
+		<td style="text-align:center">
+        	<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableList' );"/><br/>
+            <input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
+			<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableList' );"/><br/>
+			<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
+		</td>
+
+		<td>
+			<select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
+			#foreach( $group in $!report.attributeValueOrders )
+				<option value="$group.id">$!encoder.htmlEncode( $group.name )</option>
+			#end
+			</select>
+		</td>
+	</tr>
+</table>
+
+<p>
+	<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='listAllExportReport.action'" style="width:10em"/>
+</p>
+
+</form>

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm	2012-05-11 19:42:32 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm	2012-07-04 10:12:19 +0000
@@ -1,13 +1,14 @@
 <h3>$i18n.getString( "administration" )</h3>
 
 <ul class="introList">
-    #introListImgItem( "getConfiguration.action" "configuration" "systemsettings")
-    #introListImgItem( "listAllExportReport.action" "design_export_reports" "export")
+    #introListImgItem( "getConfiguration.action" "configuration" "systemsettings" )
+    #introListImgItem( "listAllExportReport.action" "design_export_reports" "export" )
 	#introListImgItem( "listAllImportReport.action" "design_import_reports" "import" )
-    #introListImgItem( "openOptionComboAssociations.action" "define_categoryoptioncombo_associations" "dhis-web-maintenance-datadictionary")
-    #introListImgItem( "listDataEntryStatus.action" "data_status_management" "validationcriteria")
-    #introListImgItem( "listAllExcelTemplates.action" "excel_template_management" "excel")
-	#introListImgItem( "javascript: cleanUp();" "clean_up" "clean-up")
+    #introListImgItem( "openOptionComboAssociations.action" "define_categoryoptioncombo_associations" "dhis-web-maintenance-datadictionary" )
+    #introListImgItem( "attributeValueGroupOrders.action" "attribute_group_order" "attribute_group_order" )
+    #introListImgItem( "listDataEntryStatus.action" "data_status_management" "validationcriteria" )
+    #introListImgItem( "listAllExcelTemplates.action" "excel_template_management" "excel" )
+	#introListImgItem( "javascript: cleanUp();" "clean_up" "clean-up" )
 	<!--#introListImgItem( "jcharts.action" "chart" "jchart")-->
 </ul>
 <script>