Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
1100aa14
Commit
1100aa14
authored
Sep 22, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui+json] Dialog form handles HTTP responses 202-399
parent
3bf9d9d1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
7 deletions
+40
-7
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.html
.../web_page_module/rjs_gadget_erp5_pt_form_dialog_html.html
+1
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.xml
...m/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
...Item/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
+35
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.html
View file @
1100aa14
...
...
@@ -6,6 +6,7 @@
data-i18n=Document was not saved! Resubmit when you are online or the document accessible
data-i18n=Encountered an unknown error. Try to resubmit
data-i18n=Data received
data-i18n=Action succeeded
-->
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_html.xml
View file @
1100aa14
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
0.56020.52206.40328
</string>
</value>
<value>
<string>
96
2.14191.38290.31931
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
150
5912615.0
</float>
<float>
150
6093694.63
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
1100aa14
...
...
@@ -55,7 +55,7 @@
// ignore options.editable because dialog is always editable
erp5_document
:
options
.
erp5_document
,
form_definition
:
options
.
form_definition
,
erp5_form
:
options
.
erp5_form
||
{}
,
erp5_form
:
options
.
erp5_form
||
{}
// ignore global editable state (be always editable)
});
})
...
...
@@ -153,7 +153,8 @@
if
(
attachment
.
target
.
responseType
!==
"
blob
"
)
{
attachment_data
=
new
Blob
(
[
attachment
.
target
.
response
],
{
type
:
attachment
.
target
.
getResponseHeader
(
"
Content-Type
"
)});
{
type
:
attachment
.
target
.
getResponseHeader
(
"
Content-Type
"
)}
);
}
a_tag
.
style
=
"
display: none
"
;
a_tag
.
href
=
URL
.
createObjectURL
(
attachment_data
);
...
...
@@ -227,7 +228,9 @@
// here we figure out where to go after form submit - indicated
// by X-Location HTTP header placed by Base_redirect script
var
jio_key
=
new
URI
(
attachment
.
target
.
getResponseHeader
(
"
X-Location
"
)).
segment
(
2
);
attachment
.
target
.
getResponseHeader
(
"
X-Location
"
)
).
segment
(
2
);
if
(
redirect_to_parent
)
{
return
form_gadget
.
redirect
({
command
:
'
history_previous
'
});
}
...
...
@@ -271,6 +274,35 @@
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
response_text
.
target
.
result
));
});
}
// response status > 200 (e.g. 202 "Accepted" or 204 "No Content")
// mean sucessful execution of an action but does not carry any data
// XMLHttpRequest automatically inserts Content-Type="text/xml" thus
// we cannot test based on that
if
(
attachment
.
target
.
response
.
size
===
0
&&
attachment
.
target
.
status
>
200
&&
attachment
.
target
.
status
<
400
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
form_gadget
.
notifySubmitted
({
"
message
"
:
"
Action succeeded
"
,
"
status
"
:
"
success
"
});
})
.
push
(
function
()
{
if
(
redirect_to_parent
)
{
return
form_gadget
.
redirect
({
command
:
'
history_previous
'
});
}
return
form_gadget
.
redirect
({
command
:
'
change
'
,
options
:
{
"
jio_key
"
:
form_gadget
.
state
.
jio_key
,
"
view
"
:
"
view
"
,
"
page
"
:
undefined
// do not mingle with editable because it isn't necessary
}
});
});
}
// any other attachment type we force to download because it is most
// likely product of export/report (thus PDF, ODT ...)
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
1100aa14
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
962.1
5391.22775.52445
</string>
</value>
<value>
<string>
962.1
7207.35280.11400
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
15060
08825.18
</float>
<float>
15060
93724.9
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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