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
                
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
    </script>
54

    
55
	<title>SANParks - South African National Park Data Repository</title>
56
	<link href="sanparks.css" rel="stylesheet" type="text/css" />
57

    
58
</head>
59
	
60
<body>
61
<!-- <body style="background: #FFFFFF;">-->
62
	<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

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