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>
|
||||
<property name="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">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
|
@ -95,6 +95,39 @@
|
|||
|
||||
default:
|
||||
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>
|
||||
|
|
|
@ -746,14 +746,33 @@ var ScholarItemPane = new function()
|
|||
t.setAttribute('multiline', true);
|
||||
t.setAttribute('rows', 8);
|
||||
}
|
||||
// TODO: only have autocomplete on a few fields
|
||||
else
|
||||
{
|
||||
t.setAttribute('type', 'autocomplete');
|
||||
t.setAttribute('autocompletesearch', 'zotero');
|
||||
t.setAttribute('autocompletesearchparam', fieldName + '/' +
|
||||
(elem.getAttribute('singleField')=='true' ? '1' : '0') +
|
||||
'-' + (itemID ? itemID : ''));
|
||||
// Add auto-complete for certain fields
|
||||
switch (field)
|
||||
{
|
||||
case 'creator':
|
||||
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;
|
||||
box.replaceChild(t,elem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue