Project

General

Profile

« Previous | Next » 

Revision 5774

add/remove ECPM search criteria that have been defined using the tree browser - incrementally refines the search

View differences:

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