mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-31 08:04:54 +00:00
Download attachments of a message as a zip archive
This commit is contained in:
@@ -659,7 +659,7 @@
|
||||
AddressBook.prototype.$deleteCards = function(cards) {
|
||||
var _this = this,
|
||||
ids = _.map(cards, 'id');
|
||||
|
||||
|
||||
return AddressBook.$$resource.post(this.id, 'batchDelete', {uids: ids}).then(function() {
|
||||
_this.$_deleteCards(ids);
|
||||
});
|
||||
@@ -713,14 +713,19 @@
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
AddressBook.prototype.exportCards = function(selectedOnly) {
|
||||
var selectedUIDs;
|
||||
var data = null, options, selectedCards;
|
||||
|
||||
options = {
|
||||
type: 'application/octet-stream',
|
||||
filename: this.name + '.ldif'
|
||||
};
|
||||
|
||||
if (selectedOnly) {
|
||||
var selectedCards = _.filter(this.$cards, function(card) { return card.selected; });
|
||||
selectedUIDs = _.map(selectedCards, 'id');
|
||||
selectedCards = _.filter(this.$cards, function(card) { return card.selected; });
|
||||
data = { uids: _.map(selectedCards, 'id') };
|
||||
}
|
||||
|
||||
return AddressBook.$$resource.download(this.id, 'export', (angular.isDefined(selectedUIDs) ? {uids: selectedUIDs} : null), {type: 'application/octet-stream'});
|
||||
return AddressBook.$$resource.download(this.id, 'export', data, options);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -269,11 +269,15 @@
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Card.prototype.export = function() {
|
||||
var selectedIDs;
|
||||
var data, options;
|
||||
|
||||
selectedIDs = [ this.id ];
|
||||
data = { uids: [ this.id ] };
|
||||
options = {
|
||||
type: 'application/octet-stream',
|
||||
filename: this.$$fullname + '.ldif'
|
||||
};
|
||||
|
||||
return Card.$$resource.download(this.pid, 'export', {uids: selectedIDs}, {type: 'application/octet-stream'});
|
||||
return Card.$$resource.download(this.pid, 'export', data, options);
|
||||
};
|
||||
|
||||
Card.prototype.$fullname = function(options) {
|
||||
|
||||
Reference in New Issue
Block a user