parent
5d1ac9db5d
commit
74acab0738
|
@ -136,7 +136,7 @@
|
|||
* @param {Object} card - an Card object instance to be added to the attendees list
|
||||
*/
|
||||
Attendees.prototype.add = function(card, options) {
|
||||
var _this = this, attendee, list, url, params;
|
||||
var _this = this, attendee, list, url, params, promise = Attendees.$q.when();
|
||||
if (card) {
|
||||
if (!this.component.attendees || (options && options.organizerCalendar)) {
|
||||
// No attendee yet; initialize the organizer
|
||||
|
@ -145,7 +145,7 @@
|
|||
if (card.$isList({expandable: true})) {
|
||||
// Decompose list members
|
||||
list = Attendees.$Card.$find(card.container, card.c_name);
|
||||
list.$id().then(function(listId) {
|
||||
promise = list.$id().then(function(listId) {
|
||||
_.forEach(list.refs, function(ref) {
|
||||
attendee = {
|
||||
name: ref.c_cn,
|
||||
|
@ -189,7 +189,7 @@
|
|||
})) {
|
||||
if (card.$isList() && Attendees.$Preferences.defaults.SOGoLDAPGroupExpansionEnabled) {
|
||||
// LDAP list -- preload members
|
||||
card.$members().then(function(members) {
|
||||
promise = card.$members().then(function(members) {
|
||||
attendee.members = members;
|
||||
attendee.isExpandableGroup = true;
|
||||
});
|
||||
|
@ -205,6 +205,8 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -205,8 +205,8 @@
|
|||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
ComponentEditorController.$inject = ['$rootScope', '$scope', '$log', '$timeout', '$window', '$element', '$mdDialog', '$mdToast', 'sgFocus', 'User', 'CalendarSettings', 'Calendar', 'Component', 'Attendees', 'AddressBook', 'Card', 'Preferences', 'stateComponent'];
|
||||
function ComponentEditorController($rootScope, $scope, $log, $timeout, $window, $element, $mdDialog, $mdToast, focus, User, CalendarSettings, Calendar, Component, Attendees, AddressBook, Card, Preferences, stateComponent) {
|
||||
ComponentEditorController.$inject = ['$rootScope', '$scope', '$q', '$log', '$timeout', '$window', '$element', '$mdDialog', '$mdToast', 'sgFocus', 'User', 'CalendarSettings', 'Calendar', 'Component', 'Attendees', 'AddressBook', 'Card', 'Preferences', 'stateComponent'];
|
||||
function ComponentEditorController($rootScope, $scope, $q, $log, $timeout, $window, $element, $mdDialog, $mdToast, focus, User, CalendarSettings, Calendar, Component, Attendees, AddressBook, Card, Preferences, stateComponent) {
|
||||
var vm = this, component, oldStartDate, oldEndDate, oldDueDate, dayStartTime, dayEndTime;
|
||||
|
||||
this.$onInit = function () {
|
||||
|
@ -291,7 +291,8 @@
|
|||
this.addAttendee = function (card, partial) {
|
||||
var initOrganizer = (!this.component.attendees || this.component.attendees.length === 0),
|
||||
destinationCalendar = Calendar.$get(this.component.destinationCalendar),
|
||||
options = initOrganizer? { organizerCalendar: destinationCalendar } : {};
|
||||
options = initOrganizer? { organizerCalendar: destinationCalendar } : {},
|
||||
promises = [];
|
||||
var emailRE = /([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i,
|
||||
i, address;
|
||||
if (partial) options.partial = partial;
|
||||
|
@ -316,7 +317,7 @@
|
|||
|
||||
function addCard(newCard) {
|
||||
if (!vm.component.$attendees.hasAttendee(newCard))
|
||||
vm.component.$attendees.add(newCard, options);
|
||||
return vm.component.$attendees.add(newCard, options);
|
||||
}
|
||||
|
||||
if (angular.isString(card)) {
|
||||
|
@ -332,23 +333,26 @@
|
|||
card.charCodeAt(i) == 44 || // ,
|
||||
card.charCodeAt(i) == 59) && // ;
|
||||
emailRE.test(address)) {
|
||||
createCard(address).then(addCard);
|
||||
promises.push(createCard(address).then(addCard));
|
||||
address = '';
|
||||
}
|
||||
else {
|
||||
address += card.charAt(i);
|
||||
}
|
||||
}
|
||||
if (address && emailRE.test(address))
|
||||
createCard(address).then(addCard);
|
||||
if (address && emailRE.test(address)) {
|
||||
promises.push(createCard(address).then(addCard));
|
||||
}
|
||||
}
|
||||
else if (angular.isDefined(card)) {
|
||||
if (!this.component.$attendees.hasAttendee(card))
|
||||
this.component.$attendees.add(card, options);
|
||||
promises.push(this.component.$attendees.add(card, options));
|
||||
this.showAttendeesEditor |= initOrganizer;
|
||||
}
|
||||
|
||||
$timeout(scrollToStart);
|
||||
|
||||
return $q.all(promises);
|
||||
};
|
||||
|
||||
function scrollToStart() {
|
||||
|
@ -466,8 +470,9 @@
|
|||
this.adjustStartTime();
|
||||
this.adjustEndTime();
|
||||
this.changeAlarmRelation(form);
|
||||
this.addAttendee(this.searchText).then(function () {
|
||||
if (form.$valid) {
|
||||
this.component.$save(options)
|
||||
vm.component.$save(options)
|
||||
.then(function(data) {
|
||||
$rootScope.$emit('calendars:list');
|
||||
Preferences.getAlarms();
|
||||
|
@ -480,6 +485,7 @@
|
|||
vm.edit(form);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.reset = function (form) {
|
||||
|
|
Loading…
Reference in New Issue