Project

General

Profile

« Previous | Next » 

Revision 5544

removing unused search pages (leftover from 'default' skin copy)

View differences:

lib/style/skins/semtools/advancedsearchforward.jsp
1
<%@ page language="java"%>
2

  
3
<!--
4
/**
5
  *  '$RCSfile$'
6
  *      Authors:     Duane Costa
7
  *      Copyright:   2005 University of New Mexico and
8
  *                   Regents of the University of California and the
9
  *                   National Center for Ecological Analysis and Synthesis
10
  *      For Details: http://www.nceas.ucsb.edu/
11
  *
12
  *   '$Author$'
13
  *     '$Date$'
14
  * '$Revision$'
15
  * 
16
  * This program is free software; you can redistribute it and/or modify
17
  * it under the terms of the GNU General Public License as published by
18
  * the Free Software Foundation; either version 2 of the License, or
19
  * (at your option) any later version.
20
  *
21
  * This program is distributed in the hope that it will be useful,
22
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
  * GNU General Public License for more details.
25
  *
26
  * You should have received a copy of the GNU General Public License
27
  * along with this program; if not, write to the Free Software
28
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
  *
30
  */
31
-->
32

  
33
<jsp:useBean id="advancedSearchBean" 
34
             class="edu.ucsb.nceas.metacat.advancedsearch.AdvancedSearchBean"
35
             scope="request">
36
  <jsp:setProperty name="advancedSearchBean" property="*" />
37
</jsp:useBean>
38
  
39
<jsp:forward page="/advancedSearchServlet" />
40 0

  
lib/style/skins/semtools/index_advanced.jsp
1
<%@ page    language="java" %>
2
<% 
3
 /**
4
  *  '$RCSfile$'
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *   '$Author$'
10
  *     '$Date$'
11
  * '$Revision$'
12
  * 
13
  * This program is free software; you can redistribute it and/or modify
14
  * it under the terms of the GNU General Public License as published by
15
  * the Free Software Foundation; either version 2 of the License, or
16
  * (at your option) any later version.
17
  *
18
  * This program is distributed in the hope that it will be useful,
19
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
  * GNU General Public License for more details.
22
  *
23
  * You should have received a copy of the GNU General Public License
24
  * along with this program; if not, write to the Free Software
25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
  *
27
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
  * convert an XML file showing the resultset of a query
29
  * into an HTML format suitable for rendering with modern web browsers.
30
  */
31
%>
32
<%@ include file="settings.jsp"%>
33
<%@ include file="session_vars.jsp"%>
34
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
35

  
36
<html>
37

  
38
<head>
39
<title>Metacat Data Catalog </title>
40
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
41
	<link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/semtools/semtools.css">
42
	<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js"></script>
43
	<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
44
</head>
45

  
46
<body>
47
  <script language="javascript">
48
	  insertTemplateOpening("<%=CONTEXT_URL%>");
49
	  insertAdvancedSearchBox("<%=CONTEXT_URL%>");
50
      insertTemplateClosing("<%=CONTEXT_URL%>");
51
  </script>
52
</body>
53

  
54
</html>
55 0

  
lib/style/skins/semtools/include_map.jsp
1
<%@ page     language="java" %>
2
<!--
3
/**
4
  *  '$RCSfile$'
5
  *      Authors:     Matthew Perry
6
  *      Copyright:   2005 University of New Mexico and
7
  *                   Regents of the University of California and the
8
  *                   National Center for Ecological Analysis and Synthesis
9
  *      For Details: http://www.nceas.ucsb.edu/
10
  *
11
  *   '$Author$'
12
  *     '$Date$'
13
  * '$Revision$'
14
  * 
15
  * This program is free software; you can redistribute it and/or modify
16
  * it under the terms of the GNU General Public License as published by
17
  * the Free Software Foundation; either version 2 of the License, or
18
  * (at your option) any later version.
19
  *
20
  * This program is distributed in the hope that it will be useful,
21
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
  * GNU General Public License for more details.
24
  *
25
  * You should have received a copy of the GNU General Public License
26
  * along with this program; if not, write to the Free Software
27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
  *
29
  */
30
-->
31
<%@ include file="settings.jsp"%>
32
<%@ include file="session_vars.jsp"%>
33
<!-- *********************** START Map ************************* -->
34
<html>
35
<head>
36
  <title>Metacat Data Catalog Map</title>
37
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
38
  <link href="<%=STYLE_SKINS_URL%>/semtools/semtools.css" rel="stylesheet" type="text/css">
39

  
40
  <script language="javascript" 
41
    type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js">
42
  </script>
43
</head>
44
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
45
  <table width="750px" align="center" cellspacing="0" cellpadding="0" >
46
    <tr> 
47
      </td>
48
      <td class="sectionheader">
49
        Data Catalog Map
50
      </td>
51
    </tr>
52
    <tr>       
53
      <td colspan="3">
54
        <table width="100%" cellspacing="0" cellpadding="0" border="0" class="subpanel">
55
          <tr><td> 
56
           <iframe scrolling="no" frameborder="0" width="750" height="520" src="<%=STYLE_COMMON_URL%>/spatial_templates/spatial1/map.html"> You need iframe support </iframe>
57
          </td></tr>
58
         </table>
59
      </td>
60
    </tr>
61
  </table>
62
</body>
63
</html>
64

  
65

  
66 0

  
lib/style/skins/semtools/include_searchbox.jsp
1
<%@ page     language="java" %>
2
<!--
3
/**
4
  *  '$RCSfile$'
5
  *      Authors: Matt Jones, CHad Berkley
6
  *    Copyright: 2000 Regents of the University of California and the
7
  *               National Center for Ecological Analysis and Synthesis
8
  *  For Details: http://www.nceas.ucsb.edu/
9
  *
10
  *   '$Author$'
11
  *     '$Date$'
12
  * '$Revision$'
13
  * 
14
  * This program is free software; you can redistribute it and/or modify
15
  * it under the terms of the GNU General Public License as published by
16
  * the Free Software Foundation; either version 2 of the License, or
17
  * (at your option) any later version.
18
  *
19
  * This program is distributed in the hope that it will be useful,
20
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
  * GNU General Public License for more details.
23
  *
24
  * You should have received a copy of the GNU General Public License
25
  * along with this program; if not, write to the Free Software
26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
  *
28
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
29
  * convert an XML file showing the resultset of a query
30
  * into an HTML format suitable for rendering with modern web browsers.
31
  */
