From 4b95b5b36265b6f8c6fc94629da62cc79f0363a9 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 11 Sep 2013 13:46:00 +0000 Subject: [PATCH] on submit of a form, move uploaded info to own datastructure (grid) to be able to preserve that over to formdata, in case we do stuff like saveAsDraft and other stuff, or to be able to manipulate the uploaded files information, or add files from vfs, ... --- mail/inc/class.mail_compose.inc.php | 5 +++++ mail/js/app.js | 1 + mail/templates/default/compose.xet | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 9bdca5e541..65449a24fc 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -976,6 +976,11 @@ class mail_compose //error_log(__METHOD__.__LINE__.$sessionData['body']); $content['mail_'.($this->sessionData['mimeType'] == 'html'?'html':'plain').'text'] = $sessionData['body']; } + $content['showtempname']=0; + $content['attachments']=(is_array($content['attachments'])&&is_array($content['uploadForCompose'])?array_merge($content['attachments'],$content['uploadForCompose']):(is_array($content['uploadForCompose'])?$content['uploadForCompose']:(is_array($content['attachments'])?$content['attachments']:null))); + //if (is_array($content['attachments'])) foreach($content['attachments'] as $k => &$file) $file['delete['.$file['tmp_name'].']']=0; + $content['no_griddata'] = empty($content['attachments']); + $preserv['attachments'] = $content['attachments']; $preserv['is_html'] = $content['is_html']; $preserv['is_plain'] = $content['is_plain']; $etpl = new etemplate_new('mail.compose'); diff --git a/mail/js/app.js b/mail/js/app.js index 819455e1b0..9c54db8724 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -1220,6 +1220,7 @@ app.mail = AppJS.extend( // var request = new egw_json_request('mail_ui::ajax_importMessage', ['upload', widget.getValue(), _path], this); // widget.set_value(''); // request.sendRequest();//false, this._upload_callback, this); + this.et2_obj.submit(); } }, diff --git a/mail/templates/default/compose.xet b/mail/templates/default/compose.xet index df7ee6deda..6c846b8080 100644 --- a/mail/templates/default/compose.xet +++ b/mail/templates/default/compose.xet @@ -10,7 +10,7 @@