[IMP]mail: suppress ajax attachment
bzr revid: chm@openerp.com-20121012124039-x2b2kojr8935ro1e
This commit is contained in:
@@ -199,7 +199,6 @@ openerp.mail = function(session) {
|
||||
// submit file
|
||||
//session.web.blockUI();
|
||||
self.$('form.oe_form_binary_form').submit();
|
||||
//self.submit_ajax_attachment();
|
||||
|
||||
this.$(".oe_attachment_file").hide();
|
||||
|
||||
@@ -214,52 +213,6 @@ openerp.mail = function(session) {
|
||||
}
|
||||
},
|
||||
|
||||
submit_ajax_attachment: function(){
|
||||
var self=this;
|
||||
var $form = self.$('form.oe_form_binary_form');
|
||||
var filename = this.$('input.oe_form_binary_file').val().replace(/.*[\\\/]/,'');
|
||||
|
||||
// create form data
|
||||
var fomdata = new FormData();
|
||||
$.each($form.find('input'), function(i, field) {
|
||||
var $field=$(field);
|
||||
if($field.attr('type')!='file'){
|
||||
fomdata.append($field.attr('name'), $field.val());
|
||||
} else {
|
||||
fomdata.append($field.attr('name'), field.files[0]);
|
||||
}
|
||||
});
|
||||
|
||||
var progress=function(event) {
|
||||
self.$("span[name='"+filename+"'] div:lt("+Math.floor(event.loaded / event.total*5)+")").show();
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: $form.attr("action"),
|
||||
data: fomdata,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
xhr: function() {
|
||||
// custom xhr
|
||||
myXhr = $.ajaxSettings.xhr();
|
||||
if(myXhr.upload){
|
||||
// for handling the progress of the upload
|
||||
myXhr.upload.addEventListener('progress', progress, false);
|
||||
}
|
||||
myXhr.addEventListener('progress', progress, false);
|
||||
return myXhr;
|
||||
},
|
||||
success: function(data){
|
||||
$iframe=$('<iframe style="display:none;"/>').html(data);
|
||||
$iframe.appendTo(self.$el);
|
||||
$iframe.remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
on_attachment_loaded: function (event, result) {
|
||||
//session.web.unblockUI();
|
||||
for(var i in this.attachment_ids){
|
||||
|
||||
@@ -61,11 +61,6 @@
|
||||
<span t-if="(attachment.upload or attachment.percent_loaded<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">
|
||||
<span>...wait upload...</span>
|
||||
<div t-attf-style="{attachment.percent_loaded>0?'':'display:none;'}"/>
|
||||
<div t-attf-style="{attachment.percent_loaded>20?'':'display:none;'}"/>
|
||||
<div t-attf-style="{attachment.percent_loaded>40?'':'display:none;'}"/>
|
||||
<div t-attf-style="{attachment.percent_loaded>60?'':'display:none;'}"/>
|
||||
<div t-attf-style="{attachment.percent_loaded>80?'':'display:none;'}"/>
|
||||
</div>
|
||||
<t t-raw="attachment.name || attachment.filename"/>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user