32
-->
33
<%@ include file="settings.jsp"%>
34
<%@ include file="session_vars.jsp"%>
35
<!-- *********************** START SEARCHBOX TABLE ************************* -->
36
<html>
37
<head>
38
  <title>Metacat Data Catalog Search Page</title>
39
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
40
  <link href="<%=STYLE_SKINS_URL%>/semtools/semtools.css" rel="stylesheet" type="text/css">
41
  <script language="javascript" 
42
    type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js">
43
  </script>
44
  <script language="javascript" type="text/javascript">
45
    function trim(stringToTrim) {
46
      return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
47
    }
48
    function allowSearch(formObj) {
49
      var canSearch = true;
50
      var searchString = trim(formObj.elements["anyfield"].value);
51
      if (searchString=="") {
52
        if (confirm("Show *all* data in the Catalog?\n(this may take some time!)            ")) {
53
	      formObj.elements["anyfield"].value = "%";
54
	      canSearch = true;
55
	      } else {
56
	        formObj.elements["anyfield"].focus();
57
	        canSearch = false;
58
	      }
59
      } 
60
      return canSearch;
61
    }
62
    function keywordSearch(formObj, searchKeyword) {
63

  
64
       var searchString = trim(searchKeyword);
65
  
66
        if (searchString=="") searchString="%";
67
  
68
        formObj.anyfield.value=searchString;
69

  
70
        if(checkSearch(formObj)){
71
             formObj.submit();
72
       }
73
       return true;
74
    }
75
    function checkSearch(submitFormObj) {
76
                var checkBox = document.getElementById("searchAll");
77
                var searchBox = document.getElementById("searchBox");
78
                var searchString = trim(searchBox.value);
79

  
80
                if (searchString=="") {
81
                        if (confirm("Show *all* data in the KNB?")) {
82
          			searchString = "%";
83
        		} else {
84
          			return false;
85
        		}		
86
                }
87

  
88
                //if(document.forms[0].radios[0].checked){
89
		if(!checkBox.checked){
90
                        if(searchString!="%"){
91
                                searchBox.name = "title";
92
                                searchBox.id = "searchBox";
93

  
94
                                submitFormObj.surName.value = searchString;
95
                                submitFormObj.givenName.value = searchString;
96
                                submitFormObj.keyword.value = searchString;
97
                                submitFormObj.organizationName.value = searchString;
98
                                submitFormObj.para.value = searchString;
99
                                submitFormObj.geographicDescription.value = searchString;
100
                                submitFormObj.literalLayout.value = searchString;
101
                                submitFormObj.operator.value="UNION";
102
                                var abs = document.getElementById("abstract");
103
                                abs.value=searchString;
104
                        } else {
105
                                searchBox.name = "anyfield";
106
                                searchBox.id = "searchBox";
107
                                searchBox.value = "%";
108

  
109
                                submitFormObj.surName.value = "";
110
                                submitFormObj.givenName.value = "";
111
                                submitFormObj.keyword.value = "";
112
                                submitFormObj.organizationName.value = "";
113
                                submitFormObj.para.value = "";
114
                                submitFormObj.geographicDescription.value = "";
115
                                submitFormObj.literalLayout.value = "";
116
                                submitFormObj.operator.value="INTERSECT";
117
                                var abs = document.getElementById("abstract");
118
                                abs.value="";
119

  
120
			 }
121
                } else {
122
                        searchBox.name = "anyfield";
123
                        searchBox.id = "searchBox";
124

  
125
                        submitFormObj.surName.value = "";
126
                        submitFormObj.givenName.value = "";
127
                        submitFormObj.keyword.value = "";
128
                        submitFormObj.organizationName.value = "";
129
                        submitFormObj.para.value = "";
130
                        submitFormObj.geographicDescription.value = "";
131
                        submitFormObj.literalLayout.value = "";
132
                        submitFormObj.operator.value="INTERSECT";
133
                        var abs = document.getElementById("abstract");
134
                        abs.value="";
135
                }
136

  
137

  
138
                var radioInput = document.getElementsByName("search");
139
		       radioInput[0].name = "";
140

  
141
                return true;
142
        }
143
  </script>
144
</head>
145

  
146
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
147
  <table width="750px" align="center" cellspacing="0" cellpadding="0">
148
    <tr> 
149
      </td>
150
      <td  class="sectionheader" width="750px" >
151
        search for data 
152
      </td>
153
    </tr>
154
    <tr> 
155
      <td colspan="3">
156
        <table width="100%" border="0" cellpadding="0" cellspacing="0" 
157
          class="subpanel">
158
          <tr> 
159
            <td colspan="2"></td>
160
          </tr>
161
          <tr valign="baseline"> 
162
            <td colspan="2">
163
              <form action="<%=SERVLET_URL%>" name="searchForm" method="post" 
164
                target="_top" onSubmit="return checkSearch(this);">
165
                <%=sessionidField%>
166
                <%=SIMPLE_SEARCH_METACAT_POST_FIELDS%>
167
				<input type="hidden" name="returndoctype" value="http://ecoinformatics.org/sms/annotation.0.9" />
168
				<input type="hidden" name="returnfield" value="@id"/>
169
				<input type="hidden" name="returnfield" value="@emlPackage"/>
170
				<input type="hidden" name="returnfield" value="entity/@id"/>
171
                <input type="hidden" name="organizationName">
172
  			    <input type="hidden" name="surName">
173
  			    <input type="hidden" name="givenName">
174
  			    <input type="hidden" name="keyword">
175
  			    <input type="hidden" name="para">
176
  			    <input type="hidden" name="geographicDescription">
177
  			    <input type="hidden" name="literalLayout">
178
  			    <input type="hidden" name="abstract/para" id="abstract">
179
                <table width="100%" border="0" cellpadding="5" cellspacing="0">
180
                  <tr> 
181
                    <td width="94" rowspan="2" align="left" valign="top">
182
                      <img src="<%=relativeRoot%>/images/search.jpg" 
183
                        width="94" height="80">
184
                    </td>
185
                    <td colspan="2" valign="middle" class="text_example">
186
                      <p> 
187
                        <%= loginStatus %> &nbsp;
188
                        (<a href="<%=STYLE_SKINS_URL%>/semtools/index.jsp#loginanchor" 
189
                          target="_top"><%=loginButtonLabel%></a>).&nbsp; 
190
                        You may search the data catalog without being logged 
191
                        into your account, but will have access only to 
192
                        &quot;public&quot; data (see &quot;login &amp; 
193
                        registration&quot;)
194
                      </p>
195
                      <p>
196
                        Enter a search phrase (e.g. biodiversity) to search 
197
                        for data sets in the data catalog, or simply browse 
