Add a header and/or footer to the vacation message

Fixes #1961
This commit is contained in:
Francis Lachapelle
2016-06-14 14:10:17 -04:00
parent 7f4474f47c
commit 4744170628
13 changed files with 259 additions and 7 deletions
+1
View File
@@ -57,6 +57,7 @@
- (BOOL) _isSieveServerAvailable;
- (id) _sieveClient;
- (NSString *) _vacationTextForTemplate: (NSString *) templateFilePath;
@end
+35
View File
@@ -41,6 +41,7 @@
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/SOGoUserFolder.h>
#import <SOGo/SOGoParentFolder.h>
#import <SOGo/SOGoTextTemplateFile.h>
#import <SOGo/WOResourceManager+SOGo.h>
#import <SOGo/SOGoBuild.h>
#import <Mailer/SOGoMailAccount.h>
@@ -1103,6 +1104,40 @@ static NSArray *reminderValues = nil;
return [[user domainDefaults] vacationEnabled];
}
- (NSString *) vacationHeader
{
NSString *path;
path = [[user domainDefaults] vacationHeaderTemplateFile];
return [self _vacationTextForTemplate: path];
}
- (NSString *) vacationFooter
{
NSString *path;
path = [[user domainDefaults] vacationFooterTemplateFile];
return [self _vacationTextForTemplate: path];
}
- (NSString *) _vacationTextForTemplate: (NSString *) templateFilePath
{
NSString *text;
SOGoTextTemplateFile *templateFile;
text = nil;
if (templateFilePath)
{
templateFile = [SOGoTextTemplateFile textTemplateFromFile: templateFilePath];
if (templateFile)
text = [templateFile textForUser: user];
}
return text;
}
// - (void) setSieveFiltersValue: (NSString *) newValue
// {
// sieveFilters = [newValue objectFromJSONString];
@@ -820,9 +820,15 @@
<div layout="column" flex-offset="5" ng-show="app.preferences.defaults.Vacation.enabled == 1">
<md-input-container class="md-block md-flex">
<label><var:string label:value="Auto reply message"/></label>
<var:if condition="vacationHeader.length">
<p class="text-preview" md-colors="::{color: 'default-background-600'}"><var:string value="vacationHeader"/></p>
</var:if>
<textarea const:name="autoReplyText"
const:id="autoReplyText"
ng-model="app.preferences.defaults.Vacation.autoReplyText"/>
<var:if condition="vacationFooter.length">
<p class="text-preview" md-colors="::{color: 'default-background-600'}"><var:string value="vacationFooter"/></p>
</var:if>
</md-input-container>
<div layout="row" layout-align="start center">
@@ -0,0 +1,6 @@
/// PreferencesUI.scss -*- Mode: scss; indent-tabs-mode: nil; basic-offset: 2 -*-
.text-preview {
white-space: pre-wrap;
word-wrap: break-word;
}
@@ -5,6 +5,7 @@
@import 'ContactsUI.scss';
@import 'MessageEditorUI';
@import 'SchedulerUI';
@import 'PreferencesUI';
@import 'AdministrationUI';
.view[layout=row],