=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java' --- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java 2011-06-07 10:07:02 +0000 +++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/exportreport/action/ListExportReportAction.java 2011-06-21 08:29:23 +0000 @@ -38,7 +38,7 @@ import org.hisp.dhis.reportexcel.ReportExcel; import org.hisp.dhis.reportexcel.ReportLocationManager; import org.hisp.dhis.reportexcel.comparator.ExportReportNameComparator; -import org.hisp.dhis.reportexcel.utils.ExcelFilenameFilter; +import org.hisp.dhis.reportexcel.utils.ExcelFileFilter; import org.hisp.dhis.reportexcel.utils.FileUtils; import com.opensymphony.xwork2.Action; @@ -101,7 +101,7 @@ throws Exception { valid = true; - + exportReports = new ArrayList( exportReportService.getAllExportReport() ); if ( valid ) @@ -113,17 +113,17 @@ return SUCCESS; } - List templateNames = FileUtils.getListFileName( templateDirectory, new ExcelFilenameFilter() ); + List templateFiles = FileUtils.getListFile( templateDirectory, new ExcelFileFilter() ); - if ( templateNames == null || templateNames.isEmpty() ) + if ( templateFiles == null || templateFiles.isEmpty() ) { return SUCCESS; } - + for ( ReportExcel exportReport : exportReports ) { - templateMap.put( exportReport.getExcelTemplateFile(), templateNames.contains( exportReport - .getExcelTemplateFile() ) ); + templateMap.put( exportReport.getExcelTemplateFile(), templateFiles.contains( new File( + templateDirectory, exportReport.getExcelTemplateFile() ) ) ); } } === modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFileFilter.java' --- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFileFilter.java 2010-04-12 21:23:33 +0000 +++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFileFilter.java 2011-06-21 08:29:23 +0000 @@ -36,7 +36,6 @@ public class ExcelFileFilter implements FileFilter { - @Override public boolean accept( File file ) { === removed file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java' --- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java 2011-06-07 10:07:02 +0000 +++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java 1970-01-01 00:00:00 +0000 @@ -1,56 +0,0 @@ -package org.hisp.dhis.reportexcel.utils; - -/* - * Copyright (c) 2004-2010, 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.io.File; -import java.io.FilenameFilter; - -/** - * @author Dang Duy Hieu - * @version $Id - */ -public class ExcelFilenameFilter - implements FilenameFilter -{ - @Override - public boolean accept( File file, String extension ) - { - if ( file.isDirectory() ) - return false; - else - { - String name = file.getName().toLowerCase(); - - if ( extension == null ) - { - return name.endsWith( ".xls" ) || name.endsWith( ".xlsx" ); - } - - return name.endsWith( "." + extension ); - } - } -} === modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java' --- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java 2011-06-07 10:07:02 +0000 +++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java 2011-06-21 08:29:23 +0000 @@ -32,9 +32,10 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; -import java.io.FilenameFilter; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * @author Tran Thanh Tri @@ -57,16 +58,6 @@ return result; } - public static List getListFileName( File directory, FilenameFilter filenameFilter ) - { - if ( directory != null ) - { - return Arrays.asList( directory.list( filenameFilter ) ); - } - - return new ArrayList(); - } - public static List getListFile( File directory, FileFilter fileFilter ) { if ( directory != null ) === modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js' --- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2011-06-07 10:07:02 +0000 +++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2011-06-21 08:29:23 +0000 @@ -101,13 +101,12 @@ if ( _index == _number ) { - var _colspan = 1; var _sData = getElementValue( _cols[j], 'data' ); var _align = getElementAttribute( _cols[j], 'format', 'align' ); // If this cell is merged - Key's form: Sheet#Row#Col _sPattern = _orderSheet + "#" + i + "#" + _number; - _colspan = getMergedNumberForEachCell( _sPattern, aKey, aMerged ); + var _colspan = getMergedNumberForEachCell( aKey, _sPattern, aMerged ); // Jumping for AND j = Number(j) + Number(_colspan); @@ -115,7 +114,7 @@ _sHTML += "$encoder.htmlEncode( $exportReport.excelTemplateFile ) #else - $encoder.htmlEncode( $exportReport.excelTemplateFile ) $i18n.getString( 'missing_template' ) + $encoder.htmlEncode( $exportReport.excelTemplateFile ) $i18n.getString( 'missing_template' ) #end