diff --git a/NEWS b/NEWS index fa476ff62..01d8b630b 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ New features - [web] show all/only this calendar - [web] convert a message to an appointment or a task (#1722) + - [web] customizable base font size for HTML messages Enhancements - [web] added Junk handling feature from v2 diff --git a/SoObjects/SOGo/SOGoDefaults.plist b/SoObjects/SOGo/SOGoDefaults.plist index de3c5480d..fbb962ddb 100644 --- a/SoObjects/SOGo/SOGoDefaults.plist +++ b/SoObjects/SOGo/SOGoDefaults.plist @@ -72,6 +72,7 @@ SOGoTrashFolderName = "Trash"; SOGoJunkFolderName = "Junk"; SOGoMailComposeMessageType = "html"; + SOGoMailComposeFontSize = 0; SOGoMailDisplayRemoteInlineImages = "never"; SOGoMailAutoSave = "5"; diff --git a/SoObjects/SOGo/SOGoUserDefaults.h b/SoObjects/SOGo/SOGoUserDefaults.h index 69ebb8d15..078bc4ca4 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.h +++ b/SoObjects/SOGo/SOGoUserDefaults.h @@ -132,6 +132,9 @@ extern NSString *SOGoWeekStartFirstFullWeek; - (void) setMailComposeMessageType: (NSString *) newValue; - (NSString *) mailComposeMessageType; +- (void) setMailComposeFontSize: (NSString *) newValue; +- (NSString *) mailComposeFontSize; + - (void) setMailDisplayRemoteInlineImages: (NSString *) newValue; - (NSString *) mailDisplayRemoteInlineImages; diff --git a/SoObjects/SOGo/SOGoUserDefaults.m b/SoObjects/SOGo/SOGoUserDefaults.m index ea0578f5f..7adfdc3f0 100644 --- a/SoObjects/SOGo/SOGoUserDefaults.m +++ b/SoObjects/SOGo/SOGoUserDefaults.m @@ -539,6 +539,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; return [self stringForKey: @"SOGoMailComposeMessageType"]; } +- (void) setMailComposeFontSize: (NSString *) newValue +{ + [self setObject: newValue forKey: @"SOGoMailComposeFontSize"]; +} + +- (NSString *) mailComposeFontSize +{ + return [self stringForKey: @"SOGoMailComposeFontSize"]; +} + - (void) setMailDisplayRemoteInlineImages: (NSString *) newValue { [self setObject: newValue forKey: @"SOGoMailDisplayRemoteInlineImages"]; diff --git a/UI/MailerUI/UIxMailEditor.m b/UI/MailerUI/UIxMailEditor.m index ec4260c44..28fba7853 100644 --- a/UI/MailerUI/UIxMailEditor.m +++ b/UI/MailerUI/UIxMailEditor.m @@ -629,9 +629,11 @@ static NSArray *infoKeys = nil; { NSDictionary *info; NSException *error; + NSString *fontSize, *content; NGMimeType *mimeType; WORequest *request; SOGoDraftObject *co; + SOGoUserDefaults *ud; error = nil; request = [context request]; @@ -649,7 +651,22 @@ static NSArray *infoKeys = nil; info = [self infoFromRequest]; [co setHeaders: info]; [co setIsHTML: isHTML]; - [co setText: (isHTML ? [NSString stringWithFormat: @"%@", text] : text)];; + if (isHTML) + { + // Set a base font size if mail is HTML and user has set a default font-size + ud = [[context activeUser] userDefaults]; + fontSize = [ud mailComposeFontSize]; + if ([fontSize intValue] > 0) + content = [NSString stringWithFormat: @"%@", + fontSize, text]; + else + content = [NSString stringWithFormat: @"%@", text]; + } + else + { + content = text; + } + [co setText: content]; error = [co storeInfo]; } diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index 69d577e20..c6a80de0b 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -142,6 +142,10 @@ "Compose messages in" = "Compose messages in"; "composemessagestype_html" = "HTML"; "composemessagestype_text" = "Plain text"; + +/* Base font size for messages composed in HTML */ +"Default font size" = "Default font size"; + "Display remote inline images" = "Display remote inline images"; "displayremoteinlineimages_never" = "Never"; "displayremoteinlineimages_always" = "Always"; diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index 67d405219..90fa62dea 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -174,6 +174,9 @@ static SoProduct *preferencesProduct = nil; if (![[defaults source] objectForKey: @"SOGoMailComposeMessageType"]) [[defaults source] setObject: [defaults mailComposeMessageType] forKey: @"SOGoMailComposeMessageType"]; + if (![[defaults source] objectForKey: @"SOGoMailComposeFontSize"]) + [[defaults source] setObject: [defaults mailComposeFontSize] forKey: @"SOGoMailComposeFontSize"]; + if (![[defaults source] objectForKey: @"SOGoMailDisplayRemoteInlineImages"]) [[defaults source] setObject: [defaults mailDisplayRemoteInlineImages] forKey: @"SOGoMailDisplayRemoteInlineImages"]; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index d640fe4f2..d55b361f2 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1172,6 +1172,27 @@ static NSArray *reminderValues = nil; : [self _defaultEmailAddresses]); } +// +// Used by templates +// +- (NSArray *) fontSizesList +{ + static NSArray *fontSizes = nil; + + if (!fontSizes) + { + fontSizes = [NSArray arrayWithObjects: @"8", @"9", @"10", @"11", @"12", @"13", @"14", @"16", @"18", + @"20", @"22", @"24", @"26", @"28", + @"36", + @"48", + @"72", + nil]; + [fontSizes retain]; + } + + return fontSizes; +} + // // Used by templates // diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 886544db6..5c2fd3013 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -511,19 +511,18 @@ -
+
- - - + + @@ -534,7 +533,7 @@
- + @@ -569,18 +568,42 @@
- - - - - - - - - - +
+ + + + + + + + + + - +
+ + + + + + + + + + + +
px
+
+
+
+ + diff --git a/UI/WebServerResources/js/Preferences/Preferences.service.js b/UI/WebServerResources/js/Preferences/Preferences.service.js index ec383e088..011dea01e 100644 --- a/UI/WebServerResources/js/Preferences/Preferences.service.js +++ b/UI/WebServerResources/js/Preferences/Preferences.service.js @@ -26,6 +26,15 @@ // Mail editor autosave is a number of minutes or 0 if disabled data.SOGoMailAutoSave = parseInt(data.SOGoMailAutoSave) || 0; + // Specify a base font size for HTML messages when SOGoMailComposeFontSize is not zero + data.SOGoMailComposeFontSizeEnabled = parseInt(data.SOGoMailComposeFontSize) > 0; + + if (window.CKEDITOR && data.SOGoMailComposeFontSize) { + // HTML editor is enabled; set user's preferred font size + window.CKEDITOR.config.fontSize_defaultLabel = data.SOGoMailComposeFontSize; + window.CKEDITOR.addCss('.cke_editable { font-size: ' + data.SOGoMailComposeFontSize + 'px; }'); + } + // We convert our list of autoReplyEmailAddresses/forwardAddress into a string. // We also convert our date objects into real date, otherwise we'll have strings // or undefined values and the md-datepicker does NOT like this. @@ -201,6 +210,9 @@ preferences.defaults.SOGoMailLabelsColors = labels; + if (!preferences.defaults.SOGoMailComposeFontSizeEnabled) + preferences.defaults.SOGoMailComposeFontSize = 0; + if (preferences.defaults.Vacation) { if (preferences.defaults.Vacation.endDateEnabled) preferences.defaults.Vacation.endDate = preferences.defaults.Vacation.endDate.getTime()/1000; diff --git a/UI/WebServerResources/js/vendor/ckeditor/config.js b/UI/WebServerResources/js/vendor/ckeditor/config.js index f44e50739..51dae144c 100644 --- a/UI/WebServerResources/js/vendor/ckeditor/config.js +++ b/UI/WebServerResources/js/vendor/ckeditor/config.js @@ -23,17 +23,6 @@ CKEDITOR.editorConfig = function( config ) { config.tabSpaces = 4; config.allowedContent = true; // don't filter tags - // The list of fonts size to be displayed in the Font Size combo in the toolbar. - config.fontSize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px'; - - // Explicitly show the default site font size to the end user (as defined in contents.css) - config.fontSize_defaultLabel = '13px'; - - // The CSS file(s) to be used to apply style to editor content. - // For example, the following ck.css could overwrite the font-size of .cke_editable - //config.contentsCss = ['/SOGo.woa/WebServerResources/js/vendor/ckeditor/contents.css', // default CSS - // '/css/ck.css']; // custom CSS - // Disables the built-in words spell checker if browser provides one. Defaults to true. // http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-disableNativeSpellChecker //config.disableNativeSpellChecker = false;