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
<!-- <body style="background: #FFFFFF;">-->
61
	<div class="templatecontentareaclass">
62
		<jsp:useBean id="clientViewBean" scope="session" class="edu.ucsb.nceas.metacat.clientview.ClientView" /> 
63
		<jsp:setProperty name="clientViewBean" property="*" /> 
64
		<jsp:scriptlet>
65
			clientViewHelper = ClientViewHelper.clientViewHelperInstance(request);
66
			clientViewHelper.clientRequest(request, response);
67
        </jsp:scriptlet>
68

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