]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1097 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 4 Jul 2007 16:12:59 +0000 (16:12 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Wed, 4 Jul 2007 16:12:59 +0000 (16:12 +0000)
ChangeLog
OGoContentStore/iCalRepeatableEntityObject+OCS.m
SOPE/NGCards/CardElement.m
SoObjects/Mailer/SOGoMailObject.m
UI/MailerUI/French.lproj/Localizable.strings
UI/MailerUI/GNUmakefile
UI/MailerUI/UIxMailSourceView.h [new file with mode: 0644]
UI/MailerUI/UIxMailSourceView.m [new file with mode: 0644]
UI/MailerUI/product.plist
UI/Templates/MailerUI/UIxMailMainFrame.wox
UI/WebServerResources/MailerUI.js

index 7eada783befad555aef3f3c04aa9138a759617b2..85d34b2531591a40cc8a2e8d1e7c956cda7e3735 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-07-04  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * UI/MailerUI/UIxMailSourceView.[hm]: new class module designed to
+       return the message source code in plain text.
+
+       * SoObjects/Mailer/SOGoMailObject.m ([SOGoMailObject
+       -contentAsString]): returns the message encoded in UTF8.
+
 2007-07-03  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * OGoContentStore/iCalRepeatableEntityObject+OCS.m
index 5491d12f9c1d8c3be0d2bb3165ce007d2fc092de..5bedb6e2d1f1f794c24e4add758e8796871071b6 100644 (file)
@@ -18,7 +18,6 @@
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
-// $Id$
 
 #include "iCalRepeatableEntityObject+OCS.h"
 #include "common.h"
index f715de7661ac5d4b673a92be8a32d2666b0c7b86..45c9180f1c598105fe394968b47d85d5cb2d6133 100644 (file)
   string = [renderer render: self];
   [renderer release];
 
-  return (([string length] > 1)
-         ? [string substringToIndex: [string length] - 2]
-         : @"");
+  if ([string hasSuffix: @"\r\n"])
+    string = [string substringToIndex: [string length] - 2];
+
+  return string;
 }
 
 - (CardElement *) elementWithClass: (Class) elementClass
index 6f7d6ad7a874ffa5fbd3c35c94d0d1e2e6e9cb6e..a8b76bdb240b282eb1c00529e391c25ba5dba1ec 100644 (file)
@@ -425,7 +425,8 @@ static BOOL debugSoParts       = NO;
   return @"message/rfc822";
 }
 
