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="@systemidserver@@style-skins-path@/sanparks/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="@systemidserver@@style-skins-path@/sanparks/sanparks.css" rel="stylesheet" type="text/css" />
56

    
57
</head>
58
	
59
<body>
60
	<div class="templatecontentareaclass" style="background: #FFFFFF;">
61
		<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

    
68
	<table>
69
	<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
	<tr valign="top">
79
	<td>
80
	
81
	<h2>Search for SANParks Data</h2>
82
	
83
	<p class="emphasis">Searching: 
84
		<jsp:scriptlet>
85
			String organizationScope = request.getParameter("organizationScope");
86
			if (organizationScope == null) {
87
				organizationScope = "";
88
			}
89
			if (!organizationScope.equals("")) {
90
		</jsp:scriptlet>
91
			<!-- 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
					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
					//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
		<jsp:scriptlet>
147
			}
148
			else {
149
		</jsp:scriptlet>
150
			All Organizations	
151
		<jsp:scriptlet>
152
			}
153
		</jsp:scriptlet>
154
	</p>
155
	
156
	<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
		<p class="regtext">
166
		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
		</p>
174
		<jsp:element name="input">
175
			<jsp:attribute name="name">organizationScope</jsp:attribute>
176
			<jsp:attribute name="id">organizationScope</jsp:attribute>
177
			<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
			<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
		<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
		<p class="regtext">
195
		-Or-
196
		<br />
197
		Browse all existing data sets by title. This operation can be slow.
198
		</p>
199
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
200
	</jsp:element>
201
	
202
	</td>
203
	<td>
204
	
205
	<!-- Login section -->
206
	<jsp:scriptlet>
207
		if (!clientViewHelper.isLoggedIn()) {
208
	</jsp:scriptlet>
209
	
210
	<h3>
211
		Login
212
		<!-- TODO: Config param follows --> 
213
		<a href="@cgi-prefix@/ldapweb.cgi?cfg=sanparks" target="_parent">
214
			<span class="regtext"> (request an account...)</span>
215
		</a>
216
	</h3>
217
	<form name="loginForm" method="post" action="./"
218
		onsubmit="return allowSubmit(this)">
219
		<input name="qformat" type="hidden" value="sanparks" />
220
	<table>
221
		<tr valign="top">
222
			<td>
223
				<span class="required">User name</span>	
224
			</td>
225
			<td>
226
				<input name="username" type="text" value=""
227
				style="width: 140" />
228
			</td>
229
		</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
			<td colspan="2" align="center">
246
				<input name="action"
247
				value="Login" type="submit" class="button_login" />
248
			</td>
249
		</tr>
250
	</table>
251
	</form>
252
	
253
	<jsp:scriptlet>
254
		} else {
255
	</jsp:scriptlet>
256
	<h3>
257
		Welcome,
258
		<jsp:expression>clientViewBean.getUsername()</jsp:expression>  
259
	</h3>
260
	<form name="logoutForm" method="post" action="./">
261
	<input name="qformat" value="sanparks" type="hidden" />
262
	<table>
263
		<tr valign="top">
264
			<td>
265
				<p class="regtext">
266
					You are currently logged in.
267
				</p>
268
			</td>
269
			<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
				<!-- TODO: Config param follows --> 
287
				<a
288
					href="@cgi-prefix@/ldapweb.cgi?cfg=sanparks&amp;stage=resetpass"
289
					target="_parent">reset your password</a>
290
				|
291
				<!-- TODO: Config param follows --> 
292
				<a
293
					href="@cgi-prefix@/ldapweb.cgi?cfg=sanparks&amp;stage=changepass"
294
					target="_parent">change your password</a>
295
			</td>
296
		</tr>
297
	</table>
298
	</form>
299
	<jsp:scriptlet>
300
		}
301
	</jsp:scriptlet> 
302
	
303
	<!-- File Upload Form --> 
304
	<br />
305
	<h3>Data Package Upload</h3>
306
	
307
	<jsp:scriptlet>
308
		if (clientViewHelper.isLoggedIn()) {
309
	</jsp:scriptlet>
310
	<table width="100%">
311
		<tr valign="top">
312
			<td align="right">
313
				<form action="@systemidserver@@style-skins-path@/sanparks/upload.jsp" method="post">
314
					<input type="submit" value="Go >" class="button_login" />
315
				</form>
316
			</td>
317
		</tr>
318
	</table>			
319
	<jsp:scriptlet>
320
		} 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
	<jsp:scriptlet>
327
		}
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
	<td colspan="2" align="center">
339
	
340
	
341
	<!-- Map here --> 
342
	<br />
343
	<h3>Spatial Search</h3>
344
	
345
		<!-- map frame -->
346
        <script language="JavaScript">
347
            insertMap();
348
        </script>
349
	</td>
350
	
351
	<!-- so the map frame doesn't overlap content -->
352
	<td width="50px"></td>
353
	
354
	</tr>
355
	
356
	</table>
357
	
358
	</div>
359
</body>
360
</html>
361
</jsp:root>
(3-3/21)