mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-07 06:18:50 +00:00
feat(mail): download message as .eml file
This commit is contained in:
@@ -230,6 +230,12 @@
|
||||
/* Message view "more" menu: create a task from message */
|
||||
"Convert To Task" = "Convert To Task";
|
||||
|
||||
/* Message view "more" menu: download message as an eml file */
|
||||
"Download message" = "Download message";
|
||||
|
||||
/* Message view "more" menu: download message as a zip archive */
|
||||
"Download message (zip)" = "Download message (zip)";
|
||||
|
||||
/* Message view "more" menu: download all attachments as a zip archive */
|
||||
"Download all attachments" = "Download all attachments";
|
||||
|
||||
|
||||
@@ -370,4 +370,24 @@
|
||||
return response;
|
||||
}
|
||||
|
||||
- (id <WOActionResults>) exportAction
|
||||
{
|
||||
NSString *disposition, *source;
|
||||
SOGoMailObject *co;
|
||||
WOResponse *response;
|
||||
|
||||
co = [self clientObject];
|
||||
source = [co contentAsString];
|
||||
|
||||
response = [self responseWithStatus: 200];
|
||||
[response setHeader: @"message/rfc822; charset=utf-8"
|
||||
forKey: @"content-type"];
|
||||
disposition = [NSString stringWithFormat: @"attachment; filename=\"%@.eml\"", [co nameInContainer]];
|
||||
[response setHeader: disposition forKey: @"Content-Disposition"];
|
||||
[response setContent: [source dataUsingEncoding: NSUTF8StringEncoding]];
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -265,6 +265,11 @@
|
||||
actionClass = "UIxMailActions";
|
||||
actionName = "markMessageRead";
|
||||
};
|
||||
export = {
|
||||
protectedBy = "View";
|
||||
actionClass = "UIxMailActions";
|
||||
actionName = "export";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -81,14 +81,20 @@
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item>
|
||||
<md-button label:aria-label="Save As..."
|
||||
<md-button label:aria-label="Download message"
|
||||
ng-click="viewer.message.download()">
|
||||
<var:string label:value="Save As..."/>
|
||||
<var:string label:value="Download message"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item>
|
||||
<md-button label:aria-label="Download message (zip)"
|
||||
ng-click="viewer.message.downloadArchive()">
|
||||
<var:string label:value="Download message (zip)"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
<md-menu-item ng-show="::viewer.message.attachmentAttrs.length">
|
||||
<md-button label:aria-label="Download all attachments"
|
||||
ng-click="viewer.message.downloadAttachments()">
|
||||
ng-click="viewer.message.downloadAttachmentsArchive()">
|
||||
<var:string label:value="Download all attachments"/>
|
||||
</md-button>
|
||||
</md-menu-item>
|
||||
|
||||
@@ -864,12 +864,12 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* @function download
|
||||
* @function downloadArchive
|
||||
* @memberof Message.prototype
|
||||
* @desc Download the current message
|
||||
* @desc Download the current message as a zip archive
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Message.prototype.download = function() {
|
||||
Message.prototype.downloadArchive = function() {
|
||||
var data, options;
|
||||
|
||||
data = { uids: [this.uid] };
|
||||
@@ -879,12 +879,22 @@
|
||||
};
|
||||
|
||||
/**
|
||||
* @function downloadAttachments
|
||||
* @function download
|
||||
* @memberof Message.prototype
|
||||
* @desc Download an archive of all attachments
|
||||
* @desc Download the current message as a eml file
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Message.prototype.downloadAttachments = function() {
|
||||
Message.prototype.download = function() {
|
||||
return Message.$$resource.download(this.$absolutePath(), 'export');
|
||||
};
|
||||
|
||||
/**
|
||||
* @function downloadAttachments
|
||||
* @memberof Message.prototype
|
||||
* @desc Download a zip archive of all attachments
|
||||
* @returns a promise of the HTTP operation
|
||||
*/
|
||||
Message.prototype.downloadAttachmentsArchive = function() {
|
||||
var options;
|
||||
|
||||
options = { filename: l('attachments') + "-" + this.uid + ".zip" };
|
||||
|
||||
Reference in New Issue
Block a user