www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 701845fa0a8f6de9ad1472711788285e5d751978
parent 7d0e31bc956a2cdeacd01c35fc842a61fbec05d3
Author: Simon Kornblith <simon@simonster.com>
Date:   Wed,  9 Feb 2011 05:03:40 +0000

- remove attachment go buttons
- tweaks to locate menu behavior for attachments


Diffstat:
Mchrome/content/zotero/bindings/attachmentbox.xml | 25-------------------------
Mchrome/content/zotero/locateMenu.js | 14+++++++++-----
Mchrome/content/zotero/xpcom/locateManager.js | 3++-
3 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/chrome/content/zotero/bindings/attachmentbox.xml b/chrome/content/zotero/bindings/attachmentbox.xml @@ -42,7 +42,6 @@ Public properties --> <field name="editable">false</field> - <field name="displayGoButtons">false</field> <field name="clickableLink">false</field> <field name="displayButton">false</field> <field name="displayNote">false</field> @@ -58,7 +57,6 @@ Zotero.debug("Setting mode to '" + val + "'"); this.editable = false; - this.displayGoButtons = false; this.displayURL = false; this.displayFileName = false; this.clickableLink = false; @@ -71,7 +69,6 @@ switch (val) { case 'view': - this.displayGoButtons = true; this.displayURL = true; this.displayFileName = true; this.clickableLink = true; @@ -84,7 +81,6 @@ case 'edit': this.editable = true; - this.displayGoButtons = true; this.displayURL = true; this.displayFileName = true; this.clickableLink = true; @@ -148,9 +144,6 @@ var attachmentBox = document.getAnonymousNodes(this)[0]; var title = this._id('title'); - var goButtons = this._id('go-buttons'); - var viewButton = this._id('view'); - var showButton = this._id('show'); var fileNameRow = this._id('fileNameRow'); var urlField = this._id('url'); var accessed = this._id('accessedRow'); @@ -188,14 +181,6 @@ title.addEventListener('click', this.editTitle, false); } - // View and Show buttons - if (this.displayGoButtons) { - goButtons.hidden = false; - } - else { - goButtons.hidden = true; - } - var isImportedURL = this.item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL; @@ -210,8 +195,6 @@ var str = Zotero.getString('pane.item.attachments.view.link'); } - showButton.hidden = !isImportedURL; - // URL if (this.displayURL) { var urlSpec = this.item.getField('url'); @@ -247,7 +230,6 @@ // Metadata for files else { var str = Zotero.getString('pane.item.attachments.view.file'); - showButton.hidden = false; urlField.hidden = true; accessed.hidden = true; } @@ -271,9 +253,6 @@ else { fileNameRow.hidden = true; } - - - viewButton.setAttribute('label', str); // Page count if (this.displayPages) { @@ -531,10 +510,6 @@ <vbox id="attachment-box" flex="1" orient="vertical" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <label id="title"/> - <hbox id="go-buttons"> - <button id="view" flex="1" oncommand="document.getBindingParent(this).onViewClick(event)"/> - <button id="show" label="&zotero.item.attachment.file.show;" flex="1" oncommand="document.getBindingParent(this).onShowClick(event)"/> - </hbox> <label id="url" crop="end" ondragstart="var dt = event.dataTransfer; dt.setData('text/x-moz-url', this.value); dt.setData('text/uri-list', this.value); dt.setData('text/plain', this.value);"/> <grid> diff --git a/chrome/content/zotero/locateMenu.js b/chrome/content/zotero/locateMenu.js @@ -164,11 +164,14 @@ var Zotero_LocateMenu = new function() { menuitem.addEventListener("command", this.openItemURL, false); } - // add library lookup to any item - var menuitem = _createMenuItem(Zotero.getString("locate.libraryLookup.label"), - "zotero-locate-service-openurl", Zotero.getString("locate.libraryLookup.tooltip")); - locateMenu.appendChild(menuitem); - menuitem.addEventListener("command", this.lookupItem, false); + // add library lookup to regular items + var regularItems = [item for each(item in selectedItems) if(item.isRegularItem())]; + if(regularItems.length) { + var menuitem = _createMenuItem(Zotero.getString("locate.libraryLookup.label"), + "zotero-locate-service-openurl", Zotero.getString("locate.libraryLookup.tooltip")); + locateMenu.appendChild(menuitem); + menuitem.addEventListener("command", this.lookupItem, false); + } // add wayback if there are real URLs if(realURLs.length) { @@ -259,6 +262,7 @@ var Zotero_LocateMenu = new function() { this.lookupItem = function(event) { var urls = []; for each(var item in ZoteroPane.getSelectedItems()) { + if(!item.isRegularItem()) continue; var url = Zotero.OpenURL.resolve(item); if(url) urls.push(url); } diff --git a/chrome/content/zotero/xpcom/locateManager.js b/chrome/content/zotero/xpcom/locateManager.js @@ -293,7 +293,8 @@ Zotero.LocateManager = new function() { return [encodeURIComponent(val) for each(val in itemOpenURL[OPENURL_CONTEXT_MAPPINGS[param]])]; } else if(ns === "http://www.zotero.org/namespaces/openSearch#") { if(param === "openURL") { - return [Zotero.OpenURL.createContextObject(item, "1.0")]; + var ctx = Zotero.OpenURL.createContextObject(item, "1.0"); + return (ctx ? [ctx] : false); } else if(param === "year") { return (itemOpenURL["rft.date"] ? [itemOpenURL["rft.date"][0].substr(0, 4)] : false); } else {