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