← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6639: local vn - Implemented a export report type ATTRIBUTE.

 

------------------------------------------------------------
revno: 6639
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-19 10:58:49 +0700
message:
  local vn - Implemented a export report type ATTRIBUTE.
added:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateExcelReportFlowAction.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/exportItems.js
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportItemForm.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportItemForm.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-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2012-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java	2012-04-19 03:58:49 +0000
@@ -63,6 +63,7 @@
 import org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager;
 import org.hisp.dhis.reportsheet.state.SelectionManager;
 import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * @author Dang Duy Hieu
@@ -90,32 +91,46 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    @Autowired
     CurrentUserService currentUserService;
 
+    @Autowired
     IndicatorService indicatorService;
 
+    @Autowired
     InitializePOIStylesManager initPOIStylesManager;
 
+    @Autowired
     protected AggregationService aggregationService;
 
+    @Autowired
     protected AggregatedDataValueService aggregatedDataValueService;
 
+    @Autowired
     protected DataElementCategoryService categoryService;
 
+    @Autowired
     protected DataElementService dataElementService;
 
+    @Autowired
     protected PeriodService periodService;
 
+    @Autowired
     protected ExportReportService exportReportService;
 
+    @Autowired
     protected ReportLocationManager reportLocationManager;
 
+    @Autowired
     protected StatementManager statementManager;
 
+    @Autowired
     protected SelectionManager selectionManager;
 
+    @Autowired
     protected OrganisationUnitSelectionManager organisationUnitSelectionManager;
 
+    @Autowired
     protected DataValueService dataValueService;
 
     protected I18n i18n;
@@ -212,91 +227,16 @@
         this.i18n = i18n;
     }
 
+    public void setFormat( I18nFormat format )
+    {
+        this.format = format;
+    }
+
     public InputStream getInputStream()
     {
         return inputStream;
     }
 
-    public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
-    {
-        this.organisationUnitSelectionManager = organisationUnitSelectionManager;
-    }
-
-    public void setSelectionManager( SelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    public void setIndicatorService( IndicatorService indicatorService )
-    {
-        this.indicatorService = indicatorService;
-    }
-
-    public void setDataValueService( DataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    public void setStatementManager( StatementManager statementManager )
-    {
-        this.statementManager = statementManager;
-    }
-
-    public void setCategoryService( DataElementCategoryService categoryService )
-    {
-        this.categoryService = categoryService;
-    }
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
-    public void setAggregationService( AggregationService aggregationService )
-    {
-        this.aggregationService = aggregationService;
-    }
-
-    public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
-    {
-        this.aggregatedDataValueService = aggregatedDataValueService;
-    }
-
-    public void setFormat( I18nFormat format )
-    {
-        this.format = format;
-    }
-
-    public void setReportLocationManager( ReportLocationManager reportLocationManager )
-    {
-        this.reportLocationManager = reportLocationManager;
-    }
-
-    public void setExportReportService( ExportReportService exportReportService )
-    {
-        this.exportReportService = exportReportService;
-    }
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
-
-    public InitializePOIStylesManager getInitPOIStylesManager()
-    {
-        return initPOIStylesManager;
-    }
-
-    public void setInitPOIStylesManager( InitializePOIStylesManager initPOIStylesManager )
-    {
-        this.initPOIStylesManager = initPOIStylesManager;
-    }
-
     // -------------------------------------------------------------------------
     // Supporting methods
     // -------------------------------------------------------------------------

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateExcelReportFlowAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateExcelReportFlowAction.java	2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateExcelReportFlowAction.java	2012-04-19 03:58:49 +0000
@@ -30,6 +30,7 @@
 import org.hisp.dhis.reportsheet.ExportReportService;
 import org.hisp.dhis.reportsheet.ExportReport;
 import org.hisp.dhis.reportsheet.state.SelectionManager;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import com.opensymphony.xwork2.Action;
 
@@ -45,20 +46,12 @@
     // Dependency
     // -------------------------------------------------------------------------
 
+	@Autowired
     private ExportReportService exportReportService;
 
-    public void setExportReportService( ExportReportService exportReportService )
-    {
-        this.exportReportService = exportReportService;
-    }
-
+	@Autowired
     private SelectionManager selectionManager;
 
-    public void setSelectionManager( SelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
     // -------------------------------------------------------------------------
     // Input && Output
     // -------------------------------------------------------------------------

=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java	1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java	2012-04-19 03:58:49 +0000
@@ -0,0 +1,152 @@
+package org.hisp.dhis.reportsheet.exporting.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.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.poi.ss.usermodel.Sheet;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementFormNameComparator;
+import org.hisp.dhis.dataelement.LocalDataElementService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
+import org.hisp.dhis.reportsheet.ExportItem;
+import org.hisp.dhis.reportsheet.ExportReport;
+import org.hisp.dhis.reportsheet.ExportReportAttribute;
+import org.hisp.dhis.reportsheet.exporting.AbstractGenerateExcelReportSupport;
+import org.hisp.dhis.reportsheet.utils.ExcelUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GenerateReportAttributeAction
+    extends AbstractGenerateExcelReportSupport
+{
+    @Autowired
+    private LocalDataElementService localDataElementService;
+
+    @Override
+    protected void executeGenerateOutputFile( ExportReport exportReport, Period period )
+        throws Exception
+    {
+        OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
+
+        ExportReportAttribute exportReportInstance = (ExportReportAttribute) exportReport;
+
+        this.installReadTemplateFile( exportReportInstance, period, organisationUnit );
+
+        for ( Integer sheetNo : exportReportService.getSheets( selectionManager.getSelectedReportId() ) )
+        {
+            Sheet sheet = this.templateWorkbook.getSheetAt( sheetNo - 1 );
+
+            Collection<ExportItem> exportReportItems = exportReportInstance.getExportItemBySheet( sheetNo );
+
+            this.generateOutPutFile( exportReportInstance, exportReportItems, organisationUnit, sheet );
+        }
+    }
+
+    // -------------------------------------------------------------------------
+    // Supportive method
+    // -------------------------------------------------------------------------
+
+    private void generateOutPutFile( ExportReportAttribute exportReport, Collection<ExportItem> exportReportItems,
+        OrganisationUnit organisationUnit, Sheet sheet )
+    {
+        for ( ExportItem exportItem : exportReportItems )
+        {
+            int rowBegin = exportItem.getRow();
+
+            for ( AttributeValueGroupOrder avgOrder : exportReport.getAttributeValueOrders() )
+            {
+                int beginChapter = rowBegin;
+
+                if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_NAME ) )
+                {
+                    ExcelUtils.writeValueByPOI( rowBegin, exportItem.getColumn(), avgOrder.getName(), ExcelUtils.TEXT,
+                        sheet, this.csText12BoldCenter );
+                }
+
+                rowBegin++;
+                int serial = 1;
+                List<DataElement> dataElements = null;
+
+                for ( String avalue : avgOrder.getAttributeValues() )
+                {
+                    if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_NAME ) )
+                    {
+                        ExcelUtils.writeValueByPOI( rowBegin, exportItem.getColumn(), avalue, ExcelUtils.TEXT, sheet,
+                            this.csText10Bold );
+                    }
+                    else if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.SERIAL ) )
+                    {
+                        ExcelUtils.writeValueByPOI( rowBegin, exportItem.getColumn(), String.valueOf( serial ),
+                            ExcelUtils.NUMBER, sheet, this.csTextSerial );
+                    }
+                    else
+                    {
+                        dataElements = new ArrayList<DataElement>( localDataElementService.getDataElementsByAttribute(
+                            avgOrder.getAttribute(), avalue ) );
+
+                        Collections.sort( dataElements, new DataElementFormNameComparator() );
+
+                        ExportItem newExportItem = new ExportItem();
+
+                        int innerColumn = exportItem.getColumn();
+
+                        for ( DataElement de : dataElements )
+                        {
+                            newExportItem.setExpression( String.valueOf( de.getId() ) );
+
+                            double value = this.getDataValue( newExportItem, organisationUnit );
+
+                            ExcelUtils.writeValueByPOI( rowBegin, innerColumn++, String.valueOf( value ),
+                                ExcelUtils.NUMBER, sheet, this.csNumber );
+                        }
+                    }
+
+                    rowBegin++;
+                    serial++;
+                }
+
+                if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT ) )
+                {
+                    String columnName = ExcelUtils.convertColumnNumberToName( exportItem.getColumn() );
+                    String formula = "SUM(" + columnName + (beginChapter + 1) + ":" + columnName + (rowBegin - 1) + ")";
+
+                    ExcelUtils.writeFormulaByPOI( beginChapter, exportItem.getColumn(), formula, sheet, this.csFormula );
+                }
+            }
+        }
+    }
+}

