Add TEST and PDF attachment preview (close #40)

This commit is contained in:
RainLoop Team 2013-12-29 18:26:40 +04:00
parent 50f16ea7b7
commit a8a21f42f7
7 changed files with 99 additions and 10 deletions

View file

@ -53,7 +53,7 @@ AttachmentModel.prototype.initByJson = function (oJsonAttachment)
var bResult = false;
if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
{
this.mimeType = oJsonAttachment.MimeType;
this.mimeType = (oJsonAttachment.MimeType || '').toLowerCase();
this.fileName = oJsonAttachment.FileName;
this.estimatedSize = Utils.pInt(oJsonAttachment.EstimatedSize);
this.isInline = !!oJsonAttachment.IsInline;
@ -90,7 +90,16 @@ AttachmentModel.prototype.isImage = function ()
*/
AttachmentModel.prototype.isText = function ()
{
return 'text/' === this.mimeType.substr(0, 5);
return 'text/' === this.mimeType.substr(0, 5) &&
-1 === Utils.inArray(this.mimeType, ['text/html']);
};
/**
* @return {boolean}
*/
AttachmentModel.prototype.isPdf = function ()
{
return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
};
/**