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, ...

This commit is contained in:
Klaus Leithoff 2013-09-11 13:46:00 +00:00
parent 0b3d3c132d
commit 4b95b5b362
3 changed files with 26 additions and 1 deletions

View File

@ -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');

View File

@ -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();
}
},

View File

@ -10,7 +10,7 @@
</hbox>
<hbox>
<button label="Submit" id="button[apply]"/><button label="Save" id="button[save]"/>
<file statustext="Select file to attach to message" multiple='true' progress='mailUploadProgress' onFinish="app.mail.uploadForCompose" id="uploadForCompose" drop_target ="mail-compose_mailUploadSection"/>
<file statustext="Select file to attach to message" multiple='true' progress='mailUploadProgress' onFinish="app.mail.uploadForCompose" id="uploadForCompose" drop_target ="mailUploadSection"/>
</hbox>
<hbox class="mailComposeHeaders" width="99%">
<description value="To"/>
@ -59,6 +59,25 @@
<groupbox class="et2_file" id='mailUploadSection'>
<caption label="Files"/>
<box class="mailUploadProgress" id="mailUploadProgress" width="97%"/>
<grid disabled="@no_griddata" id="attachments" width="100%" maxheight="165" overflow="auto">
<columns>
<column disabled="!@showtempname"/>
<column width="50%" />
<column width="25%" />
<column width="15%"/>
<column />
</columns>
<rows>
<row>
<description id="${row}[tmp_name]" />
<description id="${row}[name]" />
<description id="${row}[type]" />
<vfs-size align="right" id="${row}[size]" no_lang="1" readonly="true"/>
<button id="delete[$row_cont[tmp_name]]" value="Delete" image="delete" />
</row>
</rows>
</grid>
</groupbox>
</vbox>
</template>