diff --git a/NEWS b/NEWS index 739f10c8b..5fba47add 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ Enhancements - [web] prohibit subscribing a user with no rights - [web] new button to mark a task as completed (#4531) + - [web] new button to reset Calendar categories to defaults Bug fixes - [web] include mail account name in form validation (#4532) diff --git a/SoObjects/SOGo/SOGoDefaults.plist b/SoObjects/SOGo/SOGoDefaults.plist index 605d0f554..980000489 100644 --- a/SoObjects/SOGo/SOGoDefaults.plist +++ b/SoObjects/SOGo/SOGoDefaults.plist @@ -159,28 +159,28 @@ ); SOGoCalendarCategoriesColors = { - "Customer" = "#CCCCCC"; - "Calls" = "#FFCC33"; - "Favorites" = "#CCCCCC"; - "Meeting" = "#CCCCCC"; - "Ideas" = "#CCCCCC"; - "Miscellaneous" = "#CCCCCC"; - "Birthday" = "#CCCCCC"; - "Anniversary" = "#CCCCCC"; - "Vacation" = "#CCCCCC"; - "Travel" = "#CCCCCC"; - "Projects" = "#CCCCCC"; - "Suppliers" = "#CCCCCC"; - "Gifts" = "#CCCCCC"; - "Clients" = "#CCCCCC"; - "Issues" = "#CCCCCC"; - "Business" = "#CCCCCC"; - "Holidays" = "#CCCCCC"; - "Personal" = "#CCCCCC"; - "Status" = "#CCCCCC"; - "Competition" = "#CCCCCC"; - "Follow up" = "#CCCCCC"; - "Public Holiday" = "#CCCCCC"; + "Customer" = "#F8D800"; + "Calls" = "#0396FF"; + "Favorites" = "#EA5455"; + "Meeting" = "#7367F0"; + "Ideas" = "#32CCBC"; + "Miscellaneous" = "#F6416C"; + "Birthday" = "#28C76F"; + "Anniversary" = "#9F44D3"; + "Vacation" = "#623AA2"; + "Travel" = "#F55555"; + "Projects" = "#8C1BAB"; + "Suppliers" = "#9708CC"; + "Gifts" = "#736EFE"; + "Clients" = "#E96D71"; + "Issues" = "#3677FF"; + "Business" = "#FA016D"; + "Holidays" = "#0E197D"; + "Personal" = "#DE4313"; + "Status" = "#002661"; + "Competition" = "#6018DC"; + "Follow up" = "#D939CD"; + "Public Holiday" = "#E80505"; }; SOGoSubscriptionFolderFormat = "%{FolderName} (%{UserName} <%{Email}>)"; diff --git a/UI/PreferencesUI/English.lproj/Localizable.strings b/UI/PreferencesUI/English.lproj/Localizable.strings index 68d2a7004..ffee2363f 100644 --- a/UI/PreferencesUI/English.lproj/Localizable.strings +++ b/UI/PreferencesUI/English.lproj/Localizable.strings @@ -237,6 +237,7 @@ "Calendar Category" = "Calendar Category"; "Add Calendar Category" = "Add Calendar Category"; "New category" = "New category"; +"Reset to defaults" = "Reset to defaults"; "Remove Calendar Category" = "Remove Calendar Category"; "Contact Category" = "Contact Category"; "Add Contact Category" = "Add Contact Category"; diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 8937f76df..639b78432 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -1212,6 +1212,27 @@ static NSArray *reminderValues = nil; return [uniqueAddressesList componentsJoinedByString: @", "]; } +// +// Used by templates +// +- (NSString *) defaultCalendarCategoriesColors +{ + NSArray *labels, *colors; + NSMutableDictionary *defaultCategoriesColors; + unsigned int i; + + labels = [[self labelForKey: @"calendar_category_labels"] componentsSeparatedByString: @","]; + colors = [[[SOGoSystemDefaults sharedSystemDefaults] calendarCategoriesColors] allValues]; + defaultCategoriesColors = [NSMutableDictionary dictionary]; + for (i = 0; i < [colors count]; i++) + { + [defaultCategoriesColors setObject: [colors objectAtIndex: i] + forKey: [labels objectAtIndex: i]]; + } + + return [defaultCategoriesColors jsonRepresentation]; +} + // // Used by templates // diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index a4fb6d58c..b5b67043b 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -19,6 +19,7 @@ var vacationEnabled = ; var timeZonesList = ; var defaultEmailAddresses = ''; + var defaultCalendarCategories = ; var forwardConstraints = ; var sieveCapabilities = ; @@ -429,6 +430,11 @@
+ + + diff --git a/UI/WebServerResources/js/Preferences/PreferencesController.js b/UI/WebServerResources/js/Preferences/PreferencesController.js index 29fd59dd5..f5df6eaad 100644 --- a/UI/WebServerResources/js/Preferences/PreferencesController.js +++ b/UI/WebServerResources/js/Preferences/PreferencesController.js @@ -3,7 +3,7 @@ (function() { 'use strict'; - + /** * @ngInject */ @@ -62,6 +62,12 @@ }); }; + this.resetCalendarCategories = function(form) { + this.preferences.defaults.SOGoCalendarCategories = _.keys($window.defaultCalendarCategories); + this.preferences.defaults.SOGoCalendarCategoriesColors = angular.copy($window.defaultCalendarCategories); + form.$setDirty(); + }; + this.addCalendarCategory = function(form) { this.preferences.defaults.SOGoCalendarCategoriesColors[l('New category')] = "#aaa"; this.preferences.defaults.SOGoCalendarCategories.push(l('New category')); @@ -202,10 +208,10 @@ form.$setDirty(); }); }; - + this.editMailFilter = function(ev, index, form) { var filter = angular.copy(this.preferences.defaults.SOGoSieveFilters[index]); - + $mdDialog.show({ templateUrl: 'editFilter?filter=' + index, controller: 'FiltersDialogController', @@ -388,7 +394,7 @@ return false; }; - + this.changePassword = function() { Authentication.changePassword(this.passwords.newPassword).then(function() { var alert = $mdDialog.alert({