=== 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-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml	2012-04-19 03:58:49 +0000
@@ -504,138 +504,32 @@
 	<bean
 		id="org.hisp.dhis.reportsheet.exporting.action.GenerateExcelReportFlowAction"
 		class="org.hisp.dhis.reportsheet.exporting.action.GenerateExcelReportFlowAction"
-		scope="prototype">
-		<property name="exportReportService"
-			ref="org.hisp.dhis.reportsheet.ExportReportService" />
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
-	</bean>
+		scope="prototype" />
 
 	<bean
 		id="org.hisp.dhis.reportsheet.exporting.action.GenerateReportOrgGroupListingAction"
 		class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportOrgGroupListingAction"
-		scope="prototype">
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
-		<property name="exportReportService"
-			ref="org.hisp.dhis.reportsheet.ExportReportService" />
-		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
-		<property name="organisationUnitSelectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="reportLocationManager"
-			ref="org.hisp.dhis.reportsheet.ReportLocationManager" />
-		<property name="aggregationService"
-			ref="org.hisp.dhis.aggregation.AggregationService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="statementManager" ref="statementManager" />
-		<property name="dataElementService"
-			ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="indicatorService"
-			ref="org.hisp.dhis.indicator.IndicatorService" />
-		<property name="initPOIStylesManager"
-			ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
-		<property name="dataValueService"
-			ref="org.hisp.dhis.datavalue.DataValueService" />
-	</bean>
+		scope="prototype" />
 
 	<bean
 		id="org.hisp.dhis.reportsheet.exporting.action.GenerateReportNormalAction"
 		class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportNormalAction"
-		scope="prototype">
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
-		<property name="exportReportService"
-			ref="org.hisp.dhis.reportsheet.ExportReportService" />
-		<property name="periodService"
-			ref="org.hisp.dhis.period.PeriodService" />
-		<property name="organisationUnitSelectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="reportLocationManager"
-			ref="org.hisp.dhis.reportsheet.ReportLocationManager" />
-		<property name="aggregationService"
-			ref="org.hisp.dhis.aggregation.AggregationService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="statementManager" ref="statementManager" />
-		<property name="dataElementService"
-			ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="indicatorService"
-			ref="org.hisp.dhis.indicator.IndicatorService" />
-		<property name="initPOIStylesManager"
-			ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
-		<property name="dataValueService"
-			ref="org.hisp.dhis.datavalue.DataValueService" />
-	</bean>
+		scope="prototype" />
 
 	<bean
 		id="org.hisp.dhis.reportsheet.exporting.action.GenerateReportCategoryAction"
 		class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportCategoryAction"
-		scope="prototype">
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
-		<property name="exportReportService"
-			ref="org.hisp.dhis.reportsheet.ExportReportService" />
-		<property name="periodService"
-			ref="org.hisp.dhis.period.PeriodService" />
-		<property name="organisationUnitSelectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="reportLocationManager"
-			ref="org.hisp.dhis.reportsheet.ReportLocationManager" />
-		<property name="aggregationService"
-			ref="org.hisp.dhis.aggregation.AggregationService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="statementManager"
-			ref="statementManager" />
-		<property name="dataElementService"
-			ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="indicatorService"
-			ref="org.hisp.dhis.indicator.IndicatorService" />
-		<property name="initPOIStylesManager"
-			ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
-		<property name="dataValueService"
-			ref="org.hisp.dhis.datavalue.DataValueService" />
-	</bean>
+		scope="prototype" />
 
+	<bean
+		id="org.hisp.dhis.reportsheet.exporting.action.GenerateReportAttributeAction"
+		class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportAttributeAction"
+		scope="prototype" />
 
 	<bean
 		id="org.hisp.dhis.reportsheet.exporting.action.GenerateReportPeriodColumnListingAction"
 		class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportPeriodColumnListingAction"
