Project

General

Profile

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: leinfelder $'
11
  *     '$Date: 2013-05-01 15:20:34 -0700 (Wed, 01 May 2013) $'
12
  * '$Revision: 7649 $'
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=UTF-8">
40
  <link href="<%=STYLE_SKINS_URL%>/default/default.css" rel="stylesheet" type="text/css">
41
  <script language="javascript" 
42
    type="text/javascript" src="<%=STYLE_SKINS_URL%>/default/default.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?")) {
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
                                var abstractValue = document.getElementById("abstractValue");
105
                                abstractValue.value=searchString;
106
                                var keywordValue = document.getElementById("keywordValue");
107
                        		keywordValue.value=searchString;
108
                        } else {
109
                                searchBox.name = "anyfield";
110
                                searchBox.id = "searchBox";
111
                                searchBox.value = "%";
112

    
113
                                submitFormObj.surName.value = "";
114
                                submitFormObj.givenName.value = "";
115
                                submitFormObj.keyword.value = "";
116
                                submitFormObj.organizationName.value = "";
117
                                submitFormObj.para.value = "";
118
                                submitFormObj.geographicDescription.value = "";
119
                                submitFormObj.literalLayout.value = "";
120
                                submitFormObj.operator.value="INTERSECT";
121
                                var abs = document.getElementById("abstract");
122
                                abs.value="";
123
                                var abstractValue = document.getElementById("abstractValue");
124
                                abstractValue.value="";
125
                                var keywordValue = document.getElementById("keywordValue");
126
                        		keywordValue.value="";
127

    
128
			 }
129
                } else {
130
                        searchBox.name = "anyfield";
131
                        searchBox.id = "searchBox";
132

    
133
                        submitFormObj.surName.value = "";
134
                        submitFormObj.givenName.value = "";
135
                        submitFormObj.keyword.value = "";
136
                        submitFormObj.organizationName.value = "";
137
                        submitFormObj.para.value = "";
138
                        submitFormObj.geographicDescription.value = "";
139
                        submitFormObj.literalLayout.value = "";
140
                        submitFormObj.operator.value="INTERSECT";
141
                        var abs = document.getElementById("abstract");
142
                        abs.value="";
143
                        var abstractValue = document.getElementById("abstractValue");
144
                        abstractValue.value="";
145
                        var keywordValue = document.getElementById("keywordValue");
146
                        keywordValue.value="";
147
                }
148

    
149

    
150
                var radioInput = document.getElementsByName("search");
151
		       radioInput[0].name = "";
152

    
153
                return true;
154
        }
155
  </script>
156
</head>
157

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

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