198
                        by category using the links below.
199
                      </p>
200
                    </td>
201
                  </tr>
202
                  <tr valign="middle"> 
203
                    <td align="right" class="searchcat"> 
204
                      <input type="text" name="anyfield" size="30" 
205
                        maxlength="200" id="searchBox">&nbsp;&nbsp;
206
                    </td>
207
                    <td width="365" align="left" class="searchcat"> 
208
                      <input type="submit" value="Search Data Catalog">
209
                      &nbsp;&nbsp;&nbsp;
210
                      
211
                      <a target="_top" 
212
                        href="<%=STYLE_SKINS_URL%>/semtools/index_advanced.jsp"> 
213
                          &raquo;&nbsp;advanced&nbsp;search&nbsp;&laquo;</a>
214
                      
215
                    </td>
216
                  </tr>
217

  
218
                </table>
219
              </form>
220
            </td>
221
          </tr>
222
         <tr valign="baseline" >
223
         
224
             <td colspan="2">
225
                 <table width="100%" border="0" cellpadding="0" cellspacing="0" >
226
                   <from>
227
		            <tr>
228
		               <td width="105px" >		    
229
			            </td>
230
			            <td >
231
			                 <input name="search" type="radio" checked><span class="text_plain"> Search Title, Abstract, Keywords, Personnel (Quicker)</span></input>
232
		               </td>
233
		           </tr>
234
		            <tr>
235
		                 <td width="105px">		    
236
			              </td>
237
			              <td >
238
			                    <input name="search" type="radio" id="searchAll"><span class="text_plain"> Search all fields (Slower)</span></input>
239
		                 </td>
240
		           </tr>
241
		        </form>
242
		      </table>
243
             </td>
244
		  </tr>
245
	  
246
<%
247
/*
248
US Geography
249
------------
250
Northeast, Southeast, South, Midwest, Northwest, Southwest, Pacific Ocean, Atlantic Ocean, 
251
Great Lakes, (could also list states here)
252
*/
253
%>
254
          <tr> 
255
            <td width="375" class="searchcat">Taxonomy</td>
256
            <td width="365" class="searchcat">Habitat</td>
257
          </tr>
258
          <tr> 
259
            <td width="375" class="searchsubcat">
260
              <a href="#" onClick="keywordSearch(document.searchForm, 'plant')" class="searchsubcat">Plant,</a> 
261
              <a href="#" onClick="keywordSearch(document.searchForm, 'invertebrate')" class="searchsubcat">Invertebrate,</a> 
262
              <a href="#" onClick="keywordSearch(document.searchForm, 'mammal')" class="searchsubcat">Mammal,</a> 
263
              <a href="#" onClick="keywordSearch(document.searchForm, 'bird')" class="searchsubcat">Bird,</a> 
264
              <a href="#" onClick="keywordSearch(document.searchForm, 'reptile')" class="searchsubcat">Reptile,</a> 
265
              <a href="#" onClick="keywordSearch(document.searchForm, 'amphibian')" class="searchsubcat">Amphibian,</a>
266
              <a href="#" onClick="keywordSearch(document.searchForm, 'fungi')" class="searchsubcat">Fungi,</a>
267
              <a href="#" onClick="keywordSearch(document.searchForm, 'microbe')" class="searchsubcat">Microbe,</a>
268
              <a href="#" onClick="keywordSearch(document.searchForm, 'virus')" class="searchsubcat">Virus</a>
269
            </td>
270
            <td width="365" class="searchsubcat">
271
              <a href="#" onClick="keywordSearch(document.searchForm, 'alpine')" class="searchsubcat">Alpine,</a> 
272
              <a href="#" onClick="keywordSearch(document.searchForm, 'aquatic')" class="searchsubcat">Aquatic,</a> 
273
              <a href="#" onClick="keywordSearch(document.searchForm, 'beach')" class="searchsubcat">Beach,</a> 
274
              <a href="#" onClick="keywordSearch(document.searchForm, 'benthic')" class="searchsubcat">Benthic,</a> 
275
              <a href="#" onClick="keywordSearch(document.searchForm, 'desert')" class="searchsubcat">Desert,</a> 
276
              <a href="#" onClick="keywordSearch(document.searchForm, 'estuar')" class="searchsubcat">Estuary,</a>
277
              <a href="#" onClick="keywordSearch(document.searchForm, 'forest')" class="searchsubcat">Forest,</a>
278
              <a href="#" onClick="keywordSearch(document.searchForm, 'grassland')" class="searchsubcat">Grassland,</a>
279
              <a href="#" onClick="keywordSearch(document.searchForm, 'marine')" class="searchsubcat">Marine,</a>
280
              <a href="#" onClick="keywordSearch(document.searchForm, 'montane')" class="searchsubcat">Montane,</a>
281
              <a href="#" onClick="keywordSearch(document.searchForm, 'ocean')" class="searchsubcat">Oceanic,</a>
282
              <a href="#" onClick="keywordSearch(document.searchForm, 'savanna')" class="searchsubcat">Savanna,</a>
283
              <a href="#" onClick="keywordSearch(document.searchForm, 'shrubland')" class="searchsubcat">Shrubland,</a>
284
              <a href="#" onClick="keywordSearch(document.searchForm, 'terrestrial')" class="searchsubcat">Terrestrial,</a>
285
              <a href="#" onClick="keywordSearch(document.searchForm, 'tundra')" class="searchsubcat">Tundra,</a>
286
              <a href="#" onClick="keywordSearch(document.searchForm, 'urban')" class="searchsubcat">Urban,</a>
287
              <a href="#" onClick="keywordSearch(document.searchForm, 'wetland')" class="searchsubcat">Wetland</a>
288
            </td>
289
          </tr>
290
          <tr> 
291
            <td width="375">&nbsp;</td>
292
            <td width="365">&nbsp;</td>
293
          </tr>
294
        </table>
295
      </td>
296
    </tr>
297
  </table>
298
</body>
299
<!-- ************************* END SEARCHBOX TABLE ************************* -->
300 0

  
lib/style/skins/semtools/advancedsearchresults.jsp
1
<%@ page language="java"%>
2

  
3
<!--
4
/**
5
  *  '$RCSfile$'
6
  *      Authors:     Duane Costa
7
  *      Copyright:   2005 University of New Mexico and
8
  *                   Regents of the University of California and the
9
  *                   National Center for Ecological Analysis and Synthesis
10
  *      For Details: http://www.nceas.ucsb.edu/
11
  *
12
  *   '$Author$'
13
  *     '$Date$'
14
  * '$Revision$'
15
  * 
16
  * This program is free software; you can redistribute it and/or modify
17
  * it under the terms of the GNU General Public License as published by
18
  * the Free Software Foundation; either version 2 of the License, or
19
  * (at your option) any later version.
20
  *
21
  * This program is distributed in the hope that it will be useful,
22
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
  * GNU General Public License for more details.
25
  *
26
  * You should have received a copy of the GNU General Public License
27
  * along with this program; if not, write to the Free Software
28
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
  *
30
  */
