dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12487
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3849: local vn - Added new validation for generating report excel.
------------------------------------------------------------
revno: 3849
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-06-07 17:07:02 +0700
message:
local vn - Added new validation for generating report excel.
removed:
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/advancedReport.vm
added:
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/ValidateGenerateExportReportAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java
modified:
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/GenerateExcelReportFlowAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportNormalAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java
local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/generateReportForm.vm
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js
local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.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-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/GenerateExcelReportFlowAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/GenerateExcelReportFlowAction.java 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/GenerateExcelReportFlowAction.java 2011-06-07 10:07:02 +0000
@@ -29,7 +29,6 @@
import org.hisp.dhis.reportexcel.ExportReportService;
import org.hisp.dhis.reportexcel.ReportExcel;
-import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
import org.hisp.dhis.reportexcel.state.SelectionManager;
import com.opensymphony.xwork2.Action;
@@ -48,45 +47,32 @@
private ExportReportService exportReportService;
+ public void setExportReportService( ExportReportService exportReportService )
+ {
+ this.exportReportService = exportReportService;
+ }
+
private SelectionManager selectionManager;
- private PeriodGenericManager periodGenericManager;
-
- // -------------------------------------------------------------------------
- // Input & Output
- // -------------------------------------------------------------------------
-
- private Integer exportReportId;
-
- private Integer periodIndex;
-
- // -------------------------------------------------------------------------
- // Getter & Setter
- // -------------------------------------------------------------------------
-
- public void setExportReportId( Integer exportReportId )
- {
- this.exportReportId = exportReportId;
- }
-
public void setSelectionManager( SelectionManager selectionManager )
{
this.selectionManager = selectionManager;
}
- public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
- {
- this.periodGenericManager = periodGenericManager;
- }
-
- public void setPeriodIndex( Integer periodIndex )
- {
- this.periodIndex = periodIndex;
- }
-
- public void setExportReportService( ExportReportService exportReportService )
- {
- this.exportReportService = exportReportService;
+ // -------------------------------------------------------------------------
+ // Input && Output
+ // -------------------------------------------------------------------------
+
+ private Integer organisationGroupId;
+
+ public void setOrganisationGroupId( Integer organisationGroupId )
+ {
+ this.organisationGroupId = organisationGroupId;
+ }
+
+ public Integer getOrganisationGroupId()
+ {
+ return organisationGroupId;
}
// -------------------------------------------------------------------------
@@ -96,11 +82,7 @@
public String execute()
throws Exception
{
- ReportExcel exportReport = exportReportService.getExportReport( exportReportId );
-
- periodGenericManager.setSelectedPeriodIndex( periodIndex );
-
- selectionManager.setSelectedReportId( exportReportId );
+ ReportExcel exportReport = exportReportService.getExportReport( selectionManager.getSelectedReportId() );
return exportReport.getReportType();
}
=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/ValidateGenerateExportReportAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/ValidateGenerateExportReportAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/action/ValidateGenerateExportReportAction.java 2011-06-07 10:07:02 +0000
@@ -0,0 +1,137 @@
+package org.hisp.dhis.reportexcel.exporting.action;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.io.File;
+
+import org.hisp.dhis.reportexcel.ExportReportService;
+import org.hisp.dhis.reportexcel.ReportExcel;
+import org.hisp.dhis.reportexcel.ReportLocationManager;
+import org.hisp.dhis.reportexcel.action.ActionSupport;
+import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ValidateGenerateExportReportAction
+ extends ActionSupport
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private ExportReportService exportReportService;
+
+ public void setExportReportService( ExportReportService exportReportService )
+ {
+ this.exportReportService = exportReportService;
+ }
+
+ private PeriodGenericManager periodGenericManager;
+
+ public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
+ {
+ this.periodGenericManager = periodGenericManager;
+ }
+
+ private SelectionManager selectionManager;
+
+ public void setSelectionManager( SelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
+ private ReportLocationManager reportLocationManager;
+
+ public void setReportLocationManager( ReportLocationManager reportLocationManager )
+ {
+ this.reportLocationManager = reportLocationManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer exportReportId;
+
+ public void setExportReportId( Integer exportReportId )
+ {
+ this.exportReportId = exportReportId;
+ }
+
+ private Integer periodIndex;
+
+ public void setPeriodIndex( Integer periodIndex )
+ {
+ this.periodIndex = periodIndex;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ ReportExcel exportReport = exportReportService.getExportReport( exportReportId );
+
+ if ( exportReport == null )
+ {
+ message = i18n.getString( "the_specified_report_is_not_exist" );
+
+ return ERROR;
+ }
+
+ File templateDirectory = reportLocationManager.getReportExcelTemplateDirectory();
+
+ if ( templateDirectory == null || !templateDirectory.exists() )
+ {
+ message = i18n.getString( "template_folder_is_null" );
+
+ return ERROR;
+ }
+
+ File templateFile = new File( templateDirectory, exportReport.getExcelTemplateFile() );
+
+ if ( templateFile == null || !templateFile.exists() )
+ {
+ message = i18n.getString( "template_file_is_not_exist" );
+
+ return ERROR;
+ }
+
+ periodGenericManager.setSelectedPeriodIndex( periodIndex );
+
+ selectionManager.setSelectedReportId( exportReportId );
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportNormalAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportNormalAction.java 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportNormalAction.java 2011-06-07 10:07:02 +0000
@@ -49,9 +49,9 @@
public class GenerateAdvancedReportNormalAction
extends AbstractGenerateExcelReportSupport
{
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// Dependency
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
private OrganisationUnitGroupService organisationUnitGroupService;
@@ -60,9 +60,9 @@
this.organisationUnitGroupService = organisationUnitGroupService;
}
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// Input && Output
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
private Integer organisationGroupId;
@@ -71,9 +71,9 @@
this.organisationGroupId = organisationGroupId;
}
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
// Override
- // ---------------------------------------------------------------------
+ // -------------------------------------------------------------------------
@Override
protected void executeGenerateOutputFile( ReportExcel exportReport, Period period )
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java 2011-06-07 10:07:02 +0000
@@ -59,26 +59,22 @@
private OrganisationUnitGroupService organisationUnitGroupService;
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
// -------------------------------------------------------------------------
// Input && Output
// -------------------------------------------------------------------------
private Integer organisationGroupId;
- // -------------------------------------------------------------------------
- // Getters && Setters
- // -------------------------------------------------------------------------
-
public void setOrganisationGroupId( Integer organisationGroupId )
{
this.organisationGroupId = organisationGroupId;
}
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
// -------------------------------------------------------------------------
// Override
// -------------------------------------------------------------------------
@@ -102,7 +98,6 @@
this.generateOutPutFile( exportReportInstance.getPeriodColumns(), exportReportItems, organisationUnitGroup
.getMembers(), sheet );
-
}
for ( Integer sheetNo : exportReportService.getSheets( selectionManager.getSelectedReportId() ) )
@@ -110,12 +105,11 @@
Sheet sheet = this.templateWorkbook.getSheetAt( sheetNo - 1 );
this.recalculatingFormula( sheet );
-
}
}
- private void generateOutPutFile( Collection<PeriodColumn> periodColumns,
- Collection<ReportExcelItem> exportItems, Set<OrganisationUnit> organisationUnits, Sheet sheet )
+ private void generateOutPutFile( Collection<PeriodColumn> periodColumns, Collection<ReportExcelItem> exportItems,
+ Set<OrganisationUnit> organisationUnits, Sheet sheet )
{
for ( ReportExcelItem exportItem : exportItems )
{
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java 2011-06-07 10:07:02 +0000
@@ -27,13 +27,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.hisp.dhis.reportexcel.ExportReportService;
import org.hisp.dhis.reportexcel.ReportExcel;
+import org.hisp.dhis.reportexcel.ReportLocationManager;
import org.hisp.dhis.reportexcel.comparator.ExportReportNameComparator;
+import org.hisp.dhis.reportexcel.utils.ExcelFilenameFilter;
+import org.hisp.dhis.reportexcel.utils.FileUtils;
import com.opensymphony.xwork2.Action;
@@ -55,9 +61,23 @@
this.exportReportService = exportReportService;
}
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
+ private ReportLocationManager reportLocationManager;
+
+ public void setReportLocationManager( ReportLocationManager reportLocationManager )
+ {
+ this.reportLocationManager = reportLocationManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private boolean valid;
+
+ public void setValid( boolean valid )
+ {
+ this.valid = valid;
+ }
private List<ReportExcel> exportReports;
@@ -66,13 +86,50 @@
return exportReports;
}
+ private Map<String, Boolean> templateMap = new HashMap<String, Boolean>();
+
+ public Map<String, Boolean> getTemplateMap()
+ {
+ return templateMap;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
public String execute()
throws Exception
{
+ valid = true;
+
exportReports = new ArrayList<ReportExcel>( exportReportService.getAllExportReport() );
+ if ( valid )
+ {
+ File templateDirectory = reportLocationManager.getReportExcelTemplateDirectory();
+
+ if ( templateDirectory == null || !templateDirectory.exists() )
+ {
+ return SUCCESS;
+ }
+
+ List<String> templateNames = FileUtils.getListFileName( templateDirectory, new ExcelFilenameFilter() );
+
+ if ( templateNames == null || templateNames.isEmpty() )
+ {
+ return SUCCESS;
+ }
+
+ for ( ReportExcel exportReport : exportReports )
+ {
+ templateMap.put( exportReport.getExcelTemplateFile(), templateNames.contains( exportReport
+ .getExcelTemplateFile() ) );
+ }
+ }
+
Collections.sort( exportReports, new ExportReportNameComparator() );
return SUCCESS;
}
+
}
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java 2011-06-07 05:41:55 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/filemanager/action/ExcelTemplateListAction.java 2011-06-07 10:07:02 +0000
@@ -173,7 +173,7 @@
{
return ERROR;
}
-
+
File templateDirectory = reportLocationManager.getReportExcelTemplateDirectory();
if ( templateDirectory == null || !templateDirectory.exists() )
@@ -216,14 +216,7 @@
for ( File file : templateFiles )
{
- if ( exportReportTemplates.contains( file.getName() ) )
- {
- mapTemplateFiles.put( file.getName(), true );
- }
- else
- {
- mapTemplateFiles.put( file.getName(), false );
- }
+ mapTemplateFiles.put( file.getName(), exportReportTemplates.contains( file.getName() ) );
}
return SUCCESS;
=== added file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java 2011-06-07 10:07:02 +0000
@@ -0,0 +1,56 @@
+package org.hisp.dhis.reportexcel.utils;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+import java.io.File;
+import java.io.FilenameFilter;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id
+ */
+public class ExcelFilenameFilter
+ implements FilenameFilter
+{
+ @Override
+ public boolean accept( File file, String extension )
+ {
+ if ( file.isDirectory() )
+ return false;
+ else
+ {
+ String name = file.getName().toLowerCase();
+
+ if ( extension == null )
+ {
+ return name.endsWith( ".xls" ) || name.endsWith( ".xlsx" );
+ }
+
+ return name.endsWith( "." + extension );
+ }
+ }
+}
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java 2011-06-07 05:41:55 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java 2011-06-07 10:07:02 +0000
@@ -32,6 +32,7 @@
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
+import java.io.FilenameFilter;
import java.io.IOException;
import java.util.*;
@@ -41,7 +42,7 @@
*/
public class FileUtils
{
- public static List<String> getListFileName( File directory, String extentions )
+ public static List<String> getListFileName( File directory, String extention )
{
List<String> result = new ArrayList<String>();
@@ -56,6 +57,16 @@
return result;
}
+ public static List<String> getListFileName( File directory, FilenameFilter filenameFilter )
+ {
+ if ( directory != null )
+ {
+ return Arrays.asList( directory.list( filenameFilter ) );
+ }
+
+ return new ArrayList<String>();
+ }
+
public static List<File> getListFile( File directory, FileFilter fileFilter )
{
if ( directory != null )
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-06-07 05:41:55 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-06-07 10:07:02 +0000
@@ -141,13 +141,17 @@
<bean id="org.hisp.dhis.reportexcel.exportreport.action.GetExportReportGroupsAction"
class="org.hisp.dhis.reportexcel.exportreport.action.GetExportReportGroupsAction"
scope="prototype">
- <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="exportReportService"
+ ref="org.hisp.dhis.reportexcel.ExportReportService" />
</bean>
<bean id="org.hisp.dhis.reportexcel.exportreport.action.ListExportReportAction"
class="org.hisp.dhis.reportexcel.exportreport.action.ListExportReportAction"
scope="prototype">
- <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="exportReportService"
+ ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="reportLocationManager"
+ ref="org.hisp.dhis.reportexcel.ReportLocationManager" />
</bean>
<bean id="org.hisp.dhis.reportexcel.exportreport.action.UpdateExportReportAction"
@@ -405,14 +409,27 @@
</bean>
<bean
+ id="org.hisp.dhis.reportexcel.exporting.action.ValidateGenerateExportReportAction"
+ class="org.hisp.dhis.reportexcel.exporting.action.ValidateGenerateExportReportAction"
+ scope="prototype">
+ <property name="exportReportService"
+ ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
+ <property name="selectionManager"
+ ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
+ <property name="reportLocationManager"
+ ref="org.hisp.dhis.reportexcel.ReportLocationManager" />
+ </bean>
+
+ <bean
id="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction"
class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction"
scope="prototype">
- <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="exportReportService"
+ ref="org.hisp.dhis.reportexcel.ExportReportService" />
<property name="selectionManager"
ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
</bean>
<bean
@@ -421,26 +438,32 @@
scope="prototype">
<property name="selectionManager"
ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
- <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
+ <property name="exportReportService"
+ ref="org.hisp.dhis.reportexcel.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.reportexcel.ReportLocationManager" />
- <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService" />
+ <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="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="periodGenericManager"
ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
<property name="organisationUnitService"
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+ <property name="dataValueService"
+ ref="org.hisp.dhis.datavalue.DataValueService" />
</bean>
<bean
@@ -449,19 +472,25 @@
scope="prototype">
<property name="selectionManager"
ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
- <property name="exportReportService" ref="org.hisp.dhis.reportexcel.ExportReportService" />
- <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="exportReportService"
+ ref="org.hisp.dhis.reportexcel.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.reportexcel.ReportLocationManager" />
- <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService" />
+ <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="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="periodGenericManager"
ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2011-06-07 05:41:55 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2011-06-07 10:07:02 +0000
@@ -270,6 +270,7 @@
import_import_items_cannot_be_empty = Excel items for importing cannot be empty
access_denied_to_folder = Access denied to folder on server
access_denied_to_file = Access denied to file on server
+template_folder_is_null = Warning\! The template folder configuration is not created yet.
template_folder_is_not_empty= Warning\! The old template directory of system is not empty.\nWould you like to move its children to the new one before it deleted ?
config_path_invalid = Invalid configuration\! Only Alphabetic, Numbers, Undercore, Middlecore and Space alow\.
there_is_no_import_report = There is no Import Report/Import Item in system
@@ -278,4 +279,6 @@
set_organisationunit_group_level = Set up Organisation unit group level
import_unsuccessfully = Import unsuccessfully
import_successfully = Import successfully
-period_listing_importing_not_support = Sorry! Period Listing Importing is not supported.
\ No newline at end of file
+period_listing_importing_not_support = Sorry\! Period Listing Importing is not supported.
+missing_template = Warning\! Missing template.
+the_specified_report_is_not_exist = Warning\! The specified report is not available/non-existance.
\ No newline at end of file
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2011-06-07 05:41:55 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2011-06-07 10:07:02 +0000
@@ -264,6 +264,7 @@
import_excel_items_cannot_be_empty = Vui l\u00f2ng t\u1ea1o ph\u1ea7n t\u1eed excel cho import d\u1eef li\u1ec7u
access_denied_to_folder = Ba\u0323n kh\u00f4ng \u0111u\u0309 quy\u00ea\u0300n truy c\u00e2\u0323p va\u0300o th\u01b0 mu\u0323c tr\u00ean ma\u0301y chu\u0309
access_denied_to_file = Truy c\u1eadp b\u1ecb t\u1eeb ch\u1ed1i \u0111\u00ea\u0301n t\u1eadp tin tr\u00ean m\u00e1y ch\u1ee7
+template_folder_is_null = Warning\! The template folder configuration is not created yet.
template_folder_is_not_empty= C\u1ea3nh b\u00e1o! Th\u01b0 m\u1ee5c c\u0169 c\u1ee7a h\u1ec7 th\u1ed1ng hi\u1ec7n \u0111ang ch\u1ee9a c\u00e1c t\u1eadp tin excel m\u1eabu.\nB\u1ea1n c\u00f3 mu\u1ed1n di chuy\u1ec3n ch\u00fang qua th\u01b0 m\u1ee5c m\u1edbi tr\u01b0\u1edbc khi n\u00f3 b\u1ecb x\u00f3a \?
config_path_invalid = C\u1ea5u h\u00ecnh kh\u00f4ng h\u1ee3p l\u1ec7\! Ch\u1ec9 cho ph\u00e9p nh\u1eadp ch\u1eef c\u00e1i, ch\u1eef s\u1ed1, k\u00fd t\u1ef1 g\u1ea1ch d\u01b0\u1edbi, g\u1ea1ch ngang v\u00e0 kho\u1ea3ng tr\u1eafng\.
there_is_no_import_report = Ch\u01b0a c\u00f3 nh\u00f3m ph\u1ea7n t\u1eed import d\u1eef li\u1ec7u n\u00e0o \u0111\u01b0\u1ee3c t\u1ea1o trong h\u1ec7 th\u1ed1ng
@@ -272,4 +273,6 @@
set_organisationunit_group_level = Thi\u1ebft l\u1eadp c\u1ea5p hi\u1ec3n th\u1ecb cho nh\u00f3m \u0111\u01a1n v\u1ecb
import_unsuccessfully = Import kh\u00f4ng th\u00e0nh c\u00f4ng
import_successfully = Import kh\u00f4ng th\u00e0nh c\u00f4ng
-period_listing_importing_not_support = R\u1ea5t ti\u1ebfc, hi\u00ean t\u1ea1i h\u1ec7 th\u1ed1ng ch\u01b0a h\u1ed7 tr\u1ee3 import d\u1eef li\u1ec7u d\u1ea1ng danh s\u00e1ch theo th\u1eddi gian.
\ No newline at end of file
+period_listing_importing_not_support = R\u1ea5t ti\u1ebfc, hi\u00ean t\u1ea1i h\u1ec7 th\u1ed1ng ch\u01b0a h\u1ed7 tr\u1ee3 import d\u1eef li\u1ec7u d\u1ea1ng danh s\u00e1ch theo th\u1eddi gian.
+missing_template = C\u1ea3nh b\u00e1o\! T\u1eadp tin excel b\u1ecb thi\u1ebfu.
+the_specified_report_is_not_exist = C\u1ea3nh b\u00e1o\! B\u00e1o c\u00e1o n\u00e0y hi\u1ec7n t\u1ea1i kh\u00f4ng c\u00f2n gi\u00e1 tr\u1ecb.
\ No newline at end of file
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml 2011-06-07 05:41:55 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/resources/struts.xml 2011-06-07 10:07:02 +0000
@@ -437,6 +437,14 @@
<!-- Generate Report Excel use POI -->
+ <action name="validateGenerateReport"
+ class="org.hisp.dhis.reportexcel.exporting.action.ValidateGenerateExportReportAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm</result>
+ </action>
+
<action name="generateExportReport"
class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
<result name="CATEGORY" type="redirect">
@@ -649,13 +657,17 @@
<action name="generateAdvancedExportReport"
class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
<result name="CATEGORY" type="redirect">
- generateAdvancedReportCategory.action</result>
+ generateAdvancedReportCategory.action?organisationGroupId=${organisationGroupId}
+ </result>
<result name="NORMAL" type="redirect">
- generateAdvancedReportNormal.action</result>
+ generateAdvancedReportNormal.action?organisationGroupId=${organisationGroupId}
+ </result>
<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
- generateAdvancedReportOrganizationGroupListing.action</result>
+ generateAdvancedReportOrganizationGroupListing.action?organisationGroupId=${organisationGroupId}
+ </result>
<result name="PERIOD_COLUMN_LISTING" type="redirect">
- generateAdvancedReportPeriodColumnListing.action</result>
+ generateAdvancedReportPeriodColumnListing.action?organisationGroupId=${organisationGroupId}
+ </result>
</action>
<action name="generateAdvancedReportNormal"
@@ -687,13 +699,17 @@
<action name="previewAdvancedExportReport"
class="org.hisp.dhis.reportexcel.exporting.action.GenerateExcelReportFlowAction">
<result name="CATEGORY" type="redirect">
- generatePreviewAdvancedCategory.action</result>
+ generatePreviewAdvancedCategory.action?organisationGroupId=${organisationGroupId}
+ </result>
<result name="NORMAL" type="redirect">
- generatePreviewAdvancedNormal.action</result>
+ generatePreviewAdvancedNormal.action?organisationGroupId=${organisationGroupId}
+ </result>
<result name="ORGANIZATION_GROUP_LISTING" type="redirect">
- generatePreviewAdvancedOrgGroupListing.action</result>
+ generatePreviewAdvancedOrgGroupListing.action?organisationGroupId=${organisationGroupId}
+ </result>
<result name="PERIOD_COLUMN_LISTING" type="redirect">
- generatePreviewAdvancedPeriodColumnListing.action</result>
+ generatePreviewAdvancedPeriodColumnListing.action?organisationGroupId=${organisationGroupId}
+ </result>
</action>
<action name="generatePreviewAdvancedCategory"
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/advancedReport.vm 2011-06-07 10:07:02 +0000
@@ -1,5 +1,5 @@
<h3>$i18n.getString( "generate_advanced_report" ) #openHelp( "excelReportingAdvancedReport" )</h3>
-<table>
+<table >
<tr>
<td ><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
@@ -11,9 +11,9 @@
</td>
</tr>
<tr>
- <td><label>$i18n.getString('reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><label>$i18n.getString('export_reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select type="text" id="report" name="report" style="width:20em">
+ <select type="text" id="exportReport" name="exportReport" style="width:20em">
</select>
</td>
</tr>
@@ -44,9 +44,13 @@
</tr>
</table>
-<div id="actions" style="width:200px text-align:right"></div>
-
-<div id="orgUnitTree"></div>
+<div id="actions" style="width:200px text-align:right">
+
+</div>
+
+<div id="orgUnitTree">
+
+</div>
<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="hideById(this.id);"></span>
<br/>
@@ -54,7 +58,7 @@
<p>
<input type="button" value='$i18n.getString( "preview_report" )' onclick="previewAdvandReport();" />
- <input name="generateExportReport" id="generateExportReport" type="button" onClick="generateAdvancedExportReport();" value='$i18n.getString( "generate_export_report" )' />
+ <input name="generateExportReport" id="generateExportReport" type="button" onClick="generateAdvancedExportReport();" value='$i18n.getString( "generate_report" )' />
</p>
<div id="previewDiv"></div>
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm 2011-06-07 10:07:02 +0000
@@ -58,7 +58,7 @@
<td align="left">
<a href="javascript: mode='edit'; openEditExcelTemplate( '$templateFileName' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
<a href="downloadFile.action?fileName=$templateFileName" title="$i18n.getString( 'download' )"><img src="images/download.png" alt="$i18n.getString( 'download' )"></a>
- #if( !$value )
+ #if( !$value )
<a href="javascript:deleteExcelTemplate('$templateFileName');" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
#end
</td>
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/generateReportForm.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/generateReportForm.vm 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/generateReportForm.vm 2011-06-07 10:07:02 +0000
@@ -45,8 +45,8 @@
</form>
<hr/>
<p>
-<input type="button" id="previewButton" value="$i18n.getString( 'preview_report' )" onclick="previewExportReport();" style="width:150px"/>
-<input type="button" id="generateExportReport" onclick="generateExportReport();" value='$i18n.getString( "generate_export_report" )' style="width:150px"/>
+<input type="button" id="previewButton" value="$i18n.getString( 'preview_report' )" onclick="validatePreviewReport();" style="width:150px"/>
+<input type="button" id="generateExportReport" value='$i18n.getString( "generate_export_report" )' onclick="validateGenerateReport();" style="width:150px"/>
<input type="button" id="printExcelReportButton" value='$i18n.getString("print")' onclick='printExportReport()' disabled style="width:150px"/>
</p>
<div id="previewDiv"></div>
@@ -58,8 +58,8 @@
#if ( $organisationUnit )
- $(document).ready(function() {
-
+ $(document).ready(function()
+ {
getExportReportsByGroup();
});
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js 2011-06-07 10:07:02 +0000
@@ -71,28 +71,46 @@
jQuery.each( json.periods, function(i, item ){
addOption('period', item.name , i );
});
-
}
-function generateExportReport() {
-
+function validateGenerateReport( isAdvanced )
+{
var exportReport = getFieldValue('exportReport');
- if(exportReport.length == 0){
+
+ if ( exportReport.length == 0 )
+ {
showErrorMessage( i18n_specify_export_report );
return;
}
lockScreen();
-
+
+ jQuery.postJSON( 'validateGenerateReport.action',
+ {
+ 'exportReportId': byId('exportReport').value,
+ 'periodIndex': byId('period').value
+ },
+ function( json )
+ {
+ if ( json.response == "success" ) {
+ if ( isAdvanced ) {
+ generateAdvancedExportReport();
+ }
+ else generateExportReport();
+ }
+ else {
+ unLockScreen();
+ showWarningMessage( json.message );
+ }
+ });
+}
+
+function generateExportReport() {
+
var request = new Request();
request.setResponseTypeXML( 'xmlObject' );
request.setCallbackSuccess( generateExportReportReceived );
-
- var params = "exportReportId=" + byId('exportReport').value;
- params += "&periodIndex=" + byId('period').value;
- request.sendAsPost(params);
request.send( 'generateExportReport.action');
-
}
function generateExportReportReceived( xmlObject ) {
@@ -129,18 +147,10 @@
}
}
-function generateAdvancedExportReport() {
-
- lockScreen();
-
+function generateAdvancedExportReport()
+{
var request = new Request();
request.setResponseTypeXML( 'xmlObject' );
request.setCallbackSuccess( generateExportReportReceived );
-
- var params = "exportReportId=" + byId('exportReport').value;
- params += "&periodId=" + byId('period').value;
- params += "&organisationGroupId=" + byId("availableOrgunitGroups").value;
- request.sendAsPost(params);
- request.send( 'generateAdvancedExportReport.action');
-
+ request.send( 'generateAdvancedExportReport.action?organisationGroupId='+ byId("availableOrgunitGroups").value );
}
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2011-05-27 04:45:31 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2011-06-07 10:07:02 +0000
@@ -1,33 +1,50 @@
+function validatePreviewReport( isAdvanced )
+{
+ var exportReport = getFieldValue('exportReport');
+
+ if ( exportReport.length == 0 )
+ {
+ showErrorMessage( i18n_specify_export_report );
+ return;
+ }
+
+ lockScreen();
+
+ jQuery.postJSON( 'validateGenerateReport.action',
+ {
+ 'exportReportId': byId('exportReport').value,
+ 'periodIndex': byId('period').value
+ },
+ function( json )
+ {
+ if ( json.response == "success" ) {
+ if ( isAdvanced ) {
+ previewAdvandReport();
+ }
+ else previewExportReport();
+ }
+ else {
+ unLockScreen();
+ showWarningMessage( json.message );
+ }
+ });
+}
+
+function previewExportReport() {
+
+ var request = new Request();
+ request.setResponseTypeXML( 'reportXML' );
+ request.setCallbackSuccess( previewExportReportReceived );
+ request.send( 'previewExportReport.action' );
+}
+
function previewAdvandReport()
-{
- var params = "exportReportId=" + byId('exportReport').value + "&periodId=" + byId('period').value + "&organisationGroupId=" + byId("availableOrgunitGroups").value;
-
- lockScreen();
-
+{
var request = new Request();
request.setResponseTypeXML( 'reportXML' );
request.setCallbackSuccess( previewExportReportReceived );
request.sendAsPost( params );
- request.send( "previewAdvancedExportReport.action" );
-}
-
-function previewExportReport() {
-
- var exportReport = getFieldValue('exportReport');
- if(exportReport.length == 0){
- showErrorMessage(i18n_specify_export_report);
- return;
- }
-
- lockScreen();
-
- var url = "previewExportReport.action?exportReportId=" + getListValue('exportReport') + "&periodIndex=" + getListValue('period');
-
- var request = new Request();
- request.setResponseTypeXML( 'reportXML' );
- request.setCallbackSuccess( previewExportReportReceived );
- request.send( url );
-
+ request.send( "previewAdvancedExportReport.action?organisationGroupId=" + byId("availableOrgunitGroups").value );
}
function previewExportReportReceived( parentElement )
=== removed file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/advancedReport.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/advancedReport.vm 2011-05-24 07:48:23 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/advancedReport.vm 1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-<h3>$i18n.getString( "generate_advanced_report" ) #openHelp( "excelReportingAdvancedReport" )</h3>
-<table >
- <tr>
- <td ><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td>
- <select type="text" id="group" name="group" style="width:20em" onchange="getALLExportReportByGroup()" >
- #foreach($reportGroup in $reportGroups)
- <option value='$reportGroup'>$reportGroup</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td><label>$i18n.getString('export_reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td>
- <select type="text" id="exportReport" name="exportReport" style="width:20em">
- </select>
- </td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="button" value="<<" onclick="lastPeriod();" />
- <input type="button" value=">>" onclick="nextPeriod()"/>
- </td>
- </tr>
- <tr>
- <td><label>$i18n.getString('period')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td>
- <select type="text" id="period" name="period" style="width:20em" >
- #foreach($period in $periods)
- <option value='$period.id'>$format.formatPeriod( $period )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
- <td>$i18n.getString('choose_orgunit_group')<em title="$i18n.getString( 'required' )" class="required">*</em> </td>
- <td><select id="availableOrgunitGroups" name="availableOrgunitGroups" style="width:20em" >
- #foreach($organisationUnitGroup in $organisationUnitGroups)
- <option value="$organisationUnitGroup.id">$organisationUnitGroup.name</option>
- #end
- </select></td>
- </tr>
-</table>
-
-<div id="actions" style="width:200px text-align:right">
-
-</div>
-
-<div id="orgUnitTree">
-
-</div>
-
-<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="hideById(this.id);"></span>
-<br/>
-<hr/>
-<p>
- <input type="button" value='$i18n.getString( "preview_report" )' onclick="previewAdvandReport();" />
-
- <input name="generateExportReport" id="generateExportReport" type="button" onClick="generateAdvancedExportReport();" value='$i18n.getString( "generate_report" )' />
-</p>
-
-<div id="previewDiv"></div>
-
-<span id="info" style="display:none;top:70px;right:5px;position:fixed;" onclick="hideById(this.id)"></span>
-
-<span id="processing" style="display:none;position:fixed;"><img src="../images/ajax-loader-preview.gif" /></span>
-
-<script>
-
- $(document).ready(function() {
-
- getExportReportsByGroup();
- });
-
-</script>
\ No newline at end of file
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.vm 2011-05-27 04:45:31 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.vm 2011-06-07 10:07:02 +0000
@@ -1,5 +1,5 @@
<h3>$i18n.getString('export_reports') #openHelp( "excelReportingListOfExportReports" )</h3>
-<table width=100%>
+<table width="100%">
<tr>
<td>
$i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:300px"/>
@@ -21,12 +21,17 @@
</tr>
</thead>
<tbody id="list">
- #foreach($exportReport in $exportReports)
+ #foreach( $exportReport in $exportReports )
+ #set( $exist = $templateMap.get( $exportReport.excelTemplateFile ) )
<tr id="tr${exportReport.id}">
<td>$encoder.htmlEncode( $exportReport.name )</td>
- <td>$i18n.getString($exportReport.reportType)</td>
+ <td>$i18n.getString( $exportReport.reportType )</td>
<td>
- <a href="downloadFile.action?fileName=$encoder.htmlEncode( $exportReport.excelTemplateFile )" title="download">$encoder.htmlEncode( $exportReport.excelTemplateFile )</a>
+ #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/warning.png" alt="$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>