dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19649
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8665: Fix bug pagination in tabular report.
------------------------------------------------------------
revno: 8665
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-23 20:15:16 +0700
message:
Fix bug pagination in tabular report.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
--
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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-10-22 09:04:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-10-23 13:15:16 +0000
@@ -157,6 +157,13 @@
return values;
}
+ private Integer currentPage;
+
+ public void setCurrentPage( Integer currentPage )
+ {
+ this.currentPage = currentPage;
+ }
+
private List<String> searchingValues = new ArrayList<String>();
public void setSearchingValues( List<String> searchingValues )
@@ -322,20 +329,20 @@
// ---------------------------------------------------------------------
// Get program-stage, start-date, end-date
// ---------------------------------------------------------------------
-
- if( level==0 )
+
+ if ( level == 0 )
{
level = organisationUnitService.getMaxOfOrganisationUnitLevels();
for ( Integer orgunitId : orgunitIds )
{
int orgLevel = organisationUnitService.getLevelOfOrganisationUnit( orgunitId );
- if(level > orgLevel)
+ if ( level > orgLevel )
{
level = orgLevel;
}
}
}
-
+
// ---------------------------------------------------------------------
// Get program-stage, start-date, end-date
// ---------------------------------------------------------------------
@@ -347,7 +354,7 @@
Date startValue = format.parseDate( startDate );
Date endValue = format.parseDate( endDate );
List<TabularReportColumn> columns = getTableColumns();
-
+
// ---------------------------------------------------------------------
// Generate tabular report
// ---------------------------------------------------------------------
@@ -364,7 +371,7 @@
// total = paging.getTotal(); //TODO
grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
- startValue, endValue, !orderByOrgunitAsc, paging.getStartPos(), paging.getPageSize() );
+ startValue, endValue, !orderByOrgunitAsc, getStartPos(), getEndPos() );
}
else
// Download as Excel
@@ -375,7 +382,7 @@
}
catch ( SQLGrammarException ex )
{
- message = i18n.getString("failed_to_get_events");
+ message = i18n.getString( "failed_to_get_events" );
}
return type == null ? SUCCESS : type;
@@ -391,6 +398,28 @@
return (totalRecord % pageSize == 0) ? (totalRecord / pageSize) : (totalRecord / pageSize + 1);
}
+ public int getStartPos()
+ {
+ if ( currentPage == null )
+ {
+ return paging.getStartPos();
+ }
+ int startPos = currentPage <= 0 ? 0 : (currentPage - 1) * paging.getPageSize();
+ startPos = (startPos > total) ? total : startPos;
+ return startPos;
+ }
+
+ public int getEndPos()
+ {
+ if ( currentPage == null )
+ {
+ return paging.getEndPos();
+ }
+ int endPos = getStartPos() + paging.getPageSize();
+ endPos = (endPos > total) ? total : endPos;
+ return endPos;
+ }
+
private List<TabularReportColumn> getTableColumns()
{
List<TabularReportColumn> columns = new ArrayList<TabularReportColumn>();
@@ -437,7 +466,7 @@
{
int objectId = Integer.parseInt( values[1] );
DataElement dataElement = dataElementService.getDataElement( objectId );
- if(dataElement.getType().equals( DataElement.VALUE_TYPE_INT ))
+ if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
{
column.setPrefix( PREFIX_NUMBER_DATA_ELEMENT );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-10-23 08:11:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm 2012-10-23 13:15:16 +0000
@@ -89,7 +89,7 @@
<div id='dataEntryInfor' class='hidden'>
<h3>
- <a href="javascript:backEventList();">$i18n.getString( "anonymous_events" ) </a>
+ <a href="javascript:backEventList();">$i18n.getString( "anonymous_events_management" ) </a>
» <span id='programName' name='programName'></span>
</h3>
<table style="width:480px;">
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-10-16 09:52:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-10-23 13:15:16 +0000
@@ -1561,7 +1561,7 @@
paging: function( currentPage )
{
TR.state.currentPage = currentPage;
- TR.exe.execute();
+ TR.state.filterReport();
Ext.getCmp('currentPage').setValue( currentPage );
TR.datatable.setPagingToolbarStatus();
},
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-10-12 07:34:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-10-23 13:15:16 +0000
@@ -137,6 +137,7 @@
F_PATIENT_CHANGE_LOCATION = Change Person Location
F_SEARCH_PATIENT_IN_ALL_FACILITIES = Seach Person In All Facilities
F_LOAD_PERSON_EVENTS_MANAGEMENT = Load Person-Event Managenent
+F_SMS_REMINDER = Program Tracking Management
F_PROGRAM_ADD=Add Program
F_PROGRAM_UPDATE=Update Program
F_PROGRAM_DELETE=Delete Program