Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
3

    
4
	<!-- to change the content type or response encoding change the following line -->
5
	<jsp:directive.page contentType="text/html;charset=UTF-8" />
6
	<jsp:directive.page
7
		import="edu.ucsb.nceas.metacat.clientview.ClientView" />
8
	<jsp:directive.page
9
		import="edu.ucsb.nceas.metacat.clientview.ClientViewHelper" />
10
	<jsp:directive.page
11
		import="edu.ucsb.nceas.metacat.clientview.ClientHtmlHelper" />
12

    
13
	<jsp:declaration>
14
        private ClientViewHelper clientViewHelper = null;
15
    </jsp:declaration>
16

    
17
<jsp:directive.include file="settings.jsp" />
18

    
19
<html xmlns="http://www.w3.org/1999/xhtml">
20
<head>
21

    
22
	<jsp:element name="script">
23
		<jsp:attribute name="language">JavaScript</jsp:attribute>
24
		<jsp:attribute name="src">
25
			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/searchPathQuery.js"</jsp:expression>
26
		</jsp:attribute>
27
	</jsp:element>
28
	<script type="text/javascript">
29
		function trim(stringToTrim) {
30
			return(stringToTrim.replace(/^\s+|\s+$/g,""));
31
		}
32
		
33
		function isEmpty(aTextField) {
34
			var value = trim(aTextField.value);
35
			var result = ((value.length == 0) || (value == null));
36
			return(result);
37
		}
38
		
39
		function allowSubmit(formObj) {
40
			var     result = true;
41
			var     action = "";
42
		
43
		    action = trim(formObj.elements["action"].value);
44
		    if (action == "Login") {
45
		        if (isEmpty(formObj.elements["username"])) {
46
		            result = false;
47
		            alert("User name is required");
48
		        } else if (isEmpty(formObj.elements["organization"])) {
49
		            result = false;
50
		            alert("Organization is required");
51
		        } else if (isEmpty(formObj.elements["password"])) {
52
		            result = false;
53
		            alert("Password is required");
54
		        }
55
		    }
56
		    
57
			return(result);
58
		}
59
	</script>
60

    
61
	<title>SANParks - South African National Park Data Repository</title>
62
	<jsp:element name="link">
63
		<jsp:attribute name="rel">stylesheet</jsp:attribute>
64
		<jsp:attribute name="type">text/css</jsp:attribute>
65
		<jsp:attribute name="href">
66
			<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/sanparks.css"</jsp:expression>
67
		</jsp:attribute>
68
	</jsp:element>
69
</head>
70
	
71
<body>
72
	<div class="templatecontentareaclass" style="background: #FFFFFF;">
73
		<jsp:useBean id="clientViewBean" scope="session" class="edu.ucsb.nceas.metacat.clientview.ClientView" /> 
74
		<jsp:setProperty name="clientViewBean" property="*" /> 
75
		<jsp:scriptlet>
76
			clientViewHelper = ClientViewHelper.clientViewHelperInstance(request);
77
			clientViewHelper.clientRequest(request, response);
78
        </jsp:scriptlet>
79

    
80
	<table>
81
	<tr>
82
		<td colspan="3">
83
			<p class="regtext">
84
			Welcome to the SANParks Data Repository. 
85
			This is the primary source for comprehensive information about scientific 
86
			and research data sets collected throughout the South African National Park System.
87
			</p>
88
		</td>
89
	</tr>
90
	<tr valign="top">
91
	<td>
92
	
93
	<h2>Search for SANParks Data</h2>
94
	
95
	<p class="emphasis">Searching: 
96
		<jsp:scriptlet>
97
			String organizationScope = request.getParameter("organizationScope");
98
			if (organizationScope == null) {
99
				organizationScope = "";
100
			}
