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
Amer
erp5
Commits
d37bafac
Commit
d37bafac
authored
Apr 23, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: getting rid of eval in action handling
parent
760eb593
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
15 deletions
+20
-15
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_appcache.xml
..._page_module/gadget_officejs_discussion_tool_appcache.xml
+6
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+12
-11
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
...web_page_module/gadget_officejs_page_handle_action_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_appcache.xml
View file @
d37bafac
...
@@ -229,6 +229,10 @@ gadget_officejs_form_view.html\n
...
@@ -229,6 +229,10 @@ gadget_officejs_form_view.html\n
gadget_officejs_form_view.js\n
gadget_officejs_form_view.js\n
gadget_erp5_page_handle_action.html\n
gadget_erp5_page_handle_action.html\n
gadget_erp5_page_handle_action.js\n
gadget_erp5_page_handle_action.js\n
gadget_field_new_action_js_script.html\n
gadget_field_new_action_js_script.js\n
gadget_field_reply_action_js_script.html\n
gadget_field_reply_action_js_script.js\n
\n
\n
#needed for appcachestorage sync\n
#needed for appcachestorage sync\n
/\n
/\n
...
@@ -738,7 +742,7 @@ NETWORK:\n
...
@@ -738,7 +742,7 @@ NETWORK:\n
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.
7925.35634.50875
</string>
</value>
<value>
<string>
975.
15178.25005.32409
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -756,7 +760,7 @@ NETWORK:\n
...
@@ -756,7 +760,7 @@ NETWORK:\n
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
155
5618417.31
</float>
<float>
155
6053135.7
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
d37bafac
/*global window, rJS, RSVP */
/*global window,
document,
rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint evil: true */
/*jslint evil: true */
(
function
(
window
,
rJS
,
RSVP
)
{
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
var
gadget_utils
,
action_reference
,
action_type
,
action_gadget
;
var
gadget_utils
,
action_reference
,
action_type
,
action_gadget
;
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
parent_portal_type
,
action_
code
;
var
gadget
=
this
,
parent_portal_type
,
action_
gadget_url
;
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
...
@@ -44,13 +44,16 @@
...
@@ -44,13 +44,16 @@
.
push
(
function
(
form_definition
)
{
.
push
(
function
(
form_definition
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
if
(
form_definition
.
fields_raw_properties
.
hasOwnProperty
(
"
gadget_field_action_js_script
"
))
{
// eval must be removed. use loaded action gadget from gadgetfield
action_gadget_url
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
gadget_url
;
action_code
=
form_definition
.
fields_raw_properties
.
gadget_field_action_js_script
.
values
.
renderjs_extra
[
0
];
var
fragment
=
document
.
createElement
(
'
div
'
);
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, options, action_reference, parent_portal_type, form_definition, submit_code) {
'
+
action_code
[
0
]
+
'
})
'
)(
gadget
,
gadget_utils
,
options
,
action_reference
,
parent_portal_type
,
form_definition
,
action_code
[
1
]);
gadget
.
element
.
appendChild
(
fragment
);
return
form
.
getDeclaredGadget
(
'
gadget_field_action_js_script
'
)
return
gadget
.
declareGadget
(
action_gadget_url
,
{
scope
:
"
action_field
"
,
element
:
fragment
})
.
push
(
function
(
declared_gadget
)
{
.
push
(
function
(
declared_gadget
)
{
action_gadget
=
declared_gadget
;
action_gadget
=
declared_gadget
;
action_gadget
.
handleRender
(
gadget
,
gadget_utils
,
options
,
action_reference
,
parent_portal_type
,
form_definition
);
return
action_gadget
.
handleRender
(
gadget
,
gadget_utils
,
options
,
action_reference
,
parent_portal_type
,
form_definition
);
});
});
}
else
{
}
else
{
throw
"
Field 'gadget_field_action_js_script' missing in action form. Please check '
"
+
action_reference
+
"
' action configuration.
"
;
throw
"
Field 'gadget_field_action_js_script' missing in action form. Please check '
"
+
action_reference
+
"
' action configuration.
"
;
...
@@ -82,9 +85,7 @@
...
@@ -82,9 +85,7 @@
content_dict
=
options
[
2
],
content_dict
=
options
[
2
],
submit_code
=
gadget
.
state
.
submit_code
;
submit_code
=
gadget
.
state
.
submit_code
;
if
(
action_type
===
"
object_jio_js_script
"
)
{
if
(
action_type
===
"
object_jio_js_script
"
)
{
// eval must be removed. use loaded action gadget from gadgetfield
return
window
.
eval
.
call
(
window
,
'
(function (gadget, gadget_utils, jio_key, content_dict) {
'
+
submit_code
+
'
})
'
)(
gadget
,
gadget_utils
,
jio_key
,
content_dict
);
action_gadget
.
handleSubmit
(
gadget
,
gadget_utils
,
jio_key
,
content_dict
);
action_gadget
.
handleSubmit
(
gadget
,
gadget_utils
,
jio_key
,
content_dict
);
}
}
});
});
}(
window
,
rJS
,
RSVP
));
}(
window
,
document
,
rJS
,
RSVP
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
View file @
d37bafac
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
975.1
3563.49723.204
</string>
</value>
<value>
<string>
975.1
5167.546.1297
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
155
5958089.16
</float>
<float>
155
6052425.93
</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