Honor the domain defaults when creating an event

Initialize the editor with the value of
SOGoAppointmentSendEMailNotifications from the domain defaults.

Fixes #3729
This commit is contained in:
Francis Lachapelle
2016-06-14 10:31:45 -04:00
parent ff65ba88ad
commit e24ee771e2
3 changed files with 20 additions and 14 deletions

1
NEWS
View File

@@ -20,6 +20,7 @@ Bug fixes
- [web] sgTimePicker parser now respects the user's time format and language
- [web] fixed time format when user chooses the default one
- [web] added missing delegators identities in mail editor (#3720)
- [web] honor the domain default SOGoAppointmentSendEMailNotifications (#3729)
- [core] properly handle sorted/deleted calendars (#3723)
- [core] properly handle flattened timezone definitions (#2690)

View File

@@ -311,6 +311,14 @@ static SoProduct *preferencesProduct = nil;
values = [[[[defaults source] values] mutableCopy] autorelease];
//
// Expose additional information that must not be synchronized in the defaults
//
// Expose the SOGoAppointmentSendEMailNotifications configuration parameter from the domain defaults
[values setObject: [NSNumber numberWithBool: [domainDefaults appointmentSendEMailNotifications]]
forKey: @"SOGoAppointmentSendEMailNotifications"];
// Add locale code (used by CK Editor)
locale = [[preferencesProduct resourceManager] localeForLanguageNamed: [defaults language]];
[values setObject: [locale objectForKey: @"NSLocaleCode"] forKey: @"LocaleCode"];
@@ -321,10 +329,7 @@ static SoProduct *preferencesProduct = nil;
[locale objectForKey: @"NSShortWeekDayNameArray"], @"shortDays",
nil] forKey: @"locale"];
//
// We inject our default mail account, something we don't want to do before we
// call -synchronize on our defaults.
//
// We inject our default mail account
accounts = [NSMutableArray arrayWithArray: [values objectForKey: @"AuxiliaryMailAccounts"]];
account = [[[context activeUser] mailAccounts] objectAtIndex: 0];
if (![account objectForKey: @"receipts"])
@@ -335,7 +340,6 @@ static SoProduct *preferencesProduct = nil;
@"ignore", @"receiptAnyAction", nil]
forKey: @"receipts"];
}
[accounts insertObject: account atIndex: 0];
[values setObject: accounts forKey: @"AuxiliaryMailAccounts"];

View File

@@ -475,14 +475,6 @@
this.delta = 60;
angular.extend(this, data);
Component.$Preferences.ready().then(function() {
var type = (_this.type == 'appointment')? 'Events' : 'Tasks';
// Set default values from user's defaults
_this.classification = _this.classification ||
Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
});
if (this.component == 'vevent')
this.type = 'appointment';
else if (this.component == 'vtodo')
@@ -564,8 +556,14 @@
this.$hasCustomRepeat = this.hasCustomRepeat();
if (this.isNew) {
// Set default alarm
// Set default values
Component.$Preferences.ready().then(function() {
var type = (_this.type == 'appointment')? 'Events' : 'Tasks';
// Set default classification
_this.classification = Component.$Preferences.defaults['SOGoCalendar' + type + 'DefaultClassification'].toLowerCase();
// Set default alarm
var units = { M: 'MINUTES', H: 'HOURS', D: 'DAYS', W: 'WEEKS' };
var match = /-PT?([0-9]+)([MHDW])/.exec(Component.$Preferences.defaults.SOGoCalendarDefaultReminder);
if (match) {
@@ -573,6 +571,9 @@
_this.alarm.quantity = parseInt(match[1]);
_this.alarm.unit = units[match[2]];
}
// Set notitifications
_this.sendAppointmentNotifications = Component.$Preferences.defaults.SOGoAppointmentSendEMailNotifications;
});
}
else {