Mercurial > dive4elements > river
changeset 5008:04ccec566689
flys/#657: Shapefile upload now reports success or failure to client.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 18 Feb 2013 16:29:37 +0100 (2013-02-18) |
parents | 99b452967737 |
children | 7c8ce0a95a64 |
files | flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java flys-client/src/main/webapp/WEB-INF/config.yaml |
diffstat | 3 files changed, 55 insertions(+), 159 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Fri Feb 15 12:47:15 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Feb 18 16:29:37 2013 +0100 @@ -2,6 +2,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; + import com.smartgwt.client.types.Encoding; import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.util.SC; @@ -179,10 +180,13 @@ combobox.setShowTitle(false); form.setItems(combobox); - HTMLPane frame = new HTMLPane(); - frame.setWidth("1px"); - frame.setHeight("1px"); - frame.setContents("<iframe id='uploadTarget' name='uploadTarget'></iframe>"); + HTMLPane uploadTargetFrame = new HTMLPane(); + uploadTargetFrame.setWidth("200px"); + uploadTargetFrame.setHeight("50px"); + uploadTargetFrame.setContents( + "<iframe id='uploadTarget' name='uploadTarget' scrolling='no' width=200 height=50 style='border: 0px'></iframe>"); + uploadTargetFrame.setBorder("0px"); + uploadTargetFrame.setScrollbarSize(0); final DynamicForm uploadForm = new DynamicForm(); uploadForm.setAction("flys/fileupload?uuid=" + artifact.getUuid()); @@ -200,13 +204,16 @@ uploadForm.submitForm(); } }); - layout.addMember(frame); + layout.addMember(label); layout.addMember(form); layout.addMember(uploadLabel); layout.addMember(uploadForm); layout.addMember(submit); layout.addMember(getNextButton()); + + layout.setMembersMargin(10); + layout.addMember(uploadTargetFrame); } form.setValues(initial);
--- a/flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java Fri Feb 15 12:47:15 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/FileUploadServiceImpl.java Mon Feb 18 16:29:37 2013 +0100 @@ -7,7 +7,9 @@ import de.intevation.artifacts.httpclient.http.HttpClientImpl; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStream; +import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -28,11 +30,6 @@ @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) { - processPost(req, resp); - } - - - protected void processPost(HttpServletRequest req, HttpServletResponse resp) { logger.debug("handling post request."); String url = getServletContext().getInitParameter("server-url"); @@ -47,15 +44,31 @@ try { Document result = client.callService(url, "fileupload", request); + PrintWriter respWriter = resp.getWriter(); + respWriter.write("<html><link href='FLYS.css' rel='stylesheet' type='text/css'>"); + respWriter.write("<body><div style='font-face: Arial,Verdana,sans-serif; font-size: 11px'>"); + if (result == null) { logger.warn("FileUpload service returned no result."); + respWriter.write("FileUpload service returned no result"); } + else { + String status = result.getElementsByTagName("status") + .item(0).getTextContent(); + respWriter.write(status); + } + + respWriter.write("</div></body></html>"); + respWriter.flush(); return; } catch (ConnectionException ce) { logger.error(ce, ce); } + catch (IOException e) { + logger.error(e, e); + } } @@ -67,8 +80,6 @@ while (iter.hasNext()) { FileItemStream item = iter.next(); - - String name = item.getFieldName(); InputStream stream = item.openStream(); // Process the input stream
--- a/flys-client/src/main/webapp/WEB-INF/config.yaml Fri Feb 15 12:47:15 2013 +0100 +++ b/flys-client/src/main/webapp/WEB-INF/config.yaml Mon Feb 18 16:29:37 2013 +0100 @@ -25,7 +25,7 @@ - 2000000 - 4000000 -outputFilename: 'flys-${date}.pdf' +outputFilename: "flys-${date}.pdf" #=========================================================================== # the list of allowed hosts @@ -54,65 +54,12 @@ port: 80 layouts: - #=========================================================================== - A4 portrait: - #=========================================================================== - metaData: - title: '${title}' - author: 'Flys' - subject: 'Kartendruck A4 Portrait' - keywords: 'map,print' - creator: 'd4e-river' - - #------------------------------------------------------------------------- - mainPage: - pageSize: A4 - landscape: false - header: - height: 50 - items: - - !image - align: left - maxWidth: 60 - maxHeight: 60 - url: '${configDir}/../images/FLYS_Logo.png' - items: - - !text - font: Helvetica - fontSize: 30 - align: right - text: '${mapTitle}' - spacingAfter: 30 - - !map - spacingAfter: 30 - width: 440 - height: 483 - - !scalebar - type: bar - maxSize: 100 - barBgColor: white - fontSize: 8 - align: right - - !text - text: '${comment}' - spacingAfter: 30 - - !text - font: Helvetica - fontSize: 9 - align: right - text: '1:${scale} ${now MM.dd.yyyy}' - - !legends - align: left - maxIconWidth: 32 - maxIconHeight: 32 - footer: *commonFooter - #=========================================================================== A4 landscape: #=========================================================================== metaData: - title: '${title}' + title: "${title}" author: 'Flys' subject: 'Kartendruck A4 Quer' keywords: 'map,print' @@ -125,96 +72,27 @@ header: height: 50 items: - - !image - align: left - maxWidth: 60 - maxHeight: 60 - url: '${configDir}/../images/FLYS_Logo.png' + - !columns + config: + cells: + - paddingBottom: 5 + items: + - !image + align: left + maxWidth: 50 + maxHeight: 50 + url: "${configDir}/../images/FLYS_Logo.png" + - !text + font: Helvetica + fontSize: 30 + align: right + text: "${mapTitle}" + items: - - !text - font: Helvetica - fontSize: 30 - align: right - text: '${mapTitle}' - spacingAfter: 30 - - !map - absoluteX: 45 - absoluteY: 510 - #spacingAfter: 30 - width: 540 - height: 480 - align: left - - !scalebar - type: bar - maxSize: 100 - barBgColor: white - fontSize: 8 - align: right - - !text - text: '${comment}' - spacingAfter: 30 - - !text - font: Helvetica - fontSize: 9 - align: right - text: '1:${scale} ${now MM.dd.yyyy}' - - !legends - align: right - maxIconWidth: 32 - maxIconHeight: 32 -# - !columns -# widths: [500, 200] -# items: -# - !map -# width: 500 -# height: 500 -# - !legends - footer: *commonFooter - - - #=========================================================================== - A0 portrait: - #=========================================================================== - metaData: - title: '${title}' - author: 'MapFish print module' - subject: 'Simple layout' - keywords: 'map,print' - creator: 'MapFish' - - #------------------------------------------------------------------------- - mainPage: - pageSize: A0 - rotation: true - header: - height: 50 - items: - - !text - font: Helvetica - fontSize: 30 - align: right - text: '${mapTitle}' - items: - - !map - spacingAfter: 30 - width: 1760 - height: 1932 - - !scalebar - type: bar - maxSize: 100 - barBgColor: white - fontSize: 8 - align: right - - !text - text: '${comment}' - spacingAfter: 30 - - !text - font: Helvetica - fontSize: 9 - align: right - text: '1:${scale} ${now MM.dd.yyyy}' - - !legends - align: left - maxIconWidth: 32 - maxIconHeight: 32 - footer: *commonFooter + - !map + absoluteX: 45 + absoluteY: 510 + spacingAfter: 200 + width: 540 + height: 480 + align: left