← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2937: Setting report file name to the original report name

 

------------------------------------------------------------
revno: 2937
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-03-01 01:49:30 +0100
message:
  Setting report file name to the original report name
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/RenderReportAction.java


--
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-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/RenderReportAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/RenderReportAction.java	2011-02-23 21:08:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportviewer/action/RenderReportAction.java	2011-03-01 00:49:30 +0000
@@ -45,6 +45,7 @@
 import org.hisp.dhis.report.ReportService;
 import org.hisp.dhis.reporttable.ReportTable;
 import org.hisp.dhis.reporttable.ReportTableService;
+import org.hisp.dhis.system.util.CodecUtils;
 import org.hisp.dhis.system.util.StreamUtils;
 import org.hisp.dhis.util.ContextUtils;
 import org.hisp.dhis.util.StreamActionSupport;
@@ -56,6 +57,8 @@
 public class RenderReportAction
     extends StreamActionSupport
 {
+    private static final String EXT_PDF = ".pdf";
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -166,7 +169,9 @@
     @Override
     protected String getFilename()
     {
-        return "report.pdf";
+        Report report = reportService.getReport( id );
+        
+        return CodecUtils.filenameEncode( report.getName() ) + EXT_PDF;
     }
     
     @Override
@@ -178,6 +183,6 @@
     @Override
     protected boolean attachment()
     {
-        return true;
+        return false;
     }
 }