mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-06 00:45:09 +00:00
Fix handling of Web calendars
- handle Web calendars that require authentication; - properly save the "reload on login" option; - reload Web calendars when clicking on the reload button on top of the events/tasks list; - properly activate the checkbox of new calendars (as they are enabled by default). Fixes #3326
This commit is contained in:
@@ -127,8 +127,48 @@
|
||||
function addWebCalendar() {
|
||||
Dialog.prompt(l('Subscribe to a web calendar...'), l('URL of the Calendar'), {inputType: 'url'})
|
||||
.then(function(url) {
|
||||
Calendar.$addWebCalendar(url);
|
||||
Calendar.$addWebCalendar(url).then(function(calendar) {
|
||||
if (angular.isObject(calendar)) {
|
||||
// Web calendar requires HTTP authentication
|
||||
$mdDialog.show({
|
||||
parent: angular.element(document.body),
|
||||
clickOutsideToClose: true,
|
||||
escapeToClose: true,
|
||||
templateUrl: 'UIxWebCalendarAuthDialog',
|
||||
controller: WebCalendarAuthDialogController,
|
||||
controllerAs: '$WebCalendarAuthDialogController',
|
||||
locals: {
|
||||
url: url,
|
||||
calendar: calendar
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* @ngInject
|
||||
*/
|
||||
WebCalendarAuthDialogController.$inject = ['scope', '$mdDialog', 'url', 'calendar'];
|
||||
function WebCalendarAuthDialogController(scope, $mdDialog, url, calendar) {
|
||||
var vm = this,
|
||||
parts = url.split("/"),
|
||||
hostname = parts[2];
|
||||
|
||||
vm.title = l("Please identify yourself to %{0}").formatted(hostname);
|
||||
vm.authenticate = function(form) {
|
||||
if (form.$valid || !form.$error.required) {
|
||||
calendar.setCredentials(vm.username, vm.password).then(function(message) {
|
||||
$mdDialog.hide();
|
||||
}, function(reason) {
|
||||
form.password.$setValidity('credentials', false);
|
||||
});
|
||||
}
|
||||
};
|
||||
vm.cancel = function() {
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDelete(folder) {
|
||||
|
||||
Reference in New Issue
Block a user