=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties 2012-04-26 18:56:17 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties 2012-09-19 02:22:55 +0000 @@ -309,7 +309,7 @@ address=\u0110\u1ecba ch\u1ec9 Yearly=H\u00e0ng n\u0103m show_menu=Hi\u1ec7n tr\u00ecnh \u0111\u01a1n -user_account=User Account +user_account=T\u00e0i kho\u1ea3n ng\u01b0\u1eddi d\u00f9ng rows_in_page=S\u1ed1 d\u00f2ng m\u1ed7i trang help_contents=N\u1ed9i dung gi\u00fap \u0111\u1ee1 FinancialJuly=T\u00e0i ch\u00ednh-Th\u00e1ng 7 === modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/DataElementGroupOrderService.java' --- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/DataElementGroupOrderService.java 2011-08-03 08:38:38 +0000 +++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/DataElementGroupOrderService.java 2012-09-19 02:22:55 +0000 @@ -1,5 +1,7 @@ package org.hisp.dhis.reportsheet; +import java.util.List; + /* * Copyright (c) 2004-2011, University of Oslo * All rights reserved. @@ -40,11 +42,12 @@ // ------------------------------------------------------------------------- public DataElementGroupOrder getDataElementGroupOrder( Integer id ); - + public DataElementGroupOrder getDataElementGroupOrder( String name, String clazzName, Integer reportId ); public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder ); public void deleteDataElementGroupOrder( Integer id ); + public List getDataElementGroupOrders( List ids ); } \ No newline at end of file === modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/DataElementGroupOrderStore.java' --- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/DataElementGroupOrderStore.java 2011-08-03 08:38:38 +0000 +++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/DataElementGroupOrderStore.java 2012-09-19 02:22:55 +0000 @@ -1,7 +1,9 @@ package org.hisp.dhis.reportsheet; +import java.util.List; + /* - * Copyright (c) 2004-2011, University of Oslo + * Copyright (c) 2004-2012, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +49,6 @@ public void deleteDataElementGroupOrder( Integer id ); + public List getDataElementGroupOrders( List ids ); + } === modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateDataElementGroupOrderStore.java' --- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateDataElementGroupOrderStore.java 2011-12-13 07:46:57 +0000 +++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateDataElementGroupOrderStore.java 2012-09-19 02:22:55 +0000 @@ -26,6 +26,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.List; + import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; @@ -98,4 +100,12 @@ Session session = sessionFactory.getCurrentSession(); session.delete( this.getDataElementGroupOrder( id ) ); } + + @SuppressWarnings("unchecked") + public List getDataElementGroupOrders( List ids ) + { + String hql = "select distinct deo from ExportReport e join e.dataElementOrders deo where deo.id in (:ids) order by deo.name"; + + return sessionFactory.getCurrentSession().createQuery( hql ).setParameterList( "ids", ids ).list(); + } } === modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultDataElementGroupOrderService.java' --- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultDataElementGroupOrderService.java 2011-08-03 08:38:38 +0000 +++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultDataElementGroupOrderService.java 2012-09-19 02:22:55 +0000 @@ -27,6 +27,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.List; + import org.hisp.dhis.reportsheet.DataElementGroupOrder; import org.hisp.dhis.reportsheet.DataElementGroupOrderService; import org.hisp.dhis.reportsheet.DataElementGroupOrderStore; @@ -74,4 +76,9 @@ { return dataElementGroupOrderStore.getDataElementGroupOrder( name, clazzName, reportId ); } + + public List getDataElementGroupOrders( List ids ) + { + return dataElementGroupOrderStore.getDataElementGroupOrders( ids ); + } } === added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/GetDataElementGroupOrdersByReportAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/GetDataElementGroupOrdersByReportAction.java 1970-01-01 00:00:00 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/degroup/action/GetDataElementGroupOrdersByReportAction.java 2012-09-19 02:22:55 +0000 @@ -0,0 +1,115 @@ +package org.hisp.dhis.reportsheet.degroup.action; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.i18n.I18n; +import org.hisp.dhis.reportsheet.DataElementGroupOrder; +import org.hisp.dhis.reportsheet.ExportReport; +import org.hisp.dhis.reportsheet.ExportReportCategory; +import org.hisp.dhis.reportsheet.ExportReportService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Dang Duy Hieu + * @version $Id$ + */ + +public class GetDataElementGroupOrdersByReportAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependency + // ------------------------------------------------------------------------- + + private ExportReportService exportReportService; + + public void setExportReportService( ExportReportService exportReportService ) + { + this.exportReportService = exportReportService; + } + + private I18n i18n; + + public void setI18n( I18n i18n ) + { + this.i18n = i18n; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + private Integer exportReportId; + + public void setExportReportId( Integer exportReportId ) + { + this.exportReportId = exportReportId; + } + + private List orderedGroups = new ArrayList(); + + public List getOrderedGroups() + { + return orderedGroups; + } + + private String message; + + public String getMessage() + { + return message; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + ExportReport report = exportReportService.getExportReport( exportReportId ); + + if ( report == null ) + { + message = i18n.getString( "the_specified_report_is_not_exist" ); + + return ERROR; + } + + if ( report instanceof ExportReportCategory ) + { + orderedGroups = ((ExportReportCategory) report).getDataElementOrders(); + } + + return SUCCESS; + } +} === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java 2012-07-11 08:56:27 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportCategoryAction.java 2012-09-19 02:22:55 +0000 @@ -28,17 +28,20 @@ */ import java.util.Collection; +import java.util.List; import org.apache.poi.ss.usermodel.Sheet; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; import org.hisp.dhis.reportsheet.DataElementGroupOrder; +import org.hisp.dhis.reportsheet.DataElementGroupOrderService; import org.hisp.dhis.reportsheet.ExportItem; import org.hisp.dhis.reportsheet.ExportReport; import org.hisp.dhis.reportsheet.ExportReportCategory; import org.hisp.dhis.reportsheet.exporting.AbstractGenerateExcelReportSupport; import org.hisp.dhis.reportsheet.utils.ExcelUtils; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Tran Thanh Tri @@ -49,6 +52,9 @@ public class GenerateReportCategoryAction extends AbstractGenerateExcelReportSupport { + @Autowired + private DataElementGroupOrderService dataElementGroupOrderService; + @Override protected void executeGenerateOutputFile( ExportReport exportReport, Period period ) throws Exception @@ -60,7 +66,19 @@ this.installReadTemplateFile( exportReportInstance, period, organisationUnit ); Collection exportReportItems = null; - + List orderedGroups = null; + + if ( !selectionManager.getOrderedGroupList().isEmpty() ) + { + orderedGroups = dataElementGroupOrderService.getDataElementGroupOrders( selectionManager + .getOrderedGroupList() ); + } + + if ( orderedGroups == null || orderedGroups.isEmpty() ) + { + orderedGroups = exportReportInstance.getDataElementOrders(); + } + for ( Integer sheetNo : exportReportService.getSheets( selectionManager.getSelectedReportId() ) ) { Sheet sheet = this.templateWorkbook.getSheetAt( sheetNo - 1 ); @@ -69,17 +87,18 @@ if ( isVerticalCategory( exportReportItems ) ) { - this.generateVerticalOutPutFile( exportReportInstance, exportReportItems, organisationUnit, sheet ); + this.generateVerticalOutPutFile( orderedGroups, exportReportItems, organisationUnit, sheet ); } else { this.generateHorizontalOutPutFile( exportReportInstance, exportReportItems, organisationUnit, sheet ); } } - + /** * Garbage */ + orderedGroups = null; exportReportItems = null; } @@ -87,7 +106,7 @@ // Supportive method // ------------------------------------------------------------------------- - private void generateVerticalOutPutFile( ExportReportCategory exportReport, + private void generateVerticalOutPutFile( List orderedGroups, Collection exportReportItems, OrganisationUnit organisationUnit, Sheet sheet ) { for ( ExportItem reportItem : exportReportItems ) @@ -95,26 +114,26 @@ int run = 0; int rowBegin = reportItem.getRow(); - for ( DataElementGroupOrder dataElementGroup : exportReport.getDataElementOrders() ) + for ( DataElementGroupOrder group : orderedGroups ) { int beginChapter = rowBegin; if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_NAME ) ) { - ExcelUtils.writeValueByPOI( rowBegin, reportItem.getColumn(), dataElementGroup.getName(), - ExcelUtils.TEXT, sheet, this.csText12BoldCenter ); + ExcelUtils.writeValueByPOI( rowBegin, reportItem.getColumn(), group.getName(), ExcelUtils.TEXT, + sheet, this.csText12BoldCenter ); } else if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_CODE ) ) { - ExcelUtils.writeValueByPOI( rowBegin, reportItem.getColumn(), dataElementGroup.getCode(), - ExcelUtils.TEXT, sheet, this.csText12BoldCenter ); + ExcelUtils.writeValueByPOI( rowBegin, reportItem.getColumn(), group.getCode(), ExcelUtils.TEXT, + sheet, this.csText12BoldCenter ); } run++; rowBegin++; int serial = 1; - for ( DataElement dataElement : dataElementGroup.getDataElements() ) + for ( DataElement dataElement : group.getDataElements() ) { if ( reportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT_NAME ) ) { @@ -142,7 +161,7 @@ String expression = reportItem.getExpression(); expression = expression.replace( "*", String.valueOf( dataElement.getId() ) ); - + newReportItem.setPeriodType( reportItem.getPeriodType() ); newReportItem.setExpression( expression ); === 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 2012-05-12 19:01:57 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/ValidateGenerateExportReportAction.java 2012-09-19 02:22:55 +0000 @@ -28,6 +28,8 @@ */ import java.io.File; +import java.util.ArrayList; +import java.util.List; import org.hisp.dhis.reportsheet.ExportReport; import org.hisp.dhis.reportsheet.ExportReportService; @@ -78,6 +80,13 @@ this.exportReportIds = exportReportIds; } + private List orderedGroupIds = new ArrayList(); + + public void setOrderedGroupIds( List orderedGroupIds ) + { + this.orderedGroupIds = orderedGroupIds; + } + private String periodIndex; public void setPeriodIndex( String periodIndex ) @@ -150,7 +159,8 @@ selectionManager.setListObject( exportReportIds ); } + selectionManager.setOrderedGroupList( orderedGroupIds ); + return SUCCESS; } - } === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/organisationunit/action/AddMultiOrganisationUnitAction.java' --- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/organisationunit/action/AddMultiOrganisationUnitAction.java 2012-08-21 08:32:18 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/organisationunit/action/AddMultiOrganisationUnitAction.java 2012-09-19 02:22:55 +0000 @@ -172,7 +172,7 @@ // Create organization unit // --------------------------------------------------------------------- - String extraName = ( parent.getCode() == null ? String.valueOf( parent.getId() ) : parent.getCode() ); + String extraName = (parent.getCode() == null ? String.valueOf( parent.getId() ) : parent.getCode()); for ( String id : selectedList ) { === 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-10-13 03:03:58 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/DefaultSelectionManager.java 2012-09-19 02:22:55 +0000 @@ -27,6 +27,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionContext; @@ -52,6 +53,8 @@ private static final String SESSION_KEY_LIST_OBJECT = "SESSION_KEY_LIST_OBJECT"; + private static final String SESSION_KEY_LIST_ORDERED_GROUP = "SESSION_KEY_LIST_ORDERED_GROUP"; + public String getDownloadFilePath() { return (String) getSession().get( SESSION_KEY_FILE_DOWNLOAD ); @@ -124,14 +127,26 @@ getSession().put( SESSION_KEY_LIST_OBJECT, objects ); } + @SuppressWarnings("unchecked") + public List getOrderedGroupList() + { + return (List) getSession().get( SESSION_KEY_LIST_ORDERED_GROUP ); + } + + @SuppressWarnings( "unchecked" ) + public void setOrderedGroupList( List objects ) + { + getSession().put( SESSION_KEY_LIST_ORDERED_GROUP, objects ); + } + public String getSelectedPeriodIndex() { return (String) getSession().get( SESSION_KEY_SELECTED_PERIOD_ID ); } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) public void setSelectedPeriodIndex( String periodIndex ) { - getSession().put( SESSION_KEY_SELECTED_PERIOD_ID, 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-10-13 03:03:58 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/state/SelectionManager.java 2012-09-19 02:22:55 +0000 @@ -26,6 +26,8 @@ */ package org.hisp.dhis.reportsheet.state; +import java.util.List; + /** * @author Tran Thanh Tri * @version $Id$ @@ -59,5 +61,8 @@ public String[] getListObject(); public void setListObject( String[] objects ); + + public List getOrderedGroupList(); + public void setOrderedGroupList( List objects ); } === 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 2012-08-21 08:32:18 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-09-19 02:22:55 +0000 @@ -243,6 +243,13 @@ + + + + === 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-08-21 08:32:18 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-09-19 02:22:55 +0000 @@ -371,4 +371,5 @@ available_data_sets = Available data sets selected_data_sets = Selected data sets select_group = Select group of unit -add_multi_organisation_unit = Add Multi-org-unit \ No newline at end of file +add_multi_organisation_unit = Add Multi-org-unit +filter_on_section=Filter on section \ 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-08-21 08:32:18 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-09-19 02:22:55 +0000 @@ -400,4 +400,5 @@ available_data_sets = Danh s\u00e1ch t\u1eadp d\u1eef li\u1ec7u hi\u1ec7n c\u00f3 selected_data_sets = Danh s\u00e1ch t\u1eadp d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c ch\u1ecdn select_group = Ch\u1ecdn Nh\u00f3m \u0111\u01a1n v\u1ecb -add_multi_organisation_unit = T\u1ea1o nhi\u1ec1u \u0111\u01a1n v\u1ecb \ No newline at end of file +add_multi_organisation_unit = T\u1ea1o nhi\u1ec1u \u0111\u01a1n v\u1ecb +filter_on_section=L\u1ecdc theo nh\u00f3m \ No newline at end of file === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml' --- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2012-08-21 08:32:18 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2012-09-19 02:22:55 +0000 @@ -405,6 +405,14 @@ /dhis-web-spreadsheet-reporting/jsonDataElementGroupOrder.vm + + + /dhis-web-commons/ajax/jsonResponseError.vm + + /dhis-web-spreadsheet-reporting/jsonDataElementGroupOrders.vm + + /main.vm === 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-06-25 06:46:16 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/generateReportForm.vm 2012-09-19 02:22:55 +0000 @@ -17,7 +17,7 @@ -
+
+ + + + + +
@@ -30,7 +30,7 @@
- #foreach($group in $groups) #end @@ -55,15 +55,23 @@
- + - +
=== 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-06-25 06:46:16 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2012-09-19 02:22:55 +0000 @@ -90,15 +90,44 @@ if ( currentReportTypeName == "P" ) { hideById( "periodCol" ); - }else { + } else { showById( "periodCol" ); } } } - + + displayOrderedGroup(); displayPeriodsInternal(); } +function displayOrderedGroup() +{ + if ( currentReportTypeName == "C" ) + { + jQuery.post( "getDataElementGroupOrdersByReport.action", + { + exportReportId: getFieldValue( 'exportReport' ).split( '_' )[0] + }, + function ( json ) + { + clearListById( 'orderedGroups' ); + + jQuery.each( json.dataElementGroupOrders, function( i, item ) + { + addOptionById( 'orderedGroups', item.id, item.name ); + } ); + + showById( 'orderedGroupLabelTR' ); + showById( 'orderedGroupSelectTR' ); + byId( 'exportReportDiv' ).style.height = '410px'; + } ); + } else { + hideById( 'orderedGroupLabelTR' ); + hideById( 'orderedGroupSelectTR' ); + byId( 'exportReportDiv' ).style.height = '300px'; + } +} + function displayPeriodsInternal() { if ( currentPeriodTypeName ) @@ -179,6 +208,7 @@ function validateGenerateReport( isAdvanced ) { var exportReports = jQuery( 'select[id=exportReport]' ).children( 'option:selected' ); + var orderedGroups = jQuery( 'select[id=orderedGroups]' ).children( 'option:selected' ); if ( exportReports.length == 0 ) { @@ -200,6 +230,11 @@ { url += 'exportReportIds=' + item.value.split( "_" )[0] + '&'; } ); + + jQuery.each( orderedGroups, function ( i, item ) + { + url += 'orderedGroupIds=' + item.value + '&'; + } ); url = url.substring( 0, url.length - 1 ); === 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-12 15:59:33 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js 2012-09-19 02:22:55 +0000 @@ -21,6 +21,7 @@ function validatePreviewReport( isAdvanced ) { var exportReports = jQuery( 'select[id=exportReport]' ).children( 'option:selected' ); + var orderedGroups = jQuery( 'select[id=orderedGroups]' ).children( 'option:selected' ); if ( exportReports.length == 0 ) { @@ -42,6 +43,11 @@ { url += 'exportReportIds=' + item.value.split( "_" )[0] + '&'; } ); + + jQuery.each( orderedGroups, function ( i, item ) + { + url += 'orderedGroupIds=' + item.value + '&'; + } ); url = url.substring( 0, url.length - 1 ); === added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonDataElementGroupOrders.vm' --- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonDataElementGroupOrders.vm 1970-01-01 00:00:00 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonDataElementGroupOrders.vm 2012-09-19 02:22:55 +0000 @@ -0,0 +1,19 @@ +#set( $size = $!orderedGroups.size() ) +{ "dataElementGroupOrders": [ +#foreach( $dataElementGroupOrder in $!orderedGroups ) +#set( $dataElements = $!dataElementGroupOrder.dataElements ) + { + "id": "${dataElementGroupOrder.id}", + "name": "$!encoder.jsonEncode( ${dataElementGroupOrder.name} )", + "code": "$!encoder.jsonEncode( ${dataElementGroupOrder.code} )", + "dataElements": [ + #foreach( $de in $dataElements ) + { + "id": "${de.id}", + "name": "$!encoder.jsonEncode( ${de.displayName} )" + }#if( $velocityCount < $!dataElements.size() ),#end + #end + ] + }#if( $velocityCount < $size ),#end +#end +] } \ No newline at end of file