Closes #172, add preference for EndNote MIME type stealing feature

Addresses #169, add OpenURL interface hooks
Addresses #170, Put "Link" option before "Import" in drop-down menu

Fixes some advanced search flaws (there are still bugs)
This commit is contained in:
David Norton 2006-08-09 15:44:11 +00:00
parent 8d5f1e62b6
commit 6877d33e61
14 changed files with 101 additions and 46 deletions

View File

@ -35,24 +35,21 @@
var conditions = this.search.getSearchConditions(); var conditions = this.search.getSearchConditions();
if(conditions.length) if(conditions.length)
{
for(var i = 0, len = conditions.length; i<len; i++) for(var i = 0, len = conditions.length; i<len; i++)
{
this.addCondition(i); this.addCondition(i);
}
}
]]> ]]>
</setter> </setter>
</property> </property>
<method name="onAddClicked"> <method name="onAddClicked">
<body> <body>
<![CDATA[ <![CDATA[
this.search.addCondition("itemType","is","1"); this.addCondition(this.search.addCondition("itemType","is","1"));
this.addCondition();
]]> ]]>
</body> </body>
</method> </method>
<method name="addCondition"> <method name="addCondition">
<parameter name="id"/>
<body> <body>
<![CDATA[ <![CDATA[
var conditionsBox = this.id('conditions'); var conditionsBox = this.id('conditions');
@ -61,7 +58,7 @@
conditionsBox.appendChild(condition); conditionsBox.appendChild(condition);
condition.initWithParentAndConditionID(this, conditionsBox.childNodes.length-1); condition.initWithParentAndConditionID(this, id);
conditionsBox.childNodes[0].id('remove').hidden = (conditionsBox.childNodes.length == 1); conditionsBox.childNodes[0].id('remove').hidden = (conditionsBox.childNodes.length == 1);
]]> ]]>
@ -81,6 +78,20 @@
]]> ]]>
</body> </body>
</method> </method>
<method name="save">
<body>
<![CDATA[
var conditionsBox = this.id('conditions');
if(conditionsBox.hasChildNodes())
for(var i = 0, len=conditionsBox.childNodes.length; i < len; i++)
conditionsBox.childNodes[i].updateSearch();
this.search.save();
]]>
</body>
</method>
<method name="id"> <method name="id">
<parameter name="id"/> <parameter name="id"/>
<body> <body>
@ -104,7 +115,7 @@
</xul:menulist> </xul:menulist>
<xul:label value="of the following:"/> <xul:label value="of the following:"/>
</xul:caption> </xul:caption>
<xul:vbox id="conditions" style="overflow: auto;"/> <xul:vbox id="conditions"/>
</xul:groupbox> </xul:groupbox>
</content> </content>
</binding> </binding>
@ -214,7 +225,7 @@
<xul:menulist id="conditionsmenu" oncommand="this.parentNode.parentNode.onConditionSelected();"> <xul:menulist id="conditionsmenu" oncommand="this.parentNode.parentNode.onConditionSelected();">
<xul:menupopup/> <xul:menupopup/>
</xul:menulist> </xul:menulist>
<xul:menulist id="operatorsmenu" oncommand="this.parentNode.parentNode.updateSearch();"> <xul:menulist id="operatorsmenu">
<xul:menupopup> <xul:menupopup>
<xul:menuitem label="is" value="is"/> <xul:menuitem label="is" value="is"/>
<xul:menuitem label="isNot" value="isNot"/> <xul:menuitem label="isNot" value="isNot"/>
@ -222,7 +233,7 @@
<xul:menuitem label="doesNotContain" value="doesNotContain"/> <xul:menuitem label="doesNotContain" value="doesNotContain"/>
</xul:menupopup> </xul:menupopup>
</xul:menulist> </xul:menulist>
<xul:textbox id="valuefield" type="timed" timeout="1000" flex="1" oncommand="this.parentNode.parentNode.updateSearch();"/> <xul:textbox id="valuefield" flex="1"/>
<xul:toolbarbutton id="remove" class="clicky" label="-" oncommand="this.parentNode.parentNode.onRemoveClicked();"/> <xul:toolbarbutton id="remove" class="clicky" label="-" oncommand="this.parentNode.parentNode.onRemoveClicked();"/>
<xul:toolbarbutton id="add" class="clicky" label="+" oncommand="this.parentNode.parentNode.onAddClicked();"/> <xul:toolbarbutton id="add" class="clicky" label="+" oncommand="this.parentNode.parentNode.onAddClicked();"/>
</xul:hbox> </xul:hbox>

View File

