← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9074: local vn - Fixed bug when generating the org-unit-listing report. Added new property "createdBy" ...

 

------------------------------------------------------------
revno: 9074
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-11-16 18:04:48 +0700
message:
  local vn - Fixed bug when generating the org-unit-listing report. Added new property "createdBy" into ExportReport. Allowed to add the source data (datasets) into ExportReport.
added:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/CheckPermissionAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportReports.js
modified:
  local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java
  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/exporting/action/GenerateReportOrgGroupListingAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/UpdateExportReportAction.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/jsonExportGroups.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportReportForm.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/ExportReport.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java	2012-04-26 18:25:07 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReport.java	2012-11-16 11:04:48 +0000
@@ -34,6 +34,7 @@
 import java.util.Set;
 
 import org.hisp.dhis.common.BaseIdentifiableObject;
+import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.user.UserAuthorityGroup;
 
@@ -56,11 +57,15 @@
 
     private Set<OrganisationUnit> organisationAssocitions;
 
+    private Set<DataSet> dataSets;
+
+    private Collection<UserAuthorityGroup> userRoles;
+
     private String group;
 
     private String excelTemplateFile;
 
-    private Collection<UserAuthorityGroup> userRoles;
+    private String createdBy = "[unknown]";
 
     // -------------------------------------------------------------------------
     // Constructors
@@ -122,7 +127,7 @@
     // -------------------------------------------------------------------------
 
     public abstract String getReportType();
-    
+
     public abstract List<String> getItemTypes();
 
     // -------------------------------------------------------------------------
@@ -236,6 +241,19 @@
         return items;
     }
 
+    public void updateDataSetMembers( Set<DataSet> dataSetList )
+    {
+        for ( DataSet ds : new HashSet<DataSet>( dataSets ) )
+        {
+            if ( !dataSetList.contains( ds ) )
+            {
+                dataSets.remove( ds );
+            }
+        }
+
+        dataSets.addAll( dataSetList );
+    }
+
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
@@ -320,6 +338,26 @@
         this.organisationAssocitions = organisationAssocitions;
     }
 
+    public Set<DataSet> getDataSets()
+    {
+        return dataSets == null ? new HashSet<DataSet>() : dataSets;
+    }
+
+    public void setDataSets( Set<DataSet> dataSets )
+    {
+        this.dataSets = dataSets;
+    }
+
+    public Collection<UserAuthorityGroup> getUserRoles()
+    {
+        return userRoles;
+    }
+
+    public void setUserRoles( Collection<UserAuthorityGroup> userRoles )
+    {
+        this.userRoles = userRoles;
+    }
+
     public String getGroup()
     {
         return group;
@@ -340,14 +378,13 @@
         this.excelTemplateFile = excelTemplateFile;
     }
 
-    public Collection<UserAuthorityGroup> getUserRoles()
-    {
-        return userRoles;
-    }
-
-    public void setUserRoles( Collection<UserAuthorityGroup> userRoles )
-    {
-        this.userRoles = userRoles;
-    }
-
+    public String getCreatedBy()
+    {
+        return createdBy;
+    }
+
+    public void setCreatedBy( String createdBy )
+    {
+        this.createdBy = createdBy;
+    }
 }

=== 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-07-04 10:12:19 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/ExportReport.hbm.xml	2012-11-16 11:04:48 +0000
@@ -15,6 +15,7 @@
 		<property name="organisationRow" column="organisationrow" />
 		<property name="organisationColumn" column="organisationcolumn" />
 		<property name="group" column="reportgroup" not-null="true"/>
+		<property name="createdBy" column="createdby" />
 
 		<set name="exportItems" lazy="false" cascade="all-delete-orphan" inverse="true">
 			<key column="reportexcelid" />
@@ -24,13 +25,19 @@
 		<set name="organisationAssocitions" table="reportexcel_associations" lazy="false">
 			<key column="reportexcelid" />
 			<many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit"
-				column="organisationid"  foreign-key="fk_reportexcel_organisation"/>
+				column="organisationid" foreign-key="fk_reportexcel_organisation"/>
+		</set>
+
+		<set name="dataSets" table="reportexcel_datasets" lazy="false">
+			<key column="reportexcelid" />
+			<many-to-many class="org.hisp.dhis.dataset.DataSet"
+				column="datasetid" foreign-key="fk_reportexcel_dataset"/>
 		</set>	
 		
 		<set name="userRoles" table="reportexcel_userroles" lazy="false">
 			<key column="reportexcelid" />
 			<many-to-many class="org.hisp.dhis.user.UserAuthorityGroup"
-				column="userroleid"  foreign-key="fk_reportexcel_userroles"/>
+				column="userroleid" foreign-key="fk_reportexcel_userroles"/>
 		</set>
 		
 		<!-- NORMAL -->

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java	2012-11-01 07:20:12 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportOrgGroupListingAction.java	2012-11-16 11:04:48 +0000
@@ -31,11 +31,13 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import org.apache.poi.ss.usermodel.Sheet;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -139,6 +141,7 @@
         Collection<OrganisationUnit> membersOfGroup = null;
         Collection<OrganisationUnit> organisationUnitsAtLevel = null;
         Collection<OrganisationUnit> childrens = organisationUnit.getChildren();
+        Collection<DataSet> dataSets = exportReport.getDataSets();
 
         for ( OrganisationUnitGroup organisationUnitGroup : exportReport.getOrganisationUnitGroups() )
         {
@@ -165,6 +168,16 @@
                 organisationUnits.retainAll( childrens );
             }
 
+            Iterator<OrganisationUnit> iterater = organisationUnits.iterator();
+
+            while ( iterater.hasNext() )
+            {
+                if ( !iterater.next().getDataSets().retainAll( dataSets ) )
+                {
+                    iterater.remove();
+                }
+            }
+
             Collections.sort( organisationUnits, new IdentifiableObjectNameComparator() );
 
             childrenGroupMap.put( organisationUnitGroup.getId(), organisationUnits );
@@ -173,6 +186,7 @@
         /**
          * Garbage
          */
+        dataSets = null;
         childrens = null;
         membersOfGroup = null;
         organisationUnitLevel = null;

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java	2012-04-28 16:58:08 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/AddExportReportAction.java	2012-11-16 11:04:48 +0000
@@ -26,14 +26,20 @@
  * (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.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.ExportReportAttribute;
-import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.ExportReportCategory;
 import org.hisp.dhis.reportsheet.ExportReportNormal;
 import org.hisp.dhis.reportsheet.ExportReportOrganizationGroupListing;
 import org.hisp.dhis.reportsheet.ExportReportPeriodColumnListing;
+import org.hisp.dhis.reportsheet.ExportReportService;
 import org.hisp.dhis.reportsheet.ExportReportVerticalCategory;
+import org.hisp.dhis.user.CurrentUserService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -56,6 +62,20 @@
         this.exportReportService = exportReportService;
     }
 
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -78,6 +98,8 @@
 
     private String group;
 
+    private Set<Integer> dataSetIds = new HashSet<Integer>();
+
     // -------------------------------------------------------------------------
     // Getter & Setter
     // -------------------------------------------------------------------------
@@ -127,6 +149,15 @@
         this.organisationCol = organisationCol;
     }
 
+    public void setDataSetIds( Set<Integer> dataSetIds )
+    {
+        this.dataSetIds = dataSetIds;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
     public String execute()
         throws Exception
     {
@@ -176,6 +207,20 @@
             exportReport.setOrganisationRow( this.organisationRow );
         }
 
+        if ( dataSetIds != null && !dataSetIds.isEmpty() )
+        {
+            exportReport.setDataSets( new HashSet<DataSet>( dataSetService.getDataSets( dataSetIds ) ) );
+        }
+
+        String createdBy = currentUserService.getCurrentUsername();
+
+        if ( createdBy == null )
+        {
+            createdBy = "[unknown]";
+        }
+
+        exportReport.setCreatedBy( createdBy );
+
         exportReportService.addExportReport( exportReport );
 
         return SUCCESS;

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/CheckPermissionAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/CheckPermissionAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/CheckPermissionAction.java	2012-11-16 11:04:48 +0000
@@ -0,0 +1,124 @@
+package org.hisp.dhis.reportsheet.exportreport.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 org.hisp.dhis.reportsheet.ExportReport;
+import org.hisp.dhis.reportsheet.ExportReportService;
+import org.hisp.dhis.reportsheet.action.ActionSupport;
+import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserService;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class CheckPermissionAction
+    extends ActionSupport
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ExportReportService exportReportService;
+
+    public void setExportReportService( ExportReportService exportReportService )
+    {
+        this.exportReportService = exportReportService;
+    }
+
+    private CurrentUserService currentUserService;
+
+    public void setCurrentUserService( CurrentUserService currentUserService )
+    {
+        this.currentUserService = currentUserService;
+    }
+
+    private UserService userService;
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input & Output
+    // -------------------------------------------------------------------------
+
+    private Integer id;
+
+    public void setId( Integer id )
+    {
+        this.id = id;
+    }
+
+    public Integer getId()
+    {
+        return id;
+    }
+
+    // -------------------------------------------------------------------------
+    // Execute method
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        message = "";
+
+        if ( id == null )
+        {
+            message = i18n.getString( "the_specified_report_is_not_exist" );
+
+            return ERROR;
+        }
+        else
+        {
+            ExportReport report = exportReportService.getExportReport( id );
+
+            UserCredentials ownerCredentials = userService.getUserCredentialsByUsername( report.getCreatedBy() );
+            UserCredentials userCredentials = currentUserService.getCurrentUser().getUserCredentials();
+            User owner = (ownerCredentials != null) ? ownerCredentials.getUser() : null;
+
+            if ( userCredentials.isSuper()
+                || (ownerCredentials != null && ownerCredentials.getUsername().equals( userCredentials.getUsername() )) )
+            {
+                message = "granted";
+            }
+            else if ( !userCredentials.isSuper() )
+            {
+                message = i18n.getString( "permission_notification" ) + " \"" + owner.getName() + "\"";
+                message += (owner != null && owner.getEmail() != null && !owner.getEmail().trim().isEmpty()) ? " <"
+                    + owner.getEmail() + ">" : "";
+            }
+        }
+
+        return SUCCESS;
+    }
+}

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java	2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/GetExportReportAction.java	2012-11-16 11:04:48 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.reportsheet.exportreport.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
@@ -30,8 +30,8 @@
 import java.util.List;
 
 import org.hisp.dhis.reportsheet.ExportItem;
+import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.action.ActionSupport;
 import org.hisp.dhis.reportsheet.state.SelectionManager;
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/UpdateExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/UpdateExportReportAction.java	2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exportreport/action/UpdateExportReportAction.java	2012-11-16 11:04:48 +0000
@@ -27,8 +27,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReport;
 
 import com.opensymphony.xwork2.Action;
 
@@ -50,6 +55,13 @@
         this.exportReportService = exportReportService;
     }
 
+    private DataSetService dataSetService;
+
+    public void setDataSetService( DataSetService dataSetService )
+    {
+        this.dataSetService = dataSetService;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -72,6 +84,8 @@
 
     private String group;
 
+    private Set<Integer> dataSetIds = new HashSet<Integer>();
+
     // -------------------------------------------------------------------------
     // Getter & Setter
     // -------------------------------------------------------------------------
@@ -121,6 +135,11 @@
         this.organisationCol = organisationCol;
     }
 
+    public void setDataSetIds( Set<Integer> dataSetIds )
+    {
+        this.dataSetIds = dataSetIds;
+    }
+
     // -------------------------------------------------------------------------
     // Action implement
     // -------------------------------------------------------------------------
@@ -155,6 +174,11 @@
             exportReport.setOrganisationRow( organisationRow );
         }
 
+        if ( dataSetIds != null && !dataSetIds.isEmpty() )
+        {
+            exportReport.updateDataSetMembers( new HashSet<DataSet>( dataSetService.getDataSets( dataSetIds ) ) );
+        }
+
         exportReportService.updateExportReport( exportReport );
 
         return SUCCESS;

=== 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-09-19 02:22:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-11-16 11:04:48 +0000
@@ -111,9 +111,18 @@
 
 	<!-- REPORT EXCEL CORE BEAN -->
 
+	<bean id="org.hisp.dhis.reportsheet.exportreport.action.CheckPermissionAction"
+		class="org.hisp.dhis.reportsheet.exportreport.action.CheckPermissionAction" scope="prototype">
+		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService" />
+	</bean>
+
 	<bean id="org.hisp.dhis.reportsheet.exportreport.action.AddExportReportAction"
 		class="org.hisp.dhis.reportsheet.exportreport.action.AddExportReportAction" scope="prototype">
 		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
+		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.reportsheet.exportreport.action.DeleteExportReportAction"
@@ -126,15 +135,13 @@
 		class="org.hisp.dhis.reportsheet.exportreport.action.GetExportReportAction"
 		scope="prototype">
 		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
+		<property name="selectionManager" ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
 	</bean>
 
 	<bean id="org.hisp.dhis.reportsheet.exportreport.action.GetExportReportGroupsAction"
 		class="org.hisp.dhis.reportsheet.exportreport.action.GetExportReportGroupsAction"
 		scope="prototype">
-		<property name="exportReportService"
-			ref="org.hisp.dhis.reportsheet.ExportReportService" />
+		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.reportsheet.exportreport.action.ListExportReportAction"
@@ -157,6 +164,7 @@
 		class="org.hisp.dhis.reportsheet.exportreport.action.UpdateExportReportAction"
 		scope="prototype">
 		<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
+		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.reportsheet.exportreport.action.ValidateExportReportAction"

=== 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-10-02 04:32:52 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-11-16 11:04:48 +0000
@@ -373,4 +373,5 @@
 select_group				 = Select group of unit
 add_multi_organisation_unit	 = Add Multi-org-unit
 filter_on_section			 = Filter on section
-do_not_show_sub_item 		 = Don't show sub-items in group
\ No newline at end of file
+do_not_show_sub_item 		 = Don't show sub-items in group
+permission_notification 	 = You don't have any permission in this Export report. Please contact with
\ 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-10-02 04:32:52 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-11-16 11:04:48 +0000
@@ -402,4 +402,6 @@
 select_group = Ch\u1ecdn Nh\u00f3m \u0111\u01a1n v\u1ecb
 add_multi_organisation_unit = T\u1ea1o nhi\u1ec1u \u0111\u01a1n v\u1ecb
 filter_on_section=L\u1ecdc theo nh\u00f3m
-do_not_show_sub_item = Kh\u00f4ng hi\u1ec3n th\u1ecb chi ti\u1ebft trong nh\u00f3m
\ No newline at end of file
+do_not_show_sub_item = Kh\u00f4ng hi\u1ec3n th\u1ecb chi ti\u1ebft trong nh\u00f3m
+permission_notification = B\u1ea1n kh\u00f4ng c\u00f3 quy\u1ec1n thao t\u00e1c tr\u00ean b\u00e1o c\u00e1o Xu\u1ea5t n\u00e0y. Vui l\u00f2ng li\u00ean h\u1ec7 v\u1edbi
+via_email = th\u00f4ng qua th\u01b0 \u0111i\u1ec7n t\u1eed 
\ 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-10-02 04:32:52 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-11-16 11:04:48 +0000
@@ -32,6 +32,14 @@
 
 		<!-- SYSTEM CONFIGURATION ACTION -->
 
+		<action name="openAdministrator"
+			class="org.hisp.dhis.reportsheet.action.NoAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/viewAdministrator.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+		</action>
+
 		<action name="getConfiguration"
 			class="org.hisp.dhis.reportsheet.configuration.action.GetReportConfigurationAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -65,14 +73,6 @@
 			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
 		</action>
 
-		<action name="openAdministrator"
-			class="org.hisp.dhis.reportsheet.action.NoAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/viewAdministrator.vm</param>
-			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
-		</action>
-
 		<!-- PROCESSED FOR PERIOD IN REPORT -->
 
 		<action name="getPeriodsByPeriodTypeDB"
@@ -113,18 +113,27 @@
 
 		<!-- REPORT EXCEL CORE ACTION -->
 
+		<action name="checkPermission"
+			class="org.hisp.dhis.reportsheet.exportreport.action.CheckPermissionAction">
+			<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>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+
 		<action name="addExportReportForm"
 			class="org.hisp.dhis.reportsheet.filemanager.action.ExcelTemplateListAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm</param>		
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_REPORT_ADD</param>
 		</action>
 
 		<action name="addExportReport"
 			class="org.hisp.dhis.reportsheet.exportreport.action.AddExportReportAction">
 			<result name="success" type="redirect">listAllExportReport.action
 			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_REPORT_ADD</param>
 		</action>
 
 		<action name="deleteExportReport"
@@ -134,7 +143,7 @@
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_REPORT_DELETE</param>
 		</action>
 
 		<action name="getExportReportGroups"
@@ -148,7 +157,7 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/report/exportReports.vm</param>
 			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>		
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_REPORT_MANAGEMENT</param>
 		</action>
 		
 		<action name="getAllExportReport"
@@ -167,14 +176,13 @@
 			class="org.hisp.dhis.reportsheet.filemanager.action.ExcelTemplateListAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/report/updateExportReportForm.vm</param>	
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_REPORT_UPDATE</param>
 		</action>
 
 		<action name="updateExportReport"
 			class="org.hisp.dhis.reportsheet.exportreport.action.UpdateExportReportAction">
-			<result name="success" type="redirect">listAllExportReport.action
-			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<result name="success" type="redirect">listAllExportReport.action</result>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_REPORT_UPDATE</param>
 		</action>
 
 		<action name="validateExportReportAction"
@@ -571,7 +579,7 @@
 			<param name="page">/dhis-web-spreadsheet-reporting/exportReportAssociation.vm</param>
 			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
 			<param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/associations.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_REPORT_DEFINE_ASSOCIATION</param>
 		</action>		
 
 		<action name="updateDefineAssociations"
@@ -603,7 +611,7 @@
 			<param name="page">/dhis-web-spreadsheet-reporting/report/exportItems.vm</param>
 			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
 			<param name="javascripts">javascript/exportItems.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_MANAGEMENT</param>
 		</action>
 
 		<action name="validationExportItem"
