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
Eteri
erp5
Commits
bc12cb2f
Commit
bc12cb2f
authored
Aug 19, 2014
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_ace_editor: allow to have different modes, use python by default to keep compatibility
parent
915ee2fb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
7 deletions
+89
-7
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/Base_getAceEditorMode.xml
...em/portal_skins/erp5_ace_editor/Base_getAceEditorMode.xml
+76
-0
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace_editor_support.xml
...eItem/portal_skins/erp5_ace_editor/ace_editor_support.xml
+12
-6
bt5/erp5_ace_editor/bt/revision
bt5/erp5_ace_editor/bt/revision
+1
-1
No files found.
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/Base_getAceEditorMode.xml
0 → 100644
View file @
bc12cb2f
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_body
</string>
</key>
<value>
<string>
# For backward compatibility, make sure to use python as default mode\n
mode = "python"\n
portal_type = context.getPortalType()\n
if portal_type == "Web Page":\n
mode = "html"\n
elif portal_type == "Web Script":\n
mode = "javascript"\n
elif portal_type == "Web Style":\n
mode = "css"\n
return mode\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getAceEditorMode
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ace_editor/SkinTemplateItem/portal_skins/erp5_ace_editor/ace_editor_support.xml
View file @
bc12cb2f
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
<tal:block tal:define=\'site_root python: here.getWebSiteValue() or here.getPortalObject();\n
<tal:block tal:define=\'site_root python: here.getWebSiteValue() or here.getPortalObject();\n
portal_url python: site_root.absolute_url();\n
portal_url python: site_root.absolute_url();\n
div_id string:${id}_ace;\n
div_id string:${id}_ace;\n
mode python: here.Base_getAceEditorMode();\n
container_div_id string:${div_id}_container;\n
container_div_id string:${div_id}_container;\n
\'>
\n
\'>
\n
<style
type=
"text/css"
>
\n
<style
type=
"text/css"
>
\n
...
@@ -173,7 +174,7 @@
...
@@ -173,7 +174,7 @@
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/ace/ace.js"
></script>
\n
tal:attributes=
"src string:${portal_url}/ace/ace.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/ace/mode-
python
.js"
></script>
\n
tal:attributes=
"src string:${portal_url}/ace/mode-
${mode}
.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
\n
tal:attributes=
"src string:${portal_url}/ace/ext-settings_menu.js"
></script>
\n
tal:attributes=
"src string:${portal_url}/ace/ext-settings_menu.js"
></script>
\n
<script
type=
"text/javascript"
\n
<script
type=
"text/javascript"
\n
...
@@ -185,6 +186,7 @@
...
@@ -185,6 +186,7 @@
tal:content="structure string:\n
tal:content="structure string:\n
ace_editor_container_div = null;\n
ace_editor_container_div = null;\n
ace_editor = null;\n
ace_editor = null;\n
var mode = \'${mode}\';\n
\n
\n
function maximizeFullscreenRemoveSaveMessage() {\n
function maximizeFullscreenRemoveSaveMessage() {\n
$(\'.ace_editor_maximize_fullscreen_message\').remove();\n
$(\'.ace_editor_maximize_fullscreen_message\').remove();\n
...
@@ -385,7 +387,7 @@
...
@@ -385,7 +387,7 @@
$.ajax({type: \'GET\',\n
$.ajax({type: \'GET\',\n
async: false,\n
async: false,\n
url: \'Component_getErrorWarningMessageDictAsJson\',\n
url: \'Component_getErrorWarningMessageDictAsJson\',\n
success: getErrorWarningMessageDictHandler})
;
\n
success: getErrorWarningMessageDictHandler})\n
}\n
}\n
\n
\n
window.onload = function() {\n
window.onload = function() {\n
...
@@ -410,8 +412,8 @@
...
@@ -410,8 +412,8 @@
\n
\n
ace_editor.resize(true);\n
ace_editor.resize(true);\n
\n
\n
var
PythonMode = require(\'ace/mode/python\'
).Mode;\n
var
Mode = require(\'ace/mode/\' + mode
).Mode;\n
ace_editor.getSession().setMode(new
Python
Mode());\n
ace_editor.getSession().setMode(new Mode());\n
ace_editor.getSession().setUseSoftTabs(true);\n
ace_editor.getSession().setUseSoftTabs(true);\n
ace_editor.getSession().setTabSize(2);\n
ace_editor.getSession().setTabSize(2);\n
\n
\n
...
@@ -441,13 +443,17 @@
...
@@ -441,13 +443,17 @@
}, 500);\n
}, 500);\n
}\n
}\n
\n
\n
if (mode === \'python\') {\n
checkPythonSourceCode();\n
checkPythonSourceCode();\n
}\n
\n
\n
var textarea = $(\'#${id}\');\n
var textarea = $(\'#${id}\');\n
ace_editor.getSession().on(\'change\', function() {\n
ace_editor.getSession().on(\'change\', function() {\n
changed = true; // This is the dirty flag for onbeforeunload warning in erp5.js\n
changed = true; // This is the dirty flag for onbeforeunload warning in erp5.js\n
textarea.val(ace_editor.getSession().getValue());\n
textarea.val(ace_editor.getSession().getValue());\n
if (mode === \'python\') {\n
checkPythonSourceCode();\n
checkPythonSourceCode();\n
}\n
});\n
});\n
\n
\n
/* Only display the source code saving button if the main save button is\n
/* Only display the source code saving button if the main save button is\n
...
...
bt5/erp5_ace_editor/bt/revision
View file @
bc12cb2f
21
22
\ No newline at end of file
\ No newline at end of file
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