diff gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp @ 408:b5733f9f386b

Design improvements: Moved chart option panel and export actions beneath the parameterization panel on the left side. Do not render a useless 'draw' button after reaching the final state. gnv/trunk@594 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 22 Jan 2010 09:49:34 +0000
parents 9005b39c52ac
children 9602f4bffc07
line wrap: on
line diff
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp	Wed Jan 20 14:44:39 2010 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp	Fri Jan 22 09:49:34 2010 +0000
@@ -6,29 +6,22 @@
 <%@page import="java.util.Collection"%>
 <%@page import="java.util.Iterator"%>
 <%@page import="java.net.URLEncoder"%>
-<%Object diagramm = request.getAttribute("diagramm");
-SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
-if (diagramm != null){
-    String target = "chart"; 
-    String targetCSV = "csv";
-    String targetODV = "odv";
-    String targetPDF = "pdf";
-    String targetSVG = "svg";
-    String targetZIP = "zip";
-    String targetWMS = "wms";
+<%
+    // fetch diagramm parameter from request if the user clicked 'draw'
+    Object diagramm = request.getAttribute("diagramm");
+    SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+
+    String target          = "chart"; 
+    String mimeType        = null;
+    String parameterString = "";
+
     boolean supportChart = sm.getOutputMode(target) != null;
-    boolean supportCSV   = sm.getOutputMode(targetCSV) != null;
-    boolean supportODV   = sm.getOutputMode(targetODV) != null;
-    boolean supportPDF   = sm.getOutputMode(targetPDF) != null;
-    boolean supportSVG   = sm.getOutputMode(targetSVG) != null;
-    boolean supportZIP   = sm.getOutputMode(targetZIP) != null;
-    boolean supportWMS   = sm.getOutputMode(targetWMS) != null;
-    String mimeType = null;
-    String parameterString = "";
+
     if (supportChart){
-       mimeType = sm.getOutputMode(target).getMimeType();
+       mimeType                        = sm.getOutputMode(target).getMimeType();
        DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
-       Collection<OutputParameter> op = sm.getOutputMode(target).getOutputParameters();
+       Collection<OutputParameter> op  = sm.getOutputMode(target).getOutputParameters();
+
        if (op != null){
            Iterator<OutputParameter> it = op.iterator();
            while (it.hasNext()){
@@ -37,77 +30,17 @@
            }
        }
     }
-    String mimeTypePDF = null;
-    if (supportPDF) {
-       mimeTypePDF = sm.getOutputMode(targetPDF).getMimeType();
-    }
-    String mimeTypeSVG = null;
-    if (supportSVG) {
-        mimeTypeSVG = sm.getOutputMode(targetSVG).getMimeType();
-        mimeTypeSVG = URLEncoder.encode(mimeTypeSVG, "UTF-8");
-    }
-    String mimeTypeCSV = null;
-    if (supportCSV){
-        mimeTypeCSV = sm.getOutputMode(targetCSV).getMimeType();
-    }
+%> 
 
-    String mimeTypeODV = null;
-    if (supportODV){
-        mimeTypeODV = sm.getOutputMode(targetODV).getMimeType();
-    }
+<%-- show chart options if output mode 'chart' is supported --%>
+<% if (supportChart) { %>
+    <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include>
+<%}%>
 
-    String mimeTypeZIP = null;
-    if (supportZIP) {
-        mimeTypeZIP = sm.getOutputMode(targetZIP).getMimeType();
-    }
-
-    String mimeTypeWMS = null;
-    if (supportWMS) {
-        mimeTypeWMS = sm.getOutputMode(targetWMS).getMimeType();
-    }
-%>
-<div id="diagram">
-        <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
+<%-- diagramm is not null if the user clicked the 'draw' button --%>
+<%if (diagramm != null) { %>
+    <div id="diagram">
+        <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&amp;target="+target+parameterString+"&amp;uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
         <br/>
-        <div id="export">
-            <%if (supportChart) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>">
-                <img src="images/diagram_export.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportPDF) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&target="+targetPDF+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>">
-                <img src="images/pdf.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportSVG) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&target="+targetSVG+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>">
-                <img src="images/svg.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportCSV) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&target="+targetCSV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.csv.title"/>">
-                <img src="images/data_export.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportODV) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeODV+"&target="+targetODV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.odv.title"/>">
-                <img src="images/data_export.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportWMS) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeWMS+"&target="+targetWMS+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.wms.title"/>">
-                <img src="images/map_go.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportZIP) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeZIP+"&target="+targetZIP+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.zip.title"/>">
-                <img src="images/disk.png" border="0"/>
-            </a>
-            <%}%>
-        </div>
-        <%if (supportChart) { %>
-        <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp"></jsp:include>
-        <%}%>
     </div>
 <%}%>

http://dive4elements.wald.intevation.org