@@ -629,7 +637,7 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/report/addExportItemForm.vm</param>
 			<param name="javascripts">javascript/exportItems.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_ADD</param>
 		</action>
 
 		<action name="addExportItem"
@@ -637,7 +645,7 @@
 			<result name="success" type="redirect">
 				listExportItemAction.action?exportReportId=${exportReportId}
 			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_ADD</param>
 		</action>
 
 		<action name="updateExportItemForm"
@@ -645,7 +653,7 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/report/updateExportItemForm.vm</param>
 			<param name="javascripts">javascript/exportItems.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_UPDATE</param>
 		</action>
 
 		<action name="updateExportItem"
@@ -653,7 +661,7 @@
 			<result name="success" type="redirect">
 				listExportItemAction.action?exportReportId=${exportReportId}
 			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_UPDATE</param>
 		</action>	
 		
 		<action name="getDataElementCategoryOptionCombos"
@@ -669,7 +677,7 @@
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_DELETE</param>
 		</action>
 
 		<action name="deleteMultiExportItem"
@@ -679,7 +687,7 @@
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_DELETE</param>
 		</action>
 
 		<action name="getExportItemTypes"
@@ -698,14 +706,14 @@
 			class="org.hisp.dhis.reportsheet.exportitem.action.CopyExportItemToExportReportAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_COPY</param>
 		</action>
 
 		<action name="copyExportItemToImportReport"
 			class="org.hisp.dhis.reportsheet.exportitem.action.CopyExportItemToImportReportAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_EXPORT_ITEM_COPY</param>
 		</action>
 		
 		<action name="getListSheet"
@@ -831,18 +839,33 @@
 			<param name="menuTreeHeight">400</param>
 		</action>
 
+		<action name="openAddDataEntryStatus" class="org.hisp.dhis.reportsheet.action.NoAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/addDataStatus.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="requiredAuthorities">F_EXCEL_ENTRY_STATUS_ADD</param>
+		</action>
+
 		<action name="addDataEntryStatus"
 			class="org.hisp.dhis.reportsheet.dataentrystatus.action.AddDataEntryStatusAction">
 			<result name="success" type="redirect">listDataEntryStatus.action
 			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_ENTRY_STATUS_ADD</param>
+		</action>
+
+		<action name="openUpdateDataEntryStatus"
+			class="org.hisp.dhis.reportsheet.dataentrystatus.action.GetDataEntryStatusAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/updateDataStatus.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="requiredAuthorities">F_EXCEL_ENTRY_STATUS_UPDATE</param>
 		</action>
 
 		<action name="updateDataEntryStatus"
 			class="org.hisp.dhis.reportsheet.dataentrystatus.action.UpdateDataEntryStatusAction">
 			<result name="success" type="redirect">listDataEntryStatus.action
 			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_ENTRY_STATUS_UPDATE</param>
 		</action>
 		
 		<action name="updateDefault"
@@ -855,22 +878,7 @@
 			class="org.hisp.dhis.reportsheet.dataentrystatus.action.DeleteDataEntryStatusAction">
 			<result name="success" type="redirect">listDataEntryStatus.action
 			</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
-		</action>
-
-		<action name="openAddDataEntryStatus" class="org.hisp.dhis.reportsheet.action.NoAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/addDataStatus.vm</param>
-			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
-		</action>
-
-		<action name="openUpdateDataEntryStatus"
-			class="org.hisp.dhis.reportsheet.dataentrystatus.action.GetDataEntryStatusAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/updateDataStatus.vm</param>
-			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_ENTRY_STATUS_DELETE</param>
 		</action>
 
 		<action name="getDataSets"
@@ -1089,21 +1097,30 @@
 
 
 		<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-		<!-- IMPORT REPORT                                               -->
+		<!-- IMPORT REPORT                                                 -->
 		<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
+		<action name="listAllImportReport"
+			class="org.hisp.dhis.reportsheet.importreport.action.ListAllImportReportAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-spreadsheet-reporting/import/importReports.vm</param>
+			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+			<param name="menuTreeHeight">220</param>
+			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_REPORT_MANAGEMENT</param>
+		</action>
+
 		<action name="addImportReportForm"
 			class="org.hisp.dhis.reportsheet.importreport.action.SetupImportReportFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/import/addImportReport.vm</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_REPORT_ADD</param>
 		</action>
 
 		<action name="addImportReport"
 			class="org.hisp.dhis.reportsheet.importreport.action.AddImportReportAction">
-			<result name="success" type="redirect">
-				listAllImportReport.action
-			</result>
+			<result name="success" type="redirect">listAllImportReport.action</result>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_REPORT_ADD</param>
 		</action>
 
 		<action name="deleteImportReport"
@@ -1113,16 +1130,7 @@
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
-		</action>
-
-		<action name="listAllImportReport"
-			class="org.hisp.dhis.reportsheet.importreport.action.ListAllImportReportAction">
-			<result name="success" type="velocity">/main.vm</result>
-			<param name="page">/dhis-web-spreadsheet-reporting/import/importReports.vm</param>
-			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
-			<param name="menuTreeHeight">220</param>
-			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_REPORT_DELETE</param>
 		</action>
 
 		<action name="getAllImportReport"
@@ -1141,7 +1149,7 @@
 			class="org.hisp.dhis.reportsheet.importreport.action.SetupImportReportFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/import/updateImportReport.vm</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_REPORT_UPDATE</param>
 		</action>
 
 		<action name="updateImportReport"
@@ -1194,7 +1202,7 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/import/addImportItem.vm</param>
 			<param name="javascripts">javascript/importItems.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_ITEM_ADD</param>
 		</action>
 
 		<action name="addImportItem"
@@ -1210,7 +1218,7 @@
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_ITEM_DELETE</param>
 		</action>
 
 		<action name="getSelectedDataElements"
@@ -1246,7 +1254,7 @@
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-spreadsheet-reporting/import/updateImportItem.vm</param>
 			<param name="javascripts">javascript/importItems.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_ITEM_UPDATE</param>
 		</action>
 
 		<action name="updateImportItem"