-- (NSString *)contentAsString {
+- (NSString *) contentAsString
+{
   NSString *s;
   NSData *content;
   
@@ -434,8 +435,9 @@ static BOOL debugSoParts       = NO;
   if ([content isKindOfClass:[NSException class]])
     return (id)content;
   
-  s = [[NSString alloc] initWithData:content 
-                       encoding:NSISOLatin1StringEncoding];
+#warning the encoding here might be wrong...
+  s = [[NSString alloc] initWithData: content 
+                       encoding: NSUTF8StringEncoding];
   if (s == nil) {
     [self logWithFormat:
            @"ERROR: could not convert data of length %d to string", 
index c9fe7dfa05180db733f2d367eae78803ebe37795..b3c4aaf4e738ba636f1539b32ae245909977dd53 100644 (file)
 "Mark" = "Marquer";
 "Save As..." = "Enregistrer comme...";
 "Print Preview" = "Aperçu avant impression";
+"View Message Source" = "Voir le code source";
 "Print..." = "Imprimer...";
 "Delete Message" = "Supprimer le message";
 
index 7467c0262013c334ca1fb3370533fadaa686b406..38ee9ab77de733d5917ad05e9df5fba4f3912b0e 100644 (file)
@@ -20,6 +20,7 @@ MailerUI_OBJC_FILES += \
        \
        UIxMailListView.m               \
        UIxMailView.m                   \
+       UIxMailSourceView.m             \
        UIxMailPopupView.m              \
        UIxMailMoveToPopUp.m            \
        UIxMailFilterPanel.m            \
diff --git a/UI/MailerUI/UIxMailSourceView.h b/UI/MailerUI/UIxMailSourceView.h
new file mode 100644 (file)
index 0000000..51ed798
--- /dev/null
@@ -0,0 +1,33 @@
+/* UIxMailSourceView.h - this file is part of SOGo
+ *
+ * Copyright (C) 2007 Inverse groupe conseil
+ *
+ * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef UIXMAILSOURCEVIEW_H
+#define UIXMAILSOURCEVIEW_H
+
+#import <NGObjWeb/WODirectAction.h>
+
+@interface UIxMailSourceView : WODirectAction
+
+@end
+
+
+#endif /* UIXMAILSOURCEVIEW_H */
diff --git a/UI/MailerUI/UIxMailSourceView.m b/UI/MailerUI/UIxMailSourceView.m
new file mode 100644 (file)
index 0000000..c058622
--- /dev/null
@@ -0,0 +1,48 @@
+/* UIxMailSourceView.m - this file is part of SOGo
+ *
+ * Copyright (C) 2007 Inverse groupe conseil
+ *
+ * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#import <NGObjWeb/WOContext.h>
+#import <NGObjWeb/WOResponse.h>
+#import <Foundation/NSString.h>
+#import <SoObjects/Mailer/SOGoMailObject.h>
+
+#import "UIxMailSourceView.h"
+
+@implementation UIxMailSourceView
+
+- (WOResponse *) viewSourceAction
+{
+  NSString *source;
+  WOResponse *response;
+
+  source = [[self clientObject] contentAsString];
+
+  response = [context response];
+  [response setStatus: 200];
+  [response setHeader: @"text/plain; charset=utf-8"
+           forKey: @"content-type"];
+  [response appendContentString: source];
+
+  return response;
+}
+
+@end
index 2ad34027d5391105d86e8f345d24da22bbc0bfb2..32f6c3eb74d0f6038c74886c4edcb914276754b1 100644 (file)
@@ -192,6 +192,11 @@ categories = {
            protectedBy = "View";
            pageName    = "UIxMailView";
         };
+        viewsource = {
+           protectedBy = "View";
+           actionClass = "UIxMailSourceView";
+           actionName = "viewSource";
+        };
         popupview = {
            protectedBy = "View";
            pageName    = "UIxMailPopupView";
index 343ad30d825dff5cf6da8663bedba39d95c5c3d7..47c56d98577fa55f7ddac947107db11b1f2103a9 100644 (file)
@@ -95,6 +95,7 @@
         <li><var:string label:value="Mark"/></li>
         <li><!-- separator --></li>
         <li><var:string label:value="Save As..."/></li>
+        <li><var:string label:value="View Message Source"/></li>
         <li><var:string label:value="Print Preview"/></li>
         <li><var:string label:value="Print..."/></li>
         <li><var:string label:value="Delete Message"/></li>
         <li><var:string label:value="Mark"/></li>
         <li><!-- separator --></li>
         <li><var:string label:value="Save As..."/></li>
+        <li><var:string label:value="View Message Source"/></li>
         <li><var:string label:value="Print Preview"/></li>
         <li><var:string label:value="Print..."/></li>
         <li><var:string label:value="Delete Message"/></li>
index 6e30e03a6ca64563827bd969cc2a72bfb06befec..0534c65f3b0bb727eb9fc1858af4eb34f16c42a6 100644 (file)
@@ -90,7 +90,7 @@ function clickedEditorAttach(sender) {
               "width=320,height=320,resizable=1,scrollbars=1,toolbar=0," +
               "location=0,directories=0,status=0,menubar=0,copyhistory=0");
    return false; /* stop following the link */
-                    }
+}
 
 function clickedEditorSave(sender) {
    document.pageform.action = "save";
@@ -208,7 +208,7 @@ function openMessageWindowsForSelection(action) {
                              window.messageURL + "/" + action /* url */);
    else {
       var messageList = $("messageList");
-      var rows  = messageList.getSelectedRowsId();
+      var rows = messageList.getSelectedRowsId();
       var idset = "";
       for (var i = 0; i < rows.length; i++)
         win = openMessageWindow(rows[i].substr(4)        /* msguid */,
@@ -676,15 +676,19 @@ function configureLinksInMessage() {
    var messageDiv = $('messageContent');
    var mailContentDiv = document.getElementsByClassName('mailer_mailcontent',
                                                        messageDiv)[0];
-   Event.observe(mailContentDiv, "contextmenu", onMessageContentMenu.bindAsEventListener(mailContentDiv));
+   Event.observe(mailContentDiv, "contextmenu",
+                onMessageContentMenu.bindAsEventListener(mailContentDiv));
    var anchors = messageDiv.getElementsByTagName('a');
    for (var i = 0; i < anchors.length; i++)
       if (anchors[i].href.substring(0,7) == "mailto:") {
-        Event.observe(anchors[i], "click", onEmailAddressClick.bindAsEventListener(anchors[i]));
-        Event.observe(anchors[i], "contextmenu", onEmailAddressClick.bindAsEventListener(anchors[i]));
+        Event.observe(anchors[i], "click",
+                      onEmailAddressClick.bindAsEventListener(anchors[i]));
+        Event.observe(anchors[i], "contextmenu",
+                      onEmailAddressClick.bindAsEventListener(anchors[i]));
       }
       else
-        Event.observe(anchors[i], "click", onMessageAnchorClick);
+        Event.observe(anchors[i], "click",
+                      onMessageAnchorClick);
 }
 
 function onMessageContentMenu(event) {
@@ -794,6 +798,19 @@ function onMenuForwardMessage(event) {
    return openMessageWindowsForSelection('forward');
 }
 
+function onMenuViewMessageSource(event) {
+   var messageList = $("messageList");
+   var rows = messageList.getSelectedRowsId();
+
+   if (rows.length > 0) {
+      var url = (ApplicationBaseURL + currentMailbox + "/"
+                + rows[0].substr(4) + "/viewsource");
+      window.open(url);
+   }
+
+   preventDefault(event);
+}
+
 /* contacts */
 function newContactFromEmail(event) {
    var mailto = document.menuTarget.innerHTML;
@@ -1326,7 +1343,8 @@ function getMenus() {
                                        onMenuForwardMessage, null,
                                        "-", "moveMailboxMenu",
                                        "copyMailboxMenu", "label-menu",
-                                       "mark-menu", "-", null, null,
+                                       "mark-menu", "-", null,
+                                       onMenuViewMessageSource, null,
                                        null, onMenuDeleteMessage);
    menus["messageContentMenu"] = new Array(onMenuReplyToSender,
                                           onMenuReplyToAll,
@@ -1335,7 +1353,8 @@ function getMenus() {
                                           "copyMailboxMenu",
                                           "-", "label-menu", "mark-menu",
                                           "-",
-                                          null, null, null,
+                                          null, onMenuViewMessageSource,
+                                          null, null,
                                           onMenuDeleteMessage);
    menus["label-menu"] = new Array(null, "-", null , null, null, null , null,
                                   null);