mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-09-01 19:57:17 +00:00
Webmail: add reply button
This commit is contained in:
@@ -23,7 +23,9 @@
|
|||||||
<div class="buttonsToolbar">
|
<div class="buttonsToolbar">
|
||||||
<span>
|
<span>
|
||||||
<a class="button tiny radius"
|
<a class="button tiny radius"
|
||||||
data-ui-sref="mail.account.mailbox.message.editMessage({accountId: account.id, mailboxId: (mailbox.path | encodeUri), messageId: message.uid})"
|
data-ui-sref="mail.account.mailbox.message.reply({accountId: account.id, mailboxId: (mailbox.path | encodeUri), messageId: message.uid})"><i class="icon-reply"><!-- reply --></i></a>
|
||||||
|
<a class="button tiny radius"
|
||||||
|
data-ui-sref="mail.account.mailbox.message.edit({accountId: account.id, mailboxId: (mailbox.path | encodeUri), messageId: message.uid})"
|
||||||
data-ng-show="message.isDraft"><i class="icon-pencil"><!-- edit --></i></a>
|
data-ng-show="message.isDraft"><i class="icon-pencil"><!-- edit --></i></a>
|
||||||
<span class="button tiny radius alert"
|
<span class="button tiny radius alert"
|
||||||
data-ng-click="doDelete(message)"><i class="icon-trash"><!-- delete --></i></span>
|
data-ng-click="doDelete(message)"><i class="icon-trash"><!-- delete --></i></span>
|
||||||
|
|||||||
@@ -48,6 +48,10 @@
|
|||||||
return Mailbox; // return constructor
|
return Mailbox; // return constructor
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @module SOGo.MailerUI
|
||||||
|
* @desc Factory registration of Card in Angular module.
|
||||||
|
*/
|
||||||
angular.module('SOGo.MailerUI')
|
angular.module('SOGo.MailerUI')
|
||||||
/* Factory constants */
|
/* Factory constants */
|
||||||
.constant('sgMailbox_PRELOAD', {
|
.constant('sgMailbox_PRELOAD', {
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.id = this.$absolutePath();
|
this.id = this.$absolutePath();
|
||||||
if (oldUID > -1) {
|
if (oldUID > -1) {
|
||||||
|
// For new messages, $mailbox doesn't exist
|
||||||
this.$mailbox.uidsMap[uid] = this.$mailbox.uidsMap[oldUID];
|
this.$mailbox.uidsMap[uid] = this.$mailbox.uidsMap[oldUID];
|
||||||
this.$mailbox.uidsMap[oldUID] = null;
|
this.$mailbox.uidsMap[oldUID] = null;
|
||||||
}
|
}
|
||||||
@@ -170,6 +171,39 @@
|
|||||||
return this.$unwrap(futureMessageData);
|
return this.$unwrap(futureMessageData);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function $reply
|
||||||
|
* @memberof Message.prototype
|
||||||
|
* @desc Prepare a new Message object as the reply of the current message and associated to the draft mailbox.
|
||||||
|
* @see {@link Account.$newMessage}
|
||||||
|
* @returns a promise of the HTTP operations
|
||||||
|
*/
|
||||||
|
Message.prototype.$reply = function() {
|
||||||
|
var _this = this,
|
||||||
|
deferred = Message.$q.defer(),
|
||||||
|
mailbox,
|
||||||
|
message;
|
||||||
|
|
||||||
|
// Query server for draft folder and draft UID
|
||||||
|
Message.$$resource.fetch(this.id, 'reply').then(function(data) {
|
||||||
|
Message.$log.debug('New reply: ' + JSON.stringify(data, undefined, 2));
|
||||||
|
mailbox = _this.$mailbox.$account.$getMailboxByPath(data.mailboxPath);
|
||||||
|
message = new Message(data.accountId, mailbox, data);
|
||||||
|
// Fetch draft initial data
|
||||||
|
Message.$$resource.fetch(message.$absolutePath({asDraft: true}), 'edit').then(function(data) {
|
||||||
|
Message.$log.debug('New reply: ' + JSON.stringify(data, undefined, 2));
|
||||||
|
message.editable = data;
|
||||||
|
deferred.resolve(message);
|
||||||
|
}, function(data) {
|
||||||
|
deferred.reject(data);
|
||||||
|
});
|
||||||
|
}, function(data) {
|
||||||
|
deferred.reject(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function $save
|
* @function $save
|
||||||
* @memberof Message.prototype
|
* @memberof Message.prototype
|
||||||
|
|||||||
@@ -97,7 +97,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
stateMessage: ['$stateParams', '$state', 'stateMailbox', 'stateMessages', function($stateParams, $state, stateMailbox, stateMessages) {
|
stateMessage: ['encodeUriFilter', '$stateParams', '$state', 'stateMailbox', 'stateMessages', function(encodeUriFilter, $stateParams, $state, stateMailbox, stateMessages) {
|
||||||
var message = _.find(stateMessages, function(messageObject) {
|
var message = _.find(stateMessages, function(messageObject) {
|
||||||
return messageObject.uid == $stateParams.messageId;
|
return messageObject.uid == $stateParams.messageId;
|
||||||
});
|
});
|
||||||
@@ -105,11 +105,12 @@
|
|||||||
if (message)
|
if (message)
|
||||||
return message.$reload();
|
return message.$reload();
|
||||||
else
|
else
|
||||||
|
// Message not found
|
||||||
$state.go('mail.account.mailbox', { accountId: stateMailbox.$account.id, mailboxId: encodeUriFilter(stateMailbox.path) });
|
$state.go('mail.account.mailbox', { accountId: stateMailbox.$account.id, mailboxId: encodeUriFilter(stateMailbox.path) });
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('mail.account.mailbox.message.editMessage', {
|
.state('mail.account.mailbox.message.edit', {
|
||||||
url: '/edit',
|
url: '/edit',
|
||||||
views: {
|
views: {
|
||||||
'mailbox@mail': {
|
'mailbox@mail': {
|
||||||
@@ -123,6 +124,15 @@
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('mail.account.mailbox.message.reply', {
|
||||||
|
url: '/reply',
|
||||||
|
views: {
|
||||||
|
'mailbox@mail': {
|
||||||
|
templateUrl: 'editorTemplate', // UI/Templates/MailerUI/UIxMailEditor.wox
|
||||||
|
controller: 'MessageEditorCtrl'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('mail.newMessage', {
|
.state('mail.newMessage', {
|
||||||
url: '/new',
|
url: '/new',
|
||||||
views: {
|
views: {
|
||||||
@@ -243,7 +253,12 @@
|
|||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('MessageEditorCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$q', 'FileUploader', 'stateAccounts', 'stateMessage', '$timeout', '$modal', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', 'sgAddressBook', function($scope, $rootScope, $stateParams, $state, $q, FileUploader, stateAccounts, stateMessage, $timeout, $modal, focus, Dialog, Account, Mailbox, AddressBook) {
|
.controller('MessageEditorCtrl', ['$scope', '$rootScope', '$stateParams', '$state', '$q', 'FileUploader', 'stateAccounts', 'stateMessage', '$timeout', '$modal', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', 'sgAddressBook', function($scope, $rootScope, $stateParams, $state, $q, FileUploader, stateAccounts, stateMessage, $timeout, $modal, focus, Dialog, Account, Mailbox, AddressBook) {
|
||||||
if (angular.isDefined(stateMessage)) {
|
if ($state.current.url == '/reply') {
|
||||||
|
stateMessage.$reply().then(function(msgObject) {
|
||||||
|
$scope.message = msgObject;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (angular.isDefined(stateMessage)) {
|
||||||
$scope.message = stateMessage;
|
$scope.message = stateMessage;
|
||||||
}
|
}
|
||||||
$scope.identities = _.pluck(_.flatten(_.pluck(stateAccounts, 'identities')), 'full');
|
$scope.identities = _.pluck(_.flatten(_.pluck(stateAccounts, 'identities')), 'full');
|
||||||
|
|||||||
Reference in New Issue
Block a user