@@ -1281,14 +1289,14 @@
 			class="org.hisp.dhis.reportsheet.importitem.action.CopyImportItemToImportReportAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-			<param name="requiredAuthorities">F_COPY_IMPORT_ITEM_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_ITEM_COPY</param>
 		</action>
 		
 		<action name="copyImportItemToExportReport"
 			class="org.hisp.dhis.reportsheet.importitem.action.CopyImportItemToExportReportAction">
 			<result name="success" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
-			<param name="requiredAuthorities">F_COPY_IMPORT_ITEM_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_IMPORT_ITEM_COPY</param>
 		</action>
 
 		<!-- IMPORT DATA -->
@@ -1469,7 +1477,7 @@
 			<param name="page">/dhis-web-spreadsheet-reporting/excelTemplateList.vm</param>
 			<param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
 			<param name="javascripts">javascript/exceltemplate.js</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_MANAGEMENT</param>
 		</action>
 
 		<action name="deleteExcelTemplate"
@@ -1479,13 +1487,13 @@
 			<result name="error" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<param name="onExceptionReturn">plainTextError</param>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_DELETE</param>
 		</action>
 
 		<action name="uploadExcelTemplate"
 			class="org.hisp.dhis.reportsheet.filemanager.action.UploadExcelFileAction">
 			<result name="success" type="redirect">listAllExcelTemplates.action</result>
-			<param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param>
+			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_UPLOAD</param>
 			<interceptor-ref name="fileUploadStack" />
 		</action>
 
@@ -1497,7 +1505,7 @@
 				/dhis-web-commons/ajax/jsonResponseError.vm</result>
 			<result name="none" type="velocity-json">
 				/dhis-web-commons/ajax/jsonResponseInput.vm</result>
-			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_MANAGEMENT_RENAME</param>
+			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_RENAME</param>
 		</action>
 
 		<action name="updateExportReportByTemplate"
@@ -1506,7 +1514,7 @@
 				/dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
 			<result name="error" type="velocity-xml">
 				/dhis-web-commons/ajax/xmlResponseError.vm</result>			
