Project

General

Profile

1 5071 daigle
<?xml version="1.0" encoding="UTF-8"?>
2
3
<!-- to change the content type or response encoding change the following line -->
4
<%@page contentType="text/html"%>
5
<%@page pageEncoding="UTF-8"%>
6
<%@ page import="edu.ucsb.nceas.metacat.clientview.ClientView" %>
7
<%@ page import="edu.ucsb.nceas.metacat.clientview.ClientViewHelper" %>
8
<%@ page import="edu.ucsb.nceas.metacat.clientview.ClientHtmlHelper" %>
9
<%@ page import="edu.ucsb.nceas.metacat.service.SessionService" %>
10
11
<%@ include file="settings.jsp" %>
12
13
<%
14
    ClientViewHelper clientViewHelper = null;
15
%>
16
17
<html xmlns="http://www.w3.org/1999/xhtml">
18
<head>
19
	<title>SANParks - South African National Park Data Repository</title>
20
	<link rel="stylesheet" type="text/css" href="<%= CONTEXT_URL %>/style/skins/sanparks/sanparks.css"/>
21
	<script language="JavaScript" type="text/JavaScript" src="<%=STYLE_COMMON_URL%>/prototype-1.5.1.1/prototype.js"></script>
22
	<script language="JavaScript" type="text/JavaScript" src="<%=STYLE_COMMON_URL%>/ajax-utils.js"></script>
23
	<script language="JavaScript" type="text/JavaScript" src="<%=STYLE_SKINS_URL%>/sanparks/sanparksLogin.js"></script>
24
</head>
25
26
<body>
27
	<div class="templatecontentareaclass" style="background: #FFFFFF;">
28
	<jsp:useBean id="clientViewBean" scope="session" class="edu.ucsb.nceas.metacat.clientview.ClientView" />
29
	<jsp:setProperty name="clientViewBean" property="*" />
30
	<% clientViewHelper = ClientViewHelper.clientViewHelperInstance(request); %>
31
32
	<table>
33
	<tr>
34
		<td colspan="3">
35
			<p class="regtext">
36
			Welcome to the SANParks Data Repository.
37
			This is the primary source for comprehensive information about scientific
38
			and research data sets collected throughout the South African National Park System.
39
			</p>
40
		</td>
41
	</tr>
42
	<tr valign="top">
43
	<td>
44
45
	<h2>Search for SANParks Data</h2>
46
47
	<p class="emphasis">Searching:
48
		<%
49
			String organizationScope = request.getParameter("organizationScope");
50
			if (organizationScope == null) {
51
				organizationScope = "";
52
			}
53
			if (!organizationScope.equals("")) {
54
		%>
55
			<!-- set the map to use the correct scope -->
56
			<script type="text/javascript" >
57
				var dropDownTimer = null;
58
59
				//this syncs the map based on the input string location
60
				function setMapLocation(strLocation) {
61
62
					var mapFrameDocument = document.getElementById("mapFrame").contentDocument;
63
					if (!mapFrameDocument) {
64
						//alert("IE");
65
						mapFrameDocument = document.getElementById("mapFrame").contentWindow;
66
						if (mapFrameDocument.document) {
67
							mapFrameDocument = mapFrameDocument.document;
68
						}
69
70
					}
71
					//alert("mapFrame=" + mapFrameDocument.name);
72
					//alert("locations=" + mapFrameDocument.getElementsByTagName('locations'));
73
74
					//check if the dropdown is loaded in DOM
75
					if (mapFrameDocument.getElementsByName('locations').length == 0) {
76
						dropDownTimer = setTimeout("setMapLocation('" + strLocation + "')", 100);
77
						return false;
78
					}
79
					clearTimeout(dropDownTimer);
80
81
					var locationMenu = mapFrameDocument.getElementsByName('locations')[0];
82
					//alert("locationMenu=" + locationMenu);
83
					var locationOptions = locationMenu.options;
84
					//alert("locationOptions=" + locationOptions);
85
					//loop through the options to find the correct location based on input string
86 5598 leinfelder
					for (var i=0; i < locationOptions.length; i++) {
87 5071 daigle
						if (locationOptions[i].text == strLocation) {
88
							//set as selected
89
							locationMenu.selectedIndex = i;
90
							break;
91
						}
92
					}
93
					//alert("Focusing on selected location: " + locationMenu.options[locationMenu.selectedIndex].text);
94
95
					//the onchange command from select object
96
					locationMenu.onchange();
97
					//mapFrameDocument.config.objects.locationsSelect.setAoi(locationMenu.options[locationMenu.selectedIndex].value,'mainMap');
98
99
				}
100
101
				//kick it off
102
				dropDownTimer =
103
					setTimeout(
104
					"setMapLocation('<%= organizationScope %>')",
105
					 100);
106
107
			</script>
108
109
			<%= organizationScope %>
110
		<%
111
			} else {
112
		%>
113
			All Organizations
114
		<%
115
			}
116
		%>
117
	</p>
118
119
	<form id="searchform" name="searchform" method="post"
120
			action="<%= SERVLET_URL %>" target="_top"
121
			onsubmit="setQueryFormField()">
122
		<p class="regtext">
123
		The repository search system is used to locate data sets of interest by
124
		searching through existing registered data sets.
125
		Presently the search covers all fields, including author, title, abstract,
126
		keywords, and other documentation for each data set.
127
		<br />
128
		Use a '%' symbol as a wildcard in searches (e.g., '%herbivore%'
129
		would locate any phrase with the word herbivore embedded within it).
130
		</p>
131 5597 leinfelder
		<input name="organizationScope" id="organizationScope" type="hidden" value="<%= organizationScope %>" />
