Commit 6bed77f3 authored by Ivan Tyagov's avatar Ivan Tyagov

Make SVG editor work for SVG image portal types as well.

parent a12c84ec
<?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>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Allow to edit SVG images.</string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_editor</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Edit</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}/Base_viewSVGEditor</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: object is not None and object.getContentType()=="image/svg+xml"</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>portal_type = context.getPortalType()\n
if portal_type in ("Web Illustration",):\n
text_content = context.getTextContent()\n
elif portal_type in ("Image",):\n
text_content = context.getData()\n
\n
return text_content\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getSVGTextContent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -55,7 +55,11 @@
"""\n
text_content = context.REQUEST.get("text")\n
if text_content is not None:\n
context.setTextContent(text_content)\n
portal_type = context.getPortalType()\n
if portal_type in ("Web Illustration",):\n
context.setTextContent(text_content)\n
elif portal_type in ("Image",):\n
context.setData(text_content)\n
</string> </value>
</item>
<item>
......@@ -64,7 +68,7 @@ if text_content is not None:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_setTextContentWrapper</string> </value>
<value> <string>Base_setSVGTextContent</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -102,7 +102,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebIllustration_viewEditor</string> </value>
<value> <string>Base_viewSVGEditor</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......
......@@ -41,7 +41,7 @@
<value> <unicode>window.onload = function() {\n
var svg_canvas = window.frames["svgframe"].svgCanvas;\n
var text_content = $.ajax({\n
url: "getTextContent",\n
url: "Base_getSVGTextContent",\n
async: false\n
}).responseText;\n
text_content != "" ? svg_canvas.setSvgString(text_content) : null;\n
......@@ -53,7 +53,7 @@ $(document).ready(function(){\n
var svg_canvas = window.frames["svgframe"].svgCanvas;\n
$.ajax({\n
type: "POST",\n
url: "Base_setTextContentWrapper",\n
url: "Base_setSVGTextContent",\n
data: "text=" + svg_canvas.getSvgString(),\n
success: function(){\n
window.location.reload();\n
......@@ -77,7 +77,7 @@ $(document).ready(function(){\n
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
<value> <string>iso-8859-15</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
29
\ No newline at end of file
30
\ No newline at end of file
Image | view_editor
\ No newline at end of file
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