Project

General

Profile

1 3404 leinfelder
<?xml version="1.0" encoding="UTF-8"?>
2
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
3 3405 leinfelder
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 3414 leinfelder
        private ClientViewHelper clientViewHelper = null;
15 3404 leinfelder
    </jsp:declaration>
16 3405 leinfelder
17 3414 leinfelder
<html xmlns="http://www.w3.org/1999/xhtml">
18
<head>
19 3405 leinfelder
20 3672 leinfelder
	<script language="JavaScript" type="text/JavaScript" src="@systemidserver@@style-skins-path@/sanparks/searchPathQuery.js"/>
21 3405 leinfelder
	<script type="text/javascript">
22 3404 leinfelder
		function trim(stringToTrim) {
23
			return(stringToTrim.replace(/^\s+|\s+$/g,""));
24
		}
25 3491 leinfelder
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 3405 leinfelder
54 3414 leinfelder
	<title>SANParks - South African National Park Data Repository</title>
55 3672 leinfelder
	<link href="@systemidserver@@style-skins-path@/sanparks/sanparks.css" rel="stylesheet" type="text/css" />
56 3405 leinfelder
57 3414 leinfelder
</head>
58
59 3428 leinfelder
<body>
60 3496 leinfelder
	<div class="templatecontentareaclass" style="background: #FFFFFF;">
61 3414 leinfelder
		<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 3405 leinfelder
68 3414 leinfelder
	<table>
69 3415 leinfelder
	<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 3414 leinfelder
	<tr valign="top">
79
	<td>
80
81
	<h2>Search for SANParks Data</h2>
82 3426 leinfelder
83
	<p class="emphasis">Searching:
84
		<jsp:scriptlet>
85
			String organizationScope = request.getParameter("organizationScope");
86
			if (organizationScope == null) {
87 3462 leinfelder
				organizationScope = "";
88 3426 leinfelder
			}
89 3462 leinfelder
			if (!organizationScope.equals("")) {
90 3426 leinfelder
		</jsp:scriptlet>
91 3459 leinfelder
			<!-- 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 3508 leinfelder
					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 3459 leinfelder
					//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 3426 leinfelder
		<jsp:scriptlet>
147
			}
148
			else {
149
		</jsp:scriptlet>
150
			All Organizations
151
		<jsp:scriptlet>
152
			}
153
		</jsp:scriptlet>
154
	</p>
155
156 3672 leinfelder
	<jsp:element name="form">
157
		<jsp:attribute name="id">searchform</jsp:attribute>
158
		<jsp:attribute name="name">searchform</jsp:attribute>
159
		<jsp:attribute name="method">post</jsp:attribute>
160
		<jsp:attribute name="action">
161
			<jsp:expression>request.getContextPath() + "/metacat"</jsp:expression>
162
		</jsp:attribute>
163
		<jsp:attribute name="target">_top</jsp:attribute>
164
		<jsp:attribute name="onsubmit">setQueryFormField()</jsp:attribute>
165 3414 leinfelder
		<p class="regtext">
166 3415 leinfelder
		The repository search system is used to locate data sets of interest by
167
		searching through existing registered data sets.
168
		Presently the search covers all fields, including author, title, abstract,
169
		keywords, and other documentation for each data set.
170
		<br />
171
		Use a '%' symbol as a wildcard in searches (e.g., '%herbivore%'
172
		would locate any phrase with the word herbivore embedded within it).
173 3414 leinfelder
		</p>
174
		<jsp:element name="input">
175 3462 leinfelder
			<jsp:attribute name="name">organizationScope</jsp:attribute>
176
			<jsp:attribute name="id">organizationScope</jsp:attribute>
177 3459 leinfelder
			<jsp:attribute name="type">hidden</jsp:attribute>
178
			<jsp:attribute name="value">
179
				<jsp:expression>organizationScope</jsp:expression>
180
			</jsp:attribute>
181
		</jsp:element>
182
		<jsp:element name="input">
183 3414 leinfelder
			<jsp:attribute name="name">sessionid</jsp:attribute>
184
			<jsp:attribute name="type">hidden</jsp:attribute>
185
			<jsp:attribute name="value">
186
				<jsp:getProperty name="clientViewBean" property="sessionid" />
187
			</jsp:attribute>
188
		</jsp:element>
189 3462 leinfelder
		<input type="text" id="anyfield" name="anyfield" value="" size="14" />
190
		<input type="hidden" id="query" name="query"  />
191
		<input type="hidden" name="qformat" value="sanparks"/>
192
		<input type="hidden" name="action" value="squery" />
193
		<input type="submit" value="Search"  />
194 3414 leinfelder
		<p class="regtext">
195 3462 leinfelder
		-Or-
196
		<br />
197 3414 leinfelder
		Browse all existing data sets by title. This operation can be slow.
198
		</p>
199 3462 leinfelder
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
200 3672 leinfelder
	</jsp:element>
201 3462 leinfelder
202 3414 leinfelder
	</td>
203
	<td>
204
205
	<!-- Login section -->
206 3405 leinfelder
	<jsp:scriptlet>
