summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>2014-02-03 18:30:00 +0100
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>2014-02-03 18:30:00 +0100
commit753f7541db67d03e85bde6eb1c56ef2bb7468c7f (patch)
treeef621e6370d1c6b6ce3f60f990c5b03cbe086d60 /addons/mail/static/src
parent3d392cab4ec961b9d5d3e65f79f146d0bc5e1aa6 (diff)
parentc25827f84544b6ea3004c7a354122284310c528b (diff)
[MERGE] main trunk
bzr revid: qdp-launchpad@openerp.com-20140203173000-mk092iw2wz3y0e3e
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/mail.js52
-rw-r--r--addons/mail/static/src/xml/mail.xml6
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>