dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07468
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2128: update excel reporting
------------------------------------------------------------
revno: 2128
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Thu 2010-09-16 14:33:22 +0700
message:
update excel reporting
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.jqprint.0.3.js
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportCategoryAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportExcelFlowAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportNormalAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportOrganizationGroupListingAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportPeriodColumnListingAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/SelectFormAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportCategoryAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportNormalAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportOrgGroupListingAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/DefaultPeriodGenericManager.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/PeriodGenericManager.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.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-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2010-09-16 07:33:22 +0000
@@ -31,10 +31,12 @@
import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.Date;
import java.util.ResourceBundle;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.QuarterlyPeriodType;
/**
* @author Pham Thi Thuy
@@ -51,13 +53,13 @@
}
/**
- * Constructor should only be used for testing purposes. Use
+ * Constructor should only be used for testing purposes. Use
* I18nManager.getI18nFormat for normal use.
*/
public I18nFormat()
- {
+ {
}
-
+
// -------------------------------------------------------------------------
// Init
// -------------------------------------------------------------------------
@@ -160,9 +162,12 @@
return commonFormatting( date, resourceBundle.getString( "format.datetime" ) );
}
+
+
public String formatPeriod( Period period )
{
+
String typeName = period.getPeriodType().getName();
String keyStartDate = "format." + typeName + ".startDate";
@@ -173,6 +178,41 @@
return Character.toUpperCase( startDate.charAt( 0 ) ) + startDate.substring( 1 ) + endDate;
}
+
+
+
+ /*
+
+ public String formatPeriod( Period period )
+ {
+ Date startdate = period.getStartDate();
+
+ if ( period.getPeriodType().getName().equals( QuarterlyPeriodType.NAME ) )
+ {
+
+ int year = startdate.getYear() + 1900;
+
+ Calendar c = Calendar.getInstance();
+ c.set( Calendar.YEAR, year );
+ c.set( Calendar.MONTH, Calendar.JANUARY );
+ c.set( Calendar.DATE, 1 );
+
+ startdate = c.getTime();
+
+ }
+
+ String typeName = period.getPeriodType().getName();
+
+ String keyStartDate = "format." + typeName + ".startDate";
+ String keyEndDate = "format." + typeName + ".endDate";
+
+ String startDate = commonFormatting( startdate, resourceBundle.getString( keyStartDate ) );
+ String endDate = commonFormatting( period.getEndDate(), resourceBundle.getString( keyEndDate ) );
+
+ return Character.toUpperCase( startDate.charAt( 0 ) ) + startDate.substring( 1 ) + endDate;
+ }
+
+ */
// -------------------------------------------------------------------------
// Support methods
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.jqprint.0.3.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.jqprint.0.3.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.jqprint.0.3.js 2010-09-16 07:33:22 +0000
@@ -0,0 +1,76 @@
+// -----------------------------------------------------------------------
+// Eros Fratini - eros@xxxxxxxxxxx
+// jqprint 0.3
+//
+// - 19/06/2009 - some new implementations, added Opera support
+// - 11/05/2009 - first sketch
+//
+// Printing plug-in for jQuery, evolution of jPrintArea: http://plugins.jquery.com/project/jPrintArea
+// requires jQuery 1.3.x
+//
+// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
+//------------------------------------------------------------------------
+
+(function($) {
+ var opt;
+
+ $.fn.jqprint = function (options) {
+ opt = $.extend({}, $.fn.jqprint.defaults, options);
+
+ var $element = (this instanceof jQuery) ? this : $(this);
+
+ if (opt.operaSupport && $.browser.opera)
+ {
+ var tab = window.open("","jqPrint-preview");
+ tab.document.open();
+
+ var doc = tab.document;
+ }
+ else
+ {
+ var $iframe = $("<iframe />");
+
+ if (!opt.debug) { $iframe.css({ position: "absolute", width: "0px", height: "0px", left: "-600px", top: "-600px" }); }
+
+ $iframe.appendTo("body");
+ var doc = $iframe[0].contentWindow.document;
+ }
+
+ if (opt.importCSS)
+ {
+ if ($("link[media=print]").length > 0)
+ {
+ $("link[media=print]").each( function() {
+ doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' media='print' />");
+ });
+ }
+ else
+ {
+ $("link").each( function() {
+ doc.write("<link type='text/css' rel='stylesheet' href='" + $(this).attr("href") + "' />");
+ });
+ }
+ }
+
+ if (opt.printContainer) { doc.write($element.outer()); }
+ else { $element.each( function() { doc.write($(this).html()); }); }
+
+ doc.close();
+
+ (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).focus();
+ setTimeout( function() { (opt.operaSupport && $.browser.opera ? tab : $iframe[0].contentWindow).print(); if (tab) { tab.close(); } }, 1000);
+ }
+
+ $.fn.jqprint.defaults = {
+ debug: false,
+ importCSS: true,
+ printContainer: true,
+ operaSupport: true
+ };
+
+ // Thanks to 9__, found at http://users.livejournal.com/9__/380664.html
+ jQuery.fn.outer = function() {
+ return $($('<div></div>').html(this.clone())).html();
+ }
+})(jQuery);
+
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportCategoryAction.java 2010-09-06 09:12:16 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportCategoryAction.java 2010-09-16 07:33:22 +0000
@@ -54,7 +54,9 @@
statementManager.initialise();
OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
- Period period = periodDatabaseService.getSelectedPeriod();
+
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelCategory reportExcel = (ReportExcelCategory) reportService.getReportExcel( selectionManager
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportExcelFlowAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportExcelFlowAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportExcelFlowAction.java 2010-09-16 07:33:22 +0000
@@ -28,7 +28,7 @@
import org.hisp.dhis.reportexcel.ReportExcel;
import org.hisp.dhis.reportexcel.ReportExcelService;
-import org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService;
+import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
import org.hisp.dhis.reportexcel.state.SelectionManager;
import com.opensymphony.xwork2.Action;
@@ -50,7 +50,7 @@
private SelectionManager selectionManager;
- private PeriodDatabaseService periodDatabaseService;
+ private PeriodGenericManager periodGenericManager;
// -------------------------------------------
// Input & Output
@@ -58,7 +58,7 @@
private Integer reportId;
- private Integer periodId;
+ private Integer periodIndex;
// -------------------------------------------
// Getter & Setter
@@ -74,14 +74,14 @@
this.selectionManager = selectionManager;
}
- public void setPeriodDatabaseService( PeriodDatabaseService periodDatabaseService )
+ public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
{
- this.periodDatabaseService = periodDatabaseService;
+ this.periodGenericManager = periodGenericManager;
}
- public void setPeriodId( Integer periodId )
+ public void setPeriodIndex( Integer periodIndex )
{
- this.periodId = periodId;
+ this.periodIndex = periodIndex;
}
public void setReportService( ReportExcelService reportService )
@@ -89,17 +89,17 @@
this.reportService = reportService;
}
- // -------------------------------------------
+ // -------------------------------------------
// Action implementation
// -------------------------------------------
-
+
public String execute()
throws Exception
{
ReportExcel reportExcel = reportService.getReportExcel( reportId );
- periodDatabaseService.setSelectedperiod( periodId );
+ periodGenericManager.setSelectedPeriodIndex( periodIndex );
selectionManager.setSelectedReportId( reportId );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportNormalAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportNormalAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportNormalAction.java 2010-09-16 07:33:22 +0000
@@ -52,7 +52,9 @@
statementManager.initialise();
OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
- Period period = periodDatabaseService.getSelectedPeriod();
+
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelNormal reportExcel = (ReportExcelNormal) reportService
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportOrganizationGroupListingAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportOrganizationGroupListingAction.java 2010-09-06 13:09:10 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportOrganizationGroupListingAction.java 2010-09-16 07:33:22 +0000
@@ -72,7 +72,9 @@
statementManager.initialise();
OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
- Period period = periodDatabaseService.getSelectedPeriod();
+
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelOganiztionGroupListing reportExcel = (ReportExcelOganiztionGroupListing) reportService
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportPeriodColumnListingAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportPeriodColumnListingAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportPeriodColumnListingAction.java 2010-09-16 07:33:22 +0000
@@ -56,7 +56,9 @@
statementManager.initialise();
OrganisationUnit organisationUnit = organisationUnitSelectionManager.getSelectedOrganisationUnit();
- Period period = periodDatabaseService.getSelectedPeriod();
+
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelPeriodColumnListing reportExcel = (ReportExcelPeriodColumnListing) reportService
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java 2010-09-06 09:12:16 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java 2010-09-16 07:33:22 +0000
@@ -74,6 +74,7 @@
import org.hisp.dhis.reportexcel.ReportExcelService;
import org.hisp.dhis.reportexcel.ReportLocationManager;
import org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService;
+import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
import org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager;
import org.hisp.dhis.reportexcel.state.SelectionManager;
import org.hisp.dhis.reportexcel.utils.DateUtils;
@@ -132,7 +133,7 @@
protected PeriodService periodService;
- protected PeriodDatabaseService periodDatabaseService;
+ protected PeriodGenericManager periodGenericManager;
protected ReportExcelService reportService;
@@ -253,9 +254,9 @@
this.initPOIStylesManager = initPOIStylesManager;
}
- public void setPeriodDatabaseService( PeriodDatabaseService periodDatabaseService )
+ public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
{
- this.periodDatabaseService = periodDatabaseService;
+ this.periodGenericManager = periodGenericManager;
}
// -----------------------------------------
@@ -391,7 +392,8 @@
}
protected void installPeriod( Period period )
- {
+ {
+
Calendar calendar = Calendar.getInstance();
// Monthly period
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/SelectFormAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/SelectFormAction.java 2010-08-20 08:34:39 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/SelectFormAction.java 2010-09-16 07:33:22 +0000
@@ -36,7 +36,7 @@
import org.hisp.dhis.period.MonthlyPeriodType;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.reportexcel.ReportExcelService;
-import org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService;
+import org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager;
import com.opensymphony.xwork2.Action;
@@ -59,13 +59,13 @@
public void setReportService( ReportExcelService reportService )
{
this.reportService = reportService;
- }
-
- private PeriodDatabaseService periodDatabaseService;
-
- public void setPeriodDatabaseService( PeriodDatabaseService periodDatabaseService )
+ }
+
+ private PeriodGenericManager periodGenericManager;
+
+ public void setPeriodGenericManager( PeriodGenericManager periodGenericManager )
{
- this.periodDatabaseService = periodDatabaseService;
+ this.periodGenericManager = periodGenericManager;
}
private OrganisationUnitSelectionManager organisationUnitSelectionManager;
@@ -97,8 +97,8 @@
public OrganisationUnit getOrganisationUnit()
{
return organisationUnit;
- }
-
+ }
+
public List<Period> getPeriods()
{
return periods;
@@ -123,12 +123,12 @@
groups = new ArrayList<String>( reportService.getReportExcelGroups() );
- periodDatabaseService.setSelectedPeriodTypeName( MonthlyPeriodType.NAME );
+ periodGenericManager.setPeriodType( MonthlyPeriodType.NAME );
- periods = periodDatabaseService.getPeriodList();
+ periods = periodGenericManager.getPeriodList();
Collections.sort( groups );
-
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportCategoryAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportCategoryAction.java 2010-09-16 07:33:22 +0000
@@ -90,7 +90,8 @@
OrganisationUnitGroup organisationUnitGroup = organisationUnitGroupService
.getOrganisationUnitGroup( organisationGroupId );
- Period period = periodDatabaseService.getSelectedPeriod();
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelCategory reportExcel = (ReportExcelCategory) reportService.getReportExcel( selectionManager
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportNormalAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportNormalAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportNormalAction.java 2010-09-16 07:33:22 +0000
@@ -84,7 +84,7 @@
{
statementManager.initialise();
- Period period = periodDatabaseService.getSelectedPeriod();
+ Period period = periodGenericManager.getSelectedPeriod();
this.installPeriod( period );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportOrgGroupListingAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportOrgGroupListingAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportOrgGroupListingAction.java 2010-09-16 07:33:22 +0000
@@ -91,7 +91,8 @@
OrganisationUnitGroup organisationUnitGroup = organisationUnitGroupService
.getOrganisationUnitGroup( organisationGroupId );
- Period period = periodDatabaseService.getSelectedPeriod();
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelOganiztionGroupListing reportExcel = (ReportExcelOganiztionGroupListing) reportService
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java 2010-09-16 07:33:22 +0000
@@ -89,7 +89,8 @@
OrganisationUnitGroup organisationUnitGroup = organisationUnitGroupService
.getOrganisationUnitGroup( organisationGroupId.intValue() );
- Period period = periodDatabaseService.getSelectedPeriod();
+ Period period = periodGenericManager.getSelectedPeriod();
+
this.installPeriod( period );
ReportExcelPeriodColumnListing reportExcel = (ReportExcelPeriodColumnListing) reportService
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/DefaultPeriodGenericManager.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/DefaultPeriodGenericManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/DefaultPeriodGenericManager.java 2010-09-16 07:33:22 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
+import org.hisp.dhis.period.comparator.PeriodComparator;
import com.opensymphony.xwork2.ActionContext;
@@ -118,10 +119,17 @@
}
}
- Collections.sort( periods, new AscendingPeriodComparator() );
+ Collections.sort( periods, new PeriodComparator() );
return periods;
}
+
+
+ @Override
+ public Period getSelectedPeriod( Integer index )
+ {
+ return getPeriodList().get( index );
+ }
public void nextPeriodSpan()
{
@@ -211,4 +219,5 @@
{
getSession().put( SESSION_KEY_BASE_PERIOD_TYPE_GENERIC, periodTypeNam );
}
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/PeriodGenericManager.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/PeriodGenericManager.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/period/generic/PeriodGenericManager.java 2010-09-16 07:33:22 +0000
@@ -41,6 +41,8 @@
public void setSelectedPeriodIndex( Integer index );
public Integer getSelectedPeriodIndex();
+
+ public Period getSelectedPeriod( Integer index );
public Period getSelectedPeriod();
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-09-16 07:33:22 +0000
@@ -400,8 +400,8 @@
<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
<property name="organisationUnitSelectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- <property name="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
</bean>
<bean
@@ -421,8 +421,8 @@
<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
<property name="selectionManager"
ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
- <property name="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
</bean>
<bean
@@ -444,8 +444,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <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"
@@ -472,8 +472,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
@@ -498,8 +498,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
@@ -525,8 +525,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
@@ -674,8 +674,8 @@
<property name="organisationUnitGroupService"
ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
- <property name="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
</bean>
<bean
@@ -708,8 +708,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
</bean>
@@ -735,8 +735,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
</bean>
@@ -762,8 +762,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
</bean>
@@ -789,8 +789,8 @@
<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="periodDatabaseService"
- ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" />
+ <property name="periodGenericManager"
+ ref="org.hisp.dhis.reportexcel.period.generic.PeriodGenericManager" />
<property name="initPOIStylesManager"
ref="org.hisp.dhis.reportexcel.preview.manager.InitializePOIStylesManager" />
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js 2010-08-20 08:34:39 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js 2010-09-16 07:33:22 +0000
@@ -99,7 +99,7 @@
request.setCallbackSuccess( generateReportExcelReceived );
var params = "reportId=" + byId('report').value;
- params += "&periodId=" + byId('period').value;
+ params += "&periodIndex=" + byId('period').value;
request.sendAsPost(params);
request.send( 'generateReportExcel.action');
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2010-08-20 08:34:39 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2010-09-16 07:33:22 +0000
@@ -22,7 +22,7 @@
lockScreen();
- var url = "previewReportExcel.action?reportId=" + getListValue('report') + "&periodId=" + getListValue('period');
+ var url = "previewReportExcel.action?reportId=" + getListValue('report') + "&periodIndex=" + getListValue('period');
var request = new Request();
request.setResponseTypeXML( 'reportXML' );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm 2010-08-20 08:34:39 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm 2010-09-16 07:33:22 +0000
@@ -34,8 +34,10 @@
<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='$period.id'>$format.formatPeriod( $period )</option>
+ <option value='${i}'>$format.formatPeriod( $period )</option>
+ #set( $i=$i+1)
#end
</select>
</td>