[Dive4elements-commits] [PATCH 2 of 2] Added filename to export url

Wald Commits scm-commit at wald.intevation.org
Wed Jan 30 15:14:58 CET 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1359555272 -3600
# Node ID 94b95e002fb9c2e942abf0131a2d4cbf5bc1da72
# Parent  da89bb3243d378c3bf0a536e31651147643c5501
Added filename to export url.

diff -r da89bb3243d3 -r 94b95e002fb9 flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java	Wed Jan 30 15:14:07 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java	Wed Jan 30 15:14:32 2013 +0100
@@ -71,7 +71,14 @@
                 if (name.equals("fix_wq_curve_at_export")) {
                     continue;
                 }
-                layout.addMember(createExportButton(name, facet.getName()));
+                String filename = name;
+                if (name.equals("computed_dischargecurve_at_export")) {
+                    filename = "dischargecurve";
+                }
+                layout.addMember(createExportButton(
+                    name,
+                    facet.getName(),
+                    filename));
             }
         }
 
@@ -88,8 +95,12 @@
      *
      * @return an image with click handler.
      */
-    protected Canvas createExportButton(String name, String facet) {
-        String url  = getExportUrl(name, facet);
+    protected Canvas createExportButton(
+        String name,
+        String facet,
+        String filename
+    ) {
+        String url  = getExportUrl(name, facet, filename);
         String iUrl = GWT.getHostPageBaseURL() + MSG.imageSave();
 
         ImgLink link = new ImgLink(iUrl, url, 30, 30);
@@ -107,12 +118,13 @@
      *
      * @return the export URL.
      */
-    protected String getExportUrl(String name, String facet) {
+    protected String getExportUrl(String name, String facet, String filename) {
         Config config = Config.getInstance();
 
         String url = GWT.getModuleBaseURL();
         url += "export";
         url += "?uuid=" + c.identifier();
+        url += "&name=" + filename;
         url += "&mode=" + name;
         url += "&type=" + facet;
         url += "&server=" + config.getServerUrl();
diff -r da89bb3243d3 -r 94b95e002fb9 flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java	Wed Jan 30 15:14:07 2013 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java	Wed Jan 30 15:14:32 2013 +0100
@@ -41,11 +41,12 @@
 
             String url    = getServletContext().getInitParameter("server-url");
             String uuid   = req.getParameter("uuid");
+            String name   = req.getParameter("name");
             String mode   = req.getParameter("mode");
             String type   = req.getParameter("type");
             String locale = req.getParameter("locale");
             String km     = req.getParameter("km");
-            String fn     = mode + "." + type;
+            String fn     = name + "." + type;
 
             resp.setHeader("Content-Disposition", "attachment;filename=" + fn);
 


More information about the Dive4elements-commits mailing list