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
	<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
									
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
		<jsp:scriptlet>
137
			}
138
			else {
139
		</jsp:scriptlet>
140
			All Organizations	
141
		<jsp:scriptlet>
142
			}
143
		</jsp:scriptlet>
144
	</p>
145
	
146
	<form id="searchform" name="searchform" method="post" action="../../../metacat" 
147
		target="_top" 
148
		onsubmit="setQueryFormField()">
149
		<p class="regtext">
150
		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
		</p>
158
		<jsp:element name="input">
159
			<jsp:attribute name="name">organizationScope</jsp:attribute>
160
			<jsp:attribute name="id">organizationScope</jsp:attribute>
161
			<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
			<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
		<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
		<p class="regtext">
179
		-Or-
180
		<br />
181
		Browse all existing data sets by title. This operation can be slow.
182
		</p>
183
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
184
	</form>
185
	
186
	</td>
187
	<td>
188
	
189
	<!-- Login section -->
190
	<jsp:scriptlet>
191
		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
	<form name="loginForm" method="post" action="./"
202
		onsubmit="return allowSubmit(this)">
203
		<input name="qformat" type="hidden" value="sanparks" />
204
	<table>
205
		<tr valign="top">
206
			<td>
207
				<span class="required">User name</span>	
208
			</td>
209
			<td>
210
				<input name="username" type="text" value=""
211
				style="width: 140" />
212
			</td>
213
		</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
			<td colspan="2" align="center">
230
				<input name="action"
231
				value="Login" type="submit" class="button_login" />
232
			</td>
233
		</tr>
234
	</table>
235
	</form>
236
	
237
	<jsp:scriptlet>
238
		} else {
239
	</jsp:scriptlet>
240
	<h3>
241
		Welcome,
242
		<jsp:expression>clientViewBean.getUsername()</jsp:expression>  
243
	</h3>
244
	<form name="logoutForm" method="post" action="./">
245
	<input name="qformat" value="sanparks" type="hidden" />
246
	<table>
247
		<tr valign="top">
248
			<td>
249
				<p class="regtext">
250
					You are currently logged in.
251
				</p>
252
			</td>
253
			<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
				<!-- 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
				|
275
				<!-- TODO: Config param follows --> 
276
				<a
277
					href="HOSTNAME_HERE/cgiScripts/cgi-bin/ldapweb.cgi?stage=changepass"
278
					target="_parent">change your password</a>
279
			</td>
280
		</tr>
281
	</table>
282
	</form>
283
	<jsp:scriptlet>
284
		}
285
	</jsp:scriptlet> 
286
	
287
	<!-- File Upload Form --> 
288
	<br />
289
	<h3>Data Package Upload</h3>
290
	
291
	<jsp:scriptlet>
292
		if (clientViewHelper.isLoggedIn()) {
293
	</jsp:scriptlet>
294
	<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
	<jsp:scriptlet>
304
		} 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
	<jsp:scriptlet>
311
		}
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
	<td colspan="2" align="center">
323
	
324
	
325
	<!-- Map here --> 
326
	<br />
327
	<h3>Spatial Search</h3>
328
	
329
		<!-- map frame -->
330
        <script language="JavaScript">
331
            insertMap();
332
        </script>
333
	</td>
334
	
335
	<!-- so the map frame doesn't overlap content -->
336
	<td width="50px"></td>
337
	
338
	</tr>
339
	
340
	</table>
341
	
342
	</div>
343
</body>
344
</html>
345
</jsp:root>
(2-2/19)