dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14458
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4919: local vn
------------------------------------------------------------
revno: 4919
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-10-13 10:03:58 +0700
message:
local vn
- Impl new three of relative periods "Daily", "So-far-this-month", and "So-far-this-quarter".
- Applied the periodType.js into when exporting report without using the generated period service anymore.
- Applied the style of data entry into exporting report form.
added:
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportReports.vm
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/PeriodTypeListAction.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java
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/GetExportReportsByGroupAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/SelectFormAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/DefaultSelectionManager.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/SelectionManager.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.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/generateReportForm.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/responseExportReports.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 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/PeriodTypeListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/PeriodTypeListAction.java 2011-10-12 17:32:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/PeriodTypeListAction.java 2011-10-13 03:03:58 +0000
@@ -1,7 +1,7 @@
package org.hisp.dhis.dataset.action;
/*
- * Copyright (c) 2004-2010, University of Oslo
+ * Copyright (c) 2004-2011, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,7 @@
// -------------------------------------------------------------------------
// Input & output
// -------------------------------------------------------------------------
-
+
private Collection<PeriodType> periodTypes;
public Collection<PeriodType> getPeriodTypes()
@@ -65,7 +65,7 @@
public void setPeriodTypes( Collection<PeriodType> periodTypes )
{
this.periodTypes = periodTypes;
- }
+ }
// -------------------------------------------------------------------------
// Execute
@@ -73,10 +73,9 @@
public String execute()
throws Exception
- {
+ {
periodTypes = periodService.getAllPeriodTypes();
-
+
return SUCCESS;
}
}
-
=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java 2011-07-28 09:50:39 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportItem.java 2011-10-13 03:03:58 +0000
@@ -164,23 +164,34 @@
public static class PERIODTYPE
{
+ // Used for Daily report
+ public static final String DAILY = "daily";
+
+ public static final String SO_FAR_THIS_MONTH = "so_far_this_month";
+
+ public static final String SO_FAR_THIS_QUARTER = "so_far_this_quarter";
+
+ // Used for other report
public static final String SELECTED_MONTH = "selected_month";
public static final String LAST_3_MONTH = "last_3_month";
- public static final String SO_FAR_THIS_YEAR = "so_far_this_year";
-
public static final String LAST_6_MONTH = "last_6_month";
public static final String QUARTERLY = "quaterly";
public static final String SIX_MONTH = "6_month";
+ public static final String SO_FAR_THIS_YEAR = "so_far_this_year";
+
public static final String YEARLY = "yealy";
public static List<String> getPeriodTypes()
{
List<String> list = new ArrayList<String>();
+ list.add( DAILY );
+ list.add( SO_FAR_THIS_MONTH );
+ list.add( SO_FAR_THIS_QUARTER );
list.add( SELECTED_MONTH );
list.add( LAST_3_MONTH );
list.add( SO_FAR_THIS_YEAR );
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/AbstractGenerateExcelReportSupport.java 2011-10-13 03:03:58 +0000
@@ -29,6 +29,7 @@
import static org.hisp.dhis.reportsheet.utils.DateUtils.getEndQuaterly;
import static org.hisp.dhis.reportsheet.utils.DateUtils.getEndSixMonthly;
+import static org.hisp.dhis.reportsheet.utils.DateUtils.getFirstDayOfMonth;
import static org.hisp.dhis.reportsheet.utils.DateUtils.getFirstDayOfYear;
import static org.hisp.dhis.reportsheet.utils.DateUtils.getLastDayOfYear;
import static org.hisp.dhis.reportsheet.utils.DateUtils.getStartQuaterly;
@@ -49,8 +50,9 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.reportsheet.ExportItem;
import org.hisp.dhis.reportsheet.ExportReport;
-import org.hisp.dhis.reportsheet.ExportItem;
import org.hisp.dhis.reportsheet.utils.ExcelUtils;
import com.opensymphony.xwork2.Action;
@@ -72,7 +74,7 @@
{
statementManager.initialise();
- Period period = periodGenericManager.getSelectedPeriod();
+ Period period = PeriodType.createPeriodExternalId( selectionManager.getSelectedPeriodIndex() );
ExportReport exportReport = exportReportService.getExportReport( selectionManager.getSelectedReportId() );
@@ -118,6 +120,10 @@
startDate = period.getStartDate();
endDate = period.getEndDate();
+ // So-far-this-month
+ firstDayOfMonth = getFirstDayOfMonth( startDate );
+ firstDayOfMonth = getTimeRoll( firstDayOfMonth, Calendar.DATE, -1 );
+
// Last 3 month period
// Last 2 months + this month = last 3 month
last3MonthStartDate = getTimeRoll( startDate, Calendar.MONTH, -2 );
@@ -137,7 +143,7 @@
last6MonthStartDate = getTimeRoll( last6MonthStartDate, Calendar.DATE, -1 );
last6MonthEndDate = period.getEndDate();
- // Quaterly
+ // Quarterly
startQuaterly = getStartQuaterly( startDate );
startQuaterly = getTimeRoll( startQuaterly, Calendar.DATE, -1 );
endQuaterly = getEndQuaterly( startDate );
@@ -204,7 +210,22 @@
{
double value = 0.0;
- if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH ) )
+ if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.DAILY ) )
+ {
+ value = calculateExpression( generateExpression( exportItem, startDate, startDate, organisationUnit,
+ dataElementService, categoryService, aggregationService ) );
+ }
+ else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_MONTH ) )
+ {
+ value = calculateExpression( generateExpression( exportItem, firstDayOfMonth, endDate, organisationUnit,
+ dataElementService, categoryService, aggregationService ) );
+ }
+ else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_QUARTER ) )
+ {
+ value = calculateExpression( generateExpression( exportItem, startQuaterly, endDate, organisationUnit,
+ dataElementService, categoryService, aggregationService ) );
+ }
+ else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH ) )
{
value = calculateExpression( generateExpression( exportItem, startDate, endDate, organisationUnit,
dataElementService, categoryService, aggregationService ) );
@@ -214,21 +235,11 @@
value = calculateExpression( generateExpression( exportItem, last3MonthStartDate, last3MonthEndDate,
organisationUnit, dataElementService, categoryService, aggregationService ) );
}
- else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
- {
- value = calculateExpression( generateExpression( exportItem, firstDayOfYear, endDate, organisationUnit,
- dataElementService, categoryService, aggregationService ) );
- }
else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_6_MONTH ) )
{
value = calculateExpression( generateExpression( exportItem, last6MonthStartDate, last6MonthEndDate,
organisationUnit, dataElementService, categoryService, aggregationService ) );
}
- else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
- {
- value = calculateExpression( generateExpression( exportItem, firstDayOfYear, endDateOfYear,
- organisationUnit, dataElementService, categoryService, aggregationService ) );
- }
else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.QUARTERLY ) )
{
value = calculateExpression( generateExpression( exportItem, startQuaterly, endQuaterly, organisationUnit,
@@ -239,6 +250,16 @@
value = calculateExpression( generateExpression( exportItem, startSixMonthly, endSixMonthly,
organisationUnit, dataElementService, categoryService, aggregationService ) );
}
+ else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
+ {
+ value = calculateExpression( generateExpression( exportItem, firstDayOfYear, endDate, organisationUnit,
+ dataElementService, categoryService, aggregationService ) );
+ }
+ else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
+ {
+ value = calculateExpression( generateExpression( exportItem, firstDayOfYear, endDateOfYear,
+ organisationUnit, dataElementService, categoryService, aggregationService ) );
+ }
return value;
}
@@ -251,7 +272,12 @@
{
double value = 0.0;
- if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH ) )
+ if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.DAILY ) )
+ {
+ value = calculateExpression( generateIndicatorExpression( exportItem, startDate, startDate,
+ organisationUnit, indicatorService, aggregationService ) );
+ }
+ else if ( exportItem.getPeriodType().equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH ) )
{
value = calculateExpression( generateIndicatorExpression( exportItem, startDate, endDate, organisationUnit,
indicatorService, aggregationService ) );
=== 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 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java 2011-10-13 03:03:58 +0000
@@ -56,10 +56,9 @@
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.reportsheet.ExportReport;
import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReport;
import org.hisp.dhis.reportsheet.ReportLocationManager;
-import org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager;
import org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager;
import org.hisp.dhis.reportsheet.state.SelectionManager;
import org.hisp.dhis.user.CurrentUserService;
@@ -104,8 +103,6 @@
protected PeriodService periodService;
- protected PeriodGenericManager periodGenericManager;
-
protected ExportReportService exportReportService;
protected ReportLocationManager reportLocationManager;
@@ -146,6 +143,8 @@
protected Date endDate;
+ protected Date firstDayOfMonth;
+
protected Date firstDayOfYear;
protected Date last3MonthStartDate;
@@ -290,11 +289,6 @@
this.initPOIStylesManager = initPOIStylesManager;
}
- public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
- {
- this.periodGenericManager = periodGenericManager;
- }
-
// -------------------------------------------------------------------------
// Supporting methods
// -------------------------------------------------------------------------
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GetExportReportsByGroupAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GetExportReportsByGroupAction.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GetExportReportsByGroupAction.java 2011-10-13 03:03:58 +0000
@@ -33,8 +33,9 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+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.comparator.ExportReportNameComparator;
import org.hisp.dhis.user.CurrentUserService;
@@ -77,6 +78,13 @@
// Input & Output
// -------------------------------------------------------------------------
+ private List<Integer> idMap = new ArrayList<Integer>();
+
+ public List<Integer> getIdMap()
+ {
+ return idMap;
+ }
+
private List<ExportReport> exportReports;
public List<ExportReport> getExportReports()
@@ -118,9 +126,26 @@
exportReports.retainAll( reportAssociation );
Collections.sort( exportReports, new ExportReportNameComparator() );
+
+ String periodTypeName = null;
+
+ for ( ExportReport exportReport : exportReports )
+ {
+ for ( ExportItem exportItem : exportReport.getExportItems() )
+ {
+ periodTypeName = exportItem.getPeriodType();
+
+ if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.DAILY )
+ || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_MONTH )
+ || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_QUARTER ) )
+ {
+ idMap.add( exportReport.getId() );
+ break;
+ }
+ }
+ }
}
return SUCCESS;
}
-
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/SelectFormAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/SelectFormAction.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/SelectFormAction.java 2011-10-13 03:03:58 +0000
@@ -33,10 +33,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.MonthlyPeriodType;
-import org.hisp.dhis.period.Period;
import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager;
import com.opensymphony.xwork2.Action;
@@ -59,14 +56,7 @@
{
this.exportReportService = exportReportService;
}
-
- private PeriodGenericManager periodGenericManager;
-
- public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
- {
- this.periodGenericManager = periodGenericManager;
- }
-
+
private OrganisationUnitSelectionManager organisationUnitSelectionManager;
public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
@@ -78,8 +68,6 @@
// Input & Output
// -------------------------------------------------------------------------
- private List<Period> periods;
-
private OrganisationUnit organisationUnit;
private List<String> groups;
@@ -98,11 +86,6 @@
return organisationUnit;
}
- public List<Period> getPeriods()
- {
- return periods;
- }
-
private File fileExcel;
public File getFileExcel()
@@ -115,6 +98,10 @@
this.fileExcel = fileExcel;
}
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
public String execute()
throws Exception
{
@@ -122,13 +109,8 @@
groups = new ArrayList<String>( exportReportService.getExportReportGroups() );
- periodGenericManager.setPeriodType( MonthlyPeriodType.NAME );
-
- periods = periodGenericManager.getPeriodList();
-
Collections.sort( groups );
return SUCCESS;
}
-
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java 2011-10-13 03:03:58 +0000
@@ -29,11 +29,10 @@
import java.io.File;
+import org.hisp.dhis.reportsheet.ExportReport;
import org.hisp.dhis.reportsheet.ExportReportService;
-import org.hisp.dhis.reportsheet.ExportReport;
import org.hisp.dhis.reportsheet.ReportLocationManager;
import org.hisp.dhis.reportsheet.action.ActionSupport;
-import org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager;
import org.hisp.dhis.reportsheet.state.SelectionManager;
/**
@@ -54,13 +53,6 @@
this.exportReportService = exportReportService;
}
- private PeriodGenericManager periodGenericManager;
-
- public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
- {
- this.periodGenericManager = periodGenericManager;
- }
-
private SelectionManager selectionManager;
public void setSelectionManager( SelectionManager selectionManager )
@@ -79,16 +71,16 @@
// Input & Output
// -------------------------------------------------------------------------
- private Integer exportReportId;
+ private String exportReportId;
- public void setExportReportId( Integer exportReportId )
+ public void setExportReportId( String exportReportId )
{
this.exportReportId = exportReportId;
}
- private Integer periodIndex;
+ private String periodIndex;
- public void setPeriodIndex( Integer periodIndex )
+ public void setPeriodIndex( String periodIndex )
{
this.periodIndex = periodIndex;
}
@@ -100,7 +92,9 @@
public String execute()
throws Exception
{
- ExportReport exportReport = exportReportService.getExportReport( exportReportId );
+ Integer reportId = Integer.parseInt( exportReportId.split( "_" )[0] );
+
+ ExportReport exportReport = exportReportService.getExportReport( reportId );
if ( exportReport == null )
{
@@ -126,10 +120,10 @@
return ERROR;
}
-
- periodGenericManager.setSelectedPeriodIndex( periodIndex );
-
- selectionManager.setSelectedReportId( exportReportId );
+
+ selectionManager.setSelectedPeriodIndex( periodIndex );
+
+ selectionManager.setSelectedReportId( reportId );
return SUCCESS;
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/DefaultSelectionManager.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/DefaultSelectionManager.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/DefaultSelectionManager.java 2011-10-13 03:03:58 +0000
@@ -1,4 +1,5 @@
package org.hisp.dhis.reportsheet.state;
+
/*
* Copyright (c) 2004-2011, University of Oslo
* All rights reserved.
@@ -40,36 +41,34 @@
private static final String SESSION_KEY_FILE_DOWNLOAD = "SESSION_KEY_FILE_DOWNLOAD";
private static final String SESSION_KEY_FILE_UPLOAD = "SESSION_KEY_FILE_UPLOAD";
-
+
private static final String SESSION_KEY_FILE_RENAME = "SESSION_KEY_FILE_RENAME";
private static final String SESSION_KEY_SELECTED_REPORT_ID = "SESSION_KEY_SELECTED_REPORT_ID";
-
+
+ private static final String SESSION_KEY_SELECTED_PERIOD_ID = "SESSION_KEY_SELECTED_PERIOD_ID";
+
private static final String SESSION_KEY_BOOKMARK_TYPE = "SESSION_KEY_BOOKMARK_TYPE";
-
+
private static final String SESSION_KEY_LIST_OBJECT = "SESSION_KEY_LIST_OBJECT";
- @Override
public String getDownloadFilePath()
{
return (String) getSession().get( SESSION_KEY_FILE_DOWNLOAD );
}
- @Override
public String getUploadFilePath()
{
return (String) getSession().get( SESSION_KEY_FILE_UPLOAD );
}
@SuppressWarnings( "unchecked" )
- @Override
public void setDownloadFilePath( String path )
{
getSession().put( SESSION_KEY_FILE_DOWNLOAD, path );
}
@SuppressWarnings( "unchecked" )
- @Override
public void setUploadFilePath( String path )
{
getSession().put( SESSION_KEY_FILE_UPLOAD, path );
@@ -81,35 +80,30 @@
return ActionContext.getContext().getSession();
}
- @Override
public Integer getSelectedReportId()
{
return (Integer) getSession().get( SESSION_KEY_SELECTED_REPORT_ID );
}
@SuppressWarnings( "unchecked" )
- @Override
public void setSelectedReportId( Integer id )
{
getSession().put( SESSION_KEY_SELECTED_REPORT_ID, id );
}
- @Override
public String getRenameFilePath()
{
return (String) getSession().get( SESSION_KEY_FILE_RENAME );
}
- @SuppressWarnings("unchecked")
- @Override
+ @SuppressWarnings( "unchecked" )
public void setRenameFilePath( String path )
{
getSession().put( SESSION_KEY_FILE_RENAME, path );
}
- @Override
public String getBookmarkType()
- {
+ {
return (String) getSession().get( SESSION_KEY_BOOKMARK_TYPE );
}
@@ -119,16 +113,25 @@
getSession().put( SESSION_KEY_BOOKMARK_TYPE, type );
}
- @Override
public String[] getListObject()
{
return (String[]) getSession().get( SESSION_KEY_LIST_OBJECT );
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public void setListObject( String[] objects )
{
getSession().put( SESSION_KEY_LIST_OBJECT, objects );
}
+ public String getSelectedPeriodIndex()
+ {
+ return (String) getSession().get( SESSION_KEY_SELECTED_PERIOD_ID );
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setSelectedPeriodIndex( String periodIndex )
+ {
+ getSession().put( SESSION_KEY_SELECTED_PERIOD_ID, periodIndex );
+ }
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/SelectionManager.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/SelectionManager.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/SelectionManager.java 2011-10-13 03:03:58 +0000
@@ -48,6 +48,10 @@
public void setRenameFilePath( String path );
+ public String getSelectedPeriodIndex();
+
+ public void setSelectedPeriodIndex( String periodIndex );
+
public void setBookmarkType( String type );
public String getBookmarkType();
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/DateUtils.java 2011-10-13 03:03:58 +0000
@@ -34,7 +34,24 @@
* @version $Id$
*/
public class DateUtils
-{
+{
+ @SuppressWarnings("deprecation")
+ public static Date getFirstDayOfMonth( Date date )
+ {
+ Calendar result = Calendar.getInstance();
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.set( Calendar.YEAR, date.getYear() + 1900 );
+ calendar.set( Calendar.MONTH, date.getMonth() );
+ calendar.set( Calendar.DATE, date.getDate() );
+
+ result.set( Calendar.DATE, calendar.getActualMinimum( Calendar.DATE ) );
+ result.set( Calendar.MONTH, calendar.get( Calendar.MONTH ) );
+ result.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) );
+
+ return result.getTime();
+ }
+
public static Date getFirstDayOfYear( int year )
{
Calendar calendar = Calendar.getInstance();
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/utils/ExpressionUtils.java 2011-10-13 03:03:58 +0000
@@ -91,41 +91,7 @@
DataElementCategoryOptionCombo optionCombo = categoryService
.getDataElementCategoryOptionCombo( optionComboId );
- // CalculatedDataElement
- /*if ( dataElement instanceof CalculatedDataElement )
- {
- CalculatedDataElement calculatedDataElement = (CalculatedDataElement) dataElement;
-
- double factor = 0;
- double value = 0.0;
-
- Map<String, Double> factorMap = dataElementService.getOperandFactors( calculatedDataElement );
-
- Collection<String> operandIds = dataElementService.getOperandIds( calculatedDataElement );
-
- for ( String operandId : operandIds )
- {
- factor = factorMap.get( operandId );
-
- dataElementIdString = operandId.substring( 0, operandId.indexOf( SEPARATOR ) );
- optionComboIdString = operandId.substring( operandId.indexOf( SEPARATOR ) + 1, operandId
- .length() );
-
- DataElement element = dataElementService
- .getDataElement( Integer.parseInt( dataElementIdString ) );
- optionCombo = categoryService.getDataElementCategoryOptionCombo( Integer
- .parseInt( optionComboIdString ) );
-
- double dataValue = getValue( element, optionCombo, organisationUnit, startDate, endDate,
- aggregationService );
-
- value += (dataValue * factor);
- }
-
- matcher.appendReplacement( buffer, value + "" );
- }*/
// Normal
- //else
{
replaceString = getValue( dataElement, optionCombo, organisationUnit, startDate, endDate,
aggregationService )
=== 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 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-10-13 03:03:58 +0000
@@ -415,8 +415,6 @@
<property name="exportReportService" ref="org.hisp.dhis.reportsheet.ExportReportService" />
<property name="organisationUnitSelectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager" />
</bean>
<bean
@@ -435,8 +433,6 @@
scope="prototype">
<property name="exportReportService"
ref="org.hisp.dhis.reportsheet.ExportReportService" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager" />
<property name="selectionManager"
ref="org.hisp.dhis.reportsheet.state.SelectionManager" />
<property name="reportLocationManager"
@@ -477,8 +473,6 @@
ref="org.hisp.dhis.user.CurrentUserService" />
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
<property name="organisationUnitService"
@@ -512,11 +506,10 @@
ref="org.hisp.dhis.user.CurrentUserService" />
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
- <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
+ <property name="dataValueService"
+ ref="org.hisp.dhis.datavalue.DataValueService" />
</bean>
<bean
@@ -545,8 +538,6 @@
ref="org.hisp.dhis.user.CurrentUserService" />
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
<property name="dataValueService"
@@ -580,8 +571,6 @@
ref="org.hisp.dhis.user.CurrentUserService" />
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="periodGenericManager"
- ref="org.hisp.dhis.reportsheet.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportsheet.preview.manager.InitializePOIStylesManager" />
<property name="dataValueService"
@@ -1504,5 +1493,4 @@
<property name="jchartDataService" ref="org.hisp.dhis.jchart.data.JChartDataService" />
</bean>
-
</beans>
=== 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 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2011-10-13 03:03:58 +0000
@@ -24,6 +24,13 @@
report_design = Report Design
export_report = Export Report
export_item = Export Item
+daily = Daily
+so_far_this_month = So far this month
+so_far_this_quarter = So far this quarter
+last_6_month = Last 6 month
+quaterly = Quarterly
+6_month = Six monthly
+yealy = Yearly
selected_month = Selected Month
last_3_month = Last 3 Month
so_far_this_year = So Far This year
@@ -86,10 +93,6 @@
group = Group
periodlisting = Period Listing
grouplisting = Group Organization
-last_6_month = Last 6 month
-quaterly = Quarterly
-6_month = Six monthly
-yealy = Yearly
report_roles = Report and User Roles
formulaexcel = Excel Formula
formula_is_invalid = Formula is invalid \!
=== 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 2011-09-14 03:59:28 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2011-10-13 03:03:58 +0000
@@ -23,6 +23,9 @@
report_design = Thi\u1ebft k\u1ebf b\u00e1o c\u00e1o
export_report = B\u00e1o c\u00e1o
export_item = Ph\u1ea7n t\u1eed b\u00e1o c\u00e1o
+daily = H\u00e0ng ng\u00e0y
+so_far_this_month = D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u th\u00e1ng \u0111\u1ebfn ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ecdn
+so_far_this_quarter = D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u qu\u00fd \u0111\u1ebfn ng\u00e0y \u0111\u01b0\u1ee3c ch\u1ecdn
selected_month = D\u1eef li\u1ec7u c\u1ee7a th\u00e1ng \u0111\u01b0\u1ee3c ch\u1ecdn
last_3_month = D\u1eef li\u1ec7u c\u1ee7a 3 th\u00e1ng g\u1ea7n nh\u1ea5t \u0111\u1ebfn th\u1eddi \u0111i\u1ec3m \u0111\u01b0\u1ee3c ch\u1ecdn
so_far_this_year = D\u1eef li\u1ec7u t\u1eeb \u0111\u1ea7u n\u0103m \u0111\u1ebfn th\u00e1ng \u0111\u01b0\u1ee3c ch\u1ecdn
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2011-10-13 03:03:58 +0000
@@ -484,8 +484,8 @@
<action name="getExportReportsByGroup"
class="org.hisp.dhis.reportsheet.exporting.action.GetExportReportsByGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-spreadsheet-reporting/responseExportReports.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-spreadsheet-reporting/jsonExportReports.vm</result>
</action>
<!-- Generate Report Excel use POI -->
@@ -512,26 +512,26 @@
<action name="generateReportCategory"
class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportCategoryAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
<action name="generateReportNormal"
class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportNormalAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
<action name="generateReportOrgGroupListing"
class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportOrgGroupListingAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
<action name="generateReportPeriodColumnListing"
class="org.hisp.dhis.reportsheet.exporting.action.GenerateReportPeriodColumnListingAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm 2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm 2011-10-13 03:03:58 +0000
@@ -1,5 +1,5 @@
<h3>$i18n.getString( "generate_export_report" ) #openHelp( "excelReportingExportReport" )</h3>
-<form id="exportForm">
+<div class="inputCriteria" style="width:485px;height:93px;">
<table>
<tr>
<td><label>$i18n.getString('organisation')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
@@ -8,7 +8,7 @@
<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="min-width:300px" onchange="getExportReportsByGroup()" >
+ <select type="text" id="group" name="group" style="width:300px" onchange="getExportReportsByGroup()" >
#foreach($group in $groups)
<option value='$group' #if( $group == $exportReportGroup ) selected="selected" #end>$encoder.htmlEncode( $group )</option>
#end
@@ -18,31 +18,19 @@
<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="min-width:300px" >
- </select>
+ <select type="text" id="exportReport" name="exportReport" style="width:300px" onchange="reportSelected()"></select>
</td>
</tr>
<tr>
- <td></td>
+ <td><label>$i18n.getString('period')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
+ <select type="text" id="selectedPeriodId" name="selectedPeriodId" style="width:220px" disabled="true"></select>
<input type="button" value="<<" onclick="getPreviousPeriod()" id="lastPeriod"/>
<input type="button" value=">>" onclick="getNextPeriod()" id="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" style="min-width:300px">
- #set( $i=0)
- #foreach($period in $periods)
- <option value='${i}'>$format.formatPeriod( $period )</option>
- #set( $i=$i+1)
- #end
- </select>
- </td>
- </tr>
</table>
-</form>
+</div>
<hr/>
<p>
<input type="button" id="previewButton" value="$i18n.getString( 'preview_report' )" onclick="validatePreviewReport();" style="width:150px"/>
@@ -53,6 +41,7 @@
<script>
+ var i18n_select_period = '$encoder.jsEscape( $i18n.getString( "select_period" ) , "'")';
var i18n_value_rounded = '$encoder.jsEscape( $i18n.getString("value_rounded"), "'" )';
var i18n_specify_export_report = '$encoder.jsEscape( $i18n.getString("specify_export_report"), "'" )';
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2011-10-13 03:03:58 +0000
@@ -1,3 +1,14 @@
+// Current offset, next or previous corresponding to increasing or decreasing
+// value with one
+var currentPeriodOffset = 0;
+
+// Period type object
+var periodTypeFactory = new PeriodType();
+
+// The current selected period type name
+var currentPeriodTypeName = '';
+
+// Functions
function organisationUnitSelected( orgUnits )
{
getExportReportsByGroup();
@@ -7,77 +18,78 @@
function getExportReportsByGroup() {
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( getExportReportsByGroupReceived );
- request.sendAsPost("group=" + byId('group').value);
- request.send( "getExportReportsByGroup.action");
-
-}
-
-function getExportReportsByGroupReceived( xmlObject ) {
-
- clearListById('exportReport');
- var list = xmlObject.getElementsByTagName("exportReport");
-
- for(var i=0;i<list.length;i++){
- var item = list[i];
- var id = item.getElementsByTagName('id')[0].firstChild.nodeValue;
- var name = item.getElementsByTagName('name')[0].firstChild.nodeValue;
- addOption('exportReport',name,id);
- }
-
- var selectedOrganisationUnit = null;
-
- try{
-
- selectedOrganisationUnit = xmlObject.getElementsByTagName('organisationUnit')[0].firstChild.nodeValue;
-
- enable("group");
- enable("exportReport");
- enable("period");
- enable("generateExportReport");
- enable("previewButton");
- enable("nextPeriod");
- enable("lastPeriod");
-
- }catch(e){
- disable("group");
- disable("exportReport");
- disable("period");
- disable("generateExportReport");
- disable("previewButton");
- disable("nextPeriod");
- disable("lastPeriod");
- }
-
- byId("selectedOrganisationUnit").innerHTML = selectedOrganisationUnit;
-}
-
-function getPreviousPeriod()
-{
- jQuery.postJSON('previousPeriodsGeneric.action', {}, responseListPeriodReceived );
-}
-
-function getNextPeriod()
-{
- jQuery.postJSON('nextPeriodsGeneric.action', {}, responseListPeriodReceived );
-}
-
-function responseListPeriodReceived( json )
-{
- if ( json.response == "error" )
- {
- setHeaderDelayMessage( json.message );
- }
- else
- {
- clearListById('period');
-
- jQuery.each( json.periods, function(i, item ){
- addOption('period', item.name , i );
+ jQuery.postJSON( 'getExportReportsByGroup.action',
+ {
+ group: getFieldValue( 'group' )
+ },
+ function ( json )
+ {
+ jQuery('#exportReport').empty();
+ jQuery.each( json.exportReports, function(i, item){
+ addOptionById( 'exportReport', item.id + '_' + item.flag, item.name );
});
- }
+
+ currentPeriodOffset = 0;
+ reportSelected();
+ displayPeriodsInternal();
+
+ var selectedOrganisationUnit = null;
+
+ try {
+ selectedOrganisationUnit = json.organisationUnit;
+
+ enable("group");
+ enable("exportReport");
+ enable("selectedPeriodId");
+ enable("generateExportReport");
+ enable("previewButton");
+ enable("nextPeriod");
+ enable("lastPeriod");
+ }catch(e){
+ disable("group");
+ disable("exportReport");
+ disable("selectedPeriodId");
+ disable("generateExportReport");
+ disable("previewButton");
+ disable("nextPeriod");
+ disable("lastPeriod");
+ }
+
+ setInnerHTML( "selectedOrganisationUnit", selectedOrganisationUnit );
+ });
+}
+
+function reportSelected()
+{
+ currentPeriodTypeName = (getFieldValue( 'exportReport' ).split( '_' )[1] == "true") ? 'Daily' : 'Monthly';
+}
+
+function displayPeriodsInternal()
+{
+ var periods = periodTypeFactory.get( currentPeriodTypeName ).generatePeriods( currentPeriodOffset );
+ periods = periodTypeFactory.filterFuturePeriods( periods );
+
+ clearListById( 'selectedPeriodId' );
+
+ for ( i in periods )
+ {
+ addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
+ }
+}
+
+function getNextPeriod()
+{
+ if ( currentPeriodOffset < 0 ) // Cannot display future periods
+ {
+ currentPeriodOffset++;
+ displayPeriodsInternal();
+ }
+}
+
+function getPreviousPeriod()
+{
+ currentPeriodOffset--;
+ displayPeriodsInternal();
}
function validateGenerateReport( isAdvanced )
@@ -94,8 +106,8 @@
jQuery.postJSON( 'validateGenerateReport.action',
{
- 'exportReportId': byId('exportReport').value,
- 'periodIndex': byId('period').value
+ 'exportReportId': getFieldValue( 'exportReport' ),
+ 'periodIndex': getFieldValue( 'selectedPeriodId' )
},
function( json )
{
@@ -114,21 +126,12 @@
function generateExportReport() {
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( generateExportReportReceived );
- request.send( 'generateExportReport.action');
-}
-
-function generateExportReportReceived( xmlObject ) {
-
- var type = xmlObject.getAttribute("type");
-
- if( type == "success" ) {
-
- window.location = "downloadFile.action";
- unLockScreen();
- }
+ jQuery.postJSON( 'generateExportReport.action', {}, function ( json ) {
+ if ( json.response == "success" ) {
+ window.location = "downloadFile.action";
+ unLockScreen();
+ }
+ });
}
function getALLExportReportByGroup() {
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js 2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js 2011-10-13 03:03:58 +0000
@@ -25,8 +25,8 @@
jQuery.postJSON( 'validateGenerateReport.action',
{
- 'exportReportId': byId('exportReport').value,
- 'periodIndex': byId('period').value
+ 'exportReportId': getFieldValue( 'exportReport' ),
+ 'periodIndex': getFieldValue( 'selectedPeriodId' )
},
function( json )
{
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportReports.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportReports.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportReports.vm 2011-10-13 03:03:58 +0000
@@ -0,0 +1,13 @@
+{
+ "organisationUnit": "$!encoder.xmlEncode( ${organisationUnit.name} )",
+ #set( $size = $exportReports.size() )
+ "exportReports": [
+ #foreach( $exportReport in $exportReports )
+ {
+ "id": "${exportReport.id}",
+ "name": "$!encoder.jsonEncode( ${exportReport.name} )",
+ "flag": "$!idMap.contains( $!{exportReport.id} )"
+ }#if( $velocityCount < $size ),#end
+ #end
+ ]
+}
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/responseExportReports.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/responseExportReports.vm 2011-07-28 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/responseExportReports.vm 2011-10-13 03:03:58 +0000
@@ -5,6 +5,7 @@
<exportReport>
<id>$exportReport.id</id>
<name>$!encoder.xmlEncode($exportReport.name)</name>
+ <flag>$!idMap.contains($!exportReport.id)</flag>
</exportReport>
#end
</exportReports>
\ No newline at end of file