Revision 5774
Added by ben leinfelder almost 14 years ago
lib/style/skins/semtools/search.js | ||
---|---|---|
27 | 27 |
|
28 | 28 |
// handle specific classes |
29 | 29 |
// Entity |
30 |
//for (var i=0; i < submitFormObj.activeEntities.length; i++) {
|
|
31 |
var searchClass = submitFormObj.activeEntitiesClass.value;
|
|
30 |
if (submitFormObj.activeEntitiesClass.value) {
|
|
31 |
var searchClass = submitFormObj.activeEntitiesClass.value;
|
|
32 | 32 |
var searchValue = submitFormObj.activeEntitiesValue.value; |
33 | 33 |
if (searchValue!="") { |
34 | 34 |
submitFormObj.query.value += |
... | ... | |
38 | 38 |
searchValue + |
39 | 39 |
"</condition>"; |
40 | 40 |
} |
41 |
//} |
|
41 |
} else { |
|
42 |
for (var i=0; i < submitFormObj.activeEntitiesValue.length; i++) { |
|
43 |
var searchClass = submitFormObj.activeEntitiesClass[i].value; |
|
44 |
var searchValue = submitFormObj.activeEntitiesValue[i].value; |
|
45 |
if (searchValue!="") { |
|
46 |
submitFormObj.query.value += |
|
47 |
"<condition " + |
|
48 |
"concept='" + searchClass + "' " + |
|
49 |
"operator='EQUALS'>" + |
|
50 |
searchValue + |
|
51 |
"</condition>"; |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
42 | 55 |
// Characteristic |
43 |
//for (var i=0; i < submitFormObj.activeCharacteristics.length; i++) {
|
|
44 |
var searchClass = submitFormObj.activeCharacteristicsClass.value;
|
|
56 |
if (submitFormObj.activeCharacteristicsClass.value) {
|
|
57 |
var searchClass = submitFormObj.activeCharacteristicsClass.value;
|
|
45 | 58 |
var searchValue = submitFormObj.activeCharacteristicsValue.value; |
46 | 59 |
if (searchValue!="") { |
47 | 60 |
submitFormObj.query.value += |
... | ... | |
51 | 64 |
searchValue + |
52 | 65 |
"</condition>"; |
53 | 66 |
} |
54 |
//} |
|
67 |
} else { |
|
68 |
for (var i=0; i < submitFormObj.activeCharacteristicsValue.length; i++) { |
|
69 |
var searchClass = submitFormObj.activeCharacteristicsClass[i].value; |
|
70 |
var searchValue = submitFormObj.activeCharacteristicsValue[i].value; |
|
71 |
if (searchValue!="") { |
|
72 |
submitFormObj.query.value += |
|
73 |
"<condition " + |
|
74 |
"concept='" + searchClass + "' " + |
|
75 |
"operator='EQUALS'>" + |
|
76 |
searchValue + |
|
77 |
"</condition>"; |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
55 | 81 |
// Protocol |
56 |
//for (var i=0; i < submitFormObj.activeProtocols.length; i++) {
|
|
57 |
var searchClass = submitFormObj.activeProtocolsClass.value;
|
|
82 |
if (submitFormObj.activeProtocolsValue.value) {
|
|
83 |
var searchClass = submitFormObj.activeProtocolsValue.value;
|
|
58 | 84 |
var searchValue = submitFormObj.activeProtocolsValue.value; |
59 | 85 |
if (searchValue!="") { |
60 | 86 |
submitFormObj.query.value += |
... | ... | |
64 | 90 |
searchValue + |
65 | 91 |
"</condition>"; |
66 | 92 |
} |
67 |
//} |
|
93 |
} else { |
|
94 |
for (var i=0; i < submitFormObj.activeProtocolsValue.length; i++) { |
|
95 |
var searchClass = submitFormObj.activeProtocolsClass[i].value; |
|
96 |
var searchValue = submitFormObj.activeProtocolsValue[i].value; |
|
97 |
if (searchValue!="") { |
|
98 |
submitFormObj.query.value += |
|
99 |
"<condition " + |
|
100 |
"concept='" + searchClass + "' " + |
|
101 |
"operator='EQUALS'>" + |
|
102 |
searchValue + |
|
103 |
"</condition>"; |
|
104 |
} |
|
105 |
} |
|
106 |
} |
|
68 | 107 |
// Measurement |
69 |
//for (var i=0; i < submitFormObj.activeMeasurements.length; i++) {
|
|
70 |
var searchClass = submitFormObj.activeMeasurementsClass.value;
|
|
108 |
if (submitFormObj.activeMeasurementsValue.value) {
|
|
109 |
var searchClass = submitFormObj.activeMeasurementsValue.value;
|
|
71 | 110 |
var searchValue = submitFormObj.activeMeasurementsValue.value; |
72 | 111 |
if (searchValue!="") { |
73 | 112 |
submitFormObj.query.value += |
... | ... | |
77 | 116 |
searchValue + |
78 | 117 |
"</condition>"; |
79 | 118 |
} |
80 |
//} |
|
81 |
|
|
119 |
} else { |
|
120 |
for (var i=0; i < submitFormObj.activeMeasurementsValue.length; i++) { |
|
121 |
var searchClass = submitFormObj.activeMeasurementsClass[i].value; |
|
122 |
var searchValue = submitFormObj.activeMeasurementsValue[i].value; |
|
123 |
if (searchValue!="") { |
|
124 |
submitFormObj.query.value += |
|
125 |
"<condition " + |
|
126 |
"concept='" + searchClass + "' " + |
|
127 |
"operator='EQUALS'>" + |
|
128 |
searchValue + |
|
129 |
"</condition>"; |
|
130 |
} |
|
131 |
} |
|
132 |
} |
|
82 | 133 |
submitFormObj.query.value += "</" + operator + ">"; |
83 | 134 |
submitFormObj.query.value += "</sq:query>"; |
84 | 135 |
|
lib/style/skins/semtools/index.jsp | ||
---|---|---|
245 | 245 |
//alert("parent: " + parent); |
246 | 246 |
|
247 | 247 |
// set the value for the hidden input value |
248 |
// the input field of class "value" will hold it, this way we don't need to know the id
|
|
249 |
var input = $(parent).children("input.value");
|
|
248 |
// the input field of class "conceptValue" will hold it, this way we don't need to know the id
|
|
249 |
var input = $(parent).children("input.conceptValue");
|
|
250 | 250 |
$(input).val(value); |
251 | 251 |
//alert("input: " + input); |
252 | 252 |
|
... | ... | |
315 | 315 |
$(".jstree").each(function(index) { |
316 | 316 |
$(this).jstree("deselect_all"); |
317 | 317 |
}); |
318 |
$("input.value").each(function(index) {
|
|
318 |
$("input.conceptValue").each(function(index) {
|
|
319 | 319 |
$(this).val(""); |
320 | 320 |
}); |
321 | 321 |
// reload the trees |
... | ... | |
324 | 324 |
//alert($('#searchForm').get(0)); |
325 | 325 |
doSearch($('#searchForm').get(0)); |
326 | 326 |
} |
327 |
function addCurrent() { |
|
328 |
|
|
329 |
// make a container for this item |
|
330 |
var count = $("#searchCriteria").children(".searchItem").length; |
|
331 |
count++; |
|
332 |
var containerId = "searchItem_" + count; |
|
333 |
var container = "<div class='searchItem' id='" + containerId + "'/>"; |
|
334 |
$("#searchCriteria").append(container); |
|
335 |
|
|
336 |
// get the current values |
|
337 |
$("input.conceptValue").each(function(index) { |
|
338 |
var title = $(this).attr("title"); |
|
339 |
var value = $(this).val(); |
|
340 |
var shortName = value.substr(value.lastIndexOf("#") + 1); |
|
341 |
var clone = $(this).clone(); |
|
342 |
$(clone).removeClass("conceptValue"); |
|
343 |
// put the value in the container |
|
344 |
$("#" + containerId).append(clone); |
|
345 |
$("#" + containerId).append("[" + title + " = " + shortName + "] "); |
|
346 |
}); |
|
347 |
// get the current classes (for search to work correctly we need class+value for each entry) |
|
348 |
$("input.conceptClass").each(function(index) { |
|
349 |
var clone = $(this).clone(); |
|
350 |
$(clone).removeClass("conceptClass"); |
|
351 |
// put the class in the container |
|
352 |
$("#" + containerId).append(clone); |
|
353 |
}); |
|
354 |
|
|
355 |
// add the remove button |
|
356 |
$("#" + containerId).append("<input type='button' value='Remove'/>").click(function() { |
|
357 |
// remove the container (includes the form objects we added) |
|
358 |
$("#" + containerId).remove(); |
|
359 |
// refresh the search results now that they are less restrictive |
|
360 |
doSearch($("#searchForm").get(0)); |
|
361 |
}); |
|
362 |
} |
|
327 | 363 |
/** |
328 | 364 |
* Perform this when the page first loads |
329 | 365 |
*/ |
... | ... | |
392 | 428 |
<div id="activeEntities" class="activeTree"> |
393 | 429 |
<p>loading...</p> |
394 | 430 |
</div> |
395 |
<input type="hidden" class="value" name="activeEntitiesValue" id="activeEntitiesValue"/>
|
|
396 |
<input type="hidden" name="activeEntitiesClass" id="activeEntitiesClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/> |
|
431 |
<input type="hidden" class="conceptValue" name="activeEntitiesValue" id="activeEntitiesValue" title="Entity"/>
|
|
432 |
<input type="hidden" class="conceptClass" name="activeEntitiesClass" id="activeEntitiesClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Entity"/>
|
|
397 | 433 |
</div> |
398 | 434 |
</td> |
399 | 435 |
</tr> |
... | ... | |
412 | 448 |
<div id="activeCharacteristics" class="activeTree"> |
413 | 449 |
<p>loading...</p> |
414 | 450 |
</div> |
415 |
<input type="hidden" class="value" name="activeCharacteristicsValue" id="activeCharacteristicsValue"/>
|
|
416 |
<input type="hidden" name="activeCharacteristicsClass" id="activeCharacteristicsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/> |
|
451 |
<input type="hidden" class="conceptValue" name="activeCharacteristicsValue" id="activeCharacteristicsValue" title="Characteristic"/>
|
|
452 |
<input type="hidden" class="conceptClass" name="activeCharacteristicsClass" id="activeCharacteristicsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Characteristic"/>
|
|
417 | 453 |
</div> |
418 | 454 |
</td> |
419 | 455 |
</tr> |
... | ... | |
432 | 468 |
<div id="activeProtocols" class="activeTree"> |
433 | 469 |
<p>loading...</p> |
434 | 470 |
</div> |
435 |
<input type="hidden" class="value" name="activeProtocolsValue" id="activeProtocolsValue" />
|
|
436 |
<input type="hidden" name="activeProtocolsClass" id="activeProtocolsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/> |
|
471 |
<input type="hidden" class="conceptValue" name="activeProtocolsValue" id="activeProtocolsValue" title="Protocol"/>
|
|
472 |
<input type="hidden" class="conceptClass" name="activeProtocolsClass" id="activeProtocolsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Protocol"/>
|
|
437 | 473 |
</div> |
438 | 474 |
</td> |
439 | 475 |
</tr> |
... | ... | |
459 | 495 |
<div id="activeMeasurements" class="activeTree" style="width: 100%"> |
460 | 496 |
<p>loading...</p> |
461 | 497 |
</div> |
462 |
<input type="hidden" class="value" name="activeMeasurementsValue" id="activeMeasurementsValue"/>
|
|
463 |
<input type="hidden" name="activeMeasurementsClass" id="activeMeasurementsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/> |
|
498 |
<input type="hidden" class="conceptValue" name="activeMeasurementsValue" id="activeMeasurementsValue" title="Measurement"/>
|
|
499 |
<input type="hidden" class="conceptClass" name="activeMeasurementsClass" id="activeMeasurementsClass" value="http://ecoinformatics.org/oboe/oboe.1.0/oboe-core.owl#Measurement"/>
|
|
464 | 500 |
</div> |
465 | 501 |
</td> |
466 | 502 |
</tr> |
... | ... | |
490 | 526 |
</div> |
491 | 527 |
|
492 | 528 |
</div> |
529 |
|
|
530 |
<br/> |
|
531 |
|
|
532 |
<!-- collected search criteria here --> |
|
533 |
<table class="subGroup subGroup_border onehundred_percent"> |
|
534 |
<tr> |
|
535 |
<th> |
|
536 |
Search Criteria |
|
537 |
<input type="button" value="Add Current Selection" onclick="addCurrent()"/> |
|
538 |
</th> |
|
539 |
</tr> |
|
540 |
<tr> |
|
541 |
<td> |
|
542 |
<div id="searchCriteria"> |
|
543 |
</div> |
|
544 |
</td> |
|
545 |
</tr> |
|
546 |
</table> |
|
493 | 547 |
|
494 | 548 |
<br/> |
495 | 549 |
|
Also available in: Unified diff
add/remove ECPM search criteria that have been defined using the tree browser - incrementally refines the search