Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
jio
Commits
a1c6a5f8
Commit
a1c6a5f8
authored
Oct 28, 2016
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Storage: Add support to putAttachment data
parent
4be41f5f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+28
-0
No files found.
src/jio.storage/erp5storage.js
View file @
a1c6a5f8
...
...
@@ -398,6 +398,34 @@
};
ERP5Storage
.
prototype
.
putAttachment
=
function
(
id
,
name
,
blob
)
{
if
(
name
===
"
data
"
)
{
return
getDocumentAndHateoas
(
this
,
id
,
{
"
_view
"
:
"
jio_data
"
})
.
push
(
function
(
response
)
{
var
result
=
JSON
.
parse
(
response
.
target
.
responseText
);
// Remove all ERP5 hateoas links / convert them into jIO ID
// XXX Change default action to an jio urn with attachment name inside
// if Base_edit, do put URN
// if others, do post URN (ie, unique new attachment name)
// XXX Except this attachment name should be generated when
return
extractPropertyFromFormJSON
(
result
);
})
.
push
(
function
(
result
)
{
var
form_data
=
result
.
form_data
,
data
=
new
FormData
();
data
.
append
(
"
field_my_file
"
,
blob
);
data
.
append
(
"
form_id
"
,
form_data
.
form_id
[
"
default
"
]);
return
jIO
.
util
.
ajax
({
"
type
"
:
"
POST
"
,
"
url
"
:
result
.
action_href
,
"
data
"
:
data
,
"
xhrFields
"
:
{
withCredentials
:
true
}
});
});
}
// Assert we use a callable on a document from the ERP5 site
if
(
name
.
indexOf
(
this
.
_url
)
!==
0
)
{
throw
new
jIO
.
util
.
jIOError
(
"
Can not store outside ERP5:
"
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment