view gnv/src/main/webapp/WEB-INF/jsp/index.jsp @ 949:11d8cc2deb92 1.0

merged doc/1.0
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:58 +0200
parents 5f29bfeb61bd
children a0e6566cd111
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="java.util.Collection"%>
<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%>
<%@page import="de.intevation.gnv.action.CommunicationKeys"%>
<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
<%@page import="java.util.Iterator"%>
<%  
    String exception       = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID);
    SessionModel sm        = SessionModelFactory.getInstance().getSessionModel(request);
    Object ui              = request.getAttribute("ui");
    Object staticui        = request.getAttribute("staticui");
    Object chart           = request.getAttribute("chart");
    Object statistic       = request.getAttribute("statistic");
    Object histogram       = request.getAttribute("histogram");
    Object wms             = request.getAttribute("wms");
    Object wms_published   = request.getAttribute("wms_published");
    String serverPath  = (String) request.getAttribute("mapserver");
    String mapfilePath = (String) request.getAttribute("mapfile");
    String layerName   = (String) request.getAttribute("layer");
    String timeToLive  = (String) request.getAttribute("ttl");
    boolean furthertargets = true;

    if (chart == null && statistic == null && histogram == null && wms == null) {
        boolean supportChart = sm.getOutputMode("chart") != null;
        if (supportChart) {
            chart = "true";
        }
    }

    Object furthertargetsObject = request.getAttribute("furthertargets");
    if (furthertargetsObject != null){
        furthertargets = ((Boolean)furthertargetsObject).booleanValue();
    }

    Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID);
    exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null);
    exceptionMessage = (exceptionMessage != null && exceptionMessage.toString().endsWith(".") ? exceptionMessage.toString().substring(0,exceptionMessage.toString().length()-1) : exceptionMessage);

    boolean showmapviewercallBody = request.getAttribute("MAPVIEWERCALL") != null;

    String exceptionProject = (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_PROJECT);
    exceptionProject        = exceptionProject != null ? exceptionProject.toLowerCase() : null;
    exceptionProject        = exceptionProject != null ? exceptionProject.replaceAll(" ", ".") : null;
%>

    <%-- div container for project loading/saving and error messages related to this --%>
    <div id="project"> 
        <table width="100%">
            <tr>
                <td style="float: left; width: 225px;">
                    <a href="<%=response.encodeURL("store.do")%>"><bean:message key="gnviewer.project.save"/></a>
                    |
                    <a href="#" onclick="toggle('projectload');"><bean:message key="gnviewer.project.load"/></a>
                </td>
                <td style="float: left; width: 400px;">
                    <div id="projectload">
                        <form id="loadProject" action="<%=response.encodeURL("load.do")%>" method="post" enctype="multipart/form-data">
                            <div id="browseDiv"><input type="file"   name="document"     accept="application/xml"/></div>
                            <div id="loadDiv"><input type="image" src="<bean:message key="gnviewer.project.load.button.src"/>"/></div>
                        </form>
                    </div>
                </td>
            </tr>
        </table>
        <%if (exceptionProject != null) {%>
            <div class="projectException">
                <bean:message key="<%=exceptionProject%>"/>
                <br/>
                <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>">
                    <bean:message key="application.reload"/>
                </a>
            </div>
        <%}%>
         <%if (showmapviewercallBody){ %>
            <jsp:include page="includes/display_mapviewercall_inc.jsp" />
        <%}%>
    </div>

    <table style="width:100%;">
        <tr id="contentRow">
            <td id="parameterColumn">
                <%-- the parameter panel is following --%>
                <div id="parameterPanel">
                <%if (staticui == null){ %>
                    <jsp:include page="includes/display_fis_inc.jsp"></jsp:include>
                <%} else {%>
                    <div class="down">
                        <fieldset>
                            <legend><bean:message key="gnviewer.history.title"/></legend>
                            <%=staticui.toString()%>
                        </fieldset>
                    </div>
                <%}%>

                <%-- render the dynamic part to feed the state and advance to the next state --%>
                <%if (ui != null){%> 
                    <div id="timeseriesfilter"> 
                        <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>" method="post">
                           <fieldset>

                            <%-- error message, if user input was not valid --%>
                            <%if (exception != null) {%>
                                <div class="inputException"><%=exception%></div>
                            <%}%>
                            <%=ui != null ? ui.toString().replaceAll("&nbsp;", "") : "" %>

                            <%if(furthertargets){%>
                                <br>
                                <input style="margin-top: 5px;" type="image" src="<bean:message key="gnviewer.select.button.src"/>"/>
                            <%}%>
                            </fieldset>
                        </form>
                    </div>
                <%}%>

                    <%-- render export options if existing for this state --%>
                    <jsp:include page="includes/display_export_inc.jsp"></jsp:include>

                    <%if (chart != null) {%>
                        <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include>
                    <%}%>


                    <%if (histogram != null) {%>
                        <jsp:include page="/WEB-INF/jsp/includes/display_histogram_options_inc.jsp"></jsp:include>
                    <%}%>

                    <%-- render wms options --%>
                    <%if (wms != null) {%>
                        <jsp:include page="/WEB-INF/jsp/includes/display_wms_options_inc.jsp"></jsp:include>
                    <%}%>
                </div>
            </td>
            <td id="contentColumn">
                 <%if (exceptionMessage != null){ %>
                    <div class="errormsg" id="load_error">
                        <bean-el:message key="<%=exceptionMessage.toString()%>"/>
                        <p class="reload">
                            <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>">
                                <bean:message key="application.reload"/>
                            </a>
                        </p>
                    </div>
                 <%}%>
                <%if (chart != null) {%>
                <%-- render chart options if existing for this state --%>
                <jsp:include page="includes/display_diagramm_inc.jsp"></jsp:include>
                <%}%>

                <%-- render statistic --%>
                <%if (statistic != null) {%>
                    <jsp:include page="includes/display_diagramm_statistics_inc.jsp"></jsp:include>
                <%}%>

                <%-- render histogram --%>
                <%if (histogram != null) {%>
                    <jsp:include page="includes/display_histogram_inc.jsp"></jsp:include>
                <%}%>

                <%-- render wms layer --%>
                <%if (wms_published != null) {%>
                    <div class="outerMap">
                        <div id="wms">
                            <table>
                                <tr>
                                    <td class="parameter"><bean:message key="gnviewer.wms.server.path"/>:</td>
                                    <td class="wmsvalue"><%=serverPath%>?SERVICE=WMS&amp;REQUEST=GetCapabilities</td>
                                </tr>
                                <tr>
                                    <td class="parameter"><bean:message key="gnviewer.wms.server.layer"/>:</td>
                                    <td class="wmsvalue"><%=layerName%></td>
                                </tr>
                                <tr>
                                    <td class="parameter"><bean:message key="gnviewer.wms.layer.ttl"/>:</td>
                                    <td class="wmsvalue"><%=timeToLive%></td>
                                </tr>
                            </table>
                        </div>
                        <div id="map"></div>
                    </div>
                <%}%>
            </td>
        </tr>
    </table>

http://dive4elements.wald.intevation.org