101
			if (!organizationScope.equals("")) {
102
		</jsp:scriptlet>
103
			<!-- set the map to use the correct scope -->
104
			<script type="text/javascript" >
105
				var dropDownTimer = null;
106
				
107
				//this syncs the map based on the input string location
108
				function setMapLocation(strLocation) {
109
				
110
					var mapFrameDocument = document.getElementById("mapFrame").contentDocument;
111
					if (!mapFrameDocument) {
112
						//alert("IE");
113
						mapFrameDocument = document.getElementById("mapFrame").contentWindow;
114
						if (mapFrameDocument.document) {
115
							mapFrameDocument = mapFrameDocument.document;
116
						}
117
						
118
					}
119
					//alert("mapFrame=" + mapFrameDocument.name);
120
					//alert("locations=" + mapFrameDocument.getElementsByTagName('locations'));
121
					
122
					//check if the dropdown is loaded in DOM
123
					if (mapFrameDocument.getElementsByName('locations').length == 0) {
124
						dropDownTimer = setTimeout("setMapLocation('" + strLocation + "')", 100);
125
						return false;
126
					}
127
					clearTimeout(dropDownTimer);
128
					
129
					var locationMenu = mapFrameDocument.getElementsByName('locations')[0];
130
					//alert("locationMenu=" + locationMenu);
131
					var locationOptions = locationMenu.options;
132
					//alert("locationOptions=" + locationOptions);
133
					//loop through the options to find the correct location based on input string
134
					for (var i=0; i &lt; locationOptions.length; i++) {
135
						if (locationOptions[i].text == strLocation) {
136
							//set as selected
137
							locationMenu.selectedIndex = i;
138
							break;
139
						}
140
					}
141
					//alert("Focusing on selected location: " + locationMenu.options[locationMenu.selectedIndex].text);
142
					
143
					//the onchange command from select object
144
					locationMenu.onchange();
145
					//mapFrameDocument.config.objects.locationsSelect.setAoi(locationMenu.options[locationMenu.selectedIndex].value,'mainMap');
146
				
147
				}
148
				
149
				//kick it off
150
				dropDownTimer = 
151
					setTimeout(
152
					"setMapLocation('<jsp:expression>organizationScope</jsp:expression>')",
153
					 100);
154
				
155
			</script>
156
			
157
			<jsp:expression>organizationScope</jsp:expression>
158
		<jsp:scriptlet>
159
			}
160
			else {
161
		</jsp:scriptlet>
162
			All Organizations	
163
		<jsp:scriptlet>
164
			}
165
		</jsp:scriptlet>
166
	</p>
167
	
168
	<jsp:element name="form">
169
		<jsp:attribute name="id">searchform</jsp:attribute>
170
		<jsp:attribute name="name">searchform</jsp:attribute>
171
		<jsp:attribute name="method">post</jsp:attribute>
172
		<jsp:attribute name="action">
173
			<jsp:expression>METACAT_URL</jsp:expression>
174
		</jsp:attribute>
175
		<jsp:attribute name="target">_top</jsp:attribute>
176
		<jsp:attribute name="onsubmit">setQueryFormField()</jsp:attribute>
177
		<p class="regtext">
178
		The repository search system is used to locate data sets of interest by 
179
		searching through existing registered data sets. 
180
		Presently the search covers all fields, including author, title, abstract, 
181
		keywords, and other documentation for each data set. 
182
		<br />
183
		Use a '%' symbol as a wildcard in searches (e.g., '%herbivore%' 
184
		would locate any phrase with the word herbivore embedded within it).
185
		</p>
186
		<jsp:element name="input">
187
			<jsp:attribute name="name">organizationScope</jsp:attribute>
188
			<jsp:attribute name="id">organizationScope</jsp:attribute>
189
			<jsp:attribute name="type">hidden</jsp:attribute>
190
			<jsp:attribute name="value">
191
				<jsp:expression>organizationScope</jsp:expression>
192
			</jsp:attribute>
193
		</jsp:element>
194
		<jsp:element name="input">
195
			<jsp:attribute name="name">sessionid</jsp:attribute>
196
			<jsp:attribute name="type">hidden</jsp:attribute>
197
			<jsp:attribute name="value">
198
				<jsp:getProperty name="clientViewBean" property="sessionid" />
199
			</jsp:attribute>
200
		</jsp:element>
201
		<input type="text" id="anyfield" name="anyfield" value="" size="14" />
202
		<input type="hidden" id="query" name="query"  />
203
		<input type="hidden" name="qformat" value="sanparks"/>
204
		<input type="hidden" name="action" value="squery" />  
205
		<input type="submit" value="Search"  />
206
		<br/>
207
		<input type="checkbox" id="searchAll" name="searchAll" />Search all fields (slower)
208
		<p class="regtext">
209
		-Or-
210
		<br />
211
		Browse all existing data sets by title. This operation can be slow.
212
		</p>
213
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
214
	</jsp:element>
215
	
216
	</td>
217
	<td>
218
	
219
	<!-- Login section -->
220
	<jsp:scriptlet>