-			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_MANAGEMENT_RENAME</param>
+			<param name="requiredAuthorities">F_EXCEL_TEMPLATE_UPLOAD</param>
 		</action>
 
 		<action name="validateUploadExcelTemplate"

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportReports.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportReports.js	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportReports.js	2012-11-16 11:04:48 +0000
@@ -0,0 +1,138 @@
+function checkPermission( reportId, url )
+{
+	jQuery.get( 'checkPermission.action', { id: reportId }, function( json )
+	{
+		if ( json.response == "error" || json.message != "granted" ) {
+			showErrorMessage( json.message, 10000 );
+			return;
+		}
+		
+		window.location = 'openDefineAssociationsForm.action?exportReportId=' + reportId;
+	} );
+}
+
+function openDefineAssociationsForm( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "openDefineAssociationsForm" ) )
+	{
+		checkPermission( reportId, 'openDefineAssociationsForm.action?exportReportId=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function openExportReportUserRole( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "openExportReportUserRole" ) )
+	{
+		checkPermission( reportId, 'openExportReportUserRole.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function updateExportReportForm( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "updateExportReportForm" ) )
+	{
+		checkPermission( reportId, 'updateExportReportForm.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function removeReport( reportId, reportName )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "deleteExportReport" ) )
+	{
+		jQuery.get( 'checkPermission.action', { id: reportId }, function( json )
+		{
+			if ( json.response == "error" || json.message != "granted" ) {
+				showErrorMessage( json.message, 10000 );
+				return;
+			}
+			
+			removeItem( reportId, reportName, '$i18n.getString( 'confirm_delete' )', 'deleteExportReport.action' );
+		} );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function listExportItemAction( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "listExportItemAction" ) )
+	{
+		checkPermission( reportId, 'listExportItemAction.action?exportReportId=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function openUpdateOrgUnitGroupListingReport( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "openUpdateOrgUnitGroupListingReport" ) )
+	{
+		jQuery.get( 'checkPermission.action', { id: reportId }, function( json )
+		{
+			if ( json.response == "error" || json.message != "granted" ) {
+				showErrorMessage( json.message, 10000 );
+				return;
+			}
+			
+			window.location = 'openUpdateOrgUnitGroupListingReport.action?id=' + reportId;
+		} );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function organisationUnitAtLevels( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "organisationUnitAtLevels" ) )
+	{
+		checkPermission( reportId, 'organisationUnitAtLevels.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function listAttributeValueGroupOrderForExportReport( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "listAttributeValueGroupOrderForExportReport" ) )
+	{
+		checkPermission( reportId, 'listAttributeValueGroupOrderForExportReport.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function listDataElementGroupOrderForExportReport( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "listDataElementGroupOrderForExportReport" ) )
+	{
+		checkPermission( reportId, 'listDataElementGroupOrderForExportReport.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function listCategoryOptionGroupOrderForExportReport( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "listCategoryOptionGroupOrderForExportReport" ) )
+	{
+		checkPermission( reportId, 'listCategoryOptionGroupOrderForExportReport.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
+
+function periodColumns( reportId )
+{
+	if ( $auth.hasAccess( "dhis-web-spreadsheet-reporting", "periodColumns" ) )
+	{
+		checkPermission( reportId, 'periodColumns.action?id=' );
+	} else {
+		showErrorMessage( '$i18n.getString( 'access_denied' )' );
+	}
+}
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportGroups.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportGroups.vm	2012-03-29 10:05:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportGroups.vm	2012-11-16 11:04:48 +0000
@@ -1,10 +1,10 @@
+[
 #set( $size = $groups.size() )
 #foreach($g in $groups)
-[
   {
     "id" : "$!encoder.jsonEncode( ${g} )",
     "label" : "$!encoder.jsonEncode( ${g} )",
     "value" : "$!encoder.jsonEncode( ${g} )"
   }#if( $velocityCount < $size ),#end
-]
-#end
\ No newline at end of file
+#end
+]
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm	2012-04-28 16:58:08 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportReportForm.vm	2012-11-16 11:04:48 +0000
@@ -1,8 +1,24 @@
 <script>
 	jQuery(document).ready(	function(){
-		validation( 'addExportReportForm', function( form ){ form.submit() } );
+		validation( 'addExportReportForm', function( form ){
+			selectAllById( "selectedDataSetsList" );
+			form.submit();
+		});
 
 		checkValueIsExist( "name", "validateExportReportAction.action" );
+
+		jQuery( "#availableDataSetsList" ).dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getDataSets.action",
+			iterator: "dataSets",
+			connectedTo: "selectedDataSetsList",
+			handler: function( item ) {
+				var option = jQuery( "<option />" );
+				option.text( item.name );
+				option.attr( "value", item.id );
+				
+				return option;
+			}
+		});
 		
 		var cache = {},	lastXhr;
 		jQuery( "#group" ).autocomplete({
@@ -28,57 +44,88 @@
 
 <form id="addExportReportForm" method="POST" action="addExportReport.action">
 	<table>
-		<tr>
-			<td><label for="name">$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td><input type="text" name="name" id="name" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('excel_template')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td>				
-				<select name="excel" style="min-width:20em" class="{validate:{required:true}}">
-					#foreach($templateFileName in $mapTemplateFiles.keySet())		
-						<option value="$encoder.htmlEncode( $templateFileName )">$encoder.htmlEncode( $templateFileName )</option>						
-					#end						
-				</select>	
-			</td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('export_report_type')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td>
-				<select name="exportReportType" style="min-width:20em">
-					#foreach( $type in $reportTypes )
-						<option value='$type'>$i18n.getString( $type )</option>
-					#end									
-				</select>
-			</td>
-		</tr>	
-		<tr>		
-			<td><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td><input type="text" id="group" name="group" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
-		<td>		
-		<tr>
-			<td><label>$i18n.getString('period_postion_row')</label></td>
-			<td><input type="text" name="periodRow"   style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('period_postion_column')</label></td>
-			<td><input type="text" name="periodCol" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('organisation_position_row')</label></td>
-			<td><input type="text" name="organisationRow" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		</tr>
-
-		<tr>		
-			<td><label>$i18n.getString('organisation_position_column')</label></td>
-			<td><input type="text" name="organisationCol" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		<td>
-		<tr>
-			<td></td>
-			<td>
-				<input type="submit" value="$i18n.getString('ok')" style="width:150px"/>
-				<input type="button" value="$i18n.getString('cancel')" onclick="window.location = 'listAllExportReport.action'" style="width:150px"/>
-			</td>			
-		</tr>	
-	</table>
+		<thead><tr><th colspan="2">$i18n.getString( "details" )</th></tr></thead>
+		<tbody>
+			<tr>
+				<td><label for="name">$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td><input type="text" name="name" id="name" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('excel_template')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td>				
+					<select name="excel" style="width:20em" class="{validate:{required:true}}">
+						#foreach($templateFileName in $mapTemplateFiles.keySet())		
+							<option value="$encoder.htmlEncode( $templateFileName )">$encoder.htmlEncode( $templateFileName )</option>						
+						#end						
+					</select>	
+				</td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('export_report_type')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td>
+					<select name="exportReportType" style="min-width:20em">
+						#foreach( $type in $reportTypes )
+							<option value='$type'>$i18n.getString( $type )</option>
+						#end									
+					</select>
+				</td>
+			</tr>	
+			<tr>		
+				<td><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td><input type="text" id="group" name="group" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
+			<td>		
+			<tr>
+				<td><label>$i18n.getString('period_postion_row')</label></td>
+				<td><input type="text" name="periodRow"   style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('period_postion_column')</label></td>
+				<td><input type="text" name="periodCol" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('organisation_position_row')</label></td>
+				<td><input type="text" name="organisationRow" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+			<tr>		
+				<td><label>$i18n.getString('organisation_position_column')</label></td>
+				<td><input type="text" name="organisationCol" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+		</tbody>
+	</table>
+	
+	<table id="dataSetSelectionArea">
+		<col style="width: 450px"/>
+		<col/>
+		<col style="width: 450px"/>
+
+		<thead>
+			<tr>
+				<th>$i18n.getString( "available_data_sets" )</th>
+				<th>$i18n.getString( "filter" )</th>
+				<th>$i18n.getString( "selected_data_sets" )</th>
+			</tr>
+		</thead>
+
+		<tbody>
+			<tr>
+				<td>
+					<select id="availableDataSetsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+				</td>
+				<td>
+					<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataSetsList' );"/><br/>
+					<input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataSetsList' );"/><br/>
+					<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataSetsList' );"/><br/>
+					<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedDataSetsList' );"/>
+				</td>			
+				<td>
+					<select id="selectedDataSetsList" name="dataSetIds" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" class="{validate:{required:true}}"></select>
+				</td>
+			</tr>
+			<tr>
+				<td><input type="submit" value="$i18n.getString('ok')" style="width:150px"/>
+				<input type="button" value="$i18n.getString('cancel')" onclick="window.location = 'listAllExportReport.action'" style="width:150px"/></td>			
+			</tr>
+		</tbody>
+	</table>
+
 </form>
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm	2012-04-29 09:57:26 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/exportReports.vm	2012-11-16 11:04:48 +0000
@@ -1,3 +1,10 @@
+<script type="text/javascript" src="exportReports.js"></script>
+<script type="text/javascript">
+	jQuery(document).ready(function(){	  
+		tableSorter( 'listTable' );	
+    });
+</script>
+
 <h3>$i18n.getString('export_reports') #openHelp( "excelReportingListOfExportReports" )</h3>
 <table width="100%">
 	<tr>
@@ -11,6 +18,7 @@
 	</tr>
 </table>
 <table width="100%" class="listTable" id="listTable">
+	<input type="hidden" />
 	<thead>
 		<tr>
 			<th>$i18n.getString('name')</th>
@@ -30,37 +38,31 @@
 				#if( $exist )
 					<a href="downloadFile.action?fileName=$encoder.htmlEncode( $exportReport.excelTemplateFile )" title="download">$encoder.htmlEncode( $exportReport.excelTemplateFile )</a>
 				#else
-					$encoder.htmlEncode( $exportReport.excelTemplateFile ) <img src="images/question.png" alt="$i18n.getString( 'missing_template' )" title="$i18n.getString( 'missing_template' )"/>
+					$!encoder.htmlEncode( $exportReport.excelTemplateFile ) <img src="images/question.png" alt="$i18n.getString( 'missing_template' )" title="$i18n.getString( 'missing_template' )"/>
 				#end
 			</td>
 			<td align="left">
-				<a href="openDefineAssociationsForm.action?exportReportId=$exportReport.id" title="$i18n.getString( 'define_associations' )"><img src="../images/assign.png" alt="$i18n.getString( 'define_associations' )"/></a>
-				<a href="openExportReportUserRole.action?id=$exportReport.id" title="$i18n.getString( 'assign_exportreport_userrole' )"><img src="images/user_32.png" alt="$i18n.getString( 'update_exportreport_userrole' )"/></a>				
-				<a href="updateExportReportForm.action?id=$exportReport.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>				
-				<a href="javascript:removeItem( $exportReport.id, '$exportReport.displayName', '$i18n.getString( 'confirm_delete' )', 'deleteExportReport.action');" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+				<a href="javascript: openDefineAssociationsForm( $exportReport.id );" title="$i18n.getString( 'define_associations' )"><img src="../images/assign.png" alt="$i18n.getString( 'define_associations' )"/></a>
+				<a href="javascript: openExportReportUserRole( $exportReport.id );" title="$i18n.getString( 'assign_exportreport_userrole' )"><img src="images/user_32.png" alt="$i18n.getString( 'update_exportreport_userrole' )"/></a>				
+				<a href="javascript: updateExportReportForm( $exportReport.id );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>				
+				<a href="javascript: removeReport( $exportReport.id, '$exportReport.displayName' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
 			</td>
 			<td>	
-				<a href="listExportItemAction.action?exportReportId=$exportReport.id" title="$i18n.getString( 'export_item' )"><img src="../images/add_section.png" alt="$i18n.getString( 'export_item' )"/></a>
+				<a href="javascript: listExportItemAction( $exportReport.id );" title="$i18n.getString( 'export_item' )"><img src="../images/add_section.png" alt="$i18n.getString( 'export_item' )"/></a>
 				#if( $exportReport.isOrgUnitGroupListing() )
-				<a href="openUpdateOrgUnitGroupListingReport.action?id=$exportReport.id" title="$i18n.getString( 'organisation_unit_group' )"><img src="images/group_1.jpg"/></a>
-				<a href="organisationUnitAtLevels.action?id=$exportReport.id" title="$i18n.getString( 'set_organisationunit_group_level' )"><img src="images/organisationunitlevel.png" alt="$i18n.getString( 'set_organisationunit_group_level' )"/></a>				
+				<a href="javascript: openUpdateOrgUnitGroupListingReport( $exportReport.id );" title="$i18n.getString( 'organisation_unit_group' )"><img src="images/group_1.jpg"/></a>
+				<a href="javascript: organisationUnitAtLevels( $exportReport.id );" title="$i18n.getString( 'set_organisationunit_group_level' )"><img src="images/organisationunitlevel.png" alt="$i18n.getString( 'set_organisationunit_group_level' )"/></a>				
 				#elseif( $exportReport.isAttribute() )
-				<a href="listAttributeValueGroupOrderForExportReport.action?id=$exportReport.id" title="$i18n.getString( 'attributevalue_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'attributevalue_groups' )"/></a>				
+				<a href="javascript: listAttributeValueGroupOrderForExportReport( $exportReport.id );" title="$i18n.getString( 'attributevalue_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'attributevalue_groups' )"/></a>				
 				#elseif( $exportReport.isCategory() )
-				<a href="listDataElementGroupOrderForExportReport.action?id=$exportReport.id" title="$i18n.getString( 'dataelement_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'dataelement_groups' )"/></a>				
+				<a href="javascript: listDataElementGroupOrderForExportReport( $exportReport.id );" title="$i18n.getString( 'dataelement_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'dataelement_groups' )"/></a>				
 				#elseif( $exportReport.isCategoryVertical() )
-				<a href="listCategoryOptionGroupOrderForExportReport.action?id=$exportReport.id" title="$i18n.getString( 'categoryoption_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'categoryoption_groups' )"/></a>				
+				<a href="javascript: listCategoryOptionGroupOrderForExportReport( $exportReport.id );" title="$i18n.getString( 'categoryoption_groups' )"><img src="images/group.jpg" alt="$i18n.getString( 'categoryoption_groups' )"/></a>				
 				#elseif( $exportReport.isPeriodColumnListing() )
-				<a href="periodColumns.action?id=$exportReport.id" title="$i18n.getString( 'period_columns' )"><img src="images/calendar.png"/></a>
+				<a href="javascript: periodColumns( $exportReport.id );" title="$i18n.getString( 'period_columns' )"><img src="images/calendar.png"/></a>
 				#end
 			</td>
 		</tr>		
 	#end
 	</tbody>
-</table>
-
-<script>
-	jQuery(document).ready(function(){	  
-		tableSorter( 'listTable' );	
-    });
-</script>
\ No newline at end of file
+</table>
\ No newline at end of file

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportReportForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportReportForm.vm	2012-04-28 16:58:08 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportReportForm.vm	2012-11-16 11:04:48 +0000
@@ -1,9 +1,25 @@
 <script>
 	jQuery(document).ready(	function(){
-		validation( 'updateExportReportForm', function( form ){ form.submit()} );	
+		validation( 'updateExportReportForm', function( form ){
+			selectAllById( "selectedDataSetsList" );
+			form.submit();
+		});
 		
 		checkValueIsExist( "name", "validateExportReportAction.action", {id: "$exportReport.id"} );
 		
+		jQuery( "#availableDataSetsList" ).dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getDataSets.action",
+			iterator: "dataSets",
+			connectedTo: "selectedDataSetsList",
+			handler: function( item ) {
+				var option = jQuery( "<option />" );
+				option.text( item.name );
+				option.attr( "value", item.id );
+				
+				return option;
+			}
+		});
+
 		var cache = {},	lastXhr;
 		jQuery( "#group" ).autocomplete({
 			minLength: 2,
@@ -30,59 +46,94 @@
 <form id="updateExportReportForm" method="POST" action="updateExportReport.action">
 	<input type="hidden" value="$exportReport.id" name="id" id="id"/>
 	<table>
-		<tr>
-			<td><label for="name">$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td><input type="text" name="name" id="name" value="$!encoder.htmlEncode( $exportReport.displayName )" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('excel_template')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td>				
-				<select name="excel" style="min-width:20em" class="{validate:{required:true}}">
-					#foreach($templateFileName in $mapTemplateFiles.keySet())
-						<option value="$encoder.htmlEncode( $templateFileName )" #if( $exportReport.excelTemplateFile==$templateFileName) selected="selected" #end>
-							$encoder.htmlEncode( $templateFileName )
-						</option>
-					#end						
-				</select>	
-			</td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('export_report_type')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-			<td>
-				<select name="exportReportType" style="min-width:20em" disabled="true">
-					#foreach( $type in $reportTypes )
-						<option value='$type' #if( $exportReport.getReportType()==$type) selected="selected" #end>$i18n.getString( $type )</option>
-					#end												
-				</select>
-			</td>
-		</tr>	
-		<tr>		
-			<td><label>$i18n.getString('group')</label></td>
-			<td><input type="text" id="group" value="$encoder.htmlEncode( $exportReport.group )" name="group" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
-		<td>		
-		<tr>
-			<td><label>$i18n.getString('period_postion_row')</label></td>
-			<td><input type="text" name="periodRow" value="$!exportReport.periodRow"  style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('period_postion_column')</label></td>
-			<td><input type="text" name="periodCol" value="$!exportReport.periodColumn" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		</tr>
-		<tr>
-			<td><label>$i18n.getString('organisation_position_row')</label></td>
-			<td><input type="text" name="organisationRow" value="$!exportReport.organisationRow" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		</tr>
-
-		<tr>		
-			<td><label>$i18n.getString('organisation_position_column')</label></td>
-			<td><input type="text" name="organisationCol" value="$!exportReport.organisationColumn" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
-		<td>
-		<tr>
-			<td></td>
-			<td>
-				<input type="submit" value="$i18n.getString('ok')" style="width:150px"/>
-				<input type="button" value="$i18n.getString('cancel')" onclick="window.location = 'listAllExportReport.action'" style="width:150px"/>
-			</td>			
-		</tr>	
+		<thead><tr><th colspan="2">$i18n.getString( "details" )</th></tr></thead>
+		<tbody>
+			<tr>
+				<td><label for="name">$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td><input type="text" name="name" id="name" value="$!encoder.htmlEncode( $exportReport.displayName )" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('excel_template')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td>				
+					<select name="excel" style="width:20em" class="{validate:{required:true}}">
+						#foreach($templateFileName in $mapTemplateFiles.keySet())
+							<option value="$encoder.htmlEncode( $templateFileName )" #if( $exportReport.excelTemplateFile==$templateFileName) selected="selected" #end>
+								$encoder.htmlEncode( $templateFileName )
+							</option>
+						#end						
+					</select>	
+				</td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('export_report_type')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td>
+					<select name="exportReportType" style="min-width:20em" disabled="true">
+						#foreach( $type in $reportTypes )
+							<option value='$type' #if( $exportReport.getReportType()==$type) selected="selected" #end>$i18n.getString( $type )</option>
+						#end												
+					</select>
+				</td>
+			</tr>	
+			<tr>		
+				<td><label>$i18n.getString('group')</label></td>
+				<td><input type="text" id="group" value="$encoder.htmlEncode( $exportReport.group )" name="group" style="width:20em" class="{validate:{required:true,minlength:2,maxlength:160}}"/></td>
+			<td>		
+			<tr>
+				<td><label>$i18n.getString('period_postion_row')</label></td>
+				<td><input type="text" name="periodRow" value="$!exportReport.periodRow"  style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('period_postion_column')</label></td>
+				<td><input type="text" name="periodCol" value="$!exportReport.periodColumn" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+			<tr>
+				<td><label>$i18n.getString('organisation_position_row')</label></td>
+				<td><input type="text" name="organisationRow" value="$!exportReport.organisationRow" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			</tr>
+
+			<tr>		
+				<td><label>$i18n.getString('organisation_position_column')</label></td>
+				<td><input type="text" name="organisationCol" value="$!exportReport.organisationColumn" style="width:10em" class="{validate:{required:false,number:true}}"/></td>
+			<td>
+		</tbody>
+	</table>
+	
+	<table id="dataSetSelectionArea">
+		<col style="width: 450px"/>
+		<col/>
+		<col style="width: 450px"/>
+
+		<thead>
+			<tr>
+				<th>$i18n.getString( "available_data_sets" )</th>
+				<th>$i18n.getString( "filter" )</th>
+				<th>$i18n.getString( "selected_data_sets" )</th>
+			</tr>
+		</thead>
+
+		<tbody>
+			<tr>
+				<td>
+					<select id="availableDataSetsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+				</td>
+				<td>
+					<input type="button" value="&gt;" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataSetsList' );"/><br/>
+					<input type="button" value="&lt;" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataSetsList' );"/><br/>
+					<input type="button" value="&gt;&gt;" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataSetsList' );"/><br/>
+					<input type="button" value="&lt;&lt;" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedDataSetsList' );"/>
+				</td>			
+				<td>
+					<select id="selectedDataSetsList" name="dataSetIds" multiple="multiple" style="height: 200px; width: 100%; margin-top: 45px;" class="{validate:{required:true}}">
+						#foreach( $dataSet in $exportReport.dataSets )
+						<option value="$dataSet.id">$!encoder.htmlEncode( $dataSet.displayName )</option>
+						#end
+					</select>
+				</td>
+			</tr>
+			<tr>
+				<td><input type="submit" value="$i18n.getString('ok')" style="width:150px"/>
+				<input type="button" value="$i18n.getString('cancel')" onclick="window.location = 'listAllExportReport.action'" style="width:150px"/></td>			
+			</tr>
+		</tbody>
 	</table>
 </form>
\ No newline at end of file