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
<html xmlns="http://www.w3.org/1999/xhtml">
18
<head>
19

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

    
54
	<title>SANParks - South African National Park Data Repository</title>
55
	<link href="sanparks.css" rel="stylesheet" type="text/css" />
56

    
57
</head>
58
	
59
<body>
60
	<div class="templatecontentareaclass" style="background: #FFFFFF;">
61
		<jsp:useBean id="clientViewBean" scope="session" class="edu.ucsb.nceas.metacat.clientview.ClientView" /> 
62
		<jsp:setProperty name="clientViewBean" property="*" /> 
63
		<jsp:scriptlet>
64
			clientViewHelper = ClientViewHelper.clientViewHelperInstance(request);
65
			clientViewHelper.clientRequest(request, response);
66
        </jsp:scriptlet>
67

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