132 5071 daigle
		<input name="sessionid" id="sessionid" type="hidden" value="<%= request.getSession().getId() %>" />
133
		<input name="anyfield" type="text" id="anyfield" value="" size="14" />
134
		<input name="query" type="hidden" id="query" />
135
		<input name="qformat" type="hidden" value="sanparks"/>
136
		<input name="action" type="hidden" value="squery" />
137
		<input type="submit" value="Search"  />
138
		<br/>
139
		<input type="checkbox" id="searchAll" name="searchAll" />Search all fields (slower)
140
		<p class="regtext">
141
		-Or-
142
		<br />
143
		Browse all existing data sets by title. This operation can be slow.
144
		</p>
145
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
146
	</form>
147
148
	</td>
149
	<td>
150
151
	<div id="loginSection">
152
<%
153
	if (!clientViewHelper.isLoggedIn()) {
154
%>
155
		<h3>Login
156
		<a href="<%= CONTEXT_URL %>/cgi-bin/ldapweb.cgi?cfg=sanparks" target="_new" />
157
		<span class="regtext"> (request an account...)</span>
158
		</h3>
159
		<form name="loginForm" id="loginForm" onsubmit="submitLoginFormIntoDiv('<%= SERVLET_URL %>', this, 'loginSection')">
160
		  <input name="qformat" type="hidden" value="sanparks" />
161
		  <input name="action" type="hidden" value="login"/>
162
		  <table>
163
		    <tr valign="top">
164
		      <td><span class="required">User name</span></td>
165
		      <td><input name="shortusername" type="text" value="" style="width: 140" /></td>
166
		      <td><input name="username" type="hidden" value="" /></td>
167
		    </tr>
168
		    <tr>
169
		      <td><span class="required">Organization</span></td>
170
		      <td><select name="organization" style="width: 140">
171
		            <option value="SANParks" selected="">SANParks</option>
172
		            <option value="SAEON">SAEON</option>
173
		            <option value="NCEAS">NCEAS</option>
174
		            <option value="unaffiliated">unaffiliated</option>
175
		          </select></td>
176
		    </tr>
177
		    <tr>
178
		      <td><span class="required">Password</span></td>
179
		      <td><input name="password" value="" type="password" style="width: 140" maxlength="50" /></td>
180
		    </tr>
181
		    <tr>
182
		      <td colspan="2" align="center">
183
		        <input name="loginSubmit" value="login" type="submit" class="button_login" />
184
		      </td>
185
		    </tr>
186
		  </table>
187
		</form>
188
<%
189
	} else {
190
%>
191
		<h3>Welcome,<%= clientViewBean.getUsername() %></h3>
192
		<form name="logoutForm" id="logoutForm" onsubmit="submitLogoutFormIntoDiv('<%= SERVLET_URL %>', this, 'loginSection')">
193
		  <input name="qformat" value="sanparks" type="hidden" />
194
		  <input name="action" type="hidden" value="logout"/>
195
		  <table>
196
			   <tr valign="top">
197
			     <td><p class="regtext">You are currently logged in.</p></td>
198
			     <td align="right"><input name="action" type="submit" value="logout" class="button_login" /></td>
199
			   </tr>
200
		    <tr valign="top">
201
		      <td colspan="2" width="600px"><p class="regtext"></p></td>
202
		      <!--  td colspan="2">< p class="regtext">(< % = clientViewBean.getMessage(ClientView.LOGIN_MESSAGE) % >)< / p ></td -->
203
			</tr>
204
			<tr>
205
			   <td colspan="2" class="regtext" align="center" valign="top">
206
		      <!-- reset pass -->
207
		        <a href="<%= CGI_URL %>/ldapweb.cgi?cfg=sanparks&amp;stage=resetpass" target="_parent">
208
		          reset your password
209
		        </a>
210
		        |
211
		        <!-- change pass -->
212
		        <a href="<%= CGI_URL %>/ldapweb.cgi?cfg=sanparks&amp;stage=changepass" target="_parent">
213
		          change your password
214
		        </a>
215
		      </td>
216
		    </tr>
217
		  </table>
218
		</form>
219
<%
220
	}
221
%>
222
223
	<!-- File Upload Form -->
224
	<br />
225
	<h3>Data Package Upload</h3>
226
227
	<%
228
		if (clientViewHelper.isLoggedIn()) {
229
	%>
230
	<table width="100%">
231
		<tr valign="top">
232
			<td align="right">
233
				<form method="post" action="<%= CONTEXT_URL %>/style/skins/sanparks/upload.jsp">
234
					<input type="submit" value="Go >" class="button_login" />
235
				</form>
236
			</td>
237
		</tr>
238
	</table>
239
	<%
240
		} else {
241
	%>
242
243
	<p class="regtext">
244
		You must be logged into your user account before uploading a data set.
245
	</p>
246
	<%
247
		}
248
	%>
249
250
	</div>
251
	</td>
252
253
	<!-- so the map frame doesn't overlap content -->
254
	<td width="50px"></td>
255
256
	</tr>
257
258
	<tr>
259
	<td colspan="2" align="center">
260
261
262
	<!-- Map here -->
263
	<br />
264
	<h3>Spatial Search</h3>
265
266
		<!-- map frame -->
267
        <script language="JavaScript">
268
            insertMap("<%= CONTEXT_URL %>");
269
        </script>
270
	</td>
271
272
	<!-- so the map frame doesn't overlap content -->
273
	<td width="50px"></td>
274
275
	</tr>
276
277
	</table>
278
279
	</div>
280
</body>
281
</html>