221
		if (!clientViewHelper.isLoggedIn()) {
222
	</jsp:scriptlet>
223
	
224
	<h3>
225
		Login
226
		<jsp:element name="a">
227
			<jsp:attribute name="target">_parent</jsp:attribute>
228
			<jsp:attribute name="href">
229
				<jsp:expression>CGI_PREFIX + "/ldapweb.cgi?cfg=sanparks"</jsp:expression>
230
			</jsp:attribute>
231
			<span class="regtext"> (request an account...)</span>
232
		</jsp:element>
233
	</h3>
234
	<form name="loginForm" method="post" action="./"
235
		onsubmit="return allowSubmit(this)">
236
		<input name="qformat" type="hidden" value="sanparks" />
237
	<table>
238
		<tr valign="top">
239
			<td>
240
				<span class="required">User name</span>	
241
			</td>
242
			<td>
243
				<input name="username" type="text" value=""
244
				style="width: 140" />
245
			</td>
246
		</tr>
247
		<tr>
248
			<td><span class="required">Organization</span></td>
249
			<td><select name="organization" style="width: 140">
250
				<option value="SANParks" selected="">SANParks</option>
251
				<option value="SAEON">SAEON</option>
252
				<option value="NCEAS">NCEAS</option>
253
				<option value="unaffiliated">unaffiliated</option>
254
			</select></td>
255
		</tr>
256
		<tr>
257
			<td><span class="required">Password</span></td>
258
			<td><input name="password" value="" type="password"
259
				style="width: 140" maxlength="50" /></td>
260
		</tr>
261
		<tr>
262
			<td colspan="2" align="center">
263
				<input name="action"
264
				value="Login" type="submit" class="button_login" />
265
			</td>
266
		</tr>
267
	</table>
268
	</form>
269
	
270
	<jsp:scriptlet>
271
		} else {
272
	</jsp:scriptlet>
273
	<h3>
274
		Welcome,
275
		<jsp:expression>clientViewBean.getUsername()</jsp:expression>  
276
	</h3>
277
	<form name="logoutForm" method="post" action="./">
278
	<input name="qformat" value="sanparks" type="hidden" />
279
	<table>
280
		<tr valign="top">
281
			<td>
282
				<p class="regtext">
283
					You are currently logged in.
284
				</p>
285
			</td>
286
			<td align="right">
287
				<input name="action" type="submit" value="Logout" class="button_login" />
288
			</td>
289
		</tr>
290
		<tr valign="top">
291
			<td colspan="2">
292
				<p class="regtext">
293
					(<jsp:expression>clientViewBean.getMessage(ClientView.LOGIN_MESSAGE)</jsp:expression>)
294
				</p>
295
			</td>
296
		</tr>	
297
		<tr>	
298
			<td colspan="2"
299
				class="regtext" 
300
				align="center" 
301
				valign="top">
302
				
303
				<!-- reset pass --> 
304
				<jsp:element name="a">
305
					<jsp:attribute name="target">_parent</jsp:attribute>
306
					<jsp:attribute name="href">
307
						<jsp:expression>CGI_PREFIX + "/ldapweb.cgi?cfg=sanparks&amp;stage=resetpass"</jsp:expression>
308
					</jsp:attribute>
309
					reset your password
310
				</jsp:element>
311
				|
312
				<!-- change pass --> 
313
				<jsp:element name="a">
314
					<jsp:attribute name="target">_parent</jsp:attribute>
315
					<jsp:attribute name="href">
316
						<jsp:expression>CGI_PREFIX + "/ldapweb.cgi?cfg=sanparks&amp;stage=changepass"</jsp:expression>
317
					</jsp:attribute>
318
					change your password
319
				</jsp:element>
320
			</td>
321
		</tr>
322
	</table>
323
	</form>
324
	<jsp:scriptlet>
325
		}
326
	</jsp:scriptlet> 
327
	
328
	<!-- File Upload Form --> 
329
	<br />
330
	<h3>Data Package Upload</h3>
331
	
332
	<jsp:scriptlet>
333
		if (clientViewHelper.isLoggedIn()) {
334
	</jsp:scriptlet>
335
	<table width="100%">
336
		<tr valign="top">
337
			<td align="right">
338
				<jsp:element name="form">
339
					<jsp:attribute name="method">post</jsp:attribute>
340
					<jsp:attribute name="action">
341
						<jsp:expression>SERVER_URL_WITH_CONTEXT + "/style/skins/sanparks/upload.jsp"</jsp:expression>
342
					</jsp:attribute>
343
					<input type="submit" value="Go >" class="button_login" />
344
				</jsp:element>
345
			</td>
346
		</tr>
347
	</table>			
348
	<jsp:scriptlet>
349
		} else {
350
	</jsp:scriptlet>
351
	
352
	<p class="regtext">
353
		You must be logged into your user account before uploading a data set.
354
	</p>
355
	<jsp:scriptlet>
356
		}
357
	</jsp:scriptlet>
358
	
359
	</td>
360
	
361
	<!-- so the map frame doesn't overlap content -->
362
	<td width="50px"></td>
363
	
364
	</tr>
365
	
366
	<tr>
367
	<td colspan="2" align="center">
368
	
369
	
370
	<!-- Map here --> 
371
	<br />
372
	<h3>Spatial Search</h3>
373
	
374
		<!-- map frame -->
375
        <script language="JavaScript">
376
            insertMap("<jsp:expression>SERVER_URL_WITH_CONTEXT</jsp:expression>");
377
        </script>
378
	</td>
379
	
380
	<!-- so the map frame doesn't overlap content -->
381
	<td width="50px"></td>
382
	
383
	</tr>
384
	
385
	</table>
386
	
387
	</div>
388
</body>
389
</html>
390
</jsp:root>
(3-3/19)