<%-- $HeadURL: svn+ssh://jwilden@svn.wald.intevation.org/deegree/apps/igeoportal-standard/branches/2.5_testing/modules/csw/csw_dsearch_time.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" %>
<%
    RPCParameter[] params = (RPCParameter[])session.getAttribute( DetailedSearchListener.SESSION_DETAILEDSEARCHPARAM );
    RPCStruct values = null;
    String startYear = "";
    String startMonth = "";
    String startDay = "";
    String endYear = "";
    String endMonth = "";
    String endDay = "";
    if (params != null)   {
        for ( int i = 0; i < params.length; i++ ) {
            Object o = params[i].getValue();
            if ( o instanceof RPCStruct ) {
                values = (RPCStruct)o;
                if ( values.getMember("RPC_DATEFROM") != null ) {
                    RPCMember start = values.getMember("RPC_DATEFROM");
                    RPCStruct starttime = (RPCStruct)start.getValue();
                    if ( starttime.getMember("RPC_YEAR") != null ) {
                        startYear = (String)starttime.getMember("RPC_YEAR").getValue();
                    }
                    if ( starttime.getMember("RPC_MONTH") != null )  {
                        startMonth = (String)starttime.getMember("RPC_MONTH").getValue();
                    }
                    if ( starttime.getMember("RPC_DAY") != null ) {
                        startDay = (String)starttime.getMember("RPC_DAY").getValue();
                    }
                }
                if ( values.getMember("RPC_DATETO") != null ) {
                    RPCMember end = values.getMember("RPC_DATETO");
                    RPCStruct endtime = (RPCStruct)end.getValue();
                    if ( endtime.getMember("RPC_YEAR") != null ) {
                        endYear = (String)endtime.getMember("RPC_YEAR").getValue();
                    }
                    if ( endtime.getMember("RPC_MONTH") != null ) {
                        endMonth = (String)endtime.getMember("RPC_MONTH").getValue();
                    }
                    if ( endtime.getMember("RPC_DAY") != null ) {
                        endDay = (String)endtime.getMember("RPC_DAY").getValue();
                    }
                }
            }
        }
    }
%>
<tr>
    <td colspan="2">
        <span class="title" style="line-height:16pt">Temporal Search Parameter</span>
    </td>
</tr>
<tr>
     <td>
        <p>Date (from) [yyyy-mm-dd]</p>
        <input type="text" size="4" maxlength="4" name="datefromyear" value="<%out.print(startYear);%>" />&nbsp;
        <input type="text" size="2" maxlength="2" name="datefrommonth" value="<%out.print(startMonth);%>" />&nbsp;
        <input type="text" size="2" maxlength="2" name="datefromday" value="<%out.print(startDay);%>" />&nbsp;
    </td>
    <td>
        <p>Date (to) [yyyy-mm-dd]</p>
        <input type="text" size="4" maxlength="4" name="datetoyear" value="<%out.print(endYear);%>" />&nbsp;
        <input type="text" size="2" maxlength="2" name="datetomonth" value="<%out.print(endMonth);%>" />&nbsp;
        <input type="text" size="2" maxlength="2" name="datetoday" value="<%out.print(endDay);%>" />&nbsp;
    </td>
</tr>
