Commit 99e13ff3 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

erp5_officejs: mappingstorage: save filename

parent 0763cfb4
...@@ -391,13 +391,25 @@ ...@@ -391,13 +391,25 @@
&& mapping_dict[attachment_id] !== undefined && mapping_dict[attachment_id] !== undefined
&& mapping_dict[attachment_id].put !== undefined && mapping_dict[attachment_id].put !== undefined
&& mapping_dict[attachment_id].put.erp5_put_template !== undefined) { && mapping_dict[attachment_id].put.erp5_put_template !== undefined) {
return getSubStorageId(storage, id) return new RSVP.Queue()
.push(function (sub_id) { .push(function () {
var url = UriTemplate.parse( return RSVP.all([
getSubStorageId(storage, id),
storage.get(id)
]);
})
.push(function (result) {
var sub_id = result[0],
doc = result[1],
url = UriTemplate.parse(
mapping_dict[attachment_id].put.erp5_put_template mapping_dict[attachment_id].put.erp5_put_template
).expand({id: sub_id}), ).expand({id: sub_id}),
data = new FormData(); data = new FormData();
if (doc.filename) {
data.append("field_my_file", blob, doc.filename);
} else {
data.append("field_my_file", blob); data.append("field_my_file", blob);
}
data.append("form_id", "File_view"); data.append("form_id", "File_view");
return jIO.util.ajax({ return jIO.util.ajax({
"type": "POST", "type": "POST",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment