Ticket #1563: addAttachmentFromURI.diff

File addAttachmentFromURI.diff, 5.6 KB (added by ajlyon, 5 years ago)
  • chrome/locale/en-US/zotero/zotero.dtd

     
    6262<!ENTITY zotero.items.menu.attach                                               "Add Attachment"> 
    6363<!ENTITY zotero.items.menu.attach.snapshot                              "Attach Snapshot of Current Page"> 
    6464<!ENTITY zotero.items.menu.attach.link                                  "Attach Link to Current Page"> 
     65<!ENTITY zotero.items.menu.attach.link.uri                              "Attach Link to URI..."> 
    6566<!ENTITY zotero.items.menu.attach.file                                  "Attach Stored Copy of File..."> 
    6667<!ENTITY zotero.items.menu.attach.fileLink                              "Attach Link to File..."> 
    6768 
     
    228229<!ENTITY zotero.file.choose.label                       "Choose File..."> 
    229230<!ENTITY zotero.file.noneSelected.label                 "No file selected"> 
    230231 
    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

     
    141141                                                <menupopup onpopupshowing="ZoteroPane_Local.updateAttachmentButtonMenu(this)"> 
    142142                                                        <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)"/> 
    143143                                                        <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);"/> 
    144145                                                        <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);"/> 
    145146                                                        <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);"/> 
    146147                                                </menupopup> 
     
    240241                                                <menupopup id="zotero-add-attachment-popup"> 
    241242                                                        <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)"/> 
    242243                                                        <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);"/> 
    243245                                                        <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);"/> 
    244246                                                        <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);"/> 
    245247                                                </menupopup> 
  • chrome/content/zotero/zoteroPane.js

     
    7777        this.openNoteWindow = openNoteWindow; 
    7878        this.addTextToNote = addTextToNote; 
    7979        this.addAttachmentFromDialog = addAttachmentFromDialog; 
     80        this.addAttachmentFromURI = addAttachmentFromURI; 
    8081        this.viewAttachment = viewAttachment; 
    8182        this.viewSelectedAttachment = viewSelectedAttachment; 
    8283        this.showAttachmentNotFoundDialog = showAttachmentNotFoundDialog; 
     
    28512852                        + (parentItemID ? '&p=' + parentItemID : ''), 
    28522853                        name, 'chrome,resizable,centerscreen'); 
    28532854        } 
     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        } 
    28542876         
    2855          
    28562877        function addAttachmentFromDialog(link, id) 
    28572878        { 
    28582879                if (!this.canEdit()) { 
     
    36893710 * Keep track of which ZoteroPane was local (since ZoteroPane object might get swapped out for a 
    36903711 * tab's ZoteroPane) 
    36913712 */ 
    3692 var ZoteroPane_Local = ZoteroPane; 
    3693  No newline at end of file 
     3713var ZoteroPane_Local = ZoteroPane;