From a828b049de898e814b420ec04134fa357a3daf18 Mon Sep 17 00:00:00 2001 From: C Robert Date: Sun, 28 Sep 2008 19:49:17 +0000 Subject: [PATCH] Added signature/reply placement options Monotone-Parent: c465e35fc5f42324c08780dae83f7d225dca6e6a Monotone-Revision: 1d1c945ea058db7070c9b83c4c2bb60689c52f92 Monotone-Author: crobert@inverse.ca Monotone-Date: 2008-09-28T19:49:17 Monotone-Branch: ca.inverse.sogo --- .../SOGoMailEnglishReply.html | 8 +++- .../SOGoMailEnglishReply.wod | 18 ++++++++ SoObjects/Mailer/SOGoMailObject+Draft.m | 2 + SoObjects/Mailer/SOGoMailReply.h | 4 ++ SoObjects/Mailer/SOGoMailReply.m | 20 +++++++++ SoObjects/SOGo/SOGoUser.h | 2 + SoObjects/SOGo/SOGoUser.m | 27 ++++++++++++ .../Dutch.lproj/Localizable.strings | 5 +++ .../English.lproj/Localizable.strings | 5 +++ .../French.lproj/Localizable.strings | 5 +++ .../German.lproj/Localizable.strings | 5 +++ .../Italian.lproj/Localizable.strings | 5 +++ .../Spanish.lproj/Localizable.strings | 5 +++ UI/PreferencesUI/UIxPreferences.m | 44 +++++++++++++++++++ UI/Templates/PreferencesUI/UIxPreferences.wox | 11 ++++- UI/WebServerResources/UIxMailEditor.js | 24 ++++++---- UI/WebServerResources/UIxPreferences.js | 14 ++++++ 17 files changed, 194 insertions(+), 10 deletions(-) diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html index 7d34187be..e4e5dc000 100644 --- a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.html @@ -1,3 +1,8 @@ +<#signaturePlacementOnTop> + + +<#signature/> + <#outlookMode>-------- Original Message -------- Subject: <#subject/> Date: <#date/> @@ -8,4 +13,5 @@ From: <#from/> <#messageBody/> -<#signature/> + +<#signaturePlacementOnBottom><#signature/> diff --git a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod index 0df01066f..df3789cc3 100644 --- a/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod +++ b/SoObjects/Mailer/SOGoMailEnglishReply.wo/SOGoMailEnglishReply.wod @@ -81,3 +81,21 @@ signature: WOString { value = signature; escapeHTML = NO; } + +replyPlacementOnTop: WOConditional { + condition = replyPlacementOnTop; +} + +replyPlacementOnBottom: WOConditional { + condition = replyPlacementOnTop; + negate = YES; +} + +signaturePlacementOnTop: WOConditional { + condition = signaturePlacementOnTop; +} + +signaturePlacementOnBottom: WOConditional { + condition = signaturePlacementOnTop; + negate = YES; +} diff --git a/SoObjects/Mailer/SOGoMailObject+Draft.m b/SoObjects/Mailer/SOGoMailObject+Draft.m index a962df870..9ff5f4658 100644 --- a/SoObjects/Mailer/SOGoMailObject+Draft.m +++ b/SoObjects/Mailer/SOGoMailObject+Draft.m @@ -157,6 +157,8 @@ inContext: context]; [page setSourceMail: self]; [page setOutlookMode: [self useOutlookStyleReplies]]; + [page setReplyPlacement: [[currentUser userDefaults] stringForKey: @"ReplyPlacement"]]; + [page setSignaturePlacement: [[currentUser userDefaults] stringForKey: @"SignaturePlacement"]]; return [[page generateResponse] contentAsString]; } diff --git a/SoObjects/Mailer/SOGoMailReply.h b/SoObjects/Mailer/SOGoMailReply.h index 118179edc..c54865890 100644 --- a/SoObjects/Mailer/SOGoMailReply.h +++ b/SoObjects/Mailer/SOGoMailReply.h @@ -30,10 +30,14 @@ @interface SOGoMailReply : SOGoMailForward { BOOL outlookMode; + NSString *replyPlacement; + NSString *signaturePlacement; } - (void) setOutlookMode: (BOOL) newOutlookMode; - (BOOL) outlookMode; +- (void) setReplyPlacement: (NSString *) newPlacement; +- (BOOL) replyPlacementOnTop; @end diff --git a/SoObjects/Mailer/SOGoMailReply.m b/SoObjects/Mailer/SOGoMailReply.m index 5006094ad..3c2673cd9 100644 --- a/SoObjects/Mailer/SOGoMailReply.m +++ b/SoObjects/Mailer/SOGoMailReply.m @@ -51,6 +51,26 @@ return outlookMode; } +- (void) setReplyPlacement: (NSString *) newPlacement +{ + replyPlacement = newPlacement; +} + +- (BOOL) replyPlacementOnTop +{ + return [replyPlacement isEqual: @"above"]; +} + +- (void) setSignaturePlacement: (NSString *) newPlacement +{ + signaturePlacement = newPlacement; +} + +- (BOOL) signaturePlacementOnTop +{ + return [signaturePlacement isEqual: @"above"]; +} + - (NSString *) messageBody { NSString *s; diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index f86281b7b..1c4307f23 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -137,6 +137,8 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (NSString *) messageCheck; - (NSString *) signature; +- (NSString *) replyPlacement; +- (NSString *) signaturePlacement; - (void) saveMailAccounts; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index de657f149..a94e9d5f0 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -772,6 +772,33 @@ _timeValue (NSString *key) return [[self primaryIdentity] objectForKey: @"signature"]; } +/* Modification */ +- (NSString *) replyPlacement +{ + NSString *replyPlacement; + + replyPlacement + = [[self userDefaults] stringForKey: @"ReplyPlacement"]; + if (![replyPlacement length]) + replyPlacement = @"below"; + + return replyPlacement; +} + +- (NSString *) signaturePlacement +{ + NSString *signaturePlacement; + + signaturePlacement + = [[self userDefaults] stringForKey: @"SignaturePlacement"]; + if (![signaturePlacement length]) + signaturePlacement = @"below"; + + return signaturePlacement; +} + +/* Fin */ + - (NSString *) messageForwarding { NSString *messageForwarding; diff --git a/UI/PreferencesUI/Dutch.lproj/Localizable.strings b/UI/PreferencesUI/Dutch.lproj/Localizable.strings index 2031d9061..e80c07a8f 100644 --- a/UI/PreferencesUI/Dutch.lproj/Localizable.strings +++ b/UI/PreferencesUI/Dutch.lproj/Localizable.strings @@ -82,6 +82,11 @@ "Default identity:" = "Standaardidentiteit:"; "Manage identities..." = "Identiteiten beheren..."; "Signature" = "Signature"; +"replyplacement_above" = "replyplacement_above"; +"replyplacement_below" = "replyplacement_below"; +"And place my signature" = "And place my signature"; +"signatureplacement_above" = "signatureplacement_above"; +"signatureplacement_below" = "signatureplacement_below"; /* Additional Parameters */ "Additional Parameters" = "Additional Parameters"; diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index 2513db8a3..50f1490a6 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -85,6 +85,11 @@ "Default identity:" = "Default identity:"; "Manage identities..." = "Manage identities..."; "Signature" = "Signature"; +"replyplacement_above" = "Start my reply above the quote"; +"replyplacement_below" = "Start my reply below the quote"; +"And place my signature" = "And place my signature"; +"signatureplacement_above" = "below my reply"; +"signatureplacement_below" = "below the quote"; /* Additional Parameters */ "Additional Parameters" = "Additional Parameters"; diff --git a/UI/PreferencesUI/French.lproj/Localizable.strings b/UI/PreferencesUI/French.lproj/Localizable.strings index 3d11f5331..e4d7d2458 100644 --- a/UI/PreferencesUI/French.lproj/Localizable.strings +++ b/UI/PreferencesUI/French.lproj/Localizable.strings @@ -83,6 +83,11 @@ "Default identity:" = "Identité par défaut :"; "Manage identities..." = "Gérer les identitiés..."; "Signature" = "Signature"; +"replyplacement_above" = "Placer ma reponse avant la citation"; +"replyplacement_below" = "Placer ma reponse apres la citation"; +"And place my signature" = "Et placer ma signature"; +"signatureplacement_above" = "apres ma reponse"; +"signatureplacement_below" = "apres la citation"; /* Additional Parameters */ "Additional Parameters" = "Paramètres supplémentaires"; diff --git a/UI/PreferencesUI/German.lproj/Localizable.strings b/UI/PreferencesUI/German.lproj/Localizable.strings index 66562a02d..1345bb2d0 100644 --- a/UI/PreferencesUI/German.lproj/Localizable.strings +++ b/UI/PreferencesUI/German.lproj/Localizable.strings @@ -82,6 +82,11 @@ "Default identity:" = "Standard Identität:"; "Manage identities..." = "Identitäten verwalten..."; "Signature" = "Unterschrift"; +"replyplacement_above" = "replyplacement_above"; +"replyplacement_below" = "replyplacement_below"; +"And place my signature" = "And place my signature"; +"signatureplacement_above" = "signatureplacement_above"; +"signatureplacement_below" = "signatureplacement_below"; /* Additional Parameters */ "Additional Parameters" = "Additional Parameters"; diff --git a/UI/PreferencesUI/Italian.lproj/Localizable.strings b/UI/PreferencesUI/Italian.lproj/Localizable.strings index 0fa16e3d8..e4e1d79b5 100644 --- a/UI/PreferencesUI/Italian.lproj/Localizable.strings +++ b/UI/PreferencesUI/Italian.lproj/Localizable.strings @@ -83,6 +83,11 @@ "Default identity:" = "Identità principale:"; "Manage identities..." = "Gestisci identità..."; "Signature" = "Firma"; +"replyplacement_above" = "replyplacement_above"; +"replyplacement_below" = "replyplacement_below"; +"And place my signature" = "And place my signature"; +"signatureplacement_above" = "signatureplacement_above"; +"signatureplacement_below" = "signatureplacement_below"; /* Additional Parameters */ "Additional Parameters" = "Additional Parameters"; diff --git a/UI/PreferencesUI/Spanish.lproj/Localizable.strings b/UI/PreferencesUI/Spanish.lproj/Localizable.strings index 978bad3d3..5e419790d 100644 --- a/UI/PreferencesUI/Spanish.lproj/Localizable.strings +++ b/UI/PreferencesUI/Spanish.lproj/Localizable.strings @@ -94,6 +94,11 @@ "Default identity:" = "Identidad por defecto:"; "Manage identities..." = "Gestionar identidades..."; "Signature" = "Firma"; +"replyplacement_above" = "replyplacement_above"; +"replyplacement_below" = "replyplacement_below"; +"And place my signature" = "And place my signature"; +"signatureplacement_above" = "signatureplacement_above"; +"signatureplacement_below" = "signatureplacement_below"; /* Additional Parameters */ "Additional Parameters" = "Additional Parameters"; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 8859c5e3e..87abfb06c 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -513,6 +513,50 @@ static BOOL shouldDisplayAdditionalPreferences = NO; [user saveMailAccounts]; } +/* Modification */ +- (NSArray *) replyPlacementList +{ + return [NSArray arrayWithObjects: @"above", @"below", nil]; +} + +- (NSString *) itemReplyPlacementText +{ + return [self labelForKey: + [NSString stringWithFormat: @"replyplacement_%@", item]]; +} + +- (NSString *) userReplyPlacement +{ + return [user replyPlacement]; +} + +- (void) setUserReplyPlacement: (NSString *) newReplyPlacement +{ + [userDefaults setObject: newReplyPlacement forKey: @"ReplyPlacement"]; +} + +- (NSArray *) signaturePlacementList +{ + return [NSArray arrayWithObjects: @"above", @"below", nil]; +} + +- (NSString *) itemSignaturePlacementText +{ + return [self labelForKey: + [NSString stringWithFormat: @"signatureplacement_%@", item]]; +} + +- (NSString *) userSignaturePlacement +{ + return [user signaturePlacement]; +} + +- (void) setUserSignaturePlacement: (NSString *) newSignaturePlacement +{ + [userDefaults setObject: newSignaturePlacement forKey: @"SignaturePlacement"]; +} +/* Fin */ + - (id ) defaultAction { id results; diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 4a40deed0..b8f4d9ba4 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -104,6 +104,15 @@ const:id="messageForwarding" string="itemMessageForwardingText" selection="userMessageForwarding"/>
+ +
+