- Fix attachments uploading, broken with devel-addressbook branch merge

release-0.6
alecpl 14 years ago
parent 041f66e074
commit b649c49e64

@ -3190,7 +3190,7 @@ function rcube_webmail()
// create hidden iframe and post upload form // create hidden iframe and post upload form
if (send) { if (send) {
this.async_upload_form(form, 'upload', function(e) { var frame_name = this.async_upload_form(form, 'upload', function(e) {
var d, content = ''; var d, content = '';
try { try {
if (this.contentDocument) { if (this.contentDocument) {
@ -3199,7 +3199,7 @@ function rcube_webmail()
d = this.contentWindow.document; d = this.contentWindow.document;
} }
content = d.childNodes[0].innerHTML; content = d.childNodes[0].innerHTML;
} catch (e) {} } catch (err) {}
if (!content.match(/add2attachment/) && (!bw.opera || (rcmail.env.uploadframe && rcmail.env.uploadframe == e.data.ts))) { if (!content.match(/add2attachment/) && (!bw.opera || (rcmail.env.uploadframe && rcmail.env.uploadframe == e.data.ts))) {
if (!content.match(/display_message/)) if (!content.match(/display_message/))
@ -3212,7 +3212,9 @@ function rcube_webmail()
}); });
// display upload indicator and cancel button // display upload indicator and cancel button
var content = this.get_label('uploading'); var content = this.get_label('uploading'),
ts = frame_name.replace(/^rcmupload/, '');
if (this.env.loadingicon) if (this.env.loadingicon)
content = '<img src="'+this.env.loadingicon+'" alt="" />'+content; content = '<img src="'+this.env.loadingicon+'" alt="" />'+content;
if (this.env.cancelicon) if (this.env.cancelicon)
@ -5373,8 +5375,8 @@ function rcube_webmail()
// post the given form to a hidden iframe // post the given form to a hidden iframe
this.async_upload_form = function(form, action, onload) this.async_upload_form = function(form, action, onload)
{ {
var ts = new Date().getTime(); var ts = new Date().getTime(),
var frame_name = 'rcmupload'+ts; frame_name = 'rcmupload'+ts;
// have to do it this way for IE // have to do it this way for IE
// otherwise the form will be posted to a new window // otherwise the form will be posted to a new window
@ -5399,6 +5401,8 @@ function rcube_webmail()
form.action = this.url(action, { _uploadid:ts }); form.action = this.url(action, { _uploadid:ts });
form.setAttribute('enctype', 'multipart/form-data'); form.setAttribute('enctype', 'multipart/form-data');
form.submit(); form.submit();
return frame_name;
}; };
// starts interval for keep-alive/check-recent signal // starts interval for keep-alive/check-recent signal

Loading…
Cancel
Save