Ticket #1563: addAttachmentFromURI.diff
| File addAttachmentFromURI.diff, 5.6 KB (added by ajlyon, 5 years ago) |
|---|
-
chrome/locale/en-US/zotero/zotero.dtd
62 62 <!ENTITY zotero.items.menu.attach "Add Attachment"> 63 63 <!ENTITY zotero.items.menu.attach.snapshot "Attach Snapshot of Current Page"> 64 64 <!ENTITY zotero.items.menu.attach.link "Attach Link to Current Page"> 65 <!ENTITY zotero.items.menu.attach.link.uri "Attach Link to URI..."> 65 66 <!ENTITY zotero.items.menu.attach.file "Attach Stored Copy of File..."> 66 67 <!ENTITY zotero.items.menu.attach.fileLink "Attach Link to File..."> 67 68 … … 228 229 <!ENTITY zotero.file.choose.label "Choose File..."> 229 230 <!ENTITY zotero.file.noneSelected.label "No file selected"> 230 231 231 <!ENTITY zotero.downloadManager.label "Save to Zotero"> 232 No newline at end of file 232 <!ENTITY zotero.downloadManager.label "Save to Zotero"> -
chrome/content/zotero/zoteroPane.xul
141 141 <menupopup onpopupshowing="ZoteroPane_Local.updateAttachmentButtonMenu(this)"> 142 142 <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)"/> 143 143 <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)"/> 144 <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);"/> 144 145 <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);"/> 145 146 <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);"/> 146 147 </menupopup> … … 240 241 <menupopup id="zotero-add-attachment-popup"> 241 242 <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)"/> 242 243 <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)"/> 244 <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);"/> 243 245 <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);"/> 244 246 <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);"/> 245 247 </menupopup> -
chrome/content/zotero/zoteroPane.js
77 77 this.openNoteWindow = openNoteWindow; 78 78 this.addTextToNote = addTextToNote; 79 79 this.addAttachmentFromDialog = addAttachmentFromDialog; 80 this.addAttachmentFromURI = addAttachmentFromURI; 80 81 this.viewAttachment = viewAttachment; 81 82 this.viewSelectedAttachment = viewSelectedAttachment; 82 83 this.showAttachmentNotFoundDialog = showAttachmentNotFoundDialog; … … 2851 2852 + (parentItemID ? '&p=' + parentItemID : ''), 2852 2853 name, 'chrome,resizable,centerscreen'); 2853 2854 } 2855 2856 // For now, link only. 2857 function addAttachmentFromURI(link, id) 2858 { 2859 if (!this.canEdit()) { 2860 this.displayCannotEditLibraryMessage(); 2861 return; 2862 } 2863 var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] 2864 .getService(Components.interfaces.nsIPromptService); 2865 2866 var input = {}; 2867 var check = {value : false}; 2868 // TODO Localize 2869 // TODO Allow title to be specified 2870 var result = ps.prompt(null, "Add link to URI", "Enter a URI:", input, null, check); 2871 if (!result || !input.value) return false; 2872 2873 // Create a new attachment 2874 Zotero.Attachments.linkFromURL(input.value, id, null, null); 2875 } 2854 2876 2855 2856 2877 function addAttachmentFromDialog(link, id) 2857 2878 { 2858 2879 if (!this.canEdit()) { … … 3689 3710 * Keep track of which ZoteroPane was local (since ZoteroPane object might get swapped out for a 3690 3711 * tab's ZoteroPane) 3691 3712 */ 3692 var ZoteroPane_Local = ZoteroPane; 3693 No newline at end of file 3713 var ZoteroPane_Local = ZoteroPane;