Closes #260, Add auto-complete to search window
And fixed a bug that caused the text of some search conditions to not display when editing a previously saved search Also added autocomplete to more fields in metadata pane: - creator - publisher - place - publicationTitle - journalAbbreviation - seriesTitle - seriesText It should also do the type and medium fields, but they need to be separated out first--e.g. artworkType, interviewMedium--since they're describing different data
This commit is contained in:
parent
66729ed1e2
commit
a972a035c7
2 changed files with 59 additions and 7 deletions
|
@ -14,7 +14,7 @@
|
||||||
<implementation>
|
<implementation>
|
||||||
<property name="value"
|
<property name="value"
|
||||||
onget="return document.getAnonymousNodes(this)[0].value"
|
onget="return document.getAnonymousNodes(this)[0].value"
|
||||||
onset="document.getAnonymousNodes(this)[0].value = val; return val"/>
|
onset="document.getAnonymousNodes(this)[0].setAttribute('value', val); return val"/>
|
||||||
<property name="mode">
|
<property name="mode">
|
||||||
<getter>
|
<getter>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -95,6 +95,39 @@
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this.setAttribute('hasOptions', false);
|
this.setAttribute('hasOptions', false);
|
||||||
|
|
||||||
|
// Set textbox to autocomplete mode
|
||||||
|
switch (condition)
|
||||||
|
{
|
||||||
|
// Skip autocomplete for these fields
|
||||||
|
case 'note':
|
||||||
|
case 'extra':
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
var textbox = document.getAnonymousNodes(this)[0];
|
||||||
|
textbox.setAttribute('type', 'autocomplete');
|
||||||
|
textbox.setAttribute('autocompletesearch', 'zotero');
|
||||||
|
|
||||||
|
if (condition=='creator')
|
||||||
|
{
|
||||||
|
// 2 searches both single- and double-field creators
|
||||||
|
var autocompleteCondition = condition + '/2'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var autocompleteCondition = condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
textbox.setAttribute('autocompletesearchparam', autocompleteCondition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!autocompleteCondition)
|
||||||
|
{
|
||||||
|
var textbox = document.getAnonymousNodes(this)[0];
|
||||||
|
textbox.removeAttribute('type');
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -746,14 +746,33 @@ var ScholarItemPane = new function()
|
||||||
t.setAttribute('multiline', true);
|
t.setAttribute('multiline', true);
|
||||||
t.setAttribute('rows', 8);
|
t.setAttribute('rows', 8);
|
||||||
}
|
}
|
||||||
// TODO: only have autocomplete on a few fields
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t.setAttribute('type', 'autocomplete');
|
// Add auto-complete for certain fields
|
||||||
t.setAttribute('autocompletesearch', 'zotero');
|
switch (field)
|
||||||
t.setAttribute('autocompletesearchparam', fieldName + '/' +
|
{
|
||||||
(elem.getAttribute('singleField')=='true' ? '1' : '0') +
|
case 'creator':
|
||||||
'-' + (itemID ? itemID : ''));
|
case 'publisher':
|
||||||
|
case 'place':
|
||||||
|
case 'publicationTitle':
|
||||||
|
case 'journalAbbreviation':
|
||||||
|
case 'seriesTitle':
|
||||||
|
case 'seriesText':
|
||||||
|
// DEBUG: should have type and medium, but they need to be
|
||||||
|
// broken out first into multiple fields (artworkType,
|
||||||
|
// interviewMedium, etc.)
|
||||||
|
t.setAttribute('type', 'autocomplete');
|
||||||
|
t.setAttribute('autocompletesearch', 'zotero');
|
||||||
|
var suffix = itemID ? itemID : '';
|
||||||
|
if (field=='creator')
|
||||||
|
{
|
||||||
|
suffix = (elem.getAttribute('singleField')=='true'
|
||||||
|
? '1' : '0') + '-' + suffix;
|
||||||
|
}
|
||||||
|
t.setAttribute('autocompletesearchparam',
|
||||||
|
fieldName + '/' + suffix);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var box = elem.parentNode;
|
var box = elem.parentNode;
|
||||||
box.replaceChild(t,elem);
|
box.replaceChild(t,elem);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue