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 3462 leinfelder
	<script language="JavaScript" type="text/JavaScript" src="./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 3405 leinfelder
	<link href="sanparks.css" rel="stylesheet" type="text/css" />
56
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 3462 leinfelder
	<form id="searchform" name="searchform" method="post" action="../../../metacat"
157
		target="_top"
158
		onsubmit="setQueryFormField()">
159 3414 leinfelder
		<p class="regtext">
160 3415 leinfelder
		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 3414 leinfelder
		</p>
168
		<jsp:element name="input">
169 3462 leinfelder
			<jsp:attribute name="name">organizationScope</jsp:attribute>
170
			<jsp:attribute name="id">organizationScope</jsp:attribute>
171 3459 leinfelder
			<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 3414 leinfelder
			<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 3462 leinfelder
		<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 3414 leinfelder
		<p class="regtext">
189 3462 leinfelder
		-Or-
190
		<br />
191 3414 leinfelder
		Browse all existing data sets by title. This operation can be slow.
192
		</p>
193 3462 leinfelder
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
194 3405 leinfelder
	</form>
195 3462 leinfelder
196 3414 leinfelder
	</td>
197
	<td>
198
199
	<!-- Login section -->
200 3405 leinfelder
	<jsp:scriptlet>
201 3414 leinfelder
		if (!clientViewHelper.isLoggedIn()) {
202
	</jsp:scriptlet>
203
204
	<h3>
205
		Login
206
		<!-- TODO: Config param follows -->
207 3605 leinfelder
		<a href="@cgi-prefix@/ldapweb.cgi" target="_parent">
208 3414 leinfelder
			<span class="regtext"> (request an account...)</span>
209
		</a>
210
	</h3>
211 3428 leinfelder
	<form name="loginForm" method="post" action="./"
212 3414 leinfelder
		onsubmit="return allowSubmit(this)">
213
		<input name="qformat" type="hidden" value="sanparks" />
214 3405 leinfelder
	<table>
215 3414 leinfelder
		<tr valign="top">
216
			<td>
217
				<span class="required">User name</span>
218 3405 leinfelder
			</td>
219 3414 leinfelder
			<td>
220
				<input name="username" type="text" value=""
221
				style="width: 140" />
222
			</td>
223 3405 leinfelder
		</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 3414 leinfelder
			<td colspan="2" align="center">
240
				<input name="action"
241
				value="Login" type="submit" class="button_login" />
242
			</td>
243 3405 leinfelder
		</tr>
244
	</table>
245
	</form>
246 3414 leinfelder
247 3405 leinfelder
	<jsp:scriptlet>
248 3414 leinfelder
		} else {
249
	</jsp:scriptlet>
250 3416 leinfelder
	<h3>
251
		Welcome,
252
		<jsp:expression>clientViewBean.getUsername()</jsp:expression>
253
	</h3>
254 3428 leinfelder
	<form name="logoutForm" method="post" action="./">
255 3405 leinfelder
	<input name="qformat" value="sanparks" type="hidden" />
256
	<table>
257 3416 leinfelder
		<tr valign="top">
258 3405 leinfelder
			<td>
259 3416 leinfelder
				<p class="regtext">
260
					You are currently logged in.
261
				</p>
262 3405 leinfelder
			</td>
263 3416 leinfelder
			<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 3414 leinfelder
				<!-- TODO: Config param follows -->
281
				<a
282 3604 leinfelder
					href="@cgi-prefix@/ldapweb.cgi?stage=resetpass"
283 3414 leinfelder
					target="_parent">reset your password</a>
284 3416 leinfelder
				|
285
				<!-- TODO: Config param follows -->
286
				<a
287 3604 leinfelder
					href="@cgi-prefix@/ldapweb.cgi?stage=changepass"
288 3414 leinfelder
					target="_parent">change your password</a>
289 3405 leinfelder
			</td>
290
		</tr>
291
	</table>
292
	</form>
293
	<jsp:scriptlet>
294 3414 leinfelder
		}
295
	</jsp:scriptlet>
296
297
	<!-- File Upload Form -->
298
	<br />
299
	<h3>Data Package Upload</h3>
300
301 3405 leinfelder
	<jsp:scriptlet>
302 3414 leinfelder
		if (clientViewHelper.isLoggedIn()) {
303
	</jsp:scriptlet>
304 3431 leinfelder
	<table width="100%">
305
		<tr valign="top">
306
			<td align="right">
307
				<form action="./upload.jsp" method="post">
308 3548 barteau
					<input type="submit" value="Go >" class="button_login" />
309 3431 leinfelder
				</form>
310
			</td>
311
		</tr>
312
	</table>
313 3405 leinfelder
	<jsp:scriptlet>
314 3414 leinfelder
		} 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 3405 leinfelder
	<jsp:scriptlet>
321 3414 leinfelder
		}
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 3435 leinfelder
	<td colspan="2" align="center">
333 3431 leinfelder
334
335
	<!-- Map here -->
336
	<br />
337 3459 leinfelder
	<h3>Spatial Search</h3>
338 3431 leinfelder
339 3451 leinfelder
		<!-- map frame -->
340
        <script language="JavaScript">
341
            insertMap();
342
        </script>
343 3431 leinfelder
	</td>
344
345
	<!-- so the map frame doesn't overlap content -->
346
	<td width="50px"></td>
347
348 3414 leinfelder
	</tr>
349 3431 leinfelder
350 3414 leinfelder
	</table>
351
352 3405 leinfelder
	</div>
353 3414 leinfelder
</body>
354
</html>
355 3404 leinfelder
</jsp:root>