31
-->
32

  
33
<%
34
    String advancedSearchResults = (String) request.getAttribute("result");
35
%>
36

  
37
<%= advancedSearchResults %>
38 0

  
lib/style/skins/semtools/include_advancedsearch.jsp
1
<%@ page     language="java" %>
2
<!--
3
/**
4
  *  '$RCSfile$'
5
  *      Authors:     Duane Costa
6
  *      Copyright:   2005 University of New Mexico and
7
  *                   Regents of the University of California and the
8
  *                   National Center for Ecological Analysis and Synthesis
9
  *      For Details: http://www.nceas.ucsb.edu/
10
  *
11
  *   '$Author$'
12
  *     '$Date$'
13
  * '$Revision$'
14
  * 
15
  * This program is free software; you can redistribute it and/or modify
16
  * it under the terms of the GNU General Public License as published by
17
  * the Free Software Foundation; either version 2 of the License, or
18
  * (at your option) any later version.
19
  *
20
  * This program is distributed in the hope that it will be useful,
21
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
  * GNU General Public License for more details.
24
  *
25
  * You should have received a copy of the GNU General Public License
26
  * along with this program; if not, write to the Free Software
27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
  *
29
  */
30
-->
31
<%@ include file="settings.jsp"%>
32
<%@ include file="session_vars.jsp"%>
33
<!-- *********************** START SEARCHBOX TABLE ************************* -->
34
<html>
35
<head>
36
  <title>Metacat Data Catalog Advanced Search Page</title>
37
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
38
  <link href="<%=STYLE_SKINS_URL%>/semtools/semtools.css" rel="stylesheet" type="text/css">
39

  
40
  <script language="javascript" 
41
    type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js">
42
  </script>
43

  
44
  <script language="javascript" type="text/javascript">
45

  
46
      function trim(stringToTrim) {
47
        return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
48
      }
49

  
50
      function submitRequest(form) {
51
        var canSearch = true;
52
        var x_range = document.map.get_x_range();
53
        var y_range = document.map.get_y_range();
54
        var x_index = x_range.indexOf(' ');
55
        var y_index = y_range.indexOf(' ');
56
        var x_length = x_range.length;
57
        var y_length = y_range.length;
58
        var x_lo = x_range.substring(0, x_index);
59
        var x_hi = x_range.substring(x_index + 1, x_length);
60
        var y_lo = y_range.substring(0, y_index);
61
        var y_hi = y_range.substring(y_index + 1, y_length);
62

  
63
        if (trim(form.subjectValue.value) == "" &&
64
            trim(form.creatorSurname.value) == "" &&
65
            trim(form.creatorOrganization.value) == "" &&
66
            trim(form.locationName.value) == "" &&
67
            (x_range == "-180.0 180.0") &&
68
            (y_range == "-90.0 90.0") &&            
69
            trim(form.taxon.value) == "" &&
70
            form.siteValue.value == "ALLSITES"
71
           ) {              
72
          canSearch = 
73
             confirm("Show *all* data in the catalog?\n(This may take some time!)");
74
        }
75

  
76
        if (canSearch) {        
77
          // Re-initialize the hidden form values prior to submitting
78
          form.northBound.value = "";
79
          form.southBound.value = "";
80
          form.eastBound.value = "";
81
          form.westBound.value = "";
82

  
83
          if ((x_range != "-180.0 180.0") || (y_range != "-90.0 90.0")) {     
84
            form.northBound.value = y_hi;
85
            form.southBound.value = y_lo;
86
            form.eastBound.value = x_hi;
87
            form.westBound.value = x_lo;
88
          }
89
          
90
          return(validateAdvancedSearchForm(form));
91
        }
92
        else {
93
          return false;
94
        }
95
      }
96
  </script>
97
</head>
98

  
99
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
100
  <table width="750px" align="center" cellspacing="0" cellpadding="0">
101
    <tr> 
102
      <td width="10" align="right" valign="top">
103
        <img src="<%=STYLE_SKINS_URL%>/semtools/images/panelhead_bg_lcorner.gif" 
104
          width="10" height="21">
105
      </td>
106
      <td class="sectionheader">
107
        advanced search 
108
      </td>
109
      <td width="10" align="left" valign="top"> 
110
        <img src="<%=STYLE_SKINS_URL%>/semtools/images/panelhead_bg_rcorner.gif" 
111
          width="10" height="21">
112
      </td>
113
    </tr>
114
    <tr> 
115
      <td colspan="3">
116
        <table width="100%" border="0" cellpadding="0" cellspacing="0" 
117
          class="subpanel">
118
          <tr> 
119
            <td colspan="2"></td>
120
          </tr>
121
          <tr valign="baseline"> 
122
            <td colspan="2">
123
    <form name="advancedSearchForm"
124
          method="POST"
125
          action="<%=STYLE_SKINS_URL%>/semtools/advancedsearchforward.jsp"
126
          onsubmit="return submitRequest(this)"
127
          target="_top">
128
      <table width="100%" border="0" cellpadding="0" cellspacing="0" >
129
        <tr>
130
          <td colspan="2"><hr/></td>
131
        </tr>
132
        <tr>
133
          <td colspan="2">
134
            <h3>Subject</h3>
135
          </td>
136
        </tr>
137
        <tr>
138
          <td>&nbsp;</td>
139
          <td>&nbsp;</td>
140
        </tr>
141
        <tr>
142
          <td align="right" nowrap>
143
            <select name="subjectField">
144
              <option value="ALL">Subject</option>
145
              <option value="TITLE">Title Only</option>
146
              <option value="ABSTRACT">Abtract Only</option>
147
              <option value="KEYWORDS">Keywords Only</option>
148
            </select>
149
          </td>
150
          <td>
151
            <select name="subjectQueryType">
152
              <option value="0" selected="selected">contains</option>
153
              <option value="1">matches exactly</option>
154
              <option value="2">starts with</option>
155
              <option value="3">ends with</option>
156
            </select>
157
            <input type="text" name="subjectValue" value="">
158
            <input type="radio" name="subjectAllAny" value="0" checked="checked">All Terms
