fix(calendar): don't allow RDATE unless already defined

Since RDATE are not properly supported in EAS, hide the possibility to
specify recurring dates unless the component being edited already
contains RDATE(s).
pull/262/head
Francis Lachapelle 2019-10-30 11:04:59 -04:00
parent 42bb3b288b
commit f6ca946058
5 changed files with 28 additions and 9 deletions

View File

@ -1,6 +1,6 @@
/* UIxCalMainView.m - this file is part of SOGo
*
* Copyright (C) 2006-2018 Inverse inc.
* Copyright (C) 2006-2019 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -339,6 +339,22 @@
return (view ? view : @"weekview");
}
- (NSArray *) repeatFrequencies
{
NSArray *repeatFrequencies;
repeatFrequencies = [NSArray arrayWithObjects:
[NSArray arrayWithObjects: @"never", [self labelForKey: @"repeat_NEVER"], nil],
[NSArray arrayWithObjects: @"daily",[self labelForKey: @"repeat_DAILY"], nil],
[NSArray arrayWithObjects: @"weekly",[self labelForKey: @"repeat_WEEKLY"], nil],
[NSArray arrayWithObjects: @"monthly",[self labelForKey: @"repeat_MONTHLY"], nil],
[NSArray arrayWithObjects: @"yearly", [self labelForKey: @"repeat_YEARLY"], nil],
[NSArray arrayWithObjects: @"custom", [self labelForKey: @"repeat_CUSTOM"], nil],
nil];
return repeatFrequencies;
}
@end
/* Component Viewer, parent class of Appointment Viewer and Task Viewer */

View File

@ -199,9 +199,7 @@
ng-model="editor.component.repeat.frequency"
ng-change="editor.changeFrequency($event)"
ng-disabled="editor.component.occurrenceId">
<var:foreach list="repeatList" item="item">
<md-option var:value="item"><var:string var:value="itemRepeatText"/></md-option>
</var:foreach>
<md-option ng-value="frequency[0]" ng-repeat="frequency in ::editor.frequencies()">{{ frequency[1] }}</md-option>
</md-select>
</md-input-container>
<md-button type="button" class="sg-icon-button"

View File

@ -14,6 +14,7 @@
var dayStartHour = <var:string value="dayStartHour"/>;
var currentView = '<var:string value="currentView"/>';
var localeCode = '<var:string value="localeCode" />';
var repeatFrequencies = <var:string value="repeatFrequencies.jsonRepresentation" />;
var centerIsClose = <var:string value="listIsCollapsed.jsonRepresentation" />;
</script>
<var:component className="UIxCalendarSelector" />

View File

@ -196,9 +196,7 @@
<md-input-container class="md-block md-flex">
<label><var:string label:value="Repeat"/></label>
<md-select ng-model="editor.component.repeat.frequency" ng-disabled="editor.component.occurrenceId">
<var:foreach list="repeatList" item="item">
<md-option var:value="item"><var:string var:value="itemRepeatText"/></md-option>
</var:foreach>
<md-option ng-value="frequency[0]" ng-repeat="frequency in ::editor.frequencies()">{{ frequency[1] }}</md-option>
</md-select>
</md-input-container>
<md-button type="button" class="sg-icon-button"

View File

@ -205,8 +205,8 @@
/**
* @ngInject
*/
ComponentEditorController.$inject = ['$rootScope', '$scope', '$log', '$timeout', '$element', '$mdDialog', 'sgFocus', 'User', 'CalendarSettings', 'Calendar', 'Component', 'Attendees', 'AddressBook', 'Card', 'Alarm', 'Preferences', 'stateComponent'];
function ComponentEditorController($rootScope, $scope, $log, $timeout, $element, $mdDialog, focus, User, CalendarSettings, Calendar, Component, Attendees, AddressBook, Card, Alarm, Preferences, stateComponent) {
ComponentEditorController.$inject = ['$rootScope', '$scope', '$log', '$timeout', '$window', '$element', '$mdDialog', 'sgFocus', 'User', 'CalendarSettings', 'Calendar', 'Component', 'Attendees', 'AddressBook', 'Card', 'Alarm', 'Preferences', 'stateComponent'];
function ComponentEditorController($rootScope, $scope, $log, $timeout, $window, $element, $mdDialog, focus, User, CalendarSettings, Calendar, Component, Attendees, AddressBook, Card, Alarm, Preferences, stateComponent) {
var vm = this, component, oldStartDate, oldEndDate, oldDueDate, dayStartTime, dayEndTime;
this.$onInit = function () {
@ -264,6 +264,12 @@
this.component.repeat.month.type == 'bymonthday';
};
this.frequencies = function () {
return _.filter($window.repeatFrequencies, function (frequency) {
return frequency[0] != 'custom' || vm.component.repeat.frequency == 'custom';
});
};
this.changeFrequency = function () {
if (this.component.repeat.frequency == 'custom')
this.showRecurrenceEditor = true;