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