view gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp @ 1022:28a0628b11b0

Added license file and license header. gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:15:08 +0000
parents 2444da07e487
children
line wrap: on
line source
<%--
 Copyright (c) 2010 by Intevation GmbH

 This program is free software under the LGPL (>=v2.1)
 Read the file LGPL.txt coming with the software for details
 or visit http://www.gnu.org/licenses/ if it does not exist.
--%>

<%@ 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.CommunicationKeys"%>
<%@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.util.Locale"%>
<%@page import="java.net.URLEncoder"%>
<% 
    String exceptionMsg             = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE);
    String exceptionValue           = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE);
    String target                   = "chart";
    String targetPDF                = "pdf";
    String targetSVG                = "svg";
    String targetIMG                = "img";
    SessionModel sm                 = SessionModelFactory.getInstance().getSessionModel(request);
    Locale locale                   = sm.getCurrentLocale();
    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 +"&amp;"+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('diagramOptionsContent');" class="expandableFieldset">
           <bean:message key="gnviewer.diagram.options.header.title"/>
        </legend>

        <% if (exceptionMsg != null) {%>
            <div id="chartException" class="chartException">
                '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/>
            </div>
        <%}%>

        <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do?target="+target)%>">
           <table class="static">
           <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){
               Iterator<OutputParameter> it = outputMode.getOutputParameters().iterator();
               while (it.hasNext()){
                   OutputParameter om = it.next(); %>
               <tr>
                  <td class="parameter">
                      <bean-el:message key="<%=om.getName()%>"/>
                  </td>
                  <td>
                      <%if (om.getType().equalsIgnoreCase("boolean")){
                          boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName(), locale)) : 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(), locale): om.getValue()%>"/>
                      <%}%>
                  </td>
              </tr>
           <%}%>
           </table>
           <div class="exportBar">
               <input type="image" name="target" value="chart" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>" title="<bean:message key="gnviewer.output.options.refresh.title"/>"/>
               <%}%>
                <%if (supportIMG != null) { %>
                   <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&amp;target="+target+"&amp;mode="+targetIMG+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.png.title"/>">
                        <img src="images/diagram_export.png" border="0"/></a>
                <%}%>
                <%if (supportPDF != null) { %>
                    <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&amp;target="+target+"&amp;mode="+targetPDF+parameterString+"&amp;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+"&amp;target="+target+"&amp;mode="+targetSVG+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>">
                        <img src="images/svg.png" border="0"/></a>
                <%}%>
            </div>
        </form>
    </fieldset>
</div>

http://dive4elements.wald.intevation.org