Commit 4c701c70 authored by Jérome Perrin's avatar Jérome Perrin

core: improve support of ERP5 scripts in ZMI

 - fix order of ZMI tabs to make `Edit` the default
 - enable ZMI code editor
 - add an icon
 - fix links to python scripts in BusinessTemplate_getPythonSourceCodeMessageList
parent 8fa6e5b8
...@@ -77,9 +77,10 @@ class PythonScript(XMLObject, ZopePythonScript, ExpressionMixin('expression')): ...@@ -77,9 +77,10 @@ class PythonScript(XMLObject, ZopePythonScript, ExpressionMixin('expression')):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
#View content list, Force /view, Standart option in python scripts #View content list, Force /view, Standart option in python scripts
manage_options = ( XMLObject.manage_options[0], manage_options = ( ZopePythonScript.manage_options[0],
{'icon':'', 'label':'View','action':'view'}) \ {'icon':'', 'label':'View','action':'view'}) \
+ ZopePythonScript.manage_options + ( XMLObject.manage_options[0], ) \
+ ZopePythonScript.manage_options[1:]
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
......
...@@ -27,9 +27,7 @@ ...@@ -27,9 +27,7 @@
</item> </item>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <value> <string>/misc_/PythonScripts/pyscript.gif</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -65,6 +63,18 @@ ...@@ -65,6 +63,18 @@
<key> <string>type_class</string> </key> <key> <string>type_class</string> </key>
<value> <string>PythonScript</string> </value> <value> <string>PythonScript</string> </value>
</item> </item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>content_icon</string> </key> <key> <string>content_icon</string> </key>
<value> <value> <string>/misc_/PythonScripts/pyscript.gif</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
...@@ -61,7 +61,7 @@ def checkPythonScript(script_instance, script_path): ...@@ -61,7 +61,7 @@ def checkPythonScript(script_instance, script_path):
Message( Message(
location="{script_path}:{row}:{column}".format(**annotation), location="{script_path}:{row}:{column}".format(**annotation),
message=annotation['text'], message=annotation['text'],
edit_url="{script_path}/manage_main?line={row}".format(**annotation),)) edit_url="{script_path}/manage_workspace?line={row}".format(**annotation),))
def checkComponent(component_instance): def checkComponent(component_instance):
"""Check a component, adding messages to global `line_list` """Check a component, adding messages to global `line_list`
......
...@@ -58,7 +58,7 @@ def manage_page_footer(self): ...@@ -58,7 +58,7 @@ def manage_page_footer(self):
else: else:
mode = 'html' mode = 'html'
textarea_selector = 'textarea[name="filedata:text"]' textarea_selector = 'textarea[name="filedata:text"]'
elif document.meta_type in ('Script (Python)', ): elif document.meta_type in ('Script (Python)', 'ERP5 Python Script', 'ERP5 Workflow Script', ):
mode = 'python' mode = 'python'
textarea_selector = 'textarea[name="body:text"]' textarea_selector = 'textarea[name="body:text"]'
# printed is from RestrictedPython.RestrictionMutator the rest comes # printed is from RestrictedPython.RestrictionMutator the rest comes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment