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

Use a dedicated script to check if a Pad is empty or not.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42626 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a97f1901
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<!-- Render active Knowledge pad -->\n <!-- Render active Knowledge pad -->\n
<div id="pad-body-wrapper"\n <div id="pad-body-wrapper"\n
tal:condition="active_knowledge_pad">\n tal:condition="active_knowledge_pad">\n
<tal:block tal:replace="structure python: active_knowledge_pad.KnowledgePad_viewDashboardWidget(\n <tal:block tal:replace="structure python: active_knowledge_pad.KnowledgePad_viewDashboardWidget(\n
columns=columns,\n columns=columns,\n
real_context=here,\n real_context=here,\n
cancel_url=cancel_url)"/>\n cancel_url=cancel_url)"/>\n
......
<?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>"""\n
Is Knowledge Pad empty (i.e. no gadgets inside).\n
Use current Pad\'s layout.\n
"""\n
layout = context.KnowledgePad_getBoxColumnLayout()\n
return not sum([len(x) for x in layout])\n
</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>KnowledgePad_isEmpty</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -38,36 +38,33 @@ ...@@ -38,36 +38,33 @@
<div id="page_wrapper"\n <div id="page_wrapper"\n
tal:define="layout here/KnowledgePad_getBoxColumnLayout;\n tal:define="layout here/KnowledgePad_getBoxColumnLayout;\n
real_context python: options.get(\'real_context\', None);\n real_context python: options.get(\'real_context\', None);\n
cancel_url python: options.get(\'cancel_url\', None);\n cancel_url python: options.get(\'cancel_url\', None);\n
isAnon python: here.portal_membership.isAnonymousUser();\n isAnon python: here.portal_membership.isAnonymousUser();\n
is_tab_empty python: (len(layout)==1 and len(layout[0])==0) or\n is_tab_empty here/KnowledgePad_isEmpty;\n
(len(layout)==3 and len(layout[0]+layout[1]+layout[2])==0);\n columns python: options.get(\'columns\', 3);\n
columns python: options.get(\'columns\', 3);\n column_css_class python: test(isAnon, \n
column_css_class python: test(isAnon, \n \'portal-column portal-column-undraggable\', \n
\'portal-column portal-column-undraggable\', \n \'portal-column\');">\n
\'portal-column\');">\n
\n \n
<!-- No gadgets message -->\n <!-- No gadgets message -->\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/add_new_gadget_message"/> \n <span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/add_new_gadget_message"/> \n
\n \n
<!-- Render pad columns -->\n <!-- Render pad columns -->\n
<tal:block tal:repeat="column_index python: range(0, columns)">\n <tal:block tal:repeat="column_index python: range(0, columns)">\n
<div tal:attributes="class column_css_class;\n <div tal:condition="python: columns>=1+column_index"\n
id string:portal-column-${column_index}"\n tal:attributes="class column_css_class;\n
tal:condition="python: columns>=1+column_index">\n id string:portal-column-${column_index}">\n
\n \n
<tal:block tal:condition="python: len(layout)>=1+column_index"\n <tal:block tal:condition="python: len(layout)>=1+column_index"\n
tal:replace="structure python:\n tal:replace="structure python:\n
here.KnowledgePad_viewColumnWidget(section_layout=layout[column_index],\n here.KnowledgePad_viewColumnWidget(section_layout=layout[column_index],\n
real_context=real_context,\n real_context=real_context,\n
cancel_url=cancel_url)"/>\n cancel_url=cancel_url)"/>\n
\n
</div>\n </div>\n
</tal:block>\n </tal:block>\n
\n \n
</div>\n </div>
]]></unicode> </value> ]]></unicode> </value>
</item> </item>
...@@ -85,7 +82,7 @@ ...@@ -85,7 +82,7 @@
</item> </item>
<item> <item>
<key> <string>output_encoding</string> </key> <key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value> <value> <string>iso-8859-15</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
686 688
\ No newline at end of file \ 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