New SOGoMailComposeWindow default

This commit is contained in:
Francis Lachapelle
2017-09-20 16:50:41 -04:00
parent 789398bd27
commit 104ac2db33
11 changed files with 99 additions and 23 deletions
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
MailboxController.$inject = ['$window', '$scope', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'sgHotkeys', 'encodeUriFilter', 'sgSettings', 'sgFocus', 'Dialog', 'Account', 'Mailbox'];
function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, sgHotkeys, encodeUriFilter, sgSettings, focus, Dialog, Account, Mailbox) {
MailboxController.$inject = ['$window', '$scope', '$timeout', '$q', '$state', '$mdDialog', '$mdToast', 'stateAccounts', 'stateAccount', 'stateMailbox', 'sgHotkeys', 'encodeUriFilter', 'sgSettings', 'sgFocus', 'Dialog', 'Preferences', 'Account', 'Mailbox'];
function MailboxController($window, $scope, $timeout, $q, $state, $mdDialog, $mdToast, stateAccounts, stateAccount, stateMailbox, sgHotkeys, encodeUriFilter, sgSettings, focus, Dialog, Preferences, Account, Mailbox) {
var vm = this,
defaultWindowTitle = angular.element($window.document).find('title').attr('sg-default') || "SOGo",
hotkeys = [];
@@ -146,11 +146,15 @@
});
};
this.composeWindowEnabled = function() {
return Preferences.defaults.SOGoMailComposeWindowEnabled;
};
this.newMessage = function($event, inPopup) {
var message;
if (vm.messageDialog === null) {
if (inPopup)
if (inPopup || Preferences.defaults.SOGoMailComposeWindow == 'popup')
_newMessageInPopup();
else {
message = vm.account.$newMessage();
@@ -72,9 +72,8 @@
url: '/edit',
views: {
'message@': {
templateUrl: 'UIxMailEditor', // UI/Templates/MailerUI/UIxMailEditor.wox
controller: 'MessageEditorController',
controllerAs: 'editor'
template: '<ui-view/>',
controller: 'MessageEditorControllerPopup'
}
},
resolve: {
@@ -84,10 +83,9 @@
.state('mail.account.mailbox.message.action', {
url: '/{actionName:(?:reply|replyall|forward)}',
views: {
message: {
templateUrl: 'UIxMailEditor', // UI/Templates/MailerUI/UIxMailEditor.wox
controller: 'MessageEditorController',
controllerAs: 'editor'
'message@': {
template: '<ui-view/>',
controller: 'MessageEditorControllerPopup'
}
}
});
@@ -6,8 +6,8 @@
/**
* @ngInject
*/
MessageController.$inject = ['$window', '$scope', '$state', '$mdMedia', '$mdDialog', 'sgConstant', 'stateAccounts', 'stateAccount', 'stateMailbox', 'stateMessage', 'sgHotkeys', 'encodeUriFilter', 'sgSettings', 'ImageGallery', 'sgFocus', 'Dialog', 'Calendar', 'Component', 'Account', 'Mailbox', 'Message'];
function MessageController($window, $scope, $state, $mdMedia, $mdDialog, sgConstant, stateAccounts, stateAccount, stateMailbox, stateMessage, sgHotkeys, encodeUriFilter, sgSettings, ImageGallery, focus, Dialog, Calendar, Component, Account, Mailbox, Message) {
MessageController.$inject = ['$window', '$scope', '$state', '$mdMedia', '$mdDialog', 'sgConstant', 'stateAccounts', 'stateAccount', 'stateMailbox', 'stateMessage', 'sgHotkeys', 'encodeUriFilter', 'sgSettings', 'ImageGallery', 'sgFocus', 'Dialog', 'Preferences', 'Calendar', 'Component', 'Account', 'Mailbox', 'Message'];
function MessageController($window, $scope, $state, $mdMedia, $mdDialog, sgConstant, stateAccounts, stateAccount, stateMailbox, stateMessage, sgHotkeys, encodeUriFilter, sgSettings, ImageGallery, focus, Dialog, Preferences, Calendar, Component, Account, Mailbox, Message) {
var vm = this, popupWindow = null, hotkeys = [];
this.$onInit = function() {
@@ -284,6 +284,15 @@
}
}
this._showMailEditorInPopup = function(action) {
if (!sgSettings.isPopup &&
Preferences.defaults.SOGoMailComposeWindow == 'popup') {
this.openInPopup(action);
return true;
}
return false;
};
this.close = function() {
$state.go('mail.account.mailbox').then(function() {
vm.message = null;
@@ -292,27 +301,32 @@
};
this.reply = function($event) {
var message = this.message.$reply();
_showMailEditor($event, message);
if (!this._showMailEditorInPopup('reply')) {
_showMailEditor($event, this.message.$reply());
}
};
this.replyAll = function($event) {
var message = this.message.$replyAll();
_showMailEditor($event, message);
if (!this._showMailEditorInPopup('replyall')) {
_showMailEditor($event, this.message.$replyAll());
}
};
this.forward = function($event) {
var message = this.message.$forward();
_showMailEditor($event, message);
if (!this._showMailEditorInPopup('forward')) {
_showMailEditor($event, this.message.$forward());
}
};
this.edit = function($event) {
this.message.$editableContent().then(function() {
_showMailEditor($event, vm.message);
});
if (!this._showMailEditorInPopup('edit')) {
this.message.$editableContent().then(function() {
_showMailEditor($event, vm.message);
});
}
};
this.openPopup = function() {
this.openInPopup = function(action) {
var url = [sgSettings.baseURL(),
'UIxMailPopupView#!/Mail',
this.message.accountId,
@@ -321,6 +335,7 @@
this.message.uid]
.join('/'),
wId = this.message.$absolutePath();
if (action) url += '/' + action;
popupWindow = $window.open(url, wId,
["width=680",
"height=520",
@@ -44,6 +44,8 @@
// Mail editor autosave is a number of minutes or 0 if disabled
data.SOGoMailAutoSave = parseInt(data.SOGoMailAutoSave) || 0;
data.SOGoMailComposeWindowEnabled = angular.isDefined(data.SOGoMailComposeWindow);
// Specify a base font size for HTML messages when SOGoMailComposeFontSize is not zero
data.SOGoMailComposeFontSizeEnabled = parseInt(data.SOGoMailComposeFontSize) > 0;
@@ -286,6 +288,10 @@
});
});
if (!preferences.defaults.SOGoMailComposeWindowEnabled)
delete preferences.defaults.SOGoMailComposeWindow;
delete preferences.defaults.SOGoMailComposeWindowEnabled;
if (!preferences.defaults.SOGoMailComposeFontSizeEnabled)
preferences.defaults.SOGoMailComposeFontSize = 0;
delete preferences.defaults.SOGoMailComposeFontSizeEnabled;