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
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
Noah Brackenbury
erp5
Commits
e441d8e4
Commit
e441d8e4
authored
May 11, 2017
by
Xiaowu Zhang
Committed by
Klaus Wölfel
May 11, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: run script and see event log&output in object view layout
/reviewed-on
!269
parent
2e2f59f7
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
1430 additions
and
0 deletions
+1430
-0
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/PyData%20Script/run.xml
...e/ActionTemplateItem/portal_types/PyData%20Script/run.xml
+85
-0
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Python%20Script/run.xml
...e/ActionTemplateItem/portal_types/Python%20Script/run.xml
+85
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript.xml
...tem/portal_skins/erp5_core/PythonScript_viewRunScript.xml
+156
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript/my_body.xml
...al_skins/erp5_core/PythonScript_viewRunScript/my_body.xml
+307
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript/my_parameter_signature.xml
...ore/PythonScript_viewRunScript/my_parameter_signature.xml
+264
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript/test_gadget.xml
...kins/erp5_core/PythonScript_viewRunScript/test_gadget.xml
+234
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.html.xml
...eItem/portal_skins/erp5_core/gadget_callable_run.html.xml
+58
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.html.zpt
...eItem/portal_skins/erp5_core/gadget_callable_run.html.zpt
+28
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.js.js
...lateItem/portal_skins/erp5_core/gadget_callable_run.js.js
+181
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.js.xml
...ateItem/portal_skins/erp5_core/gadget_callable_run.js.xml
+28
-0
product/ERP5/bootstrap/erp5_core/bt/template_action_path_list
...uct/ERP5/bootstrap/erp5_core/bt/template_action_path_list
+2
-0
product/ERP5Type/Log.py
product/ERP5Type/Log.py
+2
-0
No files found.
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/PyData%20Script/run.xml
0 → 100644
View file @
e441d8e4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
run
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
3.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Run
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/PythonScript_viewRunScript
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/ActionTemplateItem/portal_types/Python%20Script/run.xml
0 → 100644
View file @
e441d8e4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
run
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
3.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Run
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string:${object_url}/PythonScript_viewRunScript
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript.xml
0 → 100644
View file @
e441d8e4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5 Form"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
left
</string>
<string>
right
</string>
<string>
center
</string>
<string>
bottom
</string>
<string>
hidden
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
bottom
</string>
</key>
<value>
<list>
<string>
my_body
</string>
</list>
</value>
</item>
<item>
<key>
<string>
center
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_parameter_signature
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list>
<string>
test_gadget
</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
PythonScript_viewRunScript
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
ScriptPython_view
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_view
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
PythonScript Run
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
update_action_title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript/my_body.xml
0 → 100644
View file @
e441d8e4
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript/my_parameter_signature.xml
0 → 100644
View file @
e441d8e4
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/PythonScript_viewRunScript/test_gadget.xml
0 → 100644
View file @
e441d8e4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"GadgetField"
module=
"Products.ERP5Form.GadgetField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test_gadget
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
data_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
js_sandbox
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
data_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
js_sandbox
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
data_url
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
js_sandbox
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Test
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python:{\'param_list\': \',\'.join(here.ZScriptHTML_tryParams()), \'output_url\': here.getRelativeUrl(), \'log_url\':here.getPortalObject().portal_introspections.getRelativeUrl()+\'/tailEventLog\'}
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"TALESMethod"
module=
"Products.Formulator.TALESField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_text
</string>
</key>
<value>
<string>
python: field.restrictedTraverse(\'gadget_callable_run.html\').absolute_url()
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.html.xml
0 → 100644
View file @
e441d8e4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
expand
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_callable_run.html
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
<value>
<string>
utf-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<unicode></unicode>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.html.zpt
0 → 100644
View file @
e441d8e4
<html>
<head>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"jio.js"
type=
"text/javascript"
></script>
<script
src=
"handlebars.js"
type=
"text/javascript"
></script>
<script
id=
"run"
type=
"text/x-handlebars-template"
>
{{
#
each
param_list
}}
<
div
class
=
"
field
"
>
<
label
>
{{
this
}}
<
/label
>
<
input
class
=
"
{{this}}
"
type
=
"
text
"
>
<
/div
>
{{
/
each
}}
<
div
class
=
"
field
"
>
<
textarea
rows
=
"
30
"
cols
=
"
120
"
class
=
"
test_output
"
>
<
/textarea
>
<
div
class
=
"
test_error
"
><
/div
>
<
button
>
Run
<
/button
>
<
/div
>
</script>
<script
src=
"gadget_callable_run.js"
type=
"text/javascript"
></script>
</head>
<body>
<form></form>
</body>
</html>
\ No newline at end of file
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.js.js
0 → 100644
View file @
e441d8e4
/*global window, rJS, RSVP, jIO, Handlebars, document, FormData */
/*jslint nomen: true, maxlen:150, indent:2*/
(
function
(
rJS
,
jIO
,
RSVP
,
window
,
Handlebars
)
{
"
use strict
"
;
var
gk
=
rJS
(
window
),
run_source
=
gk
.
__template_element
.
getElementById
(
'
run
'
).
innerHTML
,
run_template
=
Handlebars
.
compile
(
run_source
);
function
loopEventListener
(
target
,
type
,
useCapture
,
callback
,
prevent_default
)
{
//////////////////////////
// Infinite event listener (promise is never resolved)
// eventListener is removed when promise is cancelled/rejected
//////////////////////////
var
handle_event_callback
,
callback_promise
;
if
(
prevent_default
===
undefined
)
{
prevent_default
=
true
;
}
function
cancelResolver
()
{
if
((
callback_promise
!==
undefined
)
&&
(
typeof
callback_promise
.
cancel
===
"
function
"
))
{
callback_promise
.
cancel
();
}
}
function
canceller
()
{
if
(
handle_event_callback
!==
undefined
)
{
target
.
removeEventListener
(
type
,
handle_event_callback
,
useCapture
);
}
cancelResolver
();
}
function
itsANonResolvableTrap
(
resolve
,
reject
)
{
var
result
;
handle_event_callback
=
function
(
evt
)
{
if
(
prevent_default
)
{
evt
.
stopPropagation
();
evt
.
preventDefault
();
}
cancelResolver
();
try
{
result
=
callback
(
evt
);
}
catch
(
e
)
{
result
=
RSVP
.
reject
(
e
);
}
callback_promise
=
result
;
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
result
;
})
.
push
(
undefined
,
function
(
error
)
{
if
(
!
(
error
instanceof
RSVP
.
CancellationError
))
{
canceller
();
reject
(
error
);
}
});
};
target
.
addEventListener
(
type
,
handle_event_callback
,
useCapture
);
}
return
new
RSVP
.
Promise
(
itsANonResolvableTrap
,
canceller
);
}
function
getLog
(
gadget
)
{
return
jIO
.
util
.
ajax
(
{
"
type
"
:
"
POST
"
,
"
url
"
:
gadget
.
props
.
value_list
.
log_url
,
"
xhrFields
"
:
{
withCredentials
:
true
}
}
);
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
props
=
{};
g
.
props
.
deferred
=
new
RSVP
.
defer
();
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
param_list
,
value_list
,
gadget
=
this
;
value_list
=
options
.
value
.
replace
(
/
\'
/gi
,
"
\"
"
);
value_list
=
JSON
.
parse
(
value_list
);
if
(
value_list
.
param_list
)
{
param_list
=
value_list
.
param_list
.
split
(
'
,
'
);
value_list
.
param_list
=
param_list
;
}
gadget
.
props
.
value_list
=
value_list
;
gadget
.
element
.
querySelector
(
'
form
'
).
innerHTML
=
run_template
({
param_list
:
param_list
});
return
gadget
.
props
.
deferred
.
resolve
();
})
.
declareService
(
function
()
{
var
gadget
=
this
,
test_output
,
test_error
;
function
run
(
data
)
{
gadget
.
props
.
output
=
""
;
test_error
.
innerHTML
=
""
;
test_output
.
value
=
""
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
getLog
(
gadget
);
})
.
push
(
function
(
result
)
{
gadget
.
props
.
last_result
=
result
.
target
.
response
.
split
(
"
\n
"
);
gadget
.
props
.
last_result
=
gadget
.
props
.
last_result
[
gadget
.
props
.
last_result
.
length
-
2
];
return
jIO
.
util
.
ajax
(
{
"
type
"
:
"
POST
"
,
"
url
"
:
gadget
.
props
.
value_list
.
output_url
,
"
xhrFields
"
:
{
withCredentials
:
true
},
"
data
"
:
data
}
);
})
.
push
(
function
(
result
)
{
gadget
.
props
.
output
=
result
.
target
.
response
;
return
getLog
(
gadget
);
},
function
(
error
)
{
var
tmp
=
document
.
createElement
(
'
div
'
);
tmp
.
innerHTML
=
error
.
target
.
response
;
tmp
=
tmp
.
querySelector
(
'
.master
'
);
test_error
.
appendChild
(
tmp
);
return
getLog
(
gadget
);
})
.
push
(
function
(
result
)
{
var
currentLogValue
=
result
.
target
.
response
.
split
(
"
\n
"
),
i
,
log
=
""
;
i
=
currentLogValue
.
lastIndexOf
(
gadget
.
props
.
last_result
)
+
1
;
for
(;
i
<
currentLogValue
.
length
;
i
+=
1
)
{
log
+=
currentLogValue
[
i
]
+
"
\n
"
;
}
test_output
.
value
=
log
+
gadget
.
props
.
output
;
test_output
.
scrollTop
=
test_output
.
scrollHeight
;
});
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
props
.
deferred
.
promise
;
})
.
push
(
function
()
{
test_output
=
gadget
.
element
.
querySelector
(
'
.test_output
'
);
test_error
=
gadget
.
element
.
querySelector
(
'
.test_error
'
);
if
(
!
gadget
.
props
.
value_list
.
param_list
)
{
return
run
();
}
})
.
push
(
function
()
{
return
loopEventListener
(
gadget
.
element
.
querySelector
(
'
form
'
),
'
submit
'
,
false
,
function
()
{
var
data_list
=
new
FormData
(),
input
,
i
;
if
(
gadget
.
props
.
value_list
.
param_list
)
{
for
(
i
=
0
;
i
<
gadget
.
props
.
value_list
.
param_list
.
length
;
i
+=
1
)
{
input
=
gadget
.
element
.
querySelector
(
'
.
'
+
gadget
.
props
.
value_list
.
param_list
[
i
]);
if
(
input
.
value
)
{
data_list
.
append
(
input
.
className
,
input
.
value
);
}
}
}
return
run
(
data_list
);
}
);
});
});
}(
rJS
,
jIO
,
RSVP
,
window
,
Handlebars
));
\ No newline at end of file
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_callable_run.js.xml
0 → 100644
View file @
e441d8e4
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
gadget_callable_run.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/bt/template_action_path_list
View file @
e441d8e4
...
...
@@ -102,9 +102,11 @@ Property Type Validity Constraint | predicate
Property Type Validity Constraint | view
PyData Script | proxy_role_view
PyData Script | repository_history_view
PyData Script | run
PyData Script | view
Python Script | proxy_role_view
Python Script | repository_history_view
Python Script | run
Python Script | view
Ram Cache | statistics
Ram Cache | view
...
...
product/ERP5Type/Log.py
View file @
e441d8e4
...
...
@@ -64,6 +64,8 @@ def log(description, content=marker_, level=INFO):
break
if
frame
[
0
]
==
'Script (Python)'
:
# does anybody log from ZPT or dtml?
head
.
append
(
'%s, %d'
%
(
frame
[
2
],
frame
[
1
]))
elif
frame
[
0
]
==
'ERP5 Python Script'
:
head
.
append
(
'%s, %d'
%
(
frame
[
2
],
frame
[
1
]))
del
st
# Prevent cycling references.
head
=
' -> '
.
join
(
head
)
description
=
'%s: %s'
%
(
head
,
description
)
...
...
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