Closes #222, Quick search should use current view as the context

This commit is contained in:
Dan Stillman 2006-08-29 07:18:41 +00:00
parent 0c24beee3f
commit 97c3f13112
3 changed files with 14 additions and 3 deletions

View file

@ -311,7 +311,7 @@ var ScholarPane = new function()
{
if(itemsView)
{
searchVal = document.getElementById('tb-search').value;
var searchVal = document.getElementById('tb-search').value;
itemsView.searchText(searchVal);
document.getElementById('tb-search-cancel').hidden = searchVal == "";

View file

@ -641,7 +641,17 @@ Scholar.ItemGroup.prototype.getChildItems = function()
{
if(this.searchText)
{
return Scholar.Items.get(Scholar.Items.search(this.searchText,(this.isCollection() ? this.ref.getID() : null)));
var s = new Scholar.Search();
if (this.isCollection())
{
s.addCondition('collectionID', 'is', this.ref.getID(), true);
}
else if (this.isSearch())
{
s.addCondition('savedSearchID', 'is', this.ref['id'], true);
}
s.addCondition('fulltext', 'contains', this.searchText);
return Scholar.Items.get(s.search());
}
else
{

View file

@ -127,6 +127,7 @@ Scholar.Search.prototype.addCondition = function(condition, operator, value, req
this.addCondition('joinMode', 'any');
this.addCondition('title', operator, value, false);
this.addCondition('field', operator, value, false);
this.addCondition('numberfield', operator, value, false);
this.addCondition('creator', operator, value, false);
this.addCondition('tag', operator, value, false);
this.addCondition('note', operator, value, false);
@ -794,7 +795,7 @@ Scholar.SearchConditions = new function(){
if (!_initialized){
_init();
}
Scholar.debug(_standardConditions);
// TODO: return copy instead
return _standardConditions;
}