[IMP] mail: preview documents (doc, pdf...) on openchatter

bzr revid: chm@openerp.com-20121024140910-88gj3t5efhc7pzzi
This commit is contained in:
Christophe Matthieu
2012-10-24 16:09:10 +02:00
parent fc34572ee3
commit 4ce75bb9bd
3 changed files with 18 additions and 2 deletions
+3
View File
@@ -187,6 +187,9 @@
.openerp .oe_mail .oe_msg_attachments .oe_attachment:nth-child(even){
background: #F4F5FA;
}
.openerp .oe_mail .oe_msg_images {
display: block;
}
.openerp .oe_mail .oe_msg_footer button{
display: inline;
height: 24px;
+6 -1
View File
@@ -636,11 +636,16 @@ openerp.mail = function(session) {
}
for (var l in this.attachment_ids) {
var attach = this.attachment_ids[l];
attach['url'] = mail.ChatterUtils.get_attachment_url(this.session, attach);
if((attach.filename || attach.name).match(/[.](jpg|jpg|gif|png|tif|svg)$/i)) {
attach.is_image = true;
}
attach['url'] = mail.ChatterUtils.get_attachment_url(this.session, attach);
if((attach.filename || attach.name).match(/[.](pdf|doc|docx|xls|xlsx|ppt|pptx|psd|tiff|dxf|svg)$/i)) {
attach.is_document = true;
attach.url_escape = escape(attach.url);
}
}
},
+9 -1
View File
@@ -71,7 +71,7 @@
-->
<t t-name="mail.thread.message.attachments">
<span t-attf-class="oe_msg_attachments">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="!attachment.is_image">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="!attachment.is_image and !attachment.is_document">
<div class="oe_attachment">
<span t-if="(attachment.upload or attachment.percent_loaded&lt;100)" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}" t-attf-name="{attachment.name || attachment.filename}">
<div class="oe_upload_in_process">
@@ -97,6 +97,14 @@
</a>
</t>
</span>
<span t-attf-class="oe_msg_document">
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="attachment.is_document">
<a t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
<t t-raw="attachment.name || attachment.filename"/>
</a>
<iframe t-attf-src="http://docs.google.com/viewer?url=#{ attachment.url_escape }&amp;embedded=true" width="600" height="400" style="border: none;"></iframe>
</t>
</span>
</t>
<t t-name="mail.thread.message.private">