commit a5cdfc2ceff2178f479befa7beb3c1c2df25fed8
parent 784558829137308cc39e85283bf7014e8b1c4f61
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 24 Jul 2011 17:41:48 +0000
Use arrow panel for "Add Citation by Identifier"
Diffstat:
4 files changed, 68 insertions(+), 30 deletions(-)
diff --git a/chrome/content/zotero-platform/mac/overlay.css b/chrome/content/zotero-platform/mac/overlay.css
@@ -69,24 +69,6 @@
display: none;
}
-.zotero-tb-button[type="menu"] > .toolbarbutton-icon {
- -moz-padding-end: 4px;
-}
-
-.zotero-tb-button[type="menu"] > .toolbarbutton-menu-dropmarker {
- list-style-image: url("chrome://zotero/skin/mac/folderDropArrow.png");
- padding: 0;
-}
-
-/* This property controls the strength of the SVG outer glow mask on the toolbar buttons */
-.zotero-tb-button > .toolbarbutton-icon > stack > .zotero-tb-glow {
- opacity: .7;
-}
-
-#zotero-tb-attachment-add > .toolbarbutton-icon > stack > .zotero-tb-glow {
- display: none;
-}
-
#zotero-tb-sync > .toolbarbutton-icon {
-moz-binding: none !important;
padding: 2px 0px 2px 8px !important;
diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js
@@ -1,9 +1,9 @@
/*
***** BEGIN LICENSE BLOCK *****
- Copyright © 2009 Center for History and New Media
- George Mason University, Fairfax, Virginia, USA
- http://zotero.org
+ Copyright © 2009-2011 Center for History and New Media
+ George Mason University, Fairfax, Virginia, USA
+ http://zotero.org
This file is part of Zotero.
@@ -23,12 +23,23 @@
***** END LICENSE BLOCK *****
*/
-
+/**
+ * Handles UI for lookup panel
+ * @namespace
+ */
const Zotero_Lookup = new function () {
+ /**
+ * Performs a lookup by DOI, PMID, or ISBN
+ */
this.accept = function() {
- document.getElementById("progress").setAttribute("status", "animate");
- document.getElementById("accept-button").disabled = true;
- var identifier = document.getElementById("lookup-textbox").value;
+ var progressElement = document.getElementById("zotero-lookup-progress");
+ progressElement.setAttribute("status", "animate");
+
+ var acceptElement = document.getElementById("zotero-lookup-accept-button");
+ acceptElement.disabled = true;
+
+ var identifierElement = document.getElementById("zotero-lookup-textbox");
+ var identifier = identifierElement.value;
var doi = Zotero.Utilities.cleanDOI(identifier);
if(doi) {
@@ -54,10 +65,11 @@ const Zotero_Lookup = new function () {
translate.setHandler("done", function(translate, success) {
if(success) {
- window.close();
+ document.getElementById("zotero-lookup-panel").hidePopup();
} else {
- document.getElementById("accept-button").disabled = undefined;
- document.getElementById("progress").setAttribute("status", "error");
+ acceptElement.disabled = undefined;
+ progressElement.removeAttribute("status");
+
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
prompts.alert(window, Zotero.getString("lookup.failure.title"),
@@ -78,4 +90,24 @@ const Zotero_Lookup = new function () {
translate.translate(libraryID);
return false;
}
+
+ /**
+ * Focuses the field
+ */
+ this.onShowing = function() {
+ if(!Zotero.isFx4) {
+ document.getElementById("zotero-lookup-panel").style.padding = "10px";
+ }
+ document.getElementById("zotero-lookup-textbox").focus();
+ }
+
+ /**
+ * Cancels the popup and resets fields
+ */
+ this.onHidden = function() {
+ var progressElement = document.getElementById("zotero-lookup-progress");
+ if(progressElement.hasAttribute("status")) progressElement.removeAttribute("status");
+ document.getElementById("zotero-lookup-accept-button").disabled = undefined;
+ document.getElementById("zotero-lookup-textbox").value = "";
+ }
}
diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul
@@ -31,6 +31,7 @@
<!DOCTYPE overlay [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> %globalDTD;
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %zoteroDTD;
+ <!ENTITY % dialogOverlayDTD SYSTEM "chrome://global/locale/dialogOverlay.dtd"> %dialogOverlayDTD;
]>
<overlay id="zotero"
@@ -43,7 +44,8 @@
<script src="timelineInterface.js"/>
<script src="recognizePDF.js"/>
<script src="browser.js"/>
- <script src="locateMenu.js" type="application/javascript;version=1.7"/>
+ <script src="lookup.js"/>
+ <script src="locateMenu.js" type="application/javascript;version=1.8"/>
<commandset id="mainCommandSet">
<command id="cmd_zotero_reportErrors" oncommand="ZoteroPane_Local.reportErrors();"/>
@@ -138,7 +140,25 @@
</menupopup>
</toolbarbutton>
<toolbarbutton id="zotero-tb-item-from-page" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newItemFromPage.label;" command="cmd_zotero_newItemFromCurrentPage"/>
- <toolbarbutton id="zotero-tb-lookup" class="zotero-tb-button" tooltiptext="&zotero.toolbar.lookup.label;" oncommand="ZoteroPane_Local.openLookupWindow()"/>
+ <toolbarbutton id="zotero-tb-lookup" class="zotero-tb-button" tooltiptext="&zotero.toolbar.lookup.label;" type="panel">
+ <panel id="zotero-lookup-panel" type="arrow" onpopupshown="Zotero_Lookup.onShowing()"
+ onpopuphidden="Zotero_Lookup.onHidden()" noautohide="true">
+ <vbox>
+ <description>&zotero.lookup.description;</description>
+ <textbox id="zotero-lookup-textbox" style="margin: 2px 0 2px 0" onkeypress="if([13, 14].indexOf(event.keyCode) !== -1) { Zotero_Lookup.accept(); } return true;" flex="1"/>
+ <hbox>
+ <toolbarbutton class="zotero-small-progress-indicator" id="zotero-lookup-progress"/>
+ <spacer flex="1"/>
+ <button id="zotero-lookup-cancel-button" style="list-style-image: none"
+ class="editBookmarkPanelBottomButton" label="&cancelButton.label;"
+ oncommand="document.getElementById('zotero-lookup-panel').hidePopup()"/>
+ <button id="zotero-lookup-accept-button" style="list-style-image: none; margin-right: 0"
+ class="editBookmarkPanelBottomButton" label="&okButton.label;"
+ oncommand="Zotero_Lookup.accept()"/>
+ </hbox>
+ </vbox>
+ </panel>
+ </toolbarbutton>
<!--<toolbarbutton id="zotero-tb-note-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.note.standalone;" oncommand="ZoteroPane_Local.newNote(event.shiftKey);"/>-->
<toolbarbutton id="zotero-tb-note-add" class="zotero-tb-button" tooltiptext="&zotero.toolbar.newNote;" type="menu">
<menupopup onpopupshowing="ZoteroPane_Local.updateNoteButtonMenu()">
diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css
@@ -253,6 +253,10 @@
height:24px;
}
+.zotero-tb-button[type="panel"] > dropmarker {
+ display: none;
+}
+
#zotero-tb-collection-add
{
list-style-image: url('chrome://zotero/skin/toolbar-collection-add.png');