commit 6877d33e612634a659af815b8bd0f4eaa992095f
parent 8d5f1e62b695672953609b2b59bde3ef5ba8a2b2
Author: David Norton <david@nortoncrew.com>
Date: Wed, 9 Aug 2006 15:44:11 +0000
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)
Diffstat:
14 files changed, 102 insertions(+), 46 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml b/chrome/chromeFiles/content/scholar/bindings/scholarsearch.xml
@@ -35,24 +35,21 @@
var conditions = this.search.getSearchConditions();
if(conditions.length)
- {
for(var i = 0, len = conditions.length; i<len; i++)
- {
- this.addCondition(i);
- }
- }
+ this.addCondition(i);
+
]]>
</setter>
</property>
<method name="onAddClicked">
<body>
<![CDATA[
- this.search.addCondition("itemType","is","1");
- this.addCondition();
+ this.addCondition(this.search.addCondition("itemType","is","1"));
]]>
</body>
</method>
<method name="addCondition">
+ <parameter name="id"/>
<body>
<![CDATA[
var conditionsBox = this.id('conditions');
@@ -61,7 +58,7 @@
conditionsBox.appendChild(condition);
- condition.initWithParentAndConditionID(this, conditionsBox.childNodes.length-1);
+ condition.initWithParentAndConditionID(this, id);
conditionsBox.childNodes[0].id('remove').hidden = (conditionsBox.childNodes.length == 1);
]]>
@@ -81,6 +78,20 @@
]]>
</body>
</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">
<parameter name="id"/>
<body>
@@ -104,7 +115,7 @@
</xul:menulist>
<xul:label value="of the following:"/>
</xul:caption>
- <xul:vbox id="conditions" style="overflow: auto;"/>
+ <xul:vbox id="conditions"/>
</xul:groupbox>
</content>
</binding>
@@ -214,7 +225,7 @@
<xul:menulist id="conditionsmenu" oncommand="this.parentNode.parentNode.onConditionSelected();">
<xul:menupopup/>
</xul:menulist>
- <xul:menulist id="operatorsmenu" oncommand="this.parentNode.parentNode.updateSearch();">
+ <xul:menulist id="operatorsmenu">
<xul:menupopup>
<xul:menuitem label="is" value="is"/>
<xul:menuitem label="isNot" value="isNot"/>
@@ -222,7 +233,7 @@
<xul:menuitem label="doesNotContain" value="doesNotContain"/>
</xul:menupopup>
</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="add" class="clicky" label="+" oncommand="this.parentNode.parentNode.onAddClicked();"/>
</xul:hbox>
diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js
@@ -37,6 +37,7 @@ ScholarItemPane = new function()
this.viewItem = viewItem;
this.loadPane = loadPane;
this.changeTypeTo = changeTypeTo;
+ this.onOpenURLClick = onOpenURLClick;
this.addCreatorRow = addCreatorRow;
this.removeCreator = removeCreator;
this.showEditor = showEditor;
@@ -263,6 +264,11 @@ ScholarItemPane = new function()
}
}
+ function onOpenURLClick()
+ {
+ window.open(Scholar.OpenURL.resolve(_itemBeingEdited));
+ }
+
function addDynamicRow(label, value, beforeElement)
{
var row = document.createElement("row");
diff --git a/chrome/chromeFiles/content/scholar/itemPane.xul b/chrome/chromeFiles/content/scholar/itemPane.xul
@@ -29,9 +29,12 @@
<popupset>
<popup id="creatorTypeMenu" position="after_start" oncommand="ScholarItemPane.modifyCreator(document.popupNode.getAttribute('fieldname').split('-')[1],'typeID',event.explicitOriginalTarget.getAttribute('typeid'));"/>
</popupset>
- <menulist id="editpane-type-menu" oncommand="ScholarItemPane.changeTypeTo(this.value)">
- <menupopup/>
- </menulist>
+ <hbox align="center">
+ <menulist id="editpane-type-menu" oncommand="ScholarItemPane.changeTypeTo(this.value)" flex="1">
+ <menupopup/>
+ </menulist>
+ <toolbarbutton id="tb-openurl" tooltiptext="&toolbar.openurl.label;" oncommand="ScholarItemPane.onOpenURLClick();"/>
+ </hbox>
<grid flex="1">
<columns>
<column/>
@@ -58,10 +61,10 @@
<label id="editpane-files-label"/>
<button id="tb-item-files-add" type="menu" label="&item.add;">
<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-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-snapshot" label="&toolbar.file.snapshot;" oncommand="ScholarItemPane.addFileFromPage();"/>
</menupopup>
</button>
</hbox>
diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js
@@ -186,7 +186,6 @@ var ScholarPane = new function()
itemsView.unregister();
document.getElementById('tb-search').value = "";
- document.getElementById('scholar-search-options').hidden = true;
if(collectionsView.selection.count == 1 && collectionsView.selection.currentIndex != -1)
{
@@ -313,10 +312,6 @@ var ScholarPane = new function()
searchVal = document.getElementById('tb-search').value;
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 == "";
}
diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul
@@ -103,10 +103,10 @@
</toolbarbutton>
<toolbarbutton id="tb-file-add" type="menu" tooltiptext="&toolbar.file.standalone;">
<menupopup>
- <menuitem label="&toolbar.file.add;" oncommand="ScholarPane.addFileFromDialog();"/>
<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.snapshot;" oncommand="ScholarPane.addFileFromPage();"/>
</menupopup>
</toolbarbutton>
<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"/>
</textbox>
</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
id="items-tree" context="scholar-itemmenu"
ondblclick="ScholarPane.onDoubleClick(event, this);"
diff --git a/chrome/chromeFiles/content/scholar/preferences.js b/chrome/chromeFiles/content/scholar/preferences.js
@@ -20,6 +20,9 @@
var autoUpdateBox;
var positionMenu;
+var parseEndnoteBox;
+var openURLServerField;
+var openURLVersionMenu;
/*
To add a new preference:
@@ -41,11 +44,26 @@ function init()
positionMenu = document.getElementById('positionMenu');
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()
{
- Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked)
- Scholar.Prefs.set('scholarPaneOnTop', positionMenu.selectedIndex == 0)
+ Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked);
+ 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);
}
\ No newline at end of file
diff --git a/chrome/chromeFiles/content/scholar/preferences.xul b/chrome/chromeFiles/content/scholar/preferences.xul
@@ -31,16 +31,37 @@
<dialogheader id="header" title="&scholar.name;" description="&scholar.preferences.title;"/>
-<checkbox id="autoUpdateBox" label="&scholar.preferences.autoUpdate.label;"/>
-
-<hbox>
- <label value="Display Scholar:" control="positionMenu"/>
+<hbox align="center">
+ <label value="&scholar.preferences.position.label;" control="positionMenu"/>
<menulist id="positionMenu">
<menupopup>
- <menuitem label="Above browser content"/>
- <menuitem label="Below browser content"/>
+ <menuitem label="&scholar.preferences.position.above;"/>
+ <menuitem label="&scholar.preferences.position.below;"/>
</menupopup>
</menulist>
+ <label value="&scholar.preferences.position.browser;"/>
</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>
\ No newline at end of file
diff --git a/chrome/chromeFiles/content/scholar/searchDialog.js b/chrome/chromeFiles/content/scholar/searchDialog.js
@@ -39,6 +39,6 @@ function doUnload()
function doAccept()
{
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;
}
\ No newline at end of file
diff --git a/chrome/chromeFiles/content/scholar/searchDialog.xul b/chrome/chromeFiles/content/scholar/searchDialog.xul
@@ -27,8 +27,6 @@
id="scholar-search-dialog"
title="Search"
orient="vertical"
- width="600" flex="1"
- persist="width height screenX screenY"
buttons="cancel,accept"
ondialogaccept="doAccept();"
onload="doLoad();"
diff --git a/chrome/chromeFiles/locale/en-US/scholar/preferences.dtd b/chrome/chromeFiles/locale/en-US/scholar/preferences.dtd
@@ -1,3 +1,11 @@
<!ENTITY scholar.name "Scholar">
<!ENTITY scholar.preferences.title "Scholar Preferences">
<!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:">
+\ No newline at end of file
diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd
@@ -29,6 +29,7 @@
<!ENTITY toolbar.createBibCollection.label "Create Bibliography From Project...">
<!ENTITY toolbar.search.label "Search:">
<!ENTITY toolbar.fullscreen.tooltip "Toggle Fullscreen Mode">
+<!ENTITY toolbar.openurl.label "Find in your library's catalog">
<!ENTITY item.add "Add">
diff --git a/chrome/chromeFiles/skin/default/scholar/overlay.css b/chrome/chromeFiles/skin/default/scholar/overlay.css
@@ -148,6 +148,11 @@
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
{
overflow: auto;
diff --git a/chrome/chromeFiles/skin/default/scholar/toolbar-openurl.png b/chrome/chromeFiles/skin/default/scholar/toolbar-openurl.png
Binary files differ.
diff --git a/chrome/chromeFiles/skin/default/scholar/treesource-search.png b/chrome/chromeFiles/skin/default/scholar/treesource-search.png
Binary files differ.