Project

General

Profile

1
<?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
					for (var i=0; i < locationOptions.length; i++) {
87
						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
		<input name="organizationScope" id="organizationScope" type="hidden" value="<%= organizationScope %>" />
132
		<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="<%=USER_MANAGEMENT_URL%>" target="_new" >
157
		<span class="regtext"> (request an account...)</span>
158
		</a>
159
		</h3>
160
		<form name="loginForm" id="loginForm" onsubmit="submitLoginFormIntoDivAndReload('<%= SERVLET_URL %>', this, 'loginSection')">
161
		  <input name="qformat" type="hidden" value="sanparks" />
162
		  <input name="action" type="hidden" value="login"/>
163
		  <table>
164
		    <tr valign="top">
165
		      <td><span class="required">User name</span></td>
166
		      <td><input name="shortusername" type="text" value="" style="width: 140" /></td>
167
		      <td><input name="username" type="hidden" value="" /></td>
168
		    </tr>
169
		    <tr>
170
		      <td><span class="required">Organization</span></td>
171
		      <td><select name="organization" style="width: 140">
172
		            <option value="SANParks" selected="">SANParks</option>
173
		            <option value="SAEON">SAEON</option>
174
		            <option value="NCEAS">NCEAS</option>
175
		            <option value="unaffiliated">unaffiliated</option>
176
		          </select></td>
177
		    </tr>
178
		    <tr>
179
		      <td><span class="required">Password</span></td>
180
		      <td><input name="password" value="" type="password" style="width: 140" maxlength="50" /></td>
181
		    </tr>
182
		    <tr>
183
		      <td colspan="2" align="center">
184
		        <input name="loginSubmit" value="login" type="submit" class="button_login" />
185
		      </td>
186
		    </tr>
187
		  </table>
188
		</form>
189
<%
190
	} else {
191
%>
192
		<h3>Welcome,<%= clientViewBean.getUsername() %></h3>
193
		<form name="logoutForm" id="logoutForm" onsubmit="submitLogoutFormIntoDiv('<%= SERVLET_URL %>', this, 'loginSection')">
194
		  <input name="qformat" value="sanparks" type="hidden" />
195
		  <input name="action" type="hidden" value="logout"/>
196
		  <table>
197
			   <tr valign="top">
198
			     <td><p class="regtext">You are currently logged in.</p></td>
199
			     <td align="right"><input name="action" type="submit" value="logout" class="button_login" /></td>
200
			   </tr>
201
		    <tr valign="top">
202
		      <td colspan="2" width="600px"><p class="regtext"></p></td>
203
		      <!--  td colspan="2">< p class="regtext">(< % = clientViewBean.getMessage(ClientView.LOGIN_MESSAGE) % >)< / p ></td -->
204
			</tr>
205
			<tr>	
206
			   <td colspan="2" class="regtext" align="center" valign="top">		
207
		      <!-- reset pass -->
208
		        <a href="<%=USER_MANAGEMENT_URL%>" target="_parent">
209
		          reset your password
210
		        </a>
211
		        |
212
		        <!-- change pass -->
213
		        <a href="<%=USER_MANAGEMENT_URL%>" target="_parent">
214
		          change your password
215
		        </a>
216
		      </td>
217
		    </tr>
218
		  </table>
219
		</form>
220
<%		
221
	}
222
%>
223
	
224
	<!-- File Upload Form --> 
225
	<br />
226
	<h3>Data Package Upload</h3>
227
	
228
	<%
229
		if (clientViewHelper.isLoggedIn()) {
230
	%>
231
	<table width="100%">
232
		<tr valign="top">
233
			<td align="right">
234
				<form method="post" action="<%= CONTEXT_URL %>/style/skins/sanparks/upload.jsp">
235
					<input type="submit" value="Go >" class="button_login" />
236
				</form>
237
			</td>
238
		</tr>
239
	</table>			
240
	<%
241
		} else {
242
	%>
243
	
244
	<p class="regtext">
245
		You must be logged into your user account before uploading a data set.
246
	</p>
247
	<%
248
		}
249
	%>
250
	
251
	</div>
252
	</td>
253
	
254
	<!-- so the map frame doesn't overlap content -->
255
	<td width="50px"></td>
256
	
257
	</tr>
258
	
259
	<tr>
260
	<td colspan="2" align="center">
261
	
262
	
263
	<!-- Map here --> 
264
	<br />
265
	<h3>Spatial Search</h3>
266
	
267
		<!-- map frame -->
268
        <script language="JavaScript">
269
            insertMap("<%= CONTEXT_URL %>");
270
        </script>
271
	</td>
272
	
273
	<!-- so the map frame doesn't overlap content -->
274
	<td width="50px"></td>
275
	
276
	</tr>
277
	
278
	</table>
279
	
280
	</div>
281
</body>
282
</html>
(22-22/36)