159
            <input type="radio" name="subjectAllAny" value="1">Any Term
160
          </td>
161
        </tr>
162
        <tr>
163
          <td>&nbsp;</td>
164
          <td>&nbsp;</td>
165
        </tr>
166
        <tr>
167
          <td colspan="2"><hr/></td>
168
        </tr>
169
        <tr>
170
          <td colspan="2">
171
            <h3>Author</h3>
172
          </td>
173
        </tr>
174
        <tr>
175
          <td>&nbsp;</td>
176
          <td>&nbsp;</td>
177
        </tr>
178
        <tr>
179
          <td nowrap align="right">Individual's Last Name:
180
          </td>
181
          <td>
182
            <select name="creatorSurnameQueryType">
183
              <option value="0" selected="selected">contains</option>
184
              <option value="1">matches exactly</option>
185
              <option value="2">starts with</option>
186
              <option value="3">ends with</option></select>
187
            <input type="text" name="creatorSurname" value="">
188
          </td>
189
        </tr>
190
        <tr>
191
          <td>&nbsp;</td>
192
          <td>&nbsp;</td>
193
        </tr>
194
        <tr>
195
          <td align="right" nowrap>Organization:
196
          </td>
197
          <td>
198
            <select name="creatorOrganizationQueryType">
199
              <option value="0" selected="selected">contains</option>
200
              <option value="1">matches exactly</option>
201
              <option value="2">starts with</option>
202
              <option value="3">ends with</option></select>
203
            <input type="text" name="creatorOrganization" value="">
204
          </td>
205
        </tr>
206
        <tr>
207
          <td>&nbsp;</td>
208
          <td>&nbsp;</td>
209
        </tr>
210
        <tr>
211
          <td colspan="2"><hr/></td>
212
        </tr>
213
        <tr>
214
          <td colspan="2">
215
            <h3>Spatial Criteria</h3>
216
          </td>
217
        </tr>
218
        <tr>
219
          <td>&nbsp;</td>
220
          <td>&nbsp;</td>
221
        </tr>
222
        <tr>
223
          <td align="right">Geographic Boundaries:</td>
224
        </tr>
225
        <tr>
226
          <td>&nbsp;</td>
227
          <td>
228
            <applet
229
              CODEBASE="<%= request.getContextPath() %>/LiveMap_30"
230
              CODE="LiveMap_30.class"
231
              ARCHIVE="LiveMap_30.jar"
232
              NAME="map" 
233
              MAYSCRIPT 
234
              width=500 
235
              height=160>
236
              <param name=base_image value="gifs/java_0_world_20k.jpg">
237
              <param name=img_x_domain value="-180 180">
238
              <param name=img_y_domain value="-90 90">
239
              <param name=toolType value="XY">
240
              <param name=tool_x_range value="-180 180">
241
              <param name=tool_y_range value="-90 90">
242
            </applet>
243
          </td>
244
        </tr>
245
        <tr>
246
          <td>&nbsp;</td>
247
          <td>
248
            <!--
249
             The underlying property value associated with checkbox
250
             should be of type boolean, and any value you specify 
251
             should correspond to one of the strings that indicate a 
252
             true value ("true", "yes", or "on").
253
            -->
254
            <input type="checkbox" name="boundaryContained" value="on">
255
            Dataset must be fully contained within boundaries
256
          </td>
257
        </tr>
258
        <tr>
259
          <td>&nbsp;</td>
260
          <td>&nbsp;</td>
261
        </tr>
262
        <tr>
263
          <td align="right">Geographic Place Name: 
264
          </td>
265
          <td><input type="text" name="locationName" value="">
266
          </td>
267
        </tr>
268
        <tr>
269
          <td>&nbsp;</td>
270
          <td>&nbsp;</td>
271
        </tr>
272
        <tr>
273
          <td colspan="2"><hr/></td>
274
        </tr>
275
        <!-- Temporal Criteria section is disabled because Metacat is
276
             not able to search date ranges. An enhancement request has
