Project

General

Profile

« Previous | Next » 

Revision 3462

use 'squery' searching so that both EML and FGDC can be searched based on location and an anyfield search string.
changed 'All' to use empty string ("") value rather than "%" - plays better with QueryGroup

View differences:

lib/style/skins/sanparks/SaeonLogin.jspx
17 17
<html xmlns="http://www.w3.org/1999/xhtml">
18 18
<head>
19 19

  
20
	<script language="JavaScript" type="text/JavaScript" src="./searchPathQuery.js"/>
20 21
	<script type="text/javascript">
21 22
                
22 23
                function allowSubmit(formObj) {
......
85 86
		<jsp:scriptlet>
86 87
			String organizationScope = request.getParameter("organizationScope");
87 88
			if (organizationScope == null) {
88
				organizationScope = "%";
89
				organizationScope = "";
89 90
			}
90
			if (!organizationScope.equals("%")) {
91
			if (!organizationScope.equals("")) {
91 92
		</jsp:scriptlet>
92 93
			<!-- set the map to use the correct scope -->
93 94
			<script type="text/javascript" >
......
144 145
		</jsp:scriptlet>
145 146
	</p>
146 147
	
147
	<form name="searchform" method="post" action="../../../metacat" target="_top">
148
		<jsp:include page="SimpleSearchMetacatPostFields.html" /> 
149
		<jsp:element name="input">
150
			<jsp:attribute name="name">sessionid</jsp:attribute>
151
			<jsp:attribute name="type">hidden</jsp:attribute>
152
			<jsp:attribute name="value">
153
				<jsp:getProperty name="clientViewBean" property="sessionid" />
154
			</jsp:attribute>
155
		</jsp:element> 
148
	<form id="searchform" name="searchform" method="post" action="../../../metacat" 
149
		target="_top" 
150
		onsubmit="setQueryFormField()">
156 151
		<p class="regtext">
157 152
		The repository search system is used to locate data sets of interest by 
158 153
		searching through existing registered data sets. 
......
162 157
		Use a '%' symbol as a wildcard in searches (e.g., '%herbivore%' 
163 158
		would locate any phrase with the word herbivore embedded within it).
164 159
		</p>
165
			<input name="anyfield" value="" type="text" size="14" />
166
			<jsp:element name="input">
167
				<jsp:attribute name="name">placekey</jsp:attribute>
168
				<jsp:attribute name="type">hidden</jsp:attribute>
169
				<jsp:attribute name="value">
170
					<jsp:expression>organizationScope</jsp:expression>
171
				</jsp:attribute>
172
			</jsp:element>
173
			<input name="action" value="query" type="hidden" />  
174
			<input value="Search" type="submit" /> 
175
		
176
	</form>
177
	<p class="regtext">
178
	-Or-
179
	</p>
180
	<form name="browseform" method="post" action="../../../metacat"
181
		target="_top">
182
		<jsp:include page="SimpleSearchMetacatPostFields.html" /> 
183
		<input name="anyfield" type="hidden" value="%" />
184 160
		<jsp:element name="input">
185
			<jsp:attribute name="name">placekey</jsp:attribute>
161
			<jsp:attribute name="name">organizationScope</jsp:attribute>
162
			<jsp:attribute name="id">organizationScope</jsp:attribute>
186 163
			<jsp:attribute name="type">hidden</jsp:attribute>
187 164
			<jsp:attribute name="value">
188 165
				<jsp:expression>organizationScope</jsp:expression>
......
195 172
				<jsp:getProperty name="clientViewBean" property="sessionid" />
196 173
			</jsp:attribute>
197 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"  />
198 180
		<p class="regtext">
181
		-Or-
182
		<br />
199 183
		Browse all existing data sets by title. This operation can be slow.
200 184
		</p>
201
		<input name="action" value="query" type="hidden" />
202
		<input value="Browse All" type="submit" />
185
		<input type="button" value="Browse All" onclick="setBrowseAll();form.submit()" />
203 186
	</form>
204

  
187
	
205 188
	</td>
206 189
	<td>
207 190
	
lib/style/skins/sanparks/searchPathQuery.js
1
function generateQueryString(organizationScope, anyValue) {
2
	var queryString = ""; 
3
	queryString += "<pathquery version='1.2'>";
4
	queryString += "<returndoctype>metadata</returndoctype>";
5
	queryString += "<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>";
6
	queryString += "<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>";
7
	queryString += "<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>";
8
	queryString += "<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>";
9
	queryString += "<returndoctype>-//NCEAS//eml-dataset-2.0//EN</returndoctype>";
10
	queryString += "<returndoctype>-//NCEAS//resource//EN</returndoctype>";
11
	queryString += "<returnfield>originator/individualName/surName</returnfield>";
12
	queryString += "<returnfield>originator/individualName/givenName</returnfield>";
13
	queryString += "<returnfield>originator/organizationName</returnfield>";
14
	queryString += "<returnfield>creator/individualName/surName</returnfield>";
15
	queryString += "<returnfield>creator/organizationName</returnfield>";
16
	queryString += "<returnfield>dataset/title</returnfield>";
17
	queryString += "<returnfield>keyword</returnfield>";
18
	queryString += "<returnfield>creator/individualName/givenName</returnfield>";
19
	queryString += "<returnfield>idinfo/citation/citeinfo/title</returnfield>";
20
	queryString += "<returnfield>idinfo/citation/citeinfo/origin</returnfield>";
21
	queryString += "<returnfield>idinfo/keywords/theme/themekey</returnfield>";
22
	
23
	queryString += "<querygroup operator='INTERSECT'>";
24
	queryString += "<queryterm casesensitive='false' searchmode='contains'>";
25
	
26
	queryString += "<value>" + anyValue + "</value>";
27
			
28
	queryString += "</queryterm>";
29
	
30
	queryString += "<querygroup operator='UNION'>";
31
	queryString += "<queryterm casesensitive='false' searchmode='contains'>";
32
	
33
	queryString += "<value>" + organizationScope + "</value>";
34
	
35
	queryString += "<pathexpr>placekey</pathexpr>";
36
	queryString += "</queryterm>";
37
	queryString += "<queryterm casesensitive='false' searchmode='contains'>";
38
	
39
	queryString += "<value>" + organizationScope + "</value>";
40
	
41
	queryString += "<pathexpr>organizationName</pathexpr>";
42
	queryString += "</queryterm>";
43
	queryString += "</querygroup>";
44
	
45
	queryString += "</querygroup>";
46
	
47
	queryString += "</pathquery>";
48
	
49
	//alert(queryString);
50
	
51
	return queryString;
52
}
53

  
54
function setQueryFormField() {
55
	alert('setQueryFormField');
56
	var queryField = document.getElementById("query");
57
	//alert('queryField=' + queryField);
58
	var anyfieldField = document.getElementById("anyfield");
59
	//alert('anyfieldField=' + anyfieldField);
60
	var organizationScopeField = document.getElementById("organizationScope");
61
	//alert('organizationScopeField=' + organizationScopeField);
62
	
63
	queryField.value = 
64
		generateQueryString(
65
			organizationScopeField.value,
66
			anyfieldField.value);
67
	
68
	alert(queryField.value);
69
}
70

  
71
function setBrowseAll() {
72
	//set the field to wildcard
73
	var anyfieldField = document.getElementById("anyfield");
74
	anyfieldField.value = "";
75
	
76
	//set the query
77
	setQueryFormField();
78
}
0 79

  
lib/style/skins/sanparks/leftnav.jsp
15 15
		<td>
16 16
			
17 17
			<form action="./index.jsp" method="post" target="_top" name="orgForm">
18
				<input name="organizationScope" type="hidden" value="%">
18
				<input name="organizationScope" type="hidden" value="">
19 19
				<table>
20 20
					<tr>
21 21
						<td>
22 22
							<div id="nav">
23 23
							<ul class="level-1">
24 24
								<li>
25
									<a href="#" onclick="orgForm.organizationScope.value='%';orgForm.submit();">All</a>
25
									<a href="#" onclick="orgForm.organizationScope.value='';orgForm.submit();">All</a>
26 26
								</li>
27 27
								<li>
28 28
									<a href="#" onclick="orgForm.organizationScope.value='SANParks, South Africa';orgForm.submit();">SANParks</a>

Also available in: Unified diff