← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3968: local vn - Removed unneccessary method and minor changed.

 

------------------------------------------------------------
revno: 3968
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-06-21 15:29:23 +0700
message:
  local vn - Removed unneccessary method and minor changed.
removed:
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/ExcelFilenameFilter.java
modified:
  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/utils/ExcelFileFilter.java
  local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/utils/FileUtils.java
  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/report/exportReports.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-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<ReportExcel>( exportReportService.getAllExportReport() );
 
         if ( valid )
@@ -113,17 +113,17 @@
                 return SUCCESS;
             }
 
-            List<String> templateNames = FileUtils.getListFileName( templateDirectory, new ExcelFilenameFilter() );
+            List<File> 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<String> getListFileName( File directory, FilenameFilter filenameFilter )
-    {
-        if ( directory != null )
-        {
-            return Arrays.asList( directory.list( filenameFilter ) );
-        }
-
-        return new ArrayList<String>();
-    }
-
     public static List<File> 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 <For Loop> AND <Empty Cells>
 					j 		= Number(j) + Number(_colspan);
@@ -115,7 +114,7 @@
 					
 					_sHTML += "<td align='" + _align + "' colspan='" + _colspan + "' ";
 					
-					if ( !isNaN(_sData) && (_sData != "") )
+					if ( (_sData != "") && !isNaN(_sData) )
 					{
 						_sHTML += "class='formatNumberPreview' "
 							   + "title='" + i18n_value_rounded;
@@ -149,16 +148,16 @@
 	unLockScreen();
 }
 
-function getMergedNumberForEachCell( sKey, aKey, aMerged ) {
+function getMergedNumberForEachCell( aKey, sKey, aMerged ) {
 
 	for (var i = 0 ; i < aKey.length ; i ++)
 	{
-		if ( sKey == aKey[i] )
+		if ( aKey[i] == sKey )
 		{
 			return Number(aMerged[i]);
 		}
 	}
-return 1;
+	return 1;
 }
 
 function printExportReport()

=== modified file 'local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.vm'
--- local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.vm	2011-06-07 10:07:02 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/exportReports.vm	2011-06-21 08:29:23 +0000
@@ -30,7 +30,7 @@
 				#if( $exist )
 					<a href="downloadFile.action?fileName=$encoder.htmlEncode( $exportReport.excelTemplateFile )" title="download">$encoder.htmlEncode( $exportReport.excelTemplateFile )</a>
 				#else
-					$encoder.htmlEncode( $exportReport.excelTemplateFile ) <img src="../images/warning.png" alt="$i18n.getString( 'missing_template' )"/>
+					$encoder.htmlEncode( $exportReport.excelTemplateFile ) <img src="../images/warning.png" alt="$i18n.getString( 'missing_template' )" title="$i18n.getString( 'missing_template' )"/>
 				#end
 			</td>
 			<td align="left">