277
             been entered in Bugzilla (see 
278
             http://bugzilla.ecoinformatics.org/show_bug.cgi?id=2084 )
279
        <tr>
280
          <td colspan="2">
281
            <h3>Temporal Criteria</h3>
282
          </td>
283
        </tr>
284
        <tr>
285
          <td>&nbsp;</td>
286
          <td>&nbsp;</td>
287
        </tr>
288
        <tr>
289
          <td align="right">
290
            <select name="dateField">
291
              <option value="ALL">All Dates</option>
292
              <option value="COLLECTION">Collection Date</option>
293
              <option value="PUBLICATION">Publication Date</option>
294
            </select>
295
          </td>
296
          <td colspan="2">
297
            <input type="text" name="startDate" maxlength="10" size="10" value="" style="font-family:monospace;">
298
            to
299
            <input type="text" name="endDate" maxlength="10" size="10" value="" style="font-family:monospace;">
300
          </td>
301
        </tr>
302
        <tr>
303
          <td>&nbsp;</td>
304
          <td>&nbsp;</td>
305
        </tr>
306
        <tr>
307
          <td align="right">Named Timescale:
308
            <select name="namedTimescaleQueryType">
309
              <option value="0" selected="selected">contains</option>
310
              <option value="1">matches exactly</option>
311
              <option value="2">starts with</option>
312
              <option value="3">ends with</option>
313
            </select>
314
          </td>
315
          <td>
316
            <input type="text" name="namedTimescale" value="">
317
          </td>
318
        </tr>
319
        <tr>
320
          <td>&nbsp;</td>
321
          <td>&nbsp;</td>
322
        </tr>
323
        <tr>
324
          <td colspan="2"><hr/></td>
325
        </tr>
326
        -->
327
        <tr>
328
          <td colspan="2">
329
            <h3>Taxonomic Criteria</h3>
330
          </td>
331
        </tr>
332
        <tr>
333
          <td>&nbsp;</td>
334
          <td>&nbsp;</td>
335
        </tr>
336
        <tr>
337
          <td align="right">Taxon:
338
          </td>
339
          <td>
340
            <select name="taxonQueryType">
341
              <option value="0" selected="selected">contains</option>
342
              <option value="1">matches exactly</option>
343
              <option value="2">starts with</option>
344
              <option value="3">ends with</option>
345
            </select>
346
            <input type="text" name="taxon" value="">
347
          </td>
348
        </tr>
349
        <tr>
350
          <td>&nbsp;</td>
351
          <td>&nbsp;
352
            <input type="hidden" name="siteValue" value="ALLSITES"/>
353
          </td>
354
        </tr>
355

  
356
<!--   
357
    Un-comment the following section to include an input box that allows the
358
    user to restrict the search to a specific LTER site. Obviously, this is
359
    probably useful only within LTER. If uncommenting this section, 
360
    be sure to comment-out the hidden siteValue input above.
361
-->
362
       
363
<!--
364
        <tr>
365
          <td colspan="2"><hr/></td>
366
        </tr>
367
        <tr>
368
          <td colspan="2">
369
            <h3>LTER Site</h3>
370
          </td>
371
        </tr>
372
        <tr>
373
          <td>&nbsp;</td>
374
          <td>&nbsp;</td>
375
        </tr>
376
        <tr>
377
          <td align="right">Limit search to LTER site:</td>
378
          <td>
379
            <select name="siteValue">
380
              <option value="ALLSITES">All LTER Sites</option>
381
              <option value="AND">Andrews LTER</option>
382
              <option value="ARC">Arctic LTER</option>
383
              <option value="BES">Baltimore Ecosystem Study</option>
384
              <option value="BNZ">Bonanza Creek LTER</option>
385
              <option value="CAP">Central Arizona - Phoenix Urban LTER</option>
386
              <option value="CCE">California Current Ecosystem</option>
387
              <option value="CDR">Cedar Creek Natural History Area</option>
388
              <option value="CWT">Coweeta LTER</option>
389
              <option value="FCE">Florida Coastal Everglades LTER</option>
390
              <option value="GCE">Georgia Coastal Ecosystems LTER</option>
391
              <option value="HBR">Hubbard Brook LTER</option>
392
              <option value="HFR">Harvard Forest LTER</option>
393
              <option value="JRN">Jornada Basin LTER</option>
394
              <option value="KBS">Kellogg Biological Station LTER</option>
395
              <option value="KNZ">Konza Prairie LTER</option>
396
              <option value="LNO">LTER Network Office</option>
397
              <option value="LUQ">Luquillo LTER</option>
398
              <option value="MCM">McMurdo Dry Valleys LTER</option>
399
              <option value="MCR">Moorea Coral Reef</option>
400
              <option value="NTL">North Temperate Lakes LTER</option>
401
              <option value="NWT">Niwot Ridge LTER</option>
402
              <option value="PAL">Palmer Station LTER</option>
403
              <option value="PIE">Plum Island Ecosystem LTER</option>
404
              <option value="SBC">Santa Barbara Coastal LTER</option>
405
              <option value="SEV">Sevilleta LTER</option>
406
              <option value="SGS">Shortgrass Steppe</option>
407
              <option value="VCR">Virginia Coastal Reserve LTER</option>
408
            </select>
409
          </td>
410
       </tr>
411
        <tr>
412
          <td>&nbsp;</td>
413
          <td>&nbsp;</td>
414
        </tr>
415
-->
416
        <tr>
417
          <td colspan="2"><hr/></td>
418
        </tr>
419
        <tr>
420
          <td colspan="2">
421
            <h3>Search Options</h3>
422
          </td>
423
        </tr>
424
        <tr>
425
          <td colspan="2" align="center">
426
            <table>
427
              <tr>
428
                <td>
429
                  <input type="radio" name="formAllAny" value="0" checked="checked">"And" all search items&nbsp;
430
                </td>
431
                <td>
432
                  <input type="radio" name="formAllAny" value="1">"Or" all search items&nbsp;
433
                </td>
434
                <td>
435
                  <input type="checkbox" name="caseSensitive" value="on">Case sensitive
436
                </td>
437
              </tr>
438
            </table>
439
          </td>
440
        </tr>
441
        <tr>
442
          <td>&nbsp;</td>
443
          <td>&nbsp;</td>
444
        </tr>
445
        <tr>
446
          <td colspan="2"><hr/></td>
447
        </tr>
448
        <tr>
449
          <td colspan="2" align="center">
450
            <input type="submit" value="Search">&nbsp;&nbsp;
451
            <!-- <input type="reset" value="Reset"> -->
452
          </td>
453
        </tr>
454
      </table>
455
      <input type="hidden" name="northBound" value=""/>
456
      <input type="hidden" name="southBound" value=""/>
457
      <input type="hidden" name="eastBound" value=""/>
458
      <input type="hidden" name="westBound" value=""/>
459
    </form>
460
    
461
    <script type="text/javascript" language="Javascript1.1"> 
462

  
463
    <!-- Begin JavaScript input validation checking code.
464
    var bCancel = false; 
465

  
466
    function validateAdvancedSearchForm(form) {                                                                   
467
        if (bCancel) 
468
            return true; 
469
        else 
470
            var formValidationResult;
471
            formValidationResult = validateFloat(form) && validateFloatRange(form); 
472
            return (formValidationResult == 1);
473
    } 
474

  
475
    function advancedSearchForm_FloatValidations () { 
476
      this.a0 = new Array("westBound", "West Boundary must be a number.", new Function ("varName", "this.min='-180.0'; this.max='180.0';  return this[varName];"));
477
      this.a1 = new Array("eastBound", "East Boundary must be a number.", new Function ("varName", "this.min='-180.0'; this.max='180.0';  return this[varName];"));
478
      this.a2 = new Array("northBound", "North Boundary must be a number.", new Function ("varName", "this.min='-90.0'; this.max='90.0';  return this[varName];"));
479
      this.a3 = new Array("southBound", "South Boundary must be a number.", new Function ("varName", "this.min='-90.0'; this.max='90.0';  return this[varName];"));
480
    } 
481

  
482
    function advancedSearchForm_DateValidations () { 
483
      this.a0 = new Array("startDate", "Start Date must be a date (YYYY-MM-DD).", new Function ("varName", "this.datePattern='yyyy-MM-dd';  return this[varName];"));
484
      this.a1 = new Array("endDate", "End Date must be a date (YYYY-MM-DD).", new Function ("varName", "this.datePattern='yyyy-MM-dd';  return this[varName];"));
485
    } 
486

  
487
    function advancedSearchForm_floatRange () { 
488
      this.a0 = new Array("westBound", "West Boundary must be in the range -180.0 through 180.0.", new Function ("varName", "this.min='-180.0'; this.max='180.0';  return this[varName];"));
489
      this.a1 = new Array("eastBound", "East Boundary must be in the range -180.0 through 180.0.", new Function ("varName", "this.min='-180.0'; this.max='180.0';  return this[varName];"));
490
      this.a2 = new Array("northBound", "North Boundary must be in the range -90.0 through 90.0.", new Function ("varName", "this.min='-90.0'; this.max='90.0';  return this[varName];"));
491
      this.a3 = new Array("southBound", "South Boundary must be in the range -90.0 through 90.0.", new Function ("varName", "this.min='-90.0'; this.max='90.0';  return this[varName];"));
492
    } 
493

  
494
    /**
495
    * Check to see if fields are in a valid float range.
496
    * Fields are not checked if they are disabled.
497
    * <p>
498
    * @param form The form validation is taking place on.
499
    */
500
    function validateFloatRange(form) {
501
        var isValid = true;
502
        var focusField = null;
503
        var i = 0;
504
        var fields = new Array();
505
        var formName = form.getAttributeNode("name"); 
506

  
507
        oRange = eval('new ' + formName.value + '_floatRange()');
508
        for (x in oRange) {
509
            var field = form[oRange[x][0]];
510
            
511
            if ((field.type == 'hidden' ||
512
                field.type == 'text' || field.type == 'textarea') &&
513
                (field.value.length > 0)  &&
514
                 field.disabled == false) {
515
        
516
                var fMin = parseFloat(oRange[x][2]("min"));
517
                var fMax = parseFloat(oRange[x][2]("max"));
518
                var fValue = parseFloat(field.value);
519
                if (!(fValue >= fMin && fValue <= fMax)) {
520
                    if (i == 0) {
521
                        focusField = field;
522
                    }
523
                    fields[i++] = oRange[x][1];
524
                    isValid = false;
525
                }
526
            }
527
        }
528
        if (fields.length > 0) {
529
            focusField.focus();
530
            alert(fields.join('\n'));
531
        }
532
        return isValid;
533
    }
534

  
535

  
536
  /**
537
  * This is a place holder for common utilities used across the javascript validation
538
  *
539
  **/
540

  
541

  
542
    /**
543
    * Check to see if fields are a valid byte.
544
    * Fields are not checked if they are disabled.
545
    * <p>
546
    * @param form The form validation is taking place on.
547
    */
548
    function validateByte(form) {
549
        var bValid = true;
550
        var focusField = null;
551
        var i = 0;
552
        var fields = new Array();
553
        var formName = form.getAttributeNode("name"); 
554
        oByte = eval('new ' + formName.value + '_ByteValidations()');
555

  
556
        for (x in oByte) {
557
            var field = form[oByte[x][0]];
558

  
559
            if ((field.type == 'hidden' ||
560
                field.type == 'text' ||
561
                field.type == 'textarea' ||
562
                field.type == 'select-one' ||
563
                field.type == 'radio')  &&
564
                field.disabled == false) {
565

  
566
                var value = '';
567
                // get field's value
568
                if (field.type == "select-one") {
569
                    var si = field.selectedIndex;
570
                    if (si >= 0) {
571
                        value = field.options[si].value;
572
                    }
573
                } else {
574
                    value = field.value;
575
                }
576

  
577
                if (value.length > 0) {
578
                    if (!isAllDigits(value)) {
579
                        bValid = false;
580
                        if (i == 0) {
581
                            focusField = field;
582
                        }
583
                        fields[i++] = oByte[x][1];
584

  
585
                    } else {
586

  
587
                        var iValue = parseInt(value);
588
                        if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
589
                            if (i == 0) {
590
                                focusField = field;
591
                            }
592
                            fields[i++] = oByte[x][1];
593
                            bValid = false;
594
                        }
595
                    }
596
                }
597

  
598
            }
599
        }
600
        if (fields.length > 0) {
601
           focusField.focus();
602
           alert(fields.join('\n'));
603
        }
604
        return bValid;
605
    }