-		scope="prototype">
-		<property name="selectionManager"
-			ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
-		<property name="exportReportService"
-			ref="org.hisp.dhis.reportsheet.ExportReportService" />
-		<property name="periodService"
-			ref="org.hisp.dhis.period.PeriodService" />
-		<property name="organisationUnitSelectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-		<property name="reportLocationManager"
-			ref="org.hisp.dhis.reportsheet.ReportLocationManager" />
-		<property name="aggregationService"
-			ref="org.hisp.dhis.aggregation.AggregationService" />
-		<property name="categoryService"
-			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="statementManager"
-			ref="statementManager" />
-		<property name="dataElementService"
-			ref="org.hisp.dhis.dataelement.DataElementService" />
-		<property name="currentUserService"
-			ref="org.hisp.dhis.user.CurrentUserService" />
-		<property name="indicatorService"
-			ref="org.hisp.dhis.indicator.IndicatorService" />
-		<property name="initPOIStylesManager"
-			ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
-		<property name="dataValueService"
-			ref="org.hisp.dhis.datavalue.DataValueService" />
-	</bean>
+		scope="prototype" />
 
 	<!-- DATA ENTRY STATUS 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-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties	2012-04-19 03:58:49 +0000
@@ -3,6 +3,7 @@
 row							= Row
 column						= Column
 excel_template				= Excel Template
+report_type					= Report type
 export_report_type			= Export report type
 import_report_type			= Import report type
 PERIOD_COLUMN_LISTING		= Period Column Listing

=== 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-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties	2012-04-19 03:58:49 +0000
@@ -15,7 +15,9 @@
 dataelement_name=T\u00ean ph\u1ea7n t\u1eed d\u1eef li\u1ec7u
 report_excel=B\u00e1o c\u00e1o excel
 line=\u0110\u01b0\u1eddng
+report_type	= Ki\u1ec3u b\u00e1o c\u00e1o
 export_report_type=Ki\u1ec3u b\u00e1o c\u00e1o
+import_report_type=Lo\u1ea1i b\u00e1o c\u00e1o t\u00edch h\u1ee3p
 export_report=B\u00e1o c\u00e1o xu\u1ea5t
 copy_export_item_to_importreport=Sao ch\u00e9p ph\u1ea7n t\u1eed Xu\u1ea5t t\u1edbi b\u00e1o c\u00e1o Nh\u1eadp
 right_brackets=\u0110\u00f3ng ngo\u1eb7c
@@ -32,7 +34,6 @@
 report_is_null=Vui l\u00f2ng ch\u1ecdn b\u00e1o c\u00e1o!
 period_is_null=Vui l\u00f2ng ch\u1ecdn th\u1eddi \u0111i\u1ec3m!
 de_in_=theo ph\u1ea7n t\u1eed d\u1eef li\u1ec7u/ch\u1ec9 s\u1ed1
-import_report_type=Lo\u1ea1i b\u00e1o c\u00e1o t\u00edch h\u1ee3p
 column_chart=Bi\u1ec3u \u0111\u1ed3 c\u1ed9t
 list_of_import_items=Danh s\u00e1ch c\u00e1c ph\u1ea7n t\u1eed t\u00edch h\u1ee3p
 override_successful=T\u1eadp tin n\u00e0y \u0111\u00e3 \u0111\u01b0\u1ee3c ghi \u0111\u00e8!

=== 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-04-16 03:00:30 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-04-19 03:58:49 +0000
@@ -602,6 +602,8 @@
 
 		<action name="generateExportReport"
 			class="org.hisp.dhis.reportsheet.exporting.action.GenerateExcelReportFlowAction">
+			<result name="ATTRIBUTE" type="redirect">
+				generateReportAttribute.action</result>
 			<result name="CATEGORY" type="redirect">
 				generateReportCategory.action</result>
 			<result name="NORMAL" type="redirect">
@@ -612,6 +614,12 @@
 				generateReportPeriodColumnListing.action</result>
 		</action>
 
