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>CONTEXT_URL + "/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>CONTEXT_URL + "/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
		<script type="text/javascript" >		
80
				setCookie('JSESSIONID','<jsp:getProperty name="clientViewBean" property="sessionid" />','<jsp:expression>request.getContextPath()</jsp:expression>');
81
		</script>
82

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