From 6a3a876e4cc0336acc2cf172c0f71f42b8513436 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Thu, 1 Nov 2007 20:23:45 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1214 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 16 ++++ SoObjects/Mailer/GNUmakefile | 6 +- SoObjects/Mailer/SOGoDraftObject.m | 8 +- .../SOGoMailEnglishReply.html | 3 + .../SOGoMailEnglishReply.wod | 14 ++++ .../SOGoMailFrenchReply.html | 3 + .../SOGoMailFrenchReply.wod | 14 ++++ .../SOGoMailGermanReply.html | 3 + .../SOGoMailGermanReply.wod | 14 ++++ SoObjects/Mailer/SOGoMailObject+Draft.m | 14 +++- SoObjects/Mailer/SOGoMailReply.h | 50 +++++++++++ SoObjects/Mailer/SOGoMailReply.m | 84 +++++++++++++++++++ UI/MailerUI/UIxMailListView.m | 4 +- UI/WebServerResources/generic.css | 1 + 14 files changed, 228 insertions(+), 6 deletions(-) create mode 100644 SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html create mode 100644 SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod create mode 100644 SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html create mode 100644 SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod create mode 100644 SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html create mode 100644 SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod create mode 100644 SoObjects/Mailer/SOGoMailReply.h create mode 100644 SoObjects/Mailer/SOGoMailReply.m diff --git a/ChangeLog b/ChangeLog index 2278ba7c..d3aeb5bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,21 @@ 2007-11-01 Wolfgang Sourdeau + * SoObjects/Mailer/SOGoMailObject+Draft.m ([SOGoMailObject + -contentForReply]): make use of the SOGoMailReply WO page. + + * SoObjects/Mailer/SOGoMailReply.[hm]: new class module copied + from SOGoMailForward to handle mail replies instead. Only three + methods remaining: date, from and messageBody. The latter is + quoted properly. + + * SoObjects/Mailer/SOGoDraftObject.m ([SOGoDraftObject + -fetchMailForForwarding:sourceMail]): fetch attachments for + forwarded messages. + + * UI/MailerUI/UIxMailListView.m ([UIxMailListView + -hasMessageAttachment]): initialize hasAttachment with "NO" to + avoid false positives. + * OGoContentStore/OCSiCalFieldExtractor.m ([OCSiCalFieldExtractor -extractQuickFieldsFromEvent:_event]) ([OCSiCalFieldExtractor -extractQuickFieldsFromTodo:_task]): set title to an empty string where the event/task summary is null. diff --git a/SoObjects/Mailer/GNUmakefile b/SoObjects/Mailer/GNUmakefile index 82e9dfb1..6be6f8a4 100644 --- a/SoObjects/Mailer/GNUmakefile +++ b/SoObjects/Mailer/GNUmakefile @@ -31,6 +31,7 @@ Mailer_OBJC_FILES += \ SOGoVCardMailBodyPart.m \ \ SOGoMailForward.m \ + SOGoMailReply.m \ \ NSData+Mail.m \ NSString+Mail.m @@ -42,7 +43,10 @@ Mailer_RESOURCE_FILES += \ Mailer_RESOURCE_FILES += \ SOGoMailEnglishForward.wo \ SOGoMailFrenchForward.wo \ - SOGoMailGermanForward.wo + SOGoMailGermanForward.wo \ + SOGoMailEnglishReply.wo \ + SOGoMailFrenchReply.wo \ + SOGoMailGermanReply.wo ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/sope-gdl1/ ADDITIONAL_LIB_DIRS += -L../../SOPE/sope-gdl1/GDLContentStore/obj/ diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 77a1f58c..34ee165c 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -187,7 +187,7 @@ static BOOL showTextAttachmentsInline = NO; if (headerValue) [headers setObject: headerValue forKey: headerKeys[count]]; - else + else if ([headers objectForKey: headerKeys[count]]) [headers removeObjectForKey: headerKeys[count]]; } @@ -569,7 +569,11 @@ static BOOL showTextAttachmentsInline = NO; /* attach message */ currentUser = [context activeUser]; if ([[currentUser messageForwarding] isEqualToString: @"inline"]) - [self setText: [sourceMail contentForInlineForward]]; + { + [self setText: [sourceMail contentForInlineForward]]; + [self _fetchAttachments: [sourceMail fetchFileAttachmentKeys] + fromMail: sourceMail]; + } else { // TODO: use subject for filename? diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html new file mode 100644 index 00000000..e0274ea0 --- /dev/null +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html @@ -0,0 +1,3 @@ +On <#date/>, <#from/> wrote: + +<#messageBody/> diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod new file mode 100644 index 00000000..830cd7a7 --- /dev/null +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod @@ -0,0 +1,14 @@ +date: WOString { + value = date; + escapeHTML = NO; +} + +from: WOString { + value = from; + escapeHTML = NO; +} + +messageBody: WOString { + value = messageBody; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html new file mode 100644 index 00000000..406f945d --- /dev/null +++ b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.html @@ -0,0 +1,3 @@ +Le <#date/>, <#from/> a écrit: + +<#messageBody/> diff --git a/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod new file mode 100644 index 00000000..830cd7a7 --- /dev/null +++ b/SoObjects/Mailer/SOGoMailFrenchReply.wo/SOGoMailFrenchReply.wod @@ -0,0 +1,14 @@ +date: WOString { + value = date; + escapeHTML = NO; +} + +from: WOString { + value = from; + escapeHTML = NO; +} + +messageBody: WOString { + value = messageBody; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html new file mode 100644 index 00000000..e0274ea0 --- /dev/null +++ b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.html @@ -0,0 +1,3 @@ +On <#date/>, <#from/> wrote: + +<#messageBody/> diff --git a/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod new file mode 100644 index 00000000..830cd7a7 --- /dev/null +++ b/SoObjects/Mailer/SOGoMailGermanReply.wo/SOGoMailGermanReply.wod @@ -0,0 +1,14 @@ +date: WOString { + value = date; + escapeHTML = NO; +} + +from: WOString { + value = from; + escapeHTML = NO; +} + +messageBody: WOString { + value = messageBody; + escapeHTML = NO; +} diff --git a/SoObjects/Mailer/SOGoMailObject+Draft.m b/SoObjects/Mailer/SOGoMailObject+Draft.m index 66ffa444..0ce4da0d 100644 --- a/SoObjects/Mailer/SOGoMailObject+Draft.m +++ b/SoObjects/Mailer/SOGoMailObject+Draft.m @@ -33,6 +33,7 @@ #import "NSString+Mail.h" #import "SOGoMailForward.h" #import "SOGoMailObject+Draft.h" +#import "SOGoMailReply.h" #define maxFilenameLength 64 @@ -121,7 +122,18 @@ - (NSString *) contentForReply { - return [[self contentForEditing] stringByApplyingMailQuoting]; + SOGoUser *currentUser; + NSString *pageName; + SOGoMailReply *page; + + currentUser = [context activeUser]; + pageName = [NSString stringWithFormat: @"SOGoMail%@Reply", + [currentUser language]]; + page = [[WOApplication application] pageWithName: pageName + inContext: context]; + [page setRepliedMail: self]; + + return [[page generateResponse] contentAsString]; } - (NSString *) filenameForForward diff --git a/SoObjects/Mailer/SOGoMailReply.h b/SoObjects/Mailer/SOGoMailReply.h new file mode 100644 index 00000000..8f13fcab --- /dev/null +++ b/SoObjects/Mailer/SOGoMailReply.h @@ -0,0 +1,50 @@ +/* SOGoMailReply.h - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 SOGOMAILREPLY_H +#define SOGOMAILREPLY_H + +#import + +@class SOGoMailObject; + +@interface SOGoMailReply : SoComponent +{ + SOGoMailObject *sourceMail; + NSString *field; + NSString *currentValue; +} + +- (void) setRepliedMail: (SOGoMailObject *) newSourceMail; + +@end + +@interface SOGoMailEnglishReply : SOGoMailReply +@end + +@interface SOGoMailFrenchReply : SOGoMailReply +@end + +@interface SOGoMailGermanReply : SOGoMailReply +@end + +#endif /* SOGOMAILREPLY_H */ diff --git a/SoObjects/Mailer/SOGoMailReply.m b/SoObjects/Mailer/SOGoMailReply.m new file mode 100644 index 00000000..d2e939d9 --- /dev/null +++ b/SoObjects/Mailer/SOGoMailReply.m @@ -0,0 +1,84 @@ +/* SOGoMailReply.m - this file is part of SOGo + * + * Copyright (C) 2007 Inverse groupe conseil + * + * Author: Wolfgang Sourdeau + * + * 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 + +#import +#import + +#import "SOGoMailObject+Draft.h" +#import "SOGoMailReply.h" + +@implementation SOGoMailReply + +- (id) init +{ + if ((self = [super init])) + { + sourceMail = nil; + currentValue = nil; + } + + return self; +} + +- (void) dealloc +{ + [sourceMail release]; + [currentValue release]; + [super dealloc]; +} + +- (void) setRepliedMail: (SOGoMailObject *) newSourceMail +{ + ASSIGN (sourceMail, newSourceMail); +} + +- (NSString *) date +{ + SOGoDateFormatter *formatter; + + formatter = [[context activeUser] dateFormatterInContext: context]; + + return [formatter formattedDateAndTime: [sourceMail date]]; +} + +- (NSString *) from +{ + return [[sourceMail mailHeaders] objectForKey: @"from"]; +} + +- (NSString *) messageBody +{ + return [[sourceMail contentForEditing] stringByApplyingMailQuoting]; +} + +@end + +@implementation SOGoMailEnglishReply +@end + +@implementation SOGoMailFrenchReply +@end + +@implementation SOGoMailGermanReply +@end diff --git a/UI/MailerUI/UIxMailListView.m b/UI/MailerUI/UIxMailListView.m index 6f7767d4..2ccc79b2 100644 --- a/UI/MailerUI/UIxMailListView.m +++ b/UI/MailerUI/UIxMailListView.m @@ -208,6 +208,8 @@ NSDictionary *currentDisp; BOOL hasAttachment; + hasAttachment = NO; + parts = [[message objectForKey: @"body"] objectForKey: @"parts"]; if ([parts count] > 1) { @@ -218,8 +220,6 @@ hasAttachment = ([[currentDisp objectForKey: @"type"] isEqualToString: @"ATTACHMENT"]); } - else - hasAttachment = NO; return hasAttachment; } diff --git a/UI/WebServerResources/generic.css b/UI/WebServerResources/generic.css index e3712550..39dc38dd 100644 --- a/UI/WebServerResources/generic.css +++ b/UI/WebServerResources/generic.css @@ -281,6 +281,7 @@ SPAN.toolbarButton:active { visibility: hidden; position: absolute; z-index: 1000; + top: -1000px; background-color: #d6cfc6; color: #000; margin: 0px; -- 2.39.5