606

  
607

  
608
    /**
609
    * A field is considered valid if less than the specified maximum.
610
    * Fields are not checked if they are disabled.
611
    * <p>
612
    * <strong>Caution:</strong> Using <code>validateMaxLength</code> on a password field in a 
613
    *  login page gives unnecessary information away to hackers. While it only slightly
614
    *  weakens security, we suggest using it only when modifying a password.</p>
615
    * @param form The form validation is taking place on.
616
    */
617
    function validateMaxLength(form) {
618
        var isValid = true;
619
        var focusField = null;
620
        var i = 0;
621
        var fields = new Array();
622
        var formName = form.getAttributeNode("name"); 
623

  
624
        oMaxLength = eval('new ' + formName.value + '_maxlength()');        
625
        for (x in oMaxLength) {
626
            var field = form[oMaxLength[x][0]];
627

  
628
            if ((field.type == 'hidden' ||
629
                field.type == 'text' ||
630
                field.type == 'password' ||
631
                field.type == 'textarea') &&
632
                field.disabled == false) {
633

  
634
                var iMax = parseInt(oMaxLength[x][2]("maxlength"));
635
                if (field.value.length > iMax) {
636
                    if (i == 0) {
637
                        focusField = field;
638
                    }
639
                    fields[i++] = oMaxLength[x][1];
640
                    isValid = false;
641
                }
642
            }
643
        }
644
        if (fields.length > 0) {
645
           focusField.focus();
646
           alert(fields.join('\n'));
647
        }
648
        return isValid;
649
    }
650

  
651

  
652
    /**
653
    *  Check to see if fields must contain a value.
654
    * Fields are not checked if they are disabled.
655
    * <p>
656
    * @param form The form validation is taking place on.
657
    */