207 3414 leinfelder
		if (!clientViewHelper.isLoggedIn()) {
208
	</jsp:scriptlet>
209
210
	<h3>
211
		Login
212
		<!-- TODO: Config param follows -->
213 3652 leinfelder
		<a href="@cgi-prefix@/ldapweb.cgi?cfg=sanparks" target="_parent">
214 3414 leinfelder
			<span class="regtext"> (request an account...)</span>
215
		</a>
216
	</h3>
217 3428 leinfelder
	<form name="loginForm" method="post" action="./"
218 3414 leinfelder
		onsubmit="return allowSubmit(this)">
219
		<input name="qformat" type="hidden" value="sanparks" />
220 3405 leinfelder
	<table>
221 3414 leinfelder
		<tr valign="top">
222
			<td>
223
				<span class="required">User name</span>
224 3405 leinfelder
			</td>
225 3414 leinfelder
			<td>
226
				<input name="username" type="text" value=""
227
				style="width: 140" />
228
			</td>
229 3405 leinfelder
		</tr>
230
		<tr>
231
			<td><span class="required">Organization</span></td>
232
			<td><select name="organization" style="width: 140">
233
				<option value="SANParks" selected="">SANParks</option>
234
				<option value="SAEON">SAEON</option>
235
				<option value="NCEAS">NCEAS</option>
236
				<option value="unaffiliated">unaffiliated</option>
237
			</select></td>
238
		</tr>
239
		<tr>
240
			<td><span class="required">Password</span></td>
241
			<td><input name="password" value="" type="password"
242
				style="width: 140" maxlength="50" /></td>
243
		</tr>
244
		<tr>
245 3414 leinfelder
			<td colspan="2" align="center">
246
				<input name="action"
247
				value="Login" type="submit" class="button_login" />
248
			</td>
249 3405 leinfelder
		</tr>
250
	</table>
251
	</form>
252 3414 leinfelder
253 3405 leinfelder
	<jsp:scriptlet>
254 3414 leinfelder
		} else {
255
	</jsp:scriptlet>
256 3416 leinfelder
	<h3>
257
		Welcome,
258
		<jsp:expression>clientViewBean.getUsername()</jsp:expression>
259
	</h3>
260 3428 leinfelder
	<form name="logoutForm" method="post" action="./">
261 3405 leinfelder
	<input name="qformat" value="sanparks" type="hidden" />
262
	<table>
263 3416 leinfelder
		<tr valign="top">
264 3405 leinfelder
			<td>
265 3416 leinfelder
				<p class="regtext">
266
					You are currently logged in.
267
				</p>
268 3405 leinfelder
			</td>
269 3416 leinfelder
			<td align="right">
270
				<input name="action" type="submit" value="Logout" class="button_login" />
271
			</td>
272
		</tr>
273
		<tr valign="top">
274
			<td colspan="2">
275
				<p class="regtext">
276
					(<jsp:expression>clientViewBean.getMessage(ClientView.LOGIN_MESSAGE)</jsp:expression>)
277
				</p>
278
			</td>
279
		</tr>
280
		<tr>
281
			<td colspan="2"
282
				class="regtext"
283
				align="center"
284
				valign="top">
285
286 3414 leinfelder
				<!-- TODO: Config param follows -->
287
				<a
288 3652 leinfelder
					href="@cgi-prefix@/ldapweb.cgi?cfg=sanparks&amp;stage=resetpass"
289 3414 leinfelder
					target="_parent">reset your password</a>
290 3416 leinfelder
				|
291
				<!-- TODO: Config param follows -->
292
				<a
293 3652 leinfelder
					href="@cgi-prefix@/ldapweb.cgi?cfg=sanparks&amp;stage=changepass"
294 3414 leinfelder
					target="_parent">change your password</a>
295 3405 leinfelder
			</td>
296
		</tr>
297
	</table>
298
	</form>
299
	<jsp:scriptlet>
300 3414 leinfelder
		}
301
	</jsp:scriptlet>
302
303
	<!-- File Upload Form -->
304
	<br />
305
	<h3>Data Package Upload</h3>
306
307 3405 leinfelder
	<jsp:scriptlet>
308 3414 leinfelder
		if (clientViewHelper.isLoggedIn()) {
309
	</jsp:scriptlet>
310 3431 leinfelder
	<table width="100%">
311
		<tr valign="top">
312
			<td align="right">
313 3672 leinfelder
				<form action="@systemidserver@@style-skins-path@/sanparks/upload.jsp" method="post">
314 3548 barteau
					<input type="submit" value="Go >" class="button_login" />
315 3431 leinfelder
				</form>
316
			</td>
317
		</tr>
318
	</table>
319 3405 leinfelder
	<jsp:scriptlet>
320 3414 leinfelder
		} else {
321
	</jsp:scriptlet>
322
323
	<p class="regtext">
324
		You must be logged into your user account before uploading a data set.
325
	</p>
326 3405 leinfelder
	<jsp:scriptlet>
327 3414 leinfelder
		}
328
	</jsp:scriptlet>
329
330
	</td>
331
332
	<!-- so the map frame doesn't overlap content -->
333
	<td width="50px"></td>
334
335
	</tr>
336
337
	<tr>
338 3435 leinfelder
	<td colspan="2" align="center">
339 3431 leinfelder
340
341
	<!-- Map here -->
342
	<br />
343 3459 leinfelder
	<h3>Spatial Search</h3>
344 3431 leinfelder
345 3451 leinfelder
		<!-- map frame -->
346
        <script language="JavaScript">
347
            insertMap();
348
        </script>
349 3431 leinfelder
	</td>
350
351
	<!-- so the map frame doesn't overlap content -->
352
	<td width="50px"></td>
353
354 3414 leinfelder
	</tr>
355 3431 leinfelder
356 3414 leinfelder
	</table>
357
358 3405 leinfelder
	</div>
359 3414 leinfelder
</body>
360
</html>
361 3404 leinfelder
</jsp:root>