comparison gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp @ 30:07e9c137a2f1

Added dynamic Outputparameter Support and Outputparameter-manipulation gnv/trunk@134 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 25 Sep 2009 14:24:08 +0000
parents bba8fd97e549
children ad739da2802b
comparison
equal deleted inserted replaced
29:bba8fd97e549 30:07e9c137a2f1
1 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> 1 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
2 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> 2 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
3 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
4 <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
5 <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
6 <%@page import="java.util.Collection"%>
7 <%@page import="java.util.Iterator"%>
3 <%Object diagramm = request.getAttribute("diagramm"); 8 <%Object diagramm = request.getAttribute("diagramm");
9 SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
4 if (diagramm != null){ 10 if (diagramm != null){
5
6 String target = "chart"; 11 String target = "chart";
7 String targetCSV = "csv"; 12 String targetCSV = "csv";
8 boolean supportCSV = true; // TODO get from SessionModel 13 boolean supportChart = sm.getOutputMode(target) != null;
9 String mimeType = "image/png";// TODO: get from SessionModel SessionModelFactory.getInstance().getSessionModel(request). 14 boolean supportCSV = sm.getOutputMode(targetCSV) != null;
10 String mimeTypeCSV = "text/plain";// TODO: get from SessionModel SessionModelFactory.getInstance().getSessionModel(request). 15 String mimeType = null;
16 String parameterString = "";
17 if (supportChart){
18 mimeType = sm.getOutputMode(target).getMimeType();
19 DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
20 Collection<OutputParameter> op = sm.getOutputMode(target).getOutputParameters();
21 if (op != null){
22 Iterator<OutputParameter> it = op.iterator();
23 while (it.hasNext()){
24 OutputParameter parameter = it.next();
25 parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
26 }
27 }
28 }
29 String mimeTypeCSV = null;
30 if (supportCSV){
31 mimeTypeCSV = sm.getOutputMode(targetCSV).getMimeType();
32 }
11 %> 33 %>
12 34 <div id="diagram">
13 <div id="diagram"> 35 <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
14 <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
15 <br/> 36 <br/>
16 <div id="export"> 37 <div id="export">
17 <a href="<%=response.encodeURL("export.do?mimetype="+mimeType+"&target="+target+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>"> 38 <a href="<%=response.encodeURL("export.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>">
18 <img src="images/diagram_export.png" border="0"/> 39 <img src="images/diagram_export.png" border="0"/>
19 </a> 40 </a>
20 <%if (supportCSV) { %> 41 <%if (supportCSV) { %>
21 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&target="+targetCSV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.title"/>"> 42 <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&target="+targetCSV+"+uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.title"/>">
22 <img src="images/data_export.png" border="0"/> 43 <img src="images/data_export.png" border="0"/>
23 </a> 44 </a>
24 <%}%> 45 <%}%>
25 </div> 46 </div>
47 <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp"></jsp:include>
26 </div> 48 </div>
27 <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp"></jsp:include>
28 <%}%> 49 <%}%>

http://dive4elements.wald.intevation.org