Mercurial > dive4elements > gnv-client
view gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp @ 575:a634d5ee961d
Added checkboxes for selecting the field which is used to adjust the number of bins in histogram charts.
gnv/trunk@707 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 24 Feb 2010 14:38:36 +0000 |
parents | bd67164cf28b |
children | 2f3d885fed09 |
line wrap: on
line source
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %> <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%> <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%> <%@page import="de.intevation.gnv.artifactdatabase.objects.ExportMode"%> <%@page import="java.util.Collection"%> <%@page import="java.util.Iterator"%> <%@page import="java.net.URLEncoder"%> <% String target = "histogram"; String targetPDF = "pdf"; String targetSVG = "svg"; String targetIMG = "img"; SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request); OutputMode outputMode = sm.getOutputMode(target); DiagrammOptions diagrammOptions = sm.getDiagrammOptions(); boolean useDiagrammOptions = diagrammOptions != null; ExportMode supportIMG = outputMode.getExportMode(targetIMG); ExportMode supportPDF = outputMode.getExportMode(targetPDF); ExportMode supportSVG = outputMode.getExportMode(targetSVG); String mimeType = outputMode.getMimeType(); String parameterString = ""; Collection<OutputParameter> op = outputMode.getOutputParameters(); if (op != null){ Iterator<OutputParameter> it = op.iterator(); while (it.hasNext()){ OutputParameter parameter = it.next(); parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue()); } } String mimeTypeIMG = null; if (supportIMG != null) { mimeTypeIMG = supportIMG.getMimeType(); } String mimeTypePDF = null; if (supportPDF != null) { mimeTypePDF = supportPDF.getMimeType(); } String mimeTypeSVG = null; if (supportSVG != null) { mimeTypeSVG = supportSVG.getMimeType(); mimeTypeSVG = URLEncoder.encode(mimeTypeSVG, "UTF-8"); } %> <div id="diagramOptionsContent"> <fieldset> <legend onmousedown="displayDiv('histogramOptionsContent');" class="expandableFieldset"> <bean:message key="gnviewer.histogram.options.header.title"/> </legend> <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do?target="+target)%>"> <table> <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){ Iterator<OutputParameter> it = outputMode.getOutputParameters().iterator(); while (it.hasNext()){ OutputParameter om = it.next(); String diaOpts = null; if (diagrammOptions != null) { diaOpts = request.getParameter("bintype"); }%> <tr> <td> <%if (om.getName().equals("bincount")) { String check = ""; if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) { check = ""; } else { check = "checked=\"checked\""; }%> <input type="checkbox" <%= check %> name="bintype" value="bincount" id="checkCount" onClick="toggleBinType('checkWidth')"> </input> <%}%> <%if (om.getName().equals("binwidth")) { String check = ""; if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) { check = "checked=\"checked\""; } else if (diaOpts == null) { check = ""; }%> <input type="checkbox" <%= check %> name="bintype" value="binwidth" id="checkWidth" onClick="toggleBinType('checkCount')"> </input> <%}%> </td> <td> <bean-el:message key="<%=om.getName()%>"/> </td> <td> <%if (om.getType().equalsIgnoreCase("boolean")){ boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName())) : om.getValue().equalsIgnoreCase("true"); %> <input type="checkbox" name="<%=om.getName() %>" <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/> <%}else{%> <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName()): om.getValue()%>"/> <%}%> </td> </tr> <%}%> </table> <input type="image" name="target" value="histogram" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>"/> <%}%> <%if (supportIMG != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&target="+target+"&mode="+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 != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&target="+target+"&mode="+targetPDF+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>"> <img src="images/pdf.png" border="0"/> </a> <%}%> <%if (supportSVG != null) { %> <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&target="+target+"&mode="+targetSVG+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>"> <img src="images/svg.png" border="0"/> </a> <%}%> </form> </fieldset> </div>