New button to reset Calendar categories

Also added default colors to categories.
This commit is contained in:
Francis Lachapelle
2018-09-07 21:38:31 -04:00
parent 2be5edde94
commit 9ddb65a07a
6 changed files with 61 additions and 26 deletions
+1
View File
@@ -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)
+22 -22
View File
@@ -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}>)";
@@ -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";
+21
View File
@@ -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
//
@@ -19,6 +19,7 @@
var vacationEnabled = <var:string value="isVacationEnabled" const:escapeHTML="NO"/>;
var timeZonesList = <var:string value="timeZonesList" const:escapeHTML="NO"/>;
var defaultEmailAddresses = '<var:string value="defaultEmailAddresses" const:escapeHTML="NO"/>';
var defaultCalendarCategories = <var:string value="defaultCalendarCategoriesColors" const:escapeHTML="NO"/>;
var forwardConstraints = <var:string value="forwardConstraints" const:escapeHTML="NO"/>;
var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>;
</script>
@@ -429,6 +430,11 @@
</md-list>
<div layout="row" layout-align="end center">
<md-button type="button"
label:aria-label="Reset to defaults"
ng-click="app.resetCalendarCategories(preferencesForm)">
<var:string label:value="Reset to defaults"/>
</md-button>
<md-button type="button"
label:aria-label="Add Calendar Category"
ng-click="app.addCalendarCategory(preferencesForm)">
@@ -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({