@ -37,6 +37,7 @@ ScholarItemPane = new function()
this.viewItem = viewItem; this.viewItem = viewItem;
this.loadPane = loadPane; this.loadPane = loadPane;
this.changeTypeTo = changeTypeTo; this.changeTypeTo = changeTypeTo;
this.onOpenURLClick = onOpenURLClick;
this.addCreatorRow = addCreatorRow; this.addCreatorRow = addCreatorRow;
this.removeCreator = removeCreator; this.removeCreator = removeCreator;
this.showEditor = showEditor; this.showEditor = showEditor;
@ -263,6 +264,11 @@ ScholarItemPane = new function()
} }
} }
function onOpenURLClick()
{
window.open(Scholar.OpenURL.resolve(_itemBeingEdited));
}
function addDynamicRow(label, value, beforeElement) function addDynamicRow(label, value, beforeElement)
{ {
var row = document.createElement("row"); var row = document.createElement("row");

View File

@ -29,9 +29,12 @@
<popupset> <popupset>
<popup id="creatorTypeMenu" position="after_start" oncommand="ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1],'typeID',event.explicitOriginalTarget.getAttribute('typeid'));"/> <popup id="creatorTypeMenu" position="after_start" oncommand="ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1],'typeID',event.explicitOriginalTarget.getAttribute('typeid'));"/>
</popupset> </popupset>
<menulist id="editpane-type-menu" oncommand="ScholarItemPane.changeTypeTo(this.value)"> <hbox align="center">
<menulist id="editpane-type-menu" oncommand="ScholarItemPane.changeTypeTo(this.value)" flex="1">
<menupopup/> <menupopup/>
</menulist> </menulist>
<toolbarbutton id="tb-openurl" tooltiptext="&toolbar.openurl.label;" oncommand="ScholarItemPane.onOpenURLClick();"/>
</hbox>
<grid flex="1"> <grid flex="1">
<columns> <columns>
<column/> <column/>
@ -58,10 +61,10 @@
<label id="editpane-files-label"/> <label id="editpane-files-label"/>
<button id="tb-item-files-add" type="menu" label="&item.add;"> <button id="tb-item-files-add" type="menu" label="&item.add;">
<menupopup> <menupopup>
<menuitem class="menuitem-iconic" id="tb-item-files-file" label="&toolbar.file.add;" oncommand="ScholarItemPane.addFileFromDialog();"/>
<menuitem class="menuitem-iconic" id="tb-item-files-link" label="&toolbar.file.linked;" oncommand="ScholarItemPane.addFileFromDialog(true);"/> <menuitem class="menuitem-iconic" id="tb-item-files-link" label="&toolbar.file.linked;" oncommand="ScholarItemPane.addFileFromDialog(true);"/>
<menuitem class="menuitem-iconic" id="tb-item-files-snapshot" label="&toolbar.file.snapshot;" oncommand="ScholarItemPane.addFileFromPage();"/> <menuitem class="menuitem-iconic" id="tb-item-files-file" label="&toolbar.file.add;" oncommand="ScholarItemPane.addFileFromDialog();"/>
<menuitem class="menuitem-iconic" id="tb-item-files-web-link" label="&toolbar.file.weblink;" oncommand="ScholarItemPane.addFileFromPage(true);"/> <menuitem class="menuitem-iconic" id="tb-item-files-web-link" label="&toolbar.file.weblink;" oncommand="ScholarItemPane.addFileFromPage(true);"/>
<menuitem class="menuitem-iconic" id="tb-item-files-snapshot" label="&toolbar.file.snapshot;" oncommand="ScholarItemPane.addFileFromPage();"/>
</menupopup> </menupopup>
</button> </button>
</hbox> </hbox>

View File

@ -186,7 +186,6 @@ var ScholarPane = new function()
itemsView.unregister(); itemsView.unregister();
document.getElementById('tb-search').value = ""; document.getElementById('tb-search').value = "";
document.getElementById('scholar-search-options').hidden = true;
if(collectionsView.selection.count == 1 && collectionsView.selection.currentIndex != -1) if(collectionsView.selection.count == 1 && collectionsView.selection.currentIndex != -1)
{ {
@ -313,10 +312,6 @@ var ScholarPane = new function()
searchVal = document.getElementById('tb-search').value; searchVal = document.getElementById('tb-search').value;
itemsView.searchText(searchVal); itemsView.searchText(searchVal);
//do something about granularity
//document.getElementById('scholar-search-options').getElementsByAttribute('checked','true')[0].label
document.getElementById('scholar-search-options').hidden = searchVal == "";
document.getElementById('tb-search-cancel').hidden = searchVal == ""; document.getElementById('tb-search-cancel').hidden = searchVal == "";
} }

View File

@ -103,10 +103,10 @@
</toolbarbutton> </toolbarbutton>
<toolbarbutton id="tb-file-add" type="menu" tooltiptext="&toolbar.file.standalone;"> <toolbarbutton id="tb-file-add" type="menu" tooltiptext="&toolbar.file.standalone;">
<menupopup> <menupopup>
<menuitem label="&toolbar.file.add;" oncommand="ScholarPane.addFileFromDialog();"/>
<menuitem label="&toolbar.file.linked;" oncommand="ScholarPane.addFileFromDialog(true);"/> <menuitem label="&toolbar.file.linked;" oncommand="ScholarPane.addFileFromDialog(true);"/>
<menuitem label="&toolbar.file.snapshot;" oncommand="ScholarPane.addFileFromPage();"/> <menuitem label="&toolbar.file.add;" oncommand="ScholarPane.addFileFromDialog();"/>
<menuitem label="&toolbar.file.weblink;" oncommand="ScholarPane.addFileFromPage(true);"/> <menuitem label="&toolbar.file.weblink;" oncommand="ScholarPane.addFileFromPage(true);"/>
<menuitem label="&toolbar.file.snapshot;" oncommand="ScholarPane.addFileFromPage();"/>
</menupopup> </menupopup>
</toolbarbutton> </toolbarbutton>
<toolbarbutton id="tb-note-add" tooltiptext="&toolbar.note.standalone;" oncommand="ScholarPane.newNote();"/> <toolbarbutton id="tb-note-add" tooltiptext="&toolbar.note.standalone;" oncommand="ScholarPane.newNote();"/>
@ -116,17 +116,6 @@
<toolbarbutton id="tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/> <toolbarbutton id="tb-search-cancel" oncommand="this.parentNode.value='';" hidden="true"/>
</textbox> </textbox>
</toolbar> </toolbar>
<hbox id="scholar-search-options" hidden="true">
<hbox>
<toolbarbutton type="checkbox" label="Entire Item" checked="true" onclick="var b = this.parentNode.getElementsByAttribute('checked','true'); b[0].checked = false;" command="cmd_scholar_search"/>
<toolbarbutton type="checkbox" label="Info" onclick="var b = this.parentNode.getElementsByAttribute('checked','true'); b[0].checked = false;" command="cmd_scholar_search"/>
<toolbarbutton type="checkbox" label="Notes" onclick="var b = this.parentNode.getElementsByAttribute('checked','true'); b[0].checked = false;" command="cmd_scholar_search"/>
<toolbarbutton type="checkbox" label="Files" onclick="var b = this.parentNode.getElementsByAttribute('checked','true'); b[0].checked = false;" command="cmd_scholar_search"/>
</hbox>
<spacer flex="1"/>
<toolbarbutton label="Save"/>
<toolbarbutton label="+"/>
</hbox>
<tree <tree
id="items-tree" context="scholar-itemmenu" id="items-tree" context="scholar-itemmenu"
ondblclick="ScholarPane.onDoubleClick(event, this);" ondblclick="ScholarPane.onDoubleClick(event, this);"

View File

@ -20,6 +20,9 @@
var autoUpdateBox; var autoUpdateBox;
var positionMenu; var positionMenu;
var parseEndnoteBox;
var openURLServerField;
var openURLVersionMenu;
/* /*
To add a new preference: To add a new preference:
@ -42,10 +45,25 @@ function init()
positionMenu = document.getElementById('positionMenu'); positionMenu = document.getElementById('positionMenu');
positionMenu.selectedIndex = Scholar.Prefs.get('scholarPaneOnTop') ? 0 : 1; positionMenu.selectedIndex = Scholar.Prefs.get('scholarPaneOnTop') ? 0 : 1;
parseEndnoteBox = document.getElementById('parseEndnoteBox');
parseEndnoteBox.checked = Scholar.Prefs.get('parseEndNoteMIMETypes');
openURLServerField = document.getElementById('openURLServerField');
openURLServerField.value = Scholar.Prefs.get('openURL.resolver');
openURLVersionMenu = document.getElementById('openURLVersionMenu');
openURLVersionMenu.value = Scholar.Prefs.get('openURL.version');
} }
function accept() function accept()
{ {
Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked) Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked);
Scholar.Prefs.set('scholarPaneOnTop', positionMenu.selectedIndex == 0) Scholar.Prefs.set('scholarPaneOnTop', positionMenu.selectedIndex == 0);
if(Scholar.Prefs.get('parseEndNoteMIMETypes') != parseEndnoteBox.checked)
{
Scholar.Prefs.set('parseEndNoteMIMETypes', parseEndnoteBox.checked);
Scholar.Ingester.MIMEHandler.init();
}
Scholar.Prefs.set('openURL.resolver', openURLServerField.value);
Scholar.Prefs.set('openURL.version', openURLVersionMenu.value);
} }

View File

@ -31,16 +31,37 @@
<dialogheader id="header" title="&scholar.name;" description="&scholar.preferences.title;"/> <dialogheader id="header" title="&scholar.name;" description="&scholar.preferences.title;"/>
<checkbox id="autoUpdateBox" label="&scholar.preferences.autoUpdate.label;"/> <hbox align="center">
<label value="&scholar.preferences.position.label;" control="positionMenu"/>
<hbox>
<label value="Display Scholar:" control="positionMenu"/>
<menulist id="positionMenu"> <menulist id="positionMenu">
<menupopup> <menupopup>
<menuitem label="Above browser content"/> <menuitem label="&scholar.preferences.position.above;"/>
<menuitem label="Below browser content"/> <menuitem label="&scholar.preferences.position.below;"/>
</menupopup> </menupopup>
</menulist> </menulist>
<label value="&scholar.preferences.position.browser;"/>
</hbox> </hbox>
<checkbox id="autoUpdateBox" label="&scholar.preferences.autoUpdate.label;"/>
<checkbox id="parseEndnoteBox" label="&scholar.preferences.parseEndnote.label;"/>
<groupbox>
<caption label="&scholar.preferences.openurl.caption;"/>
<hbox align="center">
<label value="&scholar.preferences.openurl.server;"/>
<textbox id="openURLServerField" flex="1"/>
</hbox>
<hbox align="center">
<label value="&scholar.preferences.openurl.version;"/>
<menulist id="openURLVersionMenu">
<menupopup>
<menuitem label="0.1" value="0.1"/>
<menuitem label="1.0" value="1.0"/>
</menupopup>
</menulist>
</hbox>
</groupbox>
</dialog> </dialog>

View File

@ -39,6 +39,6 @@ function doUnload()
function doAccept() function doAccept()
{ {
document.getElementById('search-box').search.setName(document.getElementById('search-name').value); document.getElementById('search-box').search.setName(document.getElementById('search-name').value);
document.getElementById('search-box').search.save(); document.getElementById('search-box').save();
io.dataOut = true; io.dataOut = true;
} }

View File

@ -27,8 +27,6 @@
id="scholar-search-dialog" id="scholar-search-dialog"
title="Search" title="Search"
orient="vertical" orient="vertical"
width="600" flex="1"
persist="width height screenX screenY"
buttons="cancel,accept" buttons="cancel,accept"
ondialogaccept="doAccept();" ondialogaccept="doAccept();"
onload="doLoad();" onload="doLoad();"

View File

@ -1,3 +1,11 @@
<!ENTITY scholar.name "Scholar"> <!ENTITY scholar.name "Scholar">
<!ENTITY scholar.preferences.title "Scholar Preferences"> <!ENTITY scholar.preferences.title "Scholar Preferences">
<!ENTITY scholar.preferences.autoUpdate.label "Automatically check for updated scrapers"> <!ENTITY scholar.preferences.autoUpdate.label "Automatically check for updated scrapers">
<!ENTITY scholar.preferences.position.label "Display Scholar">
<!ENTITY scholar.preferences.position.above "above">
<!ENTITY scholar.preferences.position.below "below">
<!ENTITY scholar.preferences.position.browser "browser content">
<!ENTITY scholar.preferences.parseEndnote.label "Use Scholar for downloaded EndNote files">
<!ENTITY scholar.preferences.openurl.caption "OpenURL">
<!ENTITY scholar.preferences.openurl.server "Resolver:">
<!ENTITY scholar.preferences.openurl.version "Version:">

View File

@ -29,6 +29,7 @@
<!ENTITY toolbar.createBibCollection.label "Create Bibliography From Project..."> <!ENTITY toolbar.createBibCollection.label "Create Bibliography From Project...">
<!ENTITY toolbar.search.label "Search:"> <!ENTITY toolbar.search.label "Search:">
<!ENTITY toolbar.fullscreen.tooltip "Toggle Fullscreen Mode"> <!ENTITY toolbar.fullscreen.tooltip "Toggle Fullscreen Mode">
<!ENTITY toolbar.openurl.label "Find in your library's catalog">
<!ENTITY item.add "Add"> <!ENTITY item.add "Add">

View File

@ -148,6 +148,11 @@
list-style-image: url('chrome://scholar/skin/search-cancel-active.png'); list-style-image: url('chrome://scholar/skin/search-cancel-active.png');
} }
#tb-openurl
{
list-style-image: url('chrome://scholar/skin/toolbar-openurl.png');
}
#scholar-view-item vbox #scholar-view-item vbox
{ {
overflow: auto; overflow: auto;

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 679 B