<%-- $HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/apps/igeoportal-standard/branches/2.5_testing/modules/csw/csw_dsearch_area.jsp $ --%>
<%--
 This file is part of deegree, http://deegree.org/
 Copyright (C) 2001-2009 by:
 - Department of Geography, University of Bonn -
 and
 - lat/lon GmbH -

 This library is free software; you can redistribute it and/or modify it under
 the terms of the GNU Lesser General Public License as published by the Free
 Software Foundation; either version 2.1 of the License, or (at your option)
 any later version.
 This library is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 details.
 You should have received a copy of the GNU Lesser General Public License
 along with this library; if not, write to the Free Software Foundation, Inc.,
 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

 Contact information:

 lat/lon GmbH
 Aennchenstr. 19, 53177 Bonn
 Germany
 http://lat-lon.de/

 Department of Geography, University of Bonn
 Prof. Dr. Klaus Greve
 Postfach 1147, 53001 Bonn
 Germany
 http://www.geographie.uni-bonn.de/deegree/

 e-mail: info@deegree.org
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="org.deegree.enterprise.control.*" %>
<%@ page import="org.deegree.portal.standard.csw.control.DetailedSearchListener" %>
<%@ page import="org.deegree.i18n.Messages" %>
<%@ page import="java.util.Locale" %>
<%
    Locale loc = request.getLocale();

    boolean ignore = false;

    String minx = "4300000";
    String miny = "5600000";
    String maxx = "5000000";
    String maxy = "6000000";
    
    RPCParameter[] params = 
        (RPCParameter[])session.getAttribute( DetailedSearchListener.SESSION_DETAILEDSEARCHPARAM );
    if ( params != null )   {
        for ( int i = 0; i < params.length; i++ ) {
            Object o = params[i].getValue();
            if ( o instanceof RPCStruct ) {
                RPCStruct struct = (RPCStruct)o;
                if ( struct.getMember( "boundingBox" ) != null )  {
                    RPCMember member = struct.getMember( "boundingBox" );
                    RPCStruct bbox = (RPCStruct)member.getValue();
                    if ( bbox != null ) {
                        if (bbox.getMember("minx") != null)  {
                            minx = bbox.getMember("minx").getValue().toString();
                        }
                        if (bbox.getMember("miny") != null)  {
                            miny = bbox.getMember("miny").getValue().toString();
                        }
                        if (bbox.getMember("maxx") != null)  {
                            maxx = bbox.getMember("maxx").getValue().toString();
                        }
                        if (bbox.getMember("maxy") != null)  {
                            maxy = bbox.getMember("maxy").getValue().toString();
                        }
                    } 
                } else {
                    ignore = true;
                }
            }
        }
    }
%>
<tr>
    <td colspan="3">
        <span class="title" style="line-height:16pt">Spatial Search Parameter</span>
    </td>
</tr>
<tr>
    <td valign="top">&nbsp;</td>
    <td valign="top" align="center"><p>Easting</p></td>
    <td valign="top" align="center"><p>Northing</p></td>
</tr>
<tr>
    <td><p>bottom left corner</p></td>
    <td align="center">
        <input type="text" size="15" maxlength="7" name="minx" style="text-align: center" value="<%out.print(minx);%>"/>&nbsp;&nbsp;
    </td>
    <td align="center">
        <input type="text" size="15" maxlength="7" name="miny" style="text-align: center" value="<%out.print(miny);%>"/>&nbsp;&nbsp;
    </td>
</tr>
<tr>
    <td><p>top right corner</p></td>
    <td align="center">
        <input type="text" size="15" maxlength="7" name="maxx" style="text-align: center" value="<%out.print(maxx);%>"/>&nbsp;&nbsp;
    </td>
    <td align="center">
        <input type="text" size="15" maxlength="7" name="maxy" style="text-align: center" value="<%out.print(maxy);%>"/>&nbsp;&nbsp;
    </td>
</tr>
<tr>
    <td>spatial search parameter</td>
    <td align="center">ignore
        <input type="checkbox" name="ignoreArea" value="ignore" <% if ( ignore ) { out.print("checked"); } %> />
    </td>
    <td align="center">
        <p>
            <a href="javascript:updateAreaValues();" class="buttonArea"><%=Messages.get( loc, "IGEO_STD_BTN_UPDATE" ) %></a>
        </p>
    </td>
</tr>
