dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17416
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6921: local vn - Implemented a new GUI for generating report.
------------------------------------------------------------
revno: 6921
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-05-12 22:59:33 +0700
message:
local vn - Implemented a new GUI for generating report.
added:
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/images/arrow_down.png
modified:
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportService.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.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/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/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/jsonExportReports.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-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportService.java 2011-11-18 04:24:39 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/ExportReportService.java 2012-05-12 15:59:33 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.reportsheet;
import java.util.Collection;
+import java.util.Map;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.i18n.I18n;
@@ -126,4 +127,10 @@
public void updatePeriodColumn( PeriodColumn periodColumn );
public String validateEmportItems( ExportReport exportReport, I18n i18n );
+
+ // -------------------------------------------------------------------------
+ // Others
+ // -------------------------------------------------------------------------
+
+ public Map<Integer, String> getPeriodTypeIdentifierMap( Collection<ExportReport> reports );
}
=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java 2012-04-29 09:57:26 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultExportReportService.java 2012-05-12 15:59:33 +0000
@@ -31,8 +31,10 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
@@ -49,7 +51,12 @@
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.DailyPeriodType;
+import org.hisp.dhis.period.MonthlyPeriodType;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.QuarterlyPeriodType;
+import org.hisp.dhis.period.SixMonthlyPeriodType;
+import org.hisp.dhis.period.YearlyPeriodType;
import org.hisp.dhis.reportsheet.AttributeValueGroupOrder;
import org.hisp.dhis.reportsheet.CategoryOptionGroupOrder;
import org.hisp.dhis.reportsheet.DataElementGroupOrder;
@@ -479,4 +486,54 @@
return null;
}
+
+ @Override
+ public Map<Integer, String> getPeriodTypeIdentifierMap( Collection<ExportReport> reports )
+ {
+ String periodTypeName = null;
+ Map<Integer, String> idMap = new HashMap<Integer, String>();
+
+ for ( ExportReport exportReport : reports )
+ {
+ 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.put( exportReport.getId(), DailyPeriodType.NAME );
+ break;
+ }
+ else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SELECTED_MONTH )
+ || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_3_MONTH )
+ || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.LAST_6_MONTH )
+ || periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SO_FAR_THIS_YEAR ) )
+ {
+ idMap.put( exportReport.getId(), MonthlyPeriodType.NAME );
+ break;
+ }
+ else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.QUARTERLY ) )
+ {
+ idMap.put( exportReport.getId(), QuarterlyPeriodType.NAME );
+ break;
+ }
+ else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.SIX_MONTH ) )
+ {
+ idMap.put( exportReport.getId(), SixMonthlyPeriodType.NAME );
+ break;
+ }
+ else if ( periodTypeName.equalsIgnoreCase( ExportItem.PERIODTYPE.YEARLY ) )
+ {
+ idMap.put( exportReport.getId(), YearlyPeriodType.NAME );
+ break;
+ }
+ }
+ }
+
+ periodTypeName = null;
+
+ return idMap;
+ }
}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java 2012-05-10 09:33:27 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/GenerateExcelReportGeneric.java 2012-05-12 15:59:33 +0000
@@ -219,9 +219,9 @@
protected Font csFont11Bold;
protected Font csFont10Bold;
-
+
protected Font csFont9Bold;
-
+
protected Font csFont8Bold;
protected Font csFont12BoldCenter;
@@ -233,9 +233,9 @@
protected CellStyle csText;
protected CellStyle csText10Bold;
-
+
protected CellStyle csText9Bold;
-
+
protected CellStyle csText8Bold;
protected CellStyle csTextSerial;
@@ -367,7 +367,7 @@
{
Calendar calendar = Calendar.getInstance();
- // Monthly period
+ // Daily (or Monthly) period
startDate = period.getStartDate();
endDate = period.getEndDate();
@@ -510,6 +510,11 @@
value = calculateExpression( generateExpression( exportItem, startQuaterly, endDate, 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.SELECTED_MONTH ) )
{
value = calculateExpression( generateExpression( exportItem, startDate, endDate, organisationUnit,
@@ -535,11 +540,6 @@
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,
=== 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-11-10 09:01:47 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GetExportReportsByGroupAction.java 2012-05-12 15:59:33 +0000
@@ -31,10 +31,10 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
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.comparator.ExportReportNameComparator;
@@ -79,9 +79,9 @@
// Input & Output
// -------------------------------------------------------------------------
- private List<Integer> idMap = new ArrayList<Integer>();
+ private Map<Integer, String> idMap;
- public List<Integer> getIdMap()
+ public Map<Integer, String> getIdMap()
{
return idMap;
}
@@ -126,25 +126,9 @@
exportReports.retainAll( reportAssociation );
+ idMap = exportReportService.getPeriodTypeIdentifierMap( exportReports );
+
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/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-05-11 19:42:32 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-05-12 15:59:33 +0000
@@ -340,4 +340,7 @@
define_categoryoptioncombo_associations = Define Categoryoption Combo Associations Management
update_associations_successful = Update associations successfully
category_options = Category options
-categories = Categories
\ No newline at end of file
+categories = Categories
+specify_periodtype_or_period = Please select a period type then specify a certain period
+show_export_params = Show export params
+hide_export_params = Hide export params
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-05-11 19:42:32 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-05-12 15:59:33 +0000
@@ -375,4 +375,7 @@
define_categoryoptioncombo_associations = Qu\u1ea3n l\u00fd g\u00e1n Option Combo cho \u0111\u01a1n v\u1ecb
update_associations_successful = C\u1eadp nh\u1eadt th\u00e0nh c\u00f4ng
category_options = Ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i
-categories = Ph\u00e2n lo\u1ea1i
\ No newline at end of file
+categories = Ph\u00e2n lo\u1ea1i
+specify_periodtype_or_period = H\u00e3y ch\u1ecdn lo\u1ea1i th\u1eddi \u0111i\u1ec3m v\u00e0 th\u1eddi \u0111i\u1ec3m t\u01b0\u01a1ng \u1ee9ng
+show_export_params = Hi\u1ec3n th\u1ecb khung ch\u1ecdn
+hide_export_params = \u1ea8n khung ch\u1ecdn
\ No newline at end of file
=== 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 2012-05-03 10:04:29 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm 2012-05-12 15:59:33 +0000
@@ -1,52 +1,75 @@
+<script type="text/javascript">
+ jQuery(document).ready(function()
+ {
+ currentOrgunitName = "$!organisationUnit.name";
+ getExportReportsByGroup( currentOrgunitName );
+ });
+
+ var i18n_specify_periodtype_or_period = '$encoder.jsEscape( $i18n.getString( "specify_periodtype_or_period" ) , "'")';
+ var i18n_value_rounded = '$encoder.jsEscape( $i18n.getString("value_rounded"), "'" )';
+ var i18n_specify_export_report = '$encoder.jsEscape( $i18n.getString("specify_export_report"), "'" )';
+</script>
+
<h3>$i18n.getString( "generate_export_report" ) #openHelp( "excelReportingExportReport" )</h3>
-<div id="exportReportDiv" class="inputCriteria" style="width:485px;height:120px;">
+
+<div id="showButtonDiv" style="display:none">
+ <a title="$i18n.getString( 'hide_params' )" href="javascript:showExportDiv();">
+ <img width="16" height="16" title="$i18n.getString( 'show_export_params' )" src="images/arrow_down.png"/></a>
+</div>
+
+<div id="exportReportDiv" class="inputCriteria" style="width:680px;height:350px;">
<table>
<tr>
- <td><label>$i18n.getString('organisation')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><span id="selectedOrganisationUnit"></span></td>
+ <td><label class='bold'>$i18n.getString('organisation')<em title="$i18n.getString( 'required' )" class="required">*</em></label>
+ <span id="selectedOrganisationUnit"></span>
+ </td>
</tr>
<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:300px" onchange="getExportReportsByGroup( currentOrgunitName )" >
+ <td><label class='bold'>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><label class='bold'>$i18n.getString('period_type')</label></td>
+ </tr>
+ <tr>
+ <td>
+ <select type="text" id="group" name="group" style="width:300px" size="5" onchange="getExportReportsByGroup( currentOrgunitName )" >
#foreach($group in $groups)
<option value='$group' #if( $group == $exportReportGroup ) selected="selected" #end>$encoder.htmlEncode( $group )</option>
#end
</select>
</td>
- </tr>
- <tr>
- <td><label>$i18n.getString('export_type')</label></td>
- <td>
- <select type="text" id="multiExport" name="multiExport" style="width:300px" onchange="changeExportType( this.value )">
- <option value="0">$i18n.getString('export_single')</option>
- <option value="1">$i18n.getString('export_multi')</option>
- </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:300px" onchange="reportSelected()"></select>
- </td>
- </tr>
- <tr id="periodTypeRow">
- <td><label>$i18n.getString('period_type')</label></td>
- <td>
- <select type="text" id="periodType" name="periodType" style="width:220px" onchange="reportSelected( this.value )">
- <option value="Daily">$i18n.getString('Daily')</option>
- <option value="Monthly">$i18n.getString('Monthly')</option>
- </select>
- </td>
- </tr>
- <tr id="periodRow">
- <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"></select>
+ <td id="periodTypeCol">
+ <select type="text" id="periodType" name="periodType" style="width:220px" disabled="true" size="5" onchange="reportSelected( this.value )">
+ <option value="Daily">$i18n.getString( 'Daily' )</option>
+ <option value="Monthly">$i18n.getString( 'Monthly' )</option>
+ <option value="Quarterly">$i18n.getString( 'Quarterly' )</option>
+ <option value="SixMonthly">$i18n.getString( 'SixMonthly' )</option>
+ <option value="Yearly">$i18n.getString( 'Yearly' )</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td><label class='bold'>$i18n.getString('export_type')</label> <input type="checkbox" id="exportTypeCB" onchange="changeExportType( this );"/></td>
+ </tr>
+ <tr>
+ <td><label class='bold'>$i18n.getString('export_reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><label class='bold'>$i18n.getString('period')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ </tr>
+ <tr>
+ <td>
+ <select type="text" id="exportReport" name="exportReport" style="width:400px" size="10" onchange="reportSelected()"></select>
+ </td>
+ <td id="periodCol">
+ <select type="text" id="selectedPeriodId" name="selectedPeriodId" style="width:220px" size="8" onchange="getRelativePeriods( this.value )"></select>
+ <input type="hidden" id="selectedPeriodId2"/><br/>
<input type="button" value="<<" onclick="getPreviousPeriod()" id="lastPeriod"/>
<input type="button" value=">>" onclick="getNextPeriod()" id="nextPeriod"/>
</td>
</tr>
+ <tr>
+ <td colspan="2" align="right">
+ <a title="$i18n.getString( 'hide_params' )" href="javascript:hideExportDiv();">
+ <img width="16" height="16" title="$i18n.getString( 'hide_export_params' )" src="../images/up_left.png"/></a>
+ </td>
+ </tr>
</table>
</div>
@@ -58,20 +81,4 @@
<input type="button" id="printExcelReportButton" value='$i18n.getString("print")' onclick='printExportReport()' style="width:150px"/>
</p>
-<div id="previewDiv"></div>
-
-<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"), "'" )';
-
- #if ( $organisationUnit )
- jQuery(document).ready(function()
- {
- currentOrgunitName = '$organisationUnit.name';
- getExportReportsByGroup( currentOrgunitName );
- changeExportType( 0 );
- });
- #end
-
-</script>
\ No newline at end of file
+<div id="previewDiv"></div>
\ No newline at end of file
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/images/arrow_down.png'
Binary files local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/images/arrow_down.png 1970-01-01 00:00:00 +0000 and local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/images/arrow_down.png 2012-05-12 15:59:33 +0000 differ
=== 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 2012-05-03 10:04:29 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2012-05-12 15:59:33 +0000
@@ -37,32 +37,32 @@
{
jQuery('#exportReport').empty();
jQuery.each( json.exportReports, function(i, item){
- addOptionById( 'exportReport', item.id + '_' + item.flag + '_' + item.reportType, item.name );
+ addOptionById( 'exportReport', item.id + '_' + item.periodType + '_' + item.reportType, item.name );
});
currentPeriodOffset = 0;
+
reportSelected();
displayPeriodsInternal();
});
}
}
-function changeExportType( value )
+function changeExportType( _this )
{
- if ( value == 0 )
- {
- byId( "exportReportDiv" ).style.height = "120px";
+ if ( _this.checked )
+ {
+ byId( "exportReport" ).multiple = true;
+ enable( "periodType" );
+ reportSelected( getFieldValue( "periodType" ) );
+ }
+ else
+ {
byId( "exportReport" ).multiple = false;
- hideById( "periodTypeRow" );
+ deselectAllById( "periodType" );
+ disable( "periodType" );
reportSelected();
}
- else
- {
- byId( "exportReportDiv" ).style.height = "200px";
- byId( "exportReport" ).multiple = true;
- showById( "periodTypeRow" );
- reportSelected( getFieldValue( "periodType" ) );
- }
displayPeriodsInternal();
showById( "periodRow" );
@@ -74,23 +74,23 @@
{
currentPeriodTypeName = _periodType;
}
- else if ( getFieldValue( "multiExport" ) == 0 )
+ else if ( !isChecked( 'exportTypeCB' ) )
{
var value = getFieldValue( 'exportReport' );
if ( value && value != null )
{
- currentPeriodTypeName = (value.split( '_' )[1] == "true") ? 'Daily' : 'Monthly';
+ currentPeriodTypeName = value.split( '_' )[1];
currentReportTypeName = value.split( '_' )[2];
if ( currentReportTypeName == "P" ) {
- hideById( "periodRow" );
+ hideById( "periodCol" );
}else {
- showById( "periodRow" );
+ showById( "periodCol" );
}
}
}
-
+
displayPeriodsInternal();
}
@@ -108,6 +108,35 @@
addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
}
}
+
+ getRelativePeriods( getFieldValue( "selectedPeriodId" ) );
+}
+
+function getRelativePeriods( value )
+{
+ if ( value )
+ {
+ var periodType = value.split( "_" )[0];
+ var date = value.split( "_" )[1];
+ var submitDateId = "";
+
+ if ( periodType == "Weekly" )
+ {
+ }
+ else if ( periodType == "Quarterly" || periodType == "Yearly" || periodType == "SixMonthly" )
+ {
+ submitDateId = "Monthly" + "_" + date;
+ }
+ else // Daily, Monthly
+ {
+ submitDateId = periodType + "_" + date;
+ }
+
+ if ( submitDateId && submitDateId != "" )
+ {
+ setFieldValue( 'selectedPeriodId2', submitDateId );
+ }
+ }
}
function getNextPeriod()
@@ -125,6 +154,18 @@
displayPeriodsInternal();
}
+function hideExportDiv()
+{
+ hideById( 'exportReportDiv' );
+ showById( 'showButtonDiv' );
+}
+
+function showExportDiv()
+{
+ showById( 'exportReportDiv' );
+ hideById( 'showButtonDiv' );
+}
+
function validateGenerateReport( isAdvanced )
{
var exportReports = jQuery( 'select[id=exportReport]' ).children( 'option:selected' );
@@ -135,6 +176,14 @@
return;
}
+ var periodIndex = getFieldValue( 'selectedPeriodId2' );
+
+ if ( periodIndex.length == 0 )
+ {
+ showErrorMessage( i18n_specify_periodtype_or_period );
+ return;
+ }
+
var url = 'validateGenerateReport.action?';
jQuery.each( exportReports, function ( i, item )
@@ -146,11 +195,12 @@
if ( url && url != '' )
{
+ hideExportDiv();
lockScreen();
jQuery.postJSON( url,
{
- 'periodIndex': getFieldValue( 'selectedPeriodId' )
+ 'periodIndex': periodIndex
},
function( json )
{
=== 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 2012-05-03 10:04:29 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js 2012-05-12 15:59:33 +0000
@@ -28,6 +28,14 @@
return;
}
+ var periodIndex = getFieldValue( 'selectedPeriodId2' );
+
+ if ( periodIndex.length == 0 )
+ {
+ showErrorMessage( i18n_specify_periodtype_or_period );
+ return;
+ }
+
var url = 'validateGenerateReport.action?';
jQuery.each( exportReports, function ( i, item )
@@ -39,11 +47,12 @@
if ( url && url != '' )
{
+ hideExportDiv();
lockScreen();
jQuery.postJSON( url,
{
- 'periodIndex': getFieldValue( 'selectedPeriodId' )
+ 'periodIndex': periodIndex
},
function( json )
{
=== modified 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 2012-04-05 07:16:03 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonExportReports.vm 2012-05-12 15:59:33 +0000
@@ -8,7 +8,7 @@
"id": "${exportReport.id}",
"name": "$!encoder.jsonEncode( ${exportReport.displayName} )",
"reportType": #if ( $reportType == "NORMAL" ) "N",#elseif ( $reportType == "CATEGORY" ) "C",#elseif ( $reportType == "PERIOD_COLUMN_LISTING" ) "P",#else "O",#end
- "flag": "$!idMap.contains( $!{exportReport.id} )"
+ "periodType": "$!idMap.get( $!{exportReport.id} )"
}#if( $velocityCount < $size ),#end
#end
]