1 |
5509
|
leinfelder
|
<%@ page language="java"%>
|
2 |
5788
|
leinfelder
|
<%@page import="edu.ucsb.nceas.metacat.util.AuthUtil"%>
|
3 |
5509
|
leinfelder
|
<%
|
4 |
|
|
/**
|
5 |
|
|
*
|
6 |
|
|
* '$RCSfile$'
|
7 |
|
|
* Copyright: 2008 Regents of the University of California and the
|
8 |
|
|
* National Center for Ecological Analysis and Synthesis
|
9 |
|
|
* '$Author$'
|
10 |
|
|
* '$Date$'
|
11 |
|
|
* '$Revision$'
|
12 |
|
|
*
|
13 |
|
|
* This program is free software; you can redistribute it and/or modify
|
14 |
|
|
* it under the terms of the GNU General Public License as published by
|
15 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
16 |
|
|
* (at your option) any later version.
|
17 |
|
|
*
|
18 |
|
|
* This program is distributed in the hope that it will be useful,
|
19 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
|
|
* GNU General Public License for more details.
|
22 |
|
|
|
23 |
|
|
* You should have received a copy of the GNU General Public License
|
24 |
|
|
* along with this program; if not, write to the Free Software
|
25 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26 |
|
|
*/
|
27 |
5385
|
leinfelder
|
%>
|
28 |
5632
|
leinfelder
|
|
29 |
5509
|
leinfelder
|
<%@ include file="../../common/common-settings.jsp"%>
|
30 |
|
|
<%@ include file="../../common/configure-check.jsp"%>
|
31 |
5604
|
leinfelder
|
|
32 |
5385
|
leinfelder
|
<html>
|
33 |
|
|
<head>
|
34 |
5509
|
leinfelder
|
<title>Semantic search</title>
|
35 |
|
|
<link rel="stylesheet" type="text/css" href="<%=STYLE_SKINS_URL%>/semtools/semtools.css">
|
36 |
5703
|
leinfelder
|
<link rel="stylesheet" type="text/css" href="<%=STYLE_COMMON_URL%>/jquery/jqueryui/css/smoothness/jquery-ui-1.8.6.custom.css">
|
37 |
5509
|
leinfelder
|
|
38 |
5703
|
leinfelder
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jquery.js"></script>
|
39 |
|
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jsTree/_lib/jquery.cookie.js"></script>
|
40 |
|
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jsTree/jquery.jstree.js"></script>
|
41 |
|
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/jqueryui/js/jquery-ui-1.8.6.custom.min.js"></script>
|
42 |
|
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/jquery/busy/jquery.busy.js"></script>
|
43 |
5669
|
leinfelder
|
|
44 |
5703
|
leinfelder
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/search.js"></script>
|
45 |
5509
|
leinfelder
|
<script language="javascript" type="text/javascript" src="<%=STYLE_SKINS_URL%>/semtools/semtools.js"></script>
|
46 |
|
|
<script language="javascript" type="text/javascript" src="<%=STYLE_COMMON_URL%>/branding.js"></script>
|
47 |
|
|
|
48 |
5656
|
leinfelder
|
<script language="Javascript" type="text/JavaScript"><!--
|
49 |
5633
|
leinfelder
|
function populateActiveDomain(divId, class) {
|
50 |
5656
|
leinfelder
|
// collect the filtering values we have so far
|
51 |
|
|
// these are hidden input fields in the form for holding the selected values
|
52 |
|
|
var entity = $("#activeEntitiesValue").val() ? $("#activeEntitiesValue").val() : "";
|
53 |
|
|
var characteristic = $("#activeCharacteristicsValue").val() ? $("#activeCharacteristicsValue").val() : "";
|
54 |
|
|
var protocol = $("#activeProtocolsValue").val() ? $("#activeProtocolsValue").val() : "";
|
55 |
|
|
var measurement = $("#activeMeasurementsValue").val() ? $("#activeMeasurementsValue").val() : "";
|
56 |
5633
|
leinfelder
|
|
57 |
5656
|
leinfelder
|
// TODO: remember the selected value for this when filtering by active domain
|
58 |
|
|
var selectedNode = $("#" + divId).jstree("get_selected", $("#" + divId));
|
59 |
|
|
var selectedNodeId = $(selectedNode).attr("id");
|
60 |
5668
|
leinfelder
|
//alert(divId + " selected node: " + selectedNodeId);
|
61 |
5656
|
leinfelder
|
|
62 |
|
|
// load the tree for the given div, passing in the other filtered values
|
63 |
5633
|
leinfelder
|
$("#" + divId).load(
|
64 |
5656
|
leinfelder
|
"<%=SERVLET_URL%>",
|
65 |
|
|
{
|
66 |
|
|
'action': "getactivedomain",
|
67 |
|
|
'class': class,
|
68 |
|
|
'entity': entity,
|
69 |
|
|
'characteristic': characteristic,
|
70 |
|
|
'protocol': protocol,
|
71 |
|
|
'measurement': measurement
|
72 |
|
|
},
|
73 |
|
|
// call back function when loading finishes
|
74 |
|
|
function(response, status, xhr) {
|
75 |
|
|
//alert("callback for: " + divId + " selected node: " + selectedNodeId);
|
76 |
|
|
// error
|
77 |
|
|
if (status == "error") {
|
78 |
|
|
var msg = "Sorry but there was an error: ";
|
79 |
|
|
$("#error").html(msg + xhr.status + " " + xhr.statusText);
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
// make it a js tree
|
83 |
|
|
$(function () {
|
84 |
|
|
$("#" + divId)
|
85 |
5660
|
leinfelder
|
//bind calls here
|
86 |
5656
|
leinfelder
|
.jstree({
|
87 |
|
|
"ui" : {
|
88 |
|
|
"select_limit" : 1,
|
89 |
|
|
"select_multiple_modifier" : "alt",
|
90 |
|
|
"selected_parent_close" : "select_parent"//,
|
91 |
|
|
//"initially_select" : [ selectedNodeId ]
|
92 |
5659
|
leinfelder
|
},
|
93 |
|
|
"themes" : {
|
94 |
|
|
"theme" : "default",
|
95 |
|
|
"dots" : true,
|
96 |
|
|
"icons" : false
|
97 |
|
|
},
|
98 |
5656
|
leinfelder
|
//"core" : { "initially_open" : [ selectedNodeId ] },
|
99 |
5658
|
leinfelder
|
"search" : { "case_insensitive" : true },
|
100 |
5668
|
leinfelder
|
//"cookies" : {
|
101 |
|
|
// "save_opened" : "jstree_open_" + divId,
|
102 |
|
|
// "save_selected" : "jstree_select_" + divId,
|
103 |
|
|
//},
|
104 |
5666
|
leinfelder
|
"plugins" : [
|
105 |
|
|
"themes",
|
106 |
|
|
"html_data",
|
107 |
|
|
"ui",
|
108 |
5668
|
leinfelder
|
//"cookies",
|
109 |
5666
|
leinfelder
|
"search" ]
|
110 |
5656
|
leinfelder
|
});
|
111 |
|
|
});
|
112 |
|
|
|
113 |
5658
|
leinfelder
|
// enable searching on it
|
114 |
|
|
$("#" + divId + "Search").keyup(
|
115 |
|
|
function () {
|
116 |
5688
|
leinfelder
|
var searchTerm = $("#" + divId + "Search").val();
|
117 |
|
|
if (searchTerm.length >= 3) {
|
118 |
5678
|
leinfelder
|
// search
|
119 |
5688
|
leinfelder
|
$("#" + divId).jstree("search", searchTerm);
|
120 |
5663
|
leinfelder
|
// now prune
|
121 |
5664
|
leinfelder
|
prune(divId, "jstree-search");
|
122 |
5688
|
leinfelder
|
// is it an exact match?
|
123 |
|
|
checkExactMatch(divId, searchTerm, "jstree-search");
|
124 |
5658
|
leinfelder
|
}
|
125 |
|
|
});
|
126 |
5664
|
leinfelder
|
|
127 |
|
|
// toggle the active domain prune
|
128 |
5668
|
leinfelder
|
$("#" + divId + "Only").click(function() {
|
129 |
|
|
doActiveDomain(divId);
|
130 |
|
|
});
|
131 |
5658
|
leinfelder
|
|
132 |
5668
|
leinfelder
|
// actually prune if we should
|
133 |
|
|
doActiveDomain(divId);
|
134 |
5687
|
leinfelder
|
|
135 |
|
|
// open first node always
|
136 |
|
|
$("#" + divId).jstree("open_node", $("#" + divId).children("ul").first().children("li").first());
|
137 |
5668
|
leinfelder
|
|
138 |
|
|
// open to the node to last selected
|
139 |
5667
|
leinfelder
|
var nodePath = $("#" + divId).jstree("get_path", $(selectedNode));
|
140 |
|
|
if (nodePath) {
|
141 |
|
|
for (var index = 0; index < nodePath.length; index++) {
|
142 |
|
|
$("#" + divId).jstree("open_node", $("#" + nodePath[index]));
|
143 |
|
|
}
|
144 |
|
|
// select the original node
|
145 |
|
|
$("#" + divId).jstree("select_node", $(selectedNode), false);
|
146 |
|
|
$("#" + divId).jstree("refresh", $(selectedNode));
|
147 |
|
|
// TODO: scroll to selected node.
|
148 |
|
|
// This is supposed to be part of jsTree 1.0-rc2 but appears to be broken
|
149 |
|
|
}
|
150 |
|
|
|
151 |
5656
|
leinfelder
|
});
|
152 |
5633
|
leinfelder
|
}
|
153 |
5664
|
leinfelder
|
/**
|
154 |
|
|
* Prunes the given tree to inlcude the given matched class
|
155 |
|
|
**/
|
156 |
|
|
function prune(divId, matchClass) {
|
157 |
5663
|
leinfelder
|
|
158 |
|
|
// show all nodes (reset)
|
159 |
|
|
$("#" + divId).find("li").show();
|
160 |
|
|
|
161 |
5664
|
leinfelder
|
// done if we don't have any thing to prune
|
162 |
|
|
if (!matchClass) {
|
163 |
|
|
return;
|
164 |
|
|
}
|
165 |
|
|
|
166 |
5663
|
leinfelder
|
// get all non-matched anchor tags
|
167 |
5664
|
leinfelder
|
var nonmatches = $("#" + divId).find("a").not("." + matchClass);
|
168 |
5663
|
leinfelder
|
|
169 |
|
|
// get their parent nodes
|
170 |
|
|
nonmatches = $(nonmatches).parents("li");
|
171 |
|
|
|
172 |
|
|
// are there any matches under each parent node?
|
173 |
|
|
$(nonmatches).each(
|
174 |
|
|
function(index) {
|
175 |
|
|
// do any chidren match?
|
176 |
5664
|
leinfelder
|
var childMatches = $(this).find("a." + matchClass);
|
177 |
5663
|
leinfelder
|
if (childMatches && childMatches.length > 0) {
|
178 |
|
|
return true;
|
179 |
|
|
}
|
180 |
|
|
// parent matches?
|
181 |
5664
|
leinfelder
|
var parentMatches = $(this).parents("li").children("a." + matchClass);
|
182 |
5663
|
leinfelder
|
if (parentMatches && parentMatches.length > 0) {
|
183 |
|
|
return true;
|
184 |
|
|
}
|
185 |
|
|
// hide this node if no matches under it
|
186 |
|
|
$(this).hide();
|
187 |
|
|
});
|
188 |
|
|
}
|
189 |
5688
|
leinfelder
|
function checkExactMatch(divId, searchTerm, matchClass) {
|
190 |
|
|
// get the current search matches
|
191 |
|
|
var matches = $("#" + divId).find("a." + matchClass);
|
192 |
|
|
// get their parent nodes
|
193 |
|
|
matches = $(matches).parents("li");
|
194 |
|
|
// check for exact matches
|
195 |
|
|
var exactMatch = $(matches).filter("#" + searchTerm).first();
|
196 |
|
|
if (exactMatch && exactMatch.length == 1) {
|
197 |
|
|
//alert("exactMatch: " + exactMatch);
|
198 |
5689
|
leinfelder
|
// select in the tree, honoring the configured selection limit
|
199 |
|
|
$("#" + divId).jstree("select_node", $(exactMatch), true);
|
200 |
|
|
// act as those you clicked it
|
201 |
|
|
// TODO: convert to event listeners on the tree
|
202 |
5688
|
leinfelder
|
select($(exactMatch).children("a"));
|
203 |
|
|
}
|
204 |
|
|
}
|
205 |
5668
|
leinfelder
|
function doActiveDomain(divId) {
|
206 |
|
|
if ($("#" + divId + "Only").is(":checked")) {
|
207 |
|
|
// prune to active
|
208 |
|
|
prune(divId, "bold");
|
209 |
|
|
} else {
|
210 |
|
|
// reset
|
211 |
|
|
prune(divId, null);
|
212 |
|
|
}
|
213 |
|
|
}
|
214 |
5633
|
leinfelder
|
function initialize(source) {
|
215 |
5656
|
leinfelder
|
// we don't want to reload the source of the filtering request
|
216 |
|
|
// but we do want to reload the other trees for active domains
|
217 |
|
|
// we reload all of them if no source is given - first time the page loads
|
218 |
5633
|
leinfelder
|
if (source) {
|
219 |
5656
|
leinfelder
|
source = $(source).attr("id");
|
220 |
5633
|
leinfelder
|
}
|
221 |
|
|
if (!source) {
|
222 |
|
|
source = "";
|
223 |
|
|
}
|
224 |
|
|
if (source != 'activeEntities') {
|
225 |
|
|
populateActiveDomain('activeEntities', 'org.ecoinformatics.sms.annotation.Entity');
|
226 |
|
|
}
|
227 |
|
|
if (source != 'activeCharacteristics') {
|
228 |
|
|
populateActiveDomain('activeCharacteristics', 'org.ecoinformatics.sms.annotation.Characteristic');
|
229 |
|
|
}
|
230 |
|
|
if (source != 'activeProtocols') {
|
231 |
|
|
populateActiveDomain('activeProtocols', 'org.ecoinformatics.sms.annotation.Protocol');
|
232 |
|
|
}
|
233 |
|
|
if (source != 'activeMeasurements') {
|
234 |
|
|
populateActiveDomain('activeMeasurements', 'org.ecoinformatics.sms.annotation.Measurement');
|
235 |
|
|
}
|
236 |
|
|
}
|
237 |
5656
|
leinfelder
|
function select(item) {
|
238 |
5633
|
leinfelder
|
|
239 |
5656
|
leinfelder
|
// get the selected value, stored in the title attribute of the item <a> tag
|
240 |
|
|
var value = $(item).attr("title");
|
241 |
|
|
//alert("value: " + value);
|
242 |
|
|
|
243 |
|
|
// get the parent div so we know what kind of class it is meant to filter
|
244 |
|
|
// this is "the first parent of the class 'select'"
|
245 |
|
|
var parent = $(item).parents("div.select:first");
|
246 |
|
|
//alert("parent: " + parent);
|
247 |
|
|
|
248 |
|
|
// set the value for the hidden input value
|
249 |
5774
|
leinfelder
|
// the input field of class "conceptValue" will hold it, this way we don't need to know the id
|
250 |
|
|
var input = $(parent).children("input.conceptValue");
|
251 |
5656
|
leinfelder
|
$(input).val(value);
|
252 |
|
|
//alert("input: " + input);
|
253 |
5662
|
leinfelder
|
|
254 |
|
|
// set it in the search field
|
255 |
|
|
var treeInstance = $(item).parents("div.jstree:first");
|
256 |
|
|
var shortName = $(item).parent().attr("id");
|
257 |
|
|
$("#" + $(treeInstance).attr("id") + "Search").val(shortName)
|
258 |
5656
|
leinfelder
|
|
259 |
5665
|
leinfelder
|
// refresh the search results
|
260 |
|
|
doSearch($("#searchForm").get(0));
|
261 |
|
|
|
262 |
5656
|
leinfelder
|
// refresh the other trees for active domain after this filtering action
|
263 |
5666
|
leinfelder
|
initialize($(parent).children("div"));
|
264 |
5656
|
leinfelder
|
}
|
265 |
5665
|
leinfelder
|
function doSearch(formObj) {
|
266 |
|
|
// set the hidden parameters based on the current state of the form
|
267 |
|
|
checkSearch(formObj);
|
268 |
|
|
|
269 |
5678
|
leinfelder
|
// start the busy indicator
|
270 |
5684
|
leinfelder
|
$("#searchResults").busy(
|
271 |
|
|
{
|
272 |
|
|
position : 'left',
|
273 |
|
|
offset : -30,
|
274 |
|
|
hide : true,
|
275 |
5703
|
leinfelder
|
img : "<%=STYLE_COMMON_URL%>/jquery/busy/busy.gif"
|
276 |
5684
|
leinfelder
|
});
|
277 |
5678
|
leinfelder
|
|
278 |
5665
|
leinfelder
|
//load the results
|
279 |
|
|
$("#searchResults").load(
|
280 |
|
|
"<%=SERVLET_URL%>" + " #content_wrapper",
|
281 |
|
|
$(formObj).serialize(),
|
282 |
|
|
// call back function when loading finishes
|
283 |
|
|
function(response, status, xhr) {
|
284 |
|
|
if (status == "error") {
|
285 |
|
|
var msg = "Sorry but there was an error performing the search: ";
|
286 |
|
|
$("#error").html(msg + xhr.status + " " + xhr.statusText);
|
287 |
|
|
}
|
288 |
5762
|
leinfelder
|
// collapsible search results - show and hide the next div
|
289 |
5675
|
leinfelder
|
$(function() {
|
290 |
5785
|
leinfelder
|
$('#searchResults').find('.accordian').click(function() {
|
291 |
5765
|
leinfelder
|
var ref = $(this);
|
292 |
|
|
$(this).parent().next().slideToggle(
|
293 |
|
|
"slow",
|
294 |
|
|
function() {
|
295 |
|
|
if ($(ref).parent().next().is(":visible")) {
|
296 |
|
|
$(ref).html("-");
|
297 |
|
|
} else {
|
298 |
|
|
$(ref).html("+");
|
299 |
|
|
}
|
300 |
|
|
});
|
301 |
5675
|
leinfelder
|
return false;
|
302 |
5762
|
leinfelder
|
}).parent().next().hide();
|
303 |
5675
|
leinfelder
|
});
|
304 |
|
|
|
305 |
5678
|
leinfelder
|
// stop the busy indicator
|
306 |
|
|
$("#searchResults").busy("hide");
|
307 |
5665
|
leinfelder
|
});
|
308 |
|
|
|
309 |
|
|
return false;
|
310 |
|
|
|
311 |
|
|
}
|
312 |
5781
|
leinfelder
|
function loadCart() {
|
313 |
|
|
|
314 |
|
|
// start the busy indicator
|
315 |
|
|
$("#cartResults").busy(
|
316 |
5785
|
leinfelder
|
{
|
317 |
|
|
position : 'left',
|
318 |
|
|
offset : -30,
|
319 |
|
|
hide : true,
|
320 |
|
|
img : "<%=STYLE_COMMON_URL%>/jquery/busy/busy.gif"
|
321 |
|
|
});
|
322 |
5781
|
leinfelder
|
|
323 |
|
|
// for looking up the cart
|
324 |
|
|
var params =
|
325 |
|
|
{
|
326 |
|
|
'action': 'getcart',
|
327 |
|
|
'showAdd': 'false',
|
328 |
|
|
'showRemove': 'true',
|
329 |
|
|
'qformat': 'semtools'
|
330 |
|
|
};
|
331 |
|
|
//load the cart results
|
332 |
|
|
$("#cartResults").load(
|
333 |
|
|
"<%=SERVLET_URL%>" + " #content_wrapper",
|
334 |
|
|
params,
|
335 |
|
|
// call back function when loading finishes
|
336 |
|
|
function(response, status, xhr) {
|
337 |
|
|
if (status == "error") {
|
338 |
|
|
var msg = "Sorry but there was an error performing the search: ";
|
339 |
|
|
$("#error").html(msg + xhr.status + " " + xhr.statusText);
|
340 |
|
|
}
|
341 |
|
|
// collapsible search results - show and hide the next div
|
342 |
|
|
$(function() {
|
343 |
5785
|
leinfelder
|
$('#cartResults').find('.accordian').click(function() {
|
344 |
5781
|
leinfelder
|
var ref = $(this);
|
345 |
|
|
$(this).parent().next().slideToggle(
|
346 |
|
|
"slow",
|
347 |
|
|
function() {
|
348 |
|
|
if ($(ref).parent().next().is(":visible")) {
|
349 |
|
|
$(ref).html("-");
|
350 |
|
|
} else {
|
351 |
|
|
$(ref).html("+");
|
352 |
|
|
}
|
353 |
|
|
});
|
354 |
|
|
return false;
|
355 |
|
|
}).parent().next().hide();
|
356 |
|
|
});
|
357 |
|
|
|
358 |
|
|
// stop the busy indicator
|
359 |
|
|
$("#cartResults").busy("hide");
|
360 |
5784
|
leinfelder
|
|
361 |
|
|
//set the count for the tab label
|
362 |
|
|
var title = "Cart (" + $("#cartResults").find(".resultCount:first").html() + ")";
|
363 |
|
|
$("#searchTabs > ul > li").last().children("a").html("<span>" + title + "</span>");
|
364 |
|
|
|
365 |
5781
|
leinfelder
|
});
|
366 |
|
|
return true;
|
367 |
|
|
}
|
368 |
|
|
function clearCart() {
|
369 |
|
|
|
370 |
|
|
// for looking up the cart
|
371 |
|
|
var params =
|
372 |
|
|
{
|
373 |
|
|
'action': 'editcart',
|
374 |
|
|
'operation': 'clear',
|
375 |
|
|
'qformat': 'semtools'
|
376 |
|
|
};
|
377 |
|
|
// post the cart clear
|
378 |
|
|
$("#cartResults").load(
|
379 |
|
|
"<%=SERVLET_URL%>",
|
380 |
|
|
params,
|
381 |
|
|
// call back function when loading finishes
|
382 |
|
|
function(response, status, xhr) {
|
383 |
|
|
if (status == "error") {
|
384 |
|
|
var msg = "Sorry but there was an error clearing the cart: ";
|
385 |
|
|
$("#error").html(msg + xhr.status + " " + xhr.statusText);
|
386 |
|
|
}
|
387 |
|
|
});
|
388 |
|
|
return true;
|
389 |
|
|
}
|
390 |
5790
|
leinfelder
|
function addAllToCart() {
|
391 |
|
|
// press all the add cart buttons?
|
392 |
|
|
// TODO: add them in a single request (the service handles multiple docids)
|
393 |
|
|
$(".addCartButton").click();
|
394 |
|
|
}
|
395 |
5668
|
leinfelder
|
function clearForm() {
|
396 |
5793
|
leinfelder
|
// remember the check boxes
|
397 |
|
|
var matchAll = $('#matchAll').attr("checked");
|
398 |
|
|
var strict = $('#strict').attr("checked");
|
399 |
|
|
|
400 |
5668
|
leinfelder
|
// clear the form values
|
401 |
|
|
$('#searchForm').get(0).reset();
|
402 |
|
|
// clear each of the tree selections
|
403 |
|
|
$(".jstree").each(function(index) {
|
404 |
|
|
$(this).jstree("deselect_all");
|
405 |
|
|
});
|
406 |
5774
|
leinfelder
|
$("input.conceptValue").each(function(index) {
|
407 |
5668
|
leinfelder
|
$(this).val("");
|
408 |
|
|
});
|
409 |
5793
|
leinfelder
|
|
410 |
5668
|
leinfelder
|
// reload the trees
|
411 |
|
|
initialize();
|
412 |
5793
|
leinfelder
|
|
413 |
|
|
// set the saved checkbox values
|
414 |
|
|
$('#matchAll').attr("checked", matchAll);
|
415 |
|
|
$('#strict').attr("checked", strict);
|
416 |
|
|
|
417 |
5668
|
leinfelder
|
// reload the search results
|
418 |
|
|
//alert($('#searchForm').get(0));
|
419 |
|
|
doSearch($('#searchForm').get(0));
|
420 |
|
|
}
|
421 |
5774
|
leinfelder
|
function addCurrent() {
|
422 |
|
|
|
423 |
|
|
// make a container for this item
|
424 |
|
|
var count = $("#searchCriteria").children(".searchItem").length;
|
425 |
|
|
count++;
|
426 |
|
|
var containerId = "searchItem_" + count;
|
427 |
5789
|
leinfelder
|
// ensure the containerId is unique
|
428 |
|
|
while ($("#" + containerId).length > 0) {
|
429 |
|
|
count++;
|
430 |
|
|
containerId = "searchItem_" + count;
|
431 |
|
|
}
|
432 |
5774
|
leinfelder
|
var container = "<div class='searchItem' id='" + containerId + "'/>";
|
433 |
|
|
$("#searchCriteria").append(container);
|
434 |
|
|
|
435 |
|
|
// get the current values
|
436 |
|
|
$("input.conceptValue").each(function(index) {
|
437 |
|
|
var title = $(this).attr("title");
|
438 |
|
|
var value = $(this).val();
|
439 |
|
|
var shortName = value.substr(value.lastIndexOf("#") + 1);
|
440 |
|
|
var clone = $(this).clone();
|
441 |
|
|
$(clone).removeClass("conceptValue");
|
442 |
|
|
// put the value in the container
|
443 |
|
|
$("#" + containerId).append(clone);
|
444 |
|
|
$("#" + containerId).append("[" + title + " = " + shortName + "] ");
|
445 |
|
|
});
|
446 |
|
|
// get the current classes (for search to work correctly we need class+value for each entry)
|
447 |
|
|
$("input.conceptClass").each(function(index) {
|
448 |
|
|
var clone = $(this).clone();
|
449 |
|
|
$(clone).removeClass("conceptClass");
|
450 |
|
|
// put the class in the container
|
451 |
|
|
$("#" + containerId).append(clone);
|
452 |
|
|
});
|
453 |
|
|
|
454 |
|
|
// add the remove button
|
455 |
5789
|
leinfelder
|
var removeButtonId = containerId + "_remove";
|
456 |
|
|
$("#" + containerId).append("<input type='button' value='Remove' id='" + removeButtonId + "'/>");
|
457 |
|
|
$("#" + removeButtonId).click(function() {
|
458 |
5774
|
leinfelder
|
// remove the container (includes the form objects we added)
|
459 |
|
|
$("#" + containerId).remove();
|
460 |
|
|
// refresh the search results now that they are less restrictive
|
461 |
|
|
doSearch($("#searchForm").get(0));
|
462 |
|
|
});
|
463 |
5790
|
leinfelder
|
|
464 |
|
|
// clear the form of what we just saved to the criteria list
|
465 |
|
|
clearForm();
|
466 |
5774
|
leinfelder
|
}
|
467 |
5790
|
leinfelder
|
function clearCriteria() {
|
468 |
|
|
|
469 |
|
|
// remove all children of the criteria
|
470 |
|
|
$("#searchCriteria").children().remove();
|
471 |
|
|
|
472 |
|
|
// clear the form of any selections
|
473 |
|
|
clearForm();
|
474 |
|
|
|
475 |
|
|
// refresh the search results now that they are less restrictive
|
476 |
|
|
doSearch($("#searchForm").get(0));
|
477 |
|
|
}
|
478 |
5685
|
leinfelder
|
/**
|
479 |
|
|
* Perform this when the page first loads
|
480 |
|
|
*/
|
481 |
|
|
function pageLoad() {
|
482 |
|
|
initialize();
|
483 |
|
|
doSearch($('#searchForm').get(0));
|
484 |
5786
|
leinfelder
|
loadCart();
|
485 |
5685
|
leinfelder
|
}
|
486 |
5656
|
leinfelder
|
function donothing() {}
|
487 |
|
|
--></script>
|
488 |
|
|
|
489 |
5385
|
leinfelder
|
</head>
|
490 |
5685
|
leinfelder
|
<body onload="pageLoad()">
|
491 |
5509
|
leinfelder
|
<script language="javascript">
|
492 |
|
|
insertTemplateOpening("<%=CONTEXT_URL%>");
|
493 |
|
|
</script>
|
494 |
5385
|
leinfelder
|
|
495 |
5574
|
leinfelder
|
<div id="content_wrapper">
|
496 |
5669
|
leinfelder
|
|
497 |
5690
|
leinfelder
|
<h2>Semantic search</h2>
|
498 |
5385
|
leinfelder
|
|
499 |
5633
|
leinfelder
|
<div id="error">
|
500 |
|
|
<!-- error messages here -->
|
501 |
|
|
</div>
|
502 |
|
|
|
503 |
5669
|
leinfelder
|
<!-- set up the tabs -->
|
504 |
|
|
<script>
|
505 |
|
|
$(function() {
|
506 |
|
|
$("#searchTabs").tabs();
|
507 |
|
|
$("#searchTabs").tabs("add", "#ecpTab", "Entity, Characteristic, Protocol");
|
508 |
|
|
$("#searchTabs").tabs("add", "#measurementTab", "Measurement");
|
509 |
5672
|
leinfelder
|
$("#searchTabs").tabs("add", "#optionsTab", "Options");
|
510 |
5782
|
leinfelder
|
$("#searchTabs").tabs("add", "#cartTab", "Cart");
|
511 |
5669
|
leinfelder
|
});
|
512 |
|
|
</script>
|
513 |
|
|
|
514 |
5665
|
leinfelder
|
<form method="POST"
|
515 |
|
|
action="<%=SERVLET_URL%>"
|
516 |
|
|
target="_top"
|
517 |
|
|
id="searchForm"
|
518 |
|
|
name="searchForm"
|
519 |
|
|
onSubmit="return doSearch(this)">
|
520 |
5509
|
leinfelder
|
<input name="query" type="hidden" />
|
521 |
|
|
<input name="qformat" value="semtools" type="hidden" />
|
522 |
5665
|
leinfelder
|
<input name="includeHeader" value="false" type="hidden" />
|
523 |
5790
|
leinfelder
|
<input name="showAdd" value="<%=AuthUtil.isUserLoggedIn(request)%>" type="hidden" />
|
524 |
5781
|
leinfelder
|
<input name="showRemove" value="false" type="hidden" />
|
525 |
5533
|
leinfelder
|
<input name="action" value="semquery" type="hidden" />
|
526 |
5509
|
leinfelder
|
|
527 |
5672
|
leinfelder
|
<!-- tabs for the search interface -->
|
528 |
|
|
<div id="searchTabs">
|
529 |
|
|
<!-- place holder for ui tabs -->
|
530 |
|
|
<ul></ul>
|
531 |
|
|
|
532 |
|
|
<!-- other criteria tabs -->
|
533 |
|
|
<div id="ecpTab">
|
534 |
|
|
<table>
|
535 |
|
|
<tr>
|
536 |
|
|
<td>
|
537 |
|
|
<table class="subGroup subGroup_border">
|
538 |
|
|
|
539 |
5669
|
leinfelder
|
<tr>
|
540 |
5672
|
leinfelder
|
<th><p>Find observations of</p></th>
|
541 |
|
|
</tr>
|
542 |
|
|
<tr>
|
543 |
5669
|
leinfelder
|
<td>
|
544 |
5672
|
leinfelder
|
<input type="text" id="activeEntitiesSearch" />
|
545 |
|
|
<input type="checkbox" id="activeEntitiesOnly" title="Show only active concepts" />
|
546 |
|
|
<div class="select">
|
547 |
|
|
<div id="activeEntities" class="activeTree">
|
548 |
|
|
<p>loading...</p>
|
549 |
|
|
</div>
|
550 |
5774
|
leinfelder
|
<input type="hidden" class="conceptValue" name="activeEntitiesValue" id="activeEntitiesValue" title="Entity"/>
|
551 |
|
|
<input type="hidden" class="conceptClass" name="activeEntitiesClass" id="activeEntitiesClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
|
552 |
5672
|
leinfelder
|
</div>
|
553 |
5669
|
leinfelder
|
</td>
|
554 |
5672
|
leinfelder
|
</tr>
|
555 |
|
|
</table>
|
556 |
|
|
</td>
|
557 |
|
|
<td>
|
558 |
|
|
<table class="subGroup subGroup_border">
|
559 |
|
|
<tr>
|
560 |
|
|
<th><p>with measurements of</p></th>
|
561 |
|
|
</tr>
|
562 |
|
|
<tr>
|
563 |
5669
|
leinfelder
|
<td>
|
564 |
5672
|
leinfelder
|
<input type="text" id="activeCharacteristicsSearch" />
|
565 |
|
|
<input type="checkbox" id="activeCharacteristicsOnly" title="Show only active concepts" />
|
566 |
|
|
<div class="select">
|
567 |
|
|
<div id="activeCharacteristics" class="activeTree">
|
568 |
|
|
<p>loading...</p>
|
569 |
|
|
</div>
|
570 |
5774
|
leinfelder
|
<input type="hidden" class="conceptValue" name="activeCharacteristicsValue" id="activeCharacteristicsValue" title="Characteristic"/>
|
571 |
|
|
<input type="hidden" class="conceptClass" name="activeCharacteristicsClass" id="activeCharacteristicsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
|
572 |
5672
|
leinfelder
|
</div>
|
573 |
5669
|
leinfelder
|
</td>
|
574 |
|
|
</tr>
|
575 |
|
|
</table>
|
576 |
5672
|
leinfelder
|
</td>
|
577 |
|
|
<td>
|
578 |
|
|
<table class="subGroup subGroup_border">
|
579 |
5669
|
leinfelder
|
<tr>
|
580 |
5672
|
leinfelder
|
<th><p>using procedures outlined by</p></th>
|
581 |
5669
|
leinfelder
|
</tr>
|
582 |
|
|
<tr>
|
583 |
|
|
<td>
|
584 |
5672
|
leinfelder
|
<input type="text" id="activeProtocolsSearch" />
|
585 |
|
|
<input type="checkbox" id="activeProtocolsOnly" title="Show only active concepts" />
|
586 |
5669
|
leinfelder
|
<div class="select">
|
587 |
5672
|
leinfelder
|
<div id="activeProtocols" class="activeTree">
|
588 |
5669
|
leinfelder
|
<p>loading...</p>
|
589 |
|
|
</div>
|
590 |
5774
|
leinfelder
|
<input type="hidden" class="conceptValue" name="activeProtocolsValue" id="activeProtocolsValue" title="Protocol"/>
|
591 |
|
|
<input type="hidden" class="conceptClass" name="activeProtocolsClass" id="activeProtocolsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
|
592 |
5669
|
leinfelder
|
</div>
|
593 |
|
|
</td>
|
594 |
|
|
</tr>
|
595 |
|
|
</table>
|
596 |
5672
|
leinfelder
|
</td>
|
597 |
|
|
</tr>
|
598 |
|
|
</table>
|
599 |
5782
|
leinfelder
|
|
600 |
|
|
<!-- collected search criteria here -->
|
601 |
|
|
<table class="subGroup subGroup_border onehundred_percent">
|
602 |
|
|
<tr>
|
603 |
|
|
<th>
|
604 |
|
|
<p>
|
605 |
|
|
Search criteria
|
606 |
5790
|
leinfelder
|
<input type="button" value="Add selected criteria" onclick="addCurrent()"/>
|
607 |
|
|
<input type="button" value="Remove all" onclick="clearCriteria()"/>
|
608 |
5782
|
leinfelder
|
</p>
|
609 |
|
|
</th>
|
610 |
|
|
</tr>
|
611 |
|
|
<tr>
|
612 |
|
|
<td>
|
613 |
|
|
<div id="searchCriteria">
|
614 |
|
|
</div>
|
615 |
|
|
</td>
|
616 |
|
|
</tr>
|
617 |
|
|
</table>
|
618 |
|
|
|
619 |
5672
|
leinfelder
|
</div>
|
620 |
|
|
|
621 |
|
|
<!-- measurement -->
|
622 |
|
|
<div id="measurementTab">
|
623 |
|
|
<table class="subGroup subGroup_border onehundred_percent">
|
624 |
5669
|
leinfelder
|
|
625 |
5672
|
leinfelder
|
<tr>
|
626 |
|
|
<th><p>a template that defines Entity, Characteristic, Standard, and/or Protocol</p></th>
|
627 |
|
|
</tr>
|
628 |
|
|
|
629 |
|
|
<tr>
|
630 |
|
|
<td>
|
631 |
|
|
<input type="text" id="activeMeasurementsSearch" />
|
632 |
|
|
Only active? <input type="checkbox" id="activeMeasurementsOnly" title="Show only active concepts"/>
|
633 |
|
|
<div class="select">
|
634 |
|
|
<div id="activeMeasurements" class="activeTree" style="width: 100%">
|
635 |
|
|
<p>loading...</p>
|
636 |
|
|
</div>
|
637 |
5774
|
leinfelder
|
<input type="hidden" class="conceptValue" name="activeMeasurementsValue" id="activeMeasurementsValue" title="Measurement"/>
|
638 |
|
|
<input type="hidden" class="conceptClass" name="activeMeasurementsClass" id="activeMeasurementsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
|
639 |
5672
|
leinfelder
|
</div>
|
640 |
|
|
</td>
|
641 |
|
|
</tr>
|
642 |
|
|
</table>
|
643 |
|
|
</div>
|
644 |
5669
|
leinfelder
|
|
645 |
5672
|
leinfelder
|
<!-- query options -->
|
646 |
|
|
<div id="optionsTab">
|
647 |
|
|
<table class="group group_border">
|
648 |
|
|
<tr>
|
649 |
|
|
<th colspan="2">
|
650 |
|
|
<p>
|
651 |
|
|
Locate <b>data packages</b> that have been semantically annotated within the observation model by
|
652 |
|
|
selecting concepts from OBOE extension ontologies
|
653 |
|
|
</p>
|
654 |
|
|
</th>
|
655 |
|
|
</tr>
|
656 |
|
|
|
657 |
|
|
<tr>
|
658 |
|
|
|
659 |
5793
|
leinfelder
|
<td colspan="1">
|
660 |
|
|
Match All?
|
661 |
|
|
<input type="checkbox" name="matchAll" id="matchAll" checked="checked" onchange="doSearch($('#searchForm').get(0))"/>
|
662 |
|
|
</td>
|
663 |
5672
|
leinfelder
|
|
664 |
5793
|
leinfelder
|
<td colspan="1">
|
665 |
|
|
From same Observation?
|
666 |
|
|
<input type="checkbox" name="strict" id="strict" onchange="doSearch($('#searchForm').get(0))"/>
|
667 |
|
|
</td>
|
668 |
5672
|
leinfelder
|
</tr>
|
669 |
|
|
|
670 |
|
|
</table>
|
671 |
5782
|
leinfelder
|
</div>
|
672 |
|
|
|
673 |
|
|
<!-- cart -->
|
674 |
|
|
<div id="cartTab">
|
675 |
|
|
<!--cart here -->
|
676 |
|
|
<table class="subGroup subGroup_border onehundred_percent">
|
677 |
|
|
<tr>
|
678 |
|
|
<th>
|
679 |
|
|
<p>
|
680 |
5788
|
leinfelder
|
Cart
|
681 |
|
|
<%
|
682 |
5790
|
leinfelder
|
if (AuthUtil.isUserLoggedIn(request)) {
|
683 |
5788
|
leinfelder
|
%>
|
684 |
|
|
<!-- <input type="button" value="Refresh" onclick="loadCart()"/> -->
|
685 |
|
|
<input type="button" value="Remove all" onclick="clearCart(); loadCart()"/>
|
686 |
|
|
<%
|
687 |
|
|
} else {
|
688 |
|
|
%>
|
689 |
|
|
(<a target="_top" href="<%=STYLE_SKINS_URL%>/semtools/login.jsp">Login</a> to edit cart)
|
690 |
|
|
<%
|
691 |
|
|
}
|
692 |
|
|
%>
|
693 |
5782
|
leinfelder
|
</p>
|
694 |
|
|
</th>
|
695 |
|
|
</tr>
|
696 |
|
|
<tr>
|
697 |
|
|
<td>
|
698 |
|
|
<div id="cartResults">
|
699 |
|
|
No items in cart
|
700 |
|
|
</div>
|
701 |
|
|
</td>
|
702 |
|
|
</tr>
|
703 |
|
|
</table>
|
704 |
5787
|
leinfelder
|
</div>
|
705 |
5672
|
leinfelder
|
|
706 |
|
|
</div>
|
707 |
|
|
|
708 |
|
|
<br/>
|
709 |
5781
|
leinfelder
|
|
710 |
5672
|
leinfelder
|
<!-- search results here -->
|
711 |
|
|
<table class="subGroup subGroup_border onehundred_percent">
|
712 |
5632
|
leinfelder
|
<tr>
|
713 |
5672
|
leinfelder
|
<th>
|
714 |
|
|
Search Results
|
715 |
5790
|
leinfelder
|
<%
|
716 |
|
|
if (AuthUtil.isUserLoggedIn(request)) {
|
717 |
|
|
%>
|
718 |
|
|
<input type="button" value="Add all to cart" onclick="addAllToCart()"/>
|
719 |
|
|
<%
|
720 |
|
|
}
|
721 |
|
|
%>
|
722 |
5672
|
leinfelder
|
</th>
|
723 |
5509
|
leinfelder
|
</tr>
|
724 |
|
|
<tr>
|
725 |
5672
|
leinfelder
|
<td>
|
726 |
|
|
<div id="searchResults">
|
727 |
|
|
No query has been specified
|
728 |
|
|
</div>
|
729 |
|
|
</td>
|
730 |
5509
|
leinfelder
|
</tr>
|
731 |
5672
|
leinfelder
|
</table>
|
732 |
|
|
|
733 |
5509
|
leinfelder
|
</form>
|
734 |
|
|
|
735 |
5665
|
leinfelder
|
|
736 |
5672
|
leinfelder
|
|
737 |
5509
|
leinfelder
|
<!-- Included default search/login -->
|
738 |
|
|
<% if ( PropertyService.getProperty("spatial.runSpatialOption").equals("true") ) { %>
|
739 |
|
|
<script language="javascript">
|
740 |
|
|
insertMap("<%=CONTEXT_URL%>");
|
741 |
|
|
</script>
|
742 |
|
|
<br/>
|
743 |
|
|
<% } %>
|
744 |
|
|
|
745 |
|
|
<script language="javascript">
|
746 |
|
|
insertSearchBox("<%=CONTEXT_URL%>");
|
747 |
|
|
insertLoginBox("<%=CONTEXT_URL%>");
|
748 |
|
|
</script>
|
749 |
|
|
|
750 |
5574
|
leinfelder
|
</div>
|
751 |
|
|
|
752 |
5509
|
leinfelder
|
<script language="javascript">
|
753 |
|
|
insertTemplateClosing("<%=CONTEXT_URL%>");
|
754 |
|
|
</script>
|
755 |
|
|
|
756 |
5385
|
leinfelder
|
</body>
|
757 |
|
|
</html>
|