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
Joshua
erp5
Commits
1c2682f2
Commit
1c2682f2
authored
Jul 07, 2017
by
Tomáš Peterka
Committed by
Romain Courteaud
Jul 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Prevent (dialog) form to crash badly in most cases
parent
30341500
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
69 additions
and
29 deletions
+69
-29
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
+3
-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
+31
-12
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
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.html
...ge_module/rjs_gadget_erp5_pt_form_view_editable_html.html
+2
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.xml
...age_module/rjs_gadget_erp5_pt_form_view_editable_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
...b_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
+25
-9
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
..._page_module/rjs_gadget_erp5_pt_form_view_editable_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 @
1c2682f2
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
<html>
<html>
<!--
<!--
data-i18n=Input data has errors
data-i18n=Input data has errors
data-i18n=You do not have the permissions to edit the object
data-i18n=Document was not saved! Resubmit when you are online or the document accessible
data-i18n=Encountered an unknown error. Try to resubmit
-->
-->
<head>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<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 @
1c2682f2
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
57.40660.8707.11059
</string>
</value>
<value>
<string>
9
60.5523.58984.43537
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
88277468.66
</float>
<float>
14
99432111.39
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js
View file @
1c2682f2
...
@@ -272,24 +272,43 @@
...
@@ -272,24 +272,43 @@
return
RSVP
.
all
(
list
);
return
RSVP
.
all
(
list
);
})
})
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
400
))
{
if
(
error
.
target
!==
undefined
)
{
return
form_gadget
.
notifySubmitted
()
var
error_text
=
'
Encountered an unknown error. Try to resubmit
'
,
promise
;
// if we know what the error was, try to precise it for the user
if
(
error
.
target
.
status
===
400
)
{
error_text
=
'
Input data has errors
'
;
}
else
if
(
error
.
target
.
status
===
403
)
{
error_text
=
'
You do not have the permissions to edit the object
'
;
}
else
if
(
error
.
target
.
status
===
0
)
{
error_text
=
'
Document was not saved! Resubmit when you are online or the document accessible
'
;
}
// display translated error_text to user
promise
=
form_gadget
.
notifySubmitted
()
.
push
(
function
()
{
.
push
(
function
()
{
return
form_gadget
.
translate
(
'
Input data has errors
'
);
return
form_gadget
.
translate
(
error_text
);
})
})
.
push
(
function
(
message
)
{
.
push
(
function
(
message
)
{
return
form_gadget
.
notifyChange
(
message
+
'
.
'
);
return
form_gadget
.
notifyChange
(
message
+
'
.
'
);
})
});
// if server validation of form data failed (indicated by response code 400)
// we parse out field errors and display them to the user
if
(
error
.
target
.
status
===
400
)
{
promise
.
push
(
function
()
{
.
push
(
function
()
{
// when the server-side validation returns the error description
if
(
error
.
target
.
responseType
===
"
blob
"
)
{
if
(
error
.
target
.
responseType
===
"
blob
"
)
{
return
jIO
.
util
.
readBlobAsText
(
error
.
target
.
response
);
return
jIO
.
util
.
readBlobAsText
(
error
.
target
.
response
);
}
}
// otherwise return (most-likely) textual response of the server
return
{
target
:
{
result
:
error
.
target
.
response
}};
return
{
target
:
{
result
:
error
.
target
.
response
}};
})
})
.
push
(
function
(
event
)
{
.
push
(
function
(
event
)
{
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
event
.
target
.
result
));
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
event
.
target
.
result
));
});
});
}
}
return
promise
;
}
throw
error
;
throw
error
;
});
});
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
1c2682f2
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
58.28347.56387.25600
</string>
</value>
<value>
<string>
9
60.5523.58984.43537
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
149
1225124.1
2
</float>
<float>
149
9170448.4
2
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_html.html
View file @
1c2682f2
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
<!--
<!--
data-i18n=Input data has errors
data-i18n=Input data has errors
data-i18n=You do not have the permissions to edit the object
data-i18n=You do not have the permissions to edit the object
data-i18n=Document was not saved! Resubmit when you are online or the document accessible
data-i18n=Encountered an unknown error. Try to resubmit
-->
-->
<head>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<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_view_editable_html.xml
View file @
1c2682f2
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
56.58742.58866.48708
</string>
</value>
<value>
<string>
9
60.5523.58984.43537
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
149
0372079.18
</float>
<float>
149
9432130.91
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.js
View file @
1c2682f2
...
@@ -121,6 +121,7 @@
...
@@ -121,6 +121,7 @@
.
push
(
function
(
validity
)
{
.
push
(
function
(
validity
)
{
if
(
validity
)
{
if
(
validity
)
{
return
erp5_form
.
getContent
()
return
erp5_form
.
getContent
()
// try to send the form data over the network to jIO storage
.
push
(
function
(
data
)
{
.
push
(
function
(
data
)
{
data
[
form_id
.
key
]
=
form_id
[
'
default
'
];
data
[
form_id
.
key
]
=
form_id
[
'
default
'
];
...
@@ -134,6 +135,7 @@
...
@@ -134,6 +135,7 @@
)
)
]);
]);
})
})
// handle response from the server
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
if
(
result_list
[
1
].
target
.
responseType
===
"
blob
"
)
{
if
(
result_list
[
1
].
target
.
responseType
===
"
blob
"
)
{
return
jIO
.
util
.
readBlobAsText
(
result_list
[
1
].
target
.
response
);
return
jIO
.
util
.
readBlobAsText
(
result_list
[
1
].
target
.
response
);
...
@@ -153,31 +155,45 @@
...
@@ -153,31 +155,45 @@
})
})
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
target
!==
undefined
)
{
if
(
error
.
target
!==
undefined
)
{
var
error_text
;
var
error_text
=
'
Encountered an unknown error. Try to resubmit
'
,
promise
;
// improve error message if we can
if
(
error
.
target
.
status
===
400
)
{
if
(
error
.
target
.
status
===
400
)
{
error_text
=
'
Input data has errors
'
;
error_text
=
'
Input data has errors
'
;
}
else
if
(
error
.
target
.
status
===
403
)
{
}
else
if
(
error
.
target
.
status
===
403
)
{
error_text
=
'
You do not have the permissions to edit the object
'
;
error_text
=
'
You do not have the permissions to edit the object
'
;
}
else
if
(
error
.
target
.
status
===
0
)
{
// no/default=0 status means a network connection problem
error_text
=
'
Document was not saved! Resubmit when you are online or the document accessible
'
;
}
}
if
(
error_text
!==
undefined
)
{
// display translated error_text to user
return
form_gadget
.
notifySubmitted
()
promise
=
form_gadget
.
notifySubmitted
()
.
push
(
function
()
{
.
push
(
function
()
{
return
form_gadget
.
translate
(
error_text
);
return
form_gadget
.
translate
(
error_text
);
})
})
.
push
(
function
(
message
)
{
.
push
(
function
(
message
)
{
return
form_gadget
.
notifyChange
(
message
+
'
.
'
);
return
form_gadget
.
notifyChange
(
message
+
'
.
'
);
})
});
// if server validation of form data failed (indicated by response code 400)
// we parse out field errors and display them to the user
if
(
error
.
target
.
status
===
400
)
{
promise
.
push
(
function
()
{
.
push
(
function
()
{
// when the server-side validation returns the error description
if
(
error
.
target
.
responseType
===
"
blob
"
)
{
if
(
error
.
target
.
responseType
===
"
blob
"
)
{
return
jIO
.
util
.
readBlobAsText
(
error
.
target
.
response
);
return
jIO
.
util
.
readBlobAsText
(
error
.
target
.
response
);
}
}
// otherwise return (most-likely) textual response of the server
return
{
target
:
{
result
:
error
.
target
.
response
}};
return
{
target
:
{
result
:
error
.
target
.
response
}};
})
})
.
push
(
function
(
event
)
{
.
push
(
function
(
event
)
{
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
event
.
target
.
result
));
return
form_gadget
.
displayFormulatorValidationError
(
JSON
.
parse
(
event
.
target
.
result
));
});
});
}
}
return
promise
;
}
}
// throwing an error is the last desperate option
throw
error
;
throw
error
;
});
});
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_view_editable_js.xml
View file @
1c2682f2
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
58.31331.40640.10291
</string>
</value>
<value>
<string>
9
60.32739.63971.65297
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
149
1385195.38
</float>
<float>
149
9430902.76
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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