+		<action name="generateReportAttribute"
+			class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportAttributeAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+		</action>
+
 		<action name="generateReportCategory"
 			class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportCategoryAction">
 			<result name="success" type="velocity-json">
@@ -745,6 +753,8 @@
 
 		<action name="previewExportReport"
 			class="org.hisp.dhis.reportsheet.exporting.action.GenerateExcelReportFlowAction">
+			<result name="ATTRIBUTE" type="redirect">
+				generatePreviewAttribute.action</result>
 			<result name="CATEGORY" type="redirect">
 				generatePreviewCategory.action</result>
 			<result name="NORMAL" type="redirect">
@@ -755,6 +765,12 @@
 				generatePreviewPeriodColumnListing.action</result>
 		</action>
 
+		<action name="generatePreviewAttribute"
+			class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportAttributeAction">
+			<result name="success" type="redirect">exportXML.action
+			</result>
+		</action>
+
 		<action name="generatePreviewCategory"
 			class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportCategoryAction">
 			<result name="success" type="redirect">exportXML.action

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportItems.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportItems.js	2012-03-16 07:09:48 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/exportItems.js	2012-04-19 03:58:49 +0000
@@ -53,13 +53,26 @@
 	
 	setFieldValue( 'exportItem input[id=expression]', getFieldValue( 'exportItem input[id=currentExpression]') );
 	
-	if( value == 'dataelement' ){
-		byId('expression-button' ).onclick = deExpressionBuilderForm;
-	}else if( value == 'indicator' ){
+	if( value == 'dataelement' )
+	{
+		if ( attribute ) {
+			disable( 'expression-button' );
+			setFieldValue( 'exportItem input[id=expression]', value );
+			removeValidatorRulesById( 'exportItem input[id=expression]' );
+			removeValidatorRulesById( 'dataelement textarea[id=formula]' );
+		} else {
+			byId('expression-button' ).onclick = deExpressionBuilderForm;
+		}
+	}
+	else if( value == 'indicator' )
+	{
 		byId('expression-button' ).onclick = inExpressionBuilderForm ;
-	}else if( value == 'formulaexcel' ){
+	}
+	else if( value == 'formulaexcel' )
+	{
 		byId('expression-button' ).onclick = excelFormulaExpressionBuilderForm ;
-	}else if( value == 'organisation' || value == 'serial' || value == 'dataelement_code' || value == 'dataelement_name' ){
+	}
+	else if( value == 'organisation' || value == 'serial' || value == 'dataelement_code' || value == 'dataelement_name' ){
 		disable( 'expression-button' );
 		setFieldValue( 'exportItem input[id=expression]', value );
 		removeValidatorRulesById( 'exportItem input[id=expression]' );
@@ -109,7 +122,7 @@
 		if( json.response == 'success' ) {					
 			form.submit();
 		}else {
-			showErrorMessage( json.message );
+			showErrorMessage( json.message, 7000 );
 		}
 	});
 }

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportItemForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportItemForm.vm	2012-03-29 10:05:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/addExportItemForm.vm	2012-04-19 03:58:49 +0000
@@ -5,7 +5,8 @@
 		});
 	});
 	
-	var category = $exportReport.isCategory();
+	var category = $!exportReport.isCategory();
+	var attribute = $!exportReport.isAttribute();
 	
 </script>
 

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportItemForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportItemForm.vm	2012-03-29 10:05:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/report/updateExportItemForm.vm	2012-04-19 03:58:49 +0000
@@ -5,8 +5,8 @@
 		});
 	});
 	
-	var category = $exportReport.isCategory();
-	
+	var category = $!exportReport.isCategory();
+	var attribute = $!exportReport.isAttribute();
 </script>
 
 <h3>$i18n.getString( 'update_export_item' )</h3>
@@ -24,8 +24,8 @@
 			<td>$!encoder.htmlEncode( $!exportReport.displayName )</td>
 		</tr>
 		<tr>
-			<td><label>$i18n.getString('report_type')</label></td>
-			<td>: $i18n.getString( $!exportReport.getReportType() )</td>
+			<td><label>$i18n.getString('report_type')</label>: </td>
+			<td>$i18n.getString( $!exportReport.getReportType() )</td>
 		</tr>
 		<tr>
 			<td colspan="2" height="20px"></td>