Mercurial > dive4elements > river
changeset 4912:94b95e002fb9
Added filename to export url.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 30 Jan 2013 15:14:32 +0100 |
parents | da89bb3243d3 |
children | 45f24180664c |
files | flys-client/src/main/java/de/intevation/flys/client/client/ui/ExportPanel.java flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java |
diffstat | 2 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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();
--- 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);