www

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

commit c10fe8606cd714958d7e3439b8cebecbd5c4ad99
parent 5d30b8c7261cc4e0ab41c3e9bd66139bd910029d
Author: Dan Stillman <dstillman@zotero.org>
Date:   Thu, 16 Jun 2011 18:17:06 +0000

Closes #1563, add ability to add links by URI and edit existing link attachment URIs

Thanks to ajlyon for the patch


Diffstat:
Mchrome/content/zotero/zoteroPane.js | 24++++++++++++++++++++++--
Mchrome/content/zotero/zoteroPane.xul | 2++
Mchrome/locale/en-US/zotero/zotero.dtd | 4++--
3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -2853,6 +2853,27 @@ var ZoteroPane = new function() } + this.addAttachmentFromURI = function (link, itemID) { + if (!this.canEdit()) { + this.displayCannotEditLibraryMessage(); + return; + } + var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] + .getService(Components.interfaces.nsIPromptService); + + var input = {}; + var check = {value : false}; + + // TODO: Localize + // TODO: Allow title to be specified? + var result = ps.prompt(null, "Attach Link to URI", "Enter a URI:", input, "", {}); + if (!result || !input.value) return false; + + // Create a new attachment + Zotero.Attachments.linkFromURL(input.value, itemID); + } + + function addAttachmentFromDialog(link, id) { if (!this.canEdit()) { @@ -3689,4 +3710,4 @@ var ZoteroPane = new function() * Keep track of which ZoteroPane was local (since ZoteroPane object might get swapped out for a * tab's ZoteroPane) */ -var ZoteroPane_Local = ZoteroPane; -\ No newline at end of file +var ZoteroPane_Local = ZoteroPane; diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul @@ -141,6 +141,7 @@ <menupopup onpopupshowing="ZoteroPane_Local.updateAttachmentButtonMenu(this)"> <menuitem class="menuitem-iconic zotero-menuitem-attachments-snapshot" label="&zotero.items.menu.attach.snapshot;" oncommand="var itemID = ZoteroPane_Local.getSelectedItems()[0].id; ZoteroPane_Local.addAttachmentFromPage(false, itemID)"/> <menuitem class="menuitem-iconic zotero-menuitem-attachments-web-link" label="&zotero.items.menu.attach.link;" oncommand="var itemID = ZoteroPane_Local.getSelectedItems()[0].id; ZoteroPane_Local.addAttachmentFromPage(true, itemID)"/> + <menuitem class="menuitem-iconic zotero-menuitem-attachments-web-link" label="&zotero.items.menu.attach.link.uri;" oncommand="var itemID = ZoteroPane_Local.getSelectedItems()[0].id; ZoteroPane_Local.addAttachmentFromURI(true, itemID);"/> <menuitem class="menuitem-iconic zotero-menuitem-attachments-file" label="Attach Stored Copy of File..." oncommand="var itemID = ZoteroPane_Local.getSelectedItems()[0].id; ZoteroPane_Local.addAttachmentFromDialog(false, itemID);"/> <menuitem class="menuitem-iconic zotero-menuitem-attachments-link" label="Attach Link to File..." oncommand="var itemID = ZoteroPane_Local.getSelectedItems()[0].id; ZoteroPane_Local.addAttachmentFromDialog(true, itemID);"/> </menupopup> @@ -240,6 +241,7 @@ <menupopup id="zotero-add-attachment-popup"> <menuitem class="menuitem-iconic zotero-menuitem-attachments-snapshot" label="&zotero.items.menu.attach.snapshot;" oncommand="var itemID = parseInt(this.parentNode.parentNode.parentNode.getAttribute('itemID')); ZoteroPane_Local.addAttachmentFromPage(false, itemID)"/> <menuitem class="menuitem-iconic zotero-menuitem-attachments-web-link" label="&zotero.items.menu.attach.link;" oncommand="var itemID = parseInt(this.parentNode.parentNode.parentNode.getAttribute('itemID')); ZoteroPane_Local.addAttachmentFromPage(true, itemID)"/> + <menuitem class="menuitem-iconic zotero-menuitem-attachments-web-link" label="&zotero.items.menu.attach.link.uri;" oncommand="var itemID = parseInt(this.parentNode.parentNode.parentNode.getAttribute('itemID')); ZoteroPane_Local.addAttachmentFromURI(true, itemID);"/> <menuitem class="menuitem-iconic zotero-menuitem-attachments-file" label="&zotero.items.menu.attach.file;" oncommand="var itemID = parseInt(this.parentNode.parentNode.parentNode.getAttribute('itemID')); ZoteroPane_Local.addAttachmentFromDialog(false, itemID);"/> <menuitem class="menuitem-iconic zotero-menuitem-attachments-link" label="&zotero.items.menu.attach.fileLink;" oncommand="var itemID = parseInt(this.parentNode.parentNode.parentNode.getAttribute('itemID')); ZoteroPane_Local.addAttachmentFromDialog(true, itemID);"/> </menupopup> diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd @@ -62,6 +62,7 @@ <!ENTITY zotero.items.menu.attach "Add Attachment"> <!ENTITY zotero.items.menu.attach.snapshot "Attach Snapshot of Current Page"> <!ENTITY zotero.items.menu.attach.link "Attach Link to Current Page"> +<!ENTITY zotero.items.menu.attach.link.uri "Attach Link to URI..."> <!ENTITY zotero.items.menu.attach.file "Attach Stored Copy of File..."> <!ENTITY zotero.items.menu.attach.fileLink "Attach Link to File..."> @@ -228,4 +229,4 @@ <!ENTITY zotero.file.choose.label "Choose File..."> <!ENTITY zotero.file.noneSelected.label "No file selected"> -<!ENTITY zotero.downloadManager.label "Save to Zotero"> -\ No newline at end of file +<!ENTITY zotero.downloadManager.label "Save to Zotero">