From 9cf72ec8d5f79efb9c6b9033d6f45e51d799cc9f Mon Sep 17 00:00:00 2001 From: C Robert Date: Thu, 9 Jul 2009 15:27:11 +0000 Subject: [PATCH] Added "Save attachment" menu Monotone-Parent: 72e05191b28fdea36565f18fc1803f1d197aee92 Monotone-Revision: 198fe6947014072d94cf42fd01ddad350fa6bd08 Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-07-09T15:27:11 Monotone-Branch: ca.inverse.sogo --- UI/MailerUI/Dutch.lproj/Localizable.strings | 1 + UI/MailerUI/English.lproj/Localizable.strings | 1 + UI/MailerUI/French.lproj/Localizable.strings | 1 + UI/MailerUI/German.lproj/Localizable.strings | 1 + UI/MailerUI/Italian.lproj/Localizable.strings | 1 + UI/MailerUI/Russian.lproj/Localizable.strings | 1 + UI/MailerUI/Spanish.lproj/Localizable.strings | 1 + UI/MailerUI/Welsh.lproj/Localizable.strings | 1 + UI/Templates/MailerUI/UIxMailMainFrame.wox | 6 +++++ UI/Templates/MailerUI/UIxMailPopupView.wox | 5 +++++ UI/WebServerResources/MailerUI.js | 22 ++++++++++++++++++- 11 files changed, 40 insertions(+), 1 deletion(-) diff --git a/UI/MailerUI/Dutch.lproj/Localizable.strings b/UI/MailerUI/Dutch.lproj/Localizable.strings index b1d121a33..a61154a7c 100644 --- a/UI/MailerUI/Dutch.lproj/Localizable.strings +++ b/UI/MailerUI/Dutch.lproj/Localizable.strings @@ -145,6 +145,7 @@ /* Image Popup menu */ "Save Image" = "Afbeelding opslaan"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "In nieuw e-mailvenster openen"; diff --git a/UI/MailerUI/English.lproj/Localizable.strings b/UI/MailerUI/English.lproj/Localizable.strings index 22819756a..556c29c66 100644 --- a/UI/MailerUI/English.lproj/Localizable.strings +++ b/UI/MailerUI/English.lproj/Localizable.strings @@ -164,6 +164,7 @@ /* Image Popup menu */ "Save Image" = "Save Image"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "Open in New Mail Window"; diff --git a/UI/MailerUI/French.lproj/Localizable.strings b/UI/MailerUI/French.lproj/Localizable.strings index 88bde86cb..434aa434b 100644 --- a/UI/MailerUI/French.lproj/Localizable.strings +++ b/UI/MailerUI/French.lproj/Localizable.strings @@ -162,6 +162,7 @@ /* Image Popup menu */ "Save Image" = "Enregistrer l'image"; +"Save Attachment" = "Enregistrer le fichier"; /* Mailbox popup menus */ "Open in New Mail Window" = "Ouvrir dans une nouvelle fenétre"; diff --git a/UI/MailerUI/German.lproj/Localizable.strings b/UI/MailerUI/German.lproj/Localizable.strings index 841d2dc4e..157a72e96 100644 --- a/UI/MailerUI/German.lproj/Localizable.strings +++ b/UI/MailerUI/German.lproj/Localizable.strings @@ -162,6 +162,7 @@ /* Image Popup menu */ "Save Image" = "Bild speichern"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "In neuem Fenster öffnen"; diff --git a/UI/MailerUI/Italian.lproj/Localizable.strings b/UI/MailerUI/Italian.lproj/Localizable.strings index 5cb94b7e2..a05557dfa 100644 --- a/UI/MailerUI/Italian.lproj/Localizable.strings +++ b/UI/MailerUI/Italian.lproj/Localizable.strings @@ -169,6 +169,7 @@ /* Image Popup menu */ "Save Image" = "Salva immagine"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "Apri in una nuova finestra"; diff --git a/UI/MailerUI/Russian.lproj/Localizable.strings b/UI/MailerUI/Russian.lproj/Localizable.strings index 00ca23a21..bc79da507 100644 --- a/UI/MailerUI/Russian.lproj/Localizable.strings +++ b/UI/MailerUI/Russian.lproj/Localizable.strings @@ -164,6 +164,7 @@ /* Image Popup menu */ "Save Image" = "Сохранить изображение"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "Открыть в новом окне"; diff --git a/UI/MailerUI/Spanish.lproj/Localizable.strings b/UI/MailerUI/Spanish.lproj/Localizable.strings index 7fcd1da76..15e59fd63 100644 --- a/UI/MailerUI/Spanish.lproj/Localizable.strings +++ b/UI/MailerUI/Spanish.lproj/Localizable.strings @@ -168,6 +168,7 @@ /* Image Popup menu */ "Save Image" = "Guardar imagen"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "Abrir mensaje en nueva ventana"; diff --git a/UI/MailerUI/Welsh.lproj/Localizable.strings b/UI/MailerUI/Welsh.lproj/Localizable.strings index 63ffc8090..a41474fb0 100644 --- a/UI/MailerUI/Welsh.lproj/Localizable.strings +++ b/UI/MailerUI/Welsh.lproj/Localizable.strings @@ -164,6 +164,7 @@ /* Image Popup menu */ "Save Image" = "Cadw Delwedd"; +"Save Attachment" = "Save Attachment"; /* Mailbox popup menus */ "Open in New Mail Window" = "Agor mewn ffenestr Neges Newydd"; diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index e0aefb431..34a6e4518 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -193,6 +193,12 @@ + +
diff --git a/UI/Templates/MailerUI/UIxMailPopupView.wox b/UI/Templates/MailerUI/UIxMailPopupView.wox index 9b1cb220a..e21c58d66 100644 --- a/UI/Templates/MailerUI/UIxMailPopupView.wox +++ b/UI/Templates/MailerUI/UIxMailPopupView.wox @@ -26,4 +26,9 @@
  • + diff --git a/UI/WebServerResources/MailerUI.js b/UI/WebServerResources/MailerUI.js index 5b20e5668..c30133144 100644 --- a/UI/WebServerResources/MailerUI.js +++ b/UI/WebServerResources/MailerUI.js @@ -917,6 +917,10 @@ function configureLinksInMessage() { else $(anchors[i]).observe("click", onMessageAnchorClick); + var attachments = messageDiv.select ("DIV.linked_attachment_body"); + for (var i = 0; i < attachments.length; i++) + $(attachments[i]).observe("contextmenu", onAttachmentClick); + var images = messageDiv.select("IMG.mailer_imagecontent"); for (var i = 0; i < images.length; i++) $(images[i]).observe("contextmenu", onImageClick); @@ -1062,6 +1066,12 @@ function onImageClick(event) { return false; } +function onAttachmentClick (event) { + popupMenu (event, 'attachmentMenu', this); + preventDefault (event); + return false; +} + function messageCallback(http) { var div = $('messageContent'); @@ -1175,6 +1185,15 @@ function saveImage(event) { window.location.href = urlAsAttachment; } +function saveAttachment(event) { + var div = document.menuTarget; + var link = div.select ("a").first (); + var url = link.getAttribute("href"); + var urlAsAttachment = url.replace(/(\/[^\/]*)$/,"/asAttachment$1"); + + window.location.href = urlAsAttachment; +} + /* contacts */ function newContactFromEmail(event) { var mailto = document.menuTarget.innerHTML; @@ -2048,6 +2067,7 @@ function getMenus() { saveAs, null, onMenuDeleteMessage); menus["imageMenu"] = new Array(saveImage); + menus["attachmentMenu"] = new Array (saveAttachment); menus["messageContentMenu"] = new Array(onMenuReplyToSender, onMenuReplyToAll, onMenuForwardMessage, @@ -2197,4 +2217,4 @@ function dropAction (dropped, zone, e) { var f = onMailboxMenuMove.bind(destination); f(); -} \ No newline at end of file +}