658

  
659
    function validateRequired(form) {
660
        var isValid = true;
661
        var focusField = null;
662
        var i = 0;
663
        var fields = new Array();
664
        var formName = form.getAttributeNode("name");
665

  
666
        oRequired = eval('new ' + formName.value + '_required()');
667

  
668
        for (x in oRequired) {
669
            var field = form[oRequired[x][0]];
670

  
671
            if ((field.type == 'hidden' ||
672
                field.type == 'text' ||
673
                field.type == 'textarea' ||
674
                field.type == 'file' ||
675
                field.type == 'checkbox' ||
676
                field.type == 'select-one' ||
677
                field.type == 'password') &&
678
                field.disabled == false) {
679

  
680
                var value = '';
681
                // get field's value
682
                if (field.type == "select-one") {
683
                    var si = field.selectedIndex;
684
                    if (si >= 0) {
685
                        value = field.options[si].value;
686
                    }
687
                } else if (field.type == 'checkbox') {
688
                    if (field.checked) {
689
                        value = field.value;
690
                    }
691
                } else {
692
                    value = field.value;
693
                }
694

  
695
                if (trim(value).length == 0) {
696

  
697
                    if (i == 0) {
698
                        focusField = field;
699
                    }
700
                    fields[i++] = oRequired[x][1];
701
                    isValid = false;
702
                }
703
            } else if (field.type == "select-multiple") { 
704
                var numOptions = field.options.length;
705
                lastSelected=-1;
706
                for(loop=numOptions-1;loop>=0;loop--) {
707
                    if(field.options[loop].selected) {
708
                        lastSelected = loop;
709
                        value = field.options[loop].value;
710
                        break;
711
                    }
712
                }
713
                if(lastSelected < 0 || trim(value).length == 0) {
714
                    if(i == 0) {
715
                        focusField = field;
716
                    }
717
                    fields[i++] = oRequired[x][1];
718
                    isValid=false;
719
                }
720
            } else if ((field.length > 0) && (field[0].type == 'radio' || field[0].type == 'checkbox')) {
721
                isChecked=-1;
722
                for (loop=0;loop < field.length;loop++) {
723
                    if (field[loop].checked) {
724
                        isChecked=loop;
725
                        break; // only one needs to be checked
726
                    }
727
                }
728
                if (isChecked < 0) {
729
                    if (i == 0) {
730
                        focusField = field[0];
731
                    }
732
                    fields[i++] = oRequired[x][1];
733
                    isValid=false;
734
                }
735
            }
736
        }
737
        if (fields.length > 0) {
738
           focusField.focus();
739
           alert(fields.join('\n'));
740
        }
741
        return isValid;
742
    }
743
    
744
    // Trim whitespace from left and right sides of s.
745
    function trim(s) {
746
        return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
747
    }
748

  
749

  
750
    /**
751
    * Check to see if fields are a valid integer.
752
    * Fields are not checked if they are disabled.
753
    * <p>
754
    * @param form The form validation is taking place on.
755
    */
756
    function validateInteger(form) {
757
        var bValid = true;
758
        var focusField = null;
759
        var i = 0;
760
        var fields = new Array();
761
        var formName = form.getAttributeNode("name"); 
762

  
763
        oInteger = eval('new ' + formName.value + '_IntegerValidations()');
764
        for (x in oInteger) {
765
            var field = form[oInteger[x][0]];
766

  
767
            if ((field.type == 'hidden' ||
768
                field.type == 'text' ||
769
                field.type == 'textarea' ||
770
                field.type == 'select-one' ||
771
                field.type == 'radio') &&
772
                field.disabled == false) {
773

  
774
                var value = '';
775
                // get field's value
776
                if (field.type == "select-one") {
777
                    var si = field.selectedIndex;
778
                    if (si >= 0) {
779
                        value = field.options[si].value;
780
                    }
781
                } else {
782
                    value = field.value;
783
                }
784

  
785
                if (value.length > 0) {
786

  
787
                    if (!isAllDigits(value)) {
788
                        bValid = false;
789
                        if (i == 0) {
790
                            focusField = field;
791
                        }
792
                        fields[i++] = oInteger[x][1];
793

  
794
                    } else {
795
                        var iValue = parseInt(value);
796
                        if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
797
                            if (i == 0) {
798
                                focusField = field;
799
                            }
800
                            fields[i++] = oInteger[x][1];
801
                            bValid = false;
802
                       }
803
                   }
804
               }
805
            }
806
        }
807
        if (fields.length > 0) {
808
           focusField.focus();
809
           alert(fields.join('\n'));
810
        }
811
        return bValid;
812
    }
813

  
814
    function isAllDigits(argvalue) {
815
        argvalue = argvalue.toString();
816
        var validChars = "0123456789";
817
        var startFrom = 0;
818
        if (argvalue.substring(0, 2) == "0x") {
819
           validChars = "0123456789abcdefABCDEF";
820
           startFrom = 2;
821
        } else if (argvalue.charAt(0) == "0") {
822
           validChars = "01234567";
823
           startFrom = 1;
824
        } else if (argvalue.charAt(0) == "-") {
825
            startFrom = 1;
826
        }
827

  
828
        for (var n = startFrom; n < argvalue.length; n++) {
829
            if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
830
        }
831
        return true;
832
    }
833

  
834

  
835
    /**
836
    * Check to see if fields are a valid date.
837
    * Fields are not checked if they are disabled.
838
    * <p>
839
    * @param form The form validation is taking place on.
840
    */
841
    function validateDate(form) {
842
       var bValid = true;
843
       var focusField = null;
844
       var i = 0;
845
       var fields = new Array();
846
       var formName = form.getAttributeNode("name"); 
847

  
848
       oDate = eval('new ' + formName.value + '_DateValidations()');
849

  
850
       for (x in oDate) {
851
           var field = form[oDate[x][0]];
852
           var value = field.value;
853
           var datePattern = oDate[x][2]("datePatternStrict");
854
           // try loose pattern
855
           if (datePattern == null)
856
               datePattern = oDate[x][2]("datePattern");
857
           if ((field.type == 'hidden' ||
858
                field.type == 'text' ||
859
                field.type == 'textarea') &&
860
               (value.length > 0) && (datePattern.length > 0) &&
861
                field.disabled == false) {
862
                 var MONTH = "MM";
863
                 var DAY = "dd";
864
                 var YEAR = "yyyy";
865
                 var orderMonth = datePattern.indexOf(MONTH);
866
                 var orderDay = datePattern.indexOf(DAY);
867
                 var orderYear = datePattern.indexOf(YEAR);
868
                 if ((orderDay < orderYear && orderDay > orderMonth)) {
869
                     var iDelim1 = orderMonth + MONTH.length;
870
                     var iDelim2 = orderDay + DAY.length;
871
                     var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
872
                     var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
873
                     if (iDelim1 == orderDay && iDelim2 == orderYear) {
874
                        dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
875
                     } else if (iDelim1 == orderDay) {
876
                        dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
877
                     } else if (iDelim2 == orderYear) {
878
                        dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
879
                     } else {
880
                        dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
881
                     }
882
                     var matched = dateRegexp.exec(value);
883
                     if(matched != null) {
884
                        if (!isValidDate(matched[2], matched[1], matched[3])) {
885
                           if (i == 0) {
886
                               focusField = field;
887
                           }
888
                           fields[i++] = oDate[x][1];
889
                           bValid =  false;
890
                        }
891
                     } else {
892
                        if (i == 0) {
893
                            focusField = field;
894
                        }
895
                        fields[i++] = oDate[x][1];
896
                        bValid =  false;
897
                     }
898
                 } else if ((orderMonth < orderYear && orderMonth > orderDay)) {
899
                     var iDelim1 = orderDay + DAY.length;
900
                     var iDelim2 = orderMonth + MONTH.length;
901
                     var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff