diff options
| author | Antony Lesuisse <al@openerp.com> | 2014-01-31 01:51:57 +0100 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2014-01-31 01:51:57 +0100 |
| commit | 4b30f1fcbd8701f82dbbe4e5c8386ee432b063ac (patch) | |
| tree | 93b17a03b45927c20fbb045cda8c8aa09d853409 /addons/mail/static/src | |
| parent | ba2d4c90307661a79d78e6ce3b274b76b4c62717 (diff) | |
| parent | 1c283ddf242f0681c1d060f3b8658efa3fcaa0a8 (diff) | |
[MERGE] trunk-website-al
bzr revid: al@openerp.com-20140131005157-jkf8hz6fh2buml2c
Diffstat (limited to 'addons/mail/static/src')
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 52 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 6 |
2 files changed, 3 insertions, 55 deletions
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 43feb52784a..58d44bab50e 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -114,57 +114,6 @@ openerp.mail = function (session) { } return out; }, - - // returns the file type of a file based on its extension - // As it only looks at the extension it is quite approximative. - filetype: function(url){ - var url = url && url.filename || url; - var tokens = typeof url == 'string' ? url.split('.') : []; - if(tokens.length <= 1){ - return 'unknown'; - } - var extension = tokens[tokens.length -1]; - if(extension.length === 0){ - return 'unknown'; - }else{ - extension = extension.toLowerCase(); - } - var filetypes = { - 'webimage': ['png','jpg','jpeg','jpe','gif'], // those have browser preview - 'image': ['tif','tiff','tga', - 'bmp','xcf','psd','ppm','pbm','pgm','pnm','mng', - 'xbm','ico','icon','exr','webp','psp','pgf','xcf', - 'jp2','jpx','dng','djvu','dds'], - 'vector': ['ai','svg','eps','vml','cdr','xar','cgm','odg','sxd'], - 'print': ['dvi','pdf','ps'], - 'document': ['doc','docx','odm','odt'], - 'presentation': ['key','keynote','odp','pps','ppt'], - 'font': ['otf','ttf','woff','eot'], - 'archive': ['zip','7z','ace','apk','bzip2','cab','deb','dmg','gzip','jar', - 'rar','tar','gz','pak','pk3','pk4','lzip','lz','rpm'], - 'certificate': ['cer','key','pfx','p12','pem','crl','der','crt','csr'], - 'audio': ['aiff','wav','mp3','ogg','flac','wma','mp2','aac', - 'm4a','ra','mid','midi'], - 'video': ['asf','avi','flv','mkv','m4v','mpeg','mpg','mpe','wmv','mp4','ogm'], - 'text': ['txt','rtf','ass'], - 'html': ['html','xhtml','xml','htm','css'], - 'disk': ['iso','nrg','img','ccd','sub','cdi','cue','mds','mdx'], - 'script': ['py','js','c','cc','cpp','cs','h','java','bat','sh', - 'd','rb','pl','as','cmd','coffee','m','r','vbs','lisp'], - 'spreadsheet': ['123','csv','ods','numbers','sxc','xls','vc','xlsx'], - 'binary': ['exe','com','bin','app'], - }; - for(filetype in filetypes){ - var ext_list = filetypes[filetype]; - for(var i = 0, len = ext_list.length; i < len; i++){ - if(extension === ext_list[i]){ - return filetype; - } - } - } - return 'unknown'; - }, - }; @@ -304,7 +253,6 @@ openerp.mail = function (session) { var attach = this.attachment_ids[l]; if (!attach.formating) { attach.url = mail.ChatterUtils.get_attachment_url(this.session, this.id, attach.id); - attach.filetype = mail.ChatterUtils.filetype(attach.filename || attach.name); attach.name = mail.ChatterUtils.breakword(attach.name || attach.filename); attach.formating = true; } diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 31539e24ab3..3a7a5469ee1 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -88,10 +88,10 @@ --> <t t-name="mail.thread.message.attachments"> <t t-foreach='widget.attachment_ids' t-as='attachment'> - <t t-if="attachment.filetype !== 'webimage'"> + <t t-if="attachment.file_type !== 'webimage'"> <div t-attf-class="oe_attachment #{attachment.upload ? 'oe_uploading' : ''}"> <a t-att-href='attachment.url' target="_blank"> - <img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.filetype + '.png'"></img> + <img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.file_type + '.png'"></img> <div class='oe_name'><t t-raw='attachment.name' /></div> </a> <div class='oe_delete oe_e' title="Delete this attachment" t-att-data-id="attachment.id">[</div> @@ -100,7 +100,7 @@ </div> </div> </t> - <t t-if="attachment.filetype === 'webimage'"> + <t t-if="attachment.file_type === 'webimage'"> <div t-attf-class="oe_attachment oe_preview #{attachment.upload ? 'oe_uploading' : ''}"> <a t-att-href='attachment.url' target="_blank"> <img t-att-src="widget.attachments_resize_image(attachment.id, [100,80])"></img> |
