2015-05-06 04:06:13 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* JavaScript for SOGoPreferences */
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
2017-12-21 22:41:06 +01:00
|
|
|
angular.module('SOGo.PreferencesUI', ['ui.router', 'ck', 'angularFileUpload', 'SOGo.Common', 'SOGo.MailerUI', 'SOGo.ContactsUI', 'SOGo.Authentication', 'as.sortable'])
|
2015-08-03 17:53:54 +02:00
|
|
|
.config(configure)
|
|
|
|
.run(runBlock);
|
2015-05-06 04:06:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngInject
|
|
|
|
*/
|
2018-06-28 21:44:12 +02:00
|
|
|
configure.$inject = ['$stateProvider', '$urlServiceProvider'];
|
|
|
|
function configure($stateProvider, $urlServiceProvider) {
|
2015-05-06 04:06:13 +02:00
|
|
|
$stateProvider
|
|
|
|
.state('preferences', {
|
|
|
|
abstract: true,
|
|
|
|
views: {
|
|
|
|
preferences: {
|
|
|
|
templateUrl: 'preferences.html',
|
|
|
|
controller: 'PreferencesController',
|
|
|
|
controllerAs: 'app'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('preferences.general', {
|
|
|
|
url: '/general',
|
|
|
|
views: {
|
|
|
|
module: {
|
|
|
|
templateUrl: 'generalPreferences.html'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('preferences.calendars', {
|
|
|
|
url: '/calendars',
|
|
|
|
views: {
|
|
|
|
module: {
|
|
|
|
templateUrl: 'calendarsPreferences.html'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('preferences.addressbooks', {
|
|
|
|
url: '/addressbooks',
|
|
|
|
views: {
|
|
|
|
module: {
|
|
|
|
templateUrl: 'addressbooksPreferences.html'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.state('preferences.mailer', {
|
|
|
|
url: '/mailer',
|
|
|
|
views: {
|
|
|
|
module: {
|
|
|
|
templateUrl: 'mailerPreferences.html'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// if none of the above states are matched, use this as the fallback
|
2018-06-28 21:44:12 +02:00
|
|
|
$urlServiceProvider.rules.otherwise('/general');
|
2015-05-06 04:06:13 +02:00
|
|
|
}
|
|
|
|
|
2015-08-03 17:53:54 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @ngInject
|
|
|
|
*/
|
2018-06-28 21:44:12 +02:00
|
|
|
runBlock.$inject = ['$window', '$log', '$transitions', '$state'];
|
|
|
|
function runBlock($window, $log, $transitions, $state) {
|
|
|
|
if (!$window.DebugEnabled)
|
|
|
|
$state.defaultErrorHandler(function() {
|
|
|
|
// Don't report any state error
|
|
|
|
});
|
|
|
|
$transitions.onError({ to: 'preferences.**' }, function(transition) {
|
|
|
|
if (transition.to().name != 'preferences' &&
|
|
|
|
!transition.ignored()) {
|
|
|
|
$log.error('transition error to ' + transition.to().name + ': ' + transition.error().detail);
|
|
|
|
$state.go({ state: 'preferences' });
|
|
|
|
}
|
2015-08-03 17:53:54 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-05-06 04:06:13 +02:00
|
|
|
})();
|