Commit 3c374695 authored by Ivan Tyagov's avatar Ivan Tyagov

With proper configuration it's now possible to make generic...

With proper configuration it's now possible to make generic ERP5Site_viewHomeAreaRenderer (usable to render a gadgets in columns). Make ERP5Site_getActiveKnowledgePadForUser generic.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40915 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent af62ce11
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
......@@ -53,7 +50,51 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># REQUEST can be used to get active pad\n
<value> <string encoding="cdata"><![CDATA[
isAnon = context.portal_membership.isAnonymousUser()\n
if isAnon and len(knowledge_pads)>=1:\n
# for anonymous we return the first one found \n
return knowledge_pads[0], knowledge_pads\n
\n
# use info from REQUEST\n
active_pad, knowledge_pads = \\\n
context.ERP5Site_getActiveKnowledgePadForUserFromRequest(knowledge_pads,\n
\'active_pad_url\')\n
if active_pad is not None and active_pad.getValidationState() in (\'visible\', \'public\',):\n
return active_pad, knowledge_pads\n
\n
# use info from REQUEST\n
active_knowledge_pad, knowledge_pads = \\\n
context.ERP5Site_getActiveKnowledgePadForUserFromRequest(knowledge_pads,\n
\'override_catalog\')\n
if active_knowledge_pad is not None:\n
return active_knowledge_pad, knowledge_pads\n
\n
# first filter if we have a custom Pad for the context\n
for knowledge_pad in knowledge_pads:\n
if knowledge_pad.getPublicationSectionValue() == context and \\\n
knowledge_pad.getValidationState() in (\'visible\', \'public\',):\n
if (knowledge_pad.getPublicationSectionValue().getPortalType() == \'Web Site\' and \\\n
default_pad_group is None):\n
# return default active front page pad\n
return knowledge_pad, knowledge_pads\n
elif (knowledge_pad.getPublicationSectionValue() == context and \\\n
knowledge_pad.getGroup() == default_pad_group):\n
# some Web Section can have a customized EXPLICILY "sticked" Pad\n
return knowledge_pad, knowledge_pads\n
\n
# no customized version found for this context so\n
# try finding pad by group\n
for knowledge_pad in knowledge_pads:\n
if knowledge_pad.getGroup() == default_pad_group and \\\n
knowledge_pad.getValidationState() in (\'visible\', \'public\',):\n
return knowledge_pad, knowledge_pads\n
\n
return None, knowledge_pads\n
\n
"""\n
# REQUEST can be used to get active pad\n
active_knowledge_pad, knowledge_pads = \\\n
context.ERP5Site_getActiveKnowledgePadForUserFromRequest(knowledge_pads,\n
\'override_catalog\')\n
......@@ -72,7 +113,10 @@ if active_knowledge_pad is None:\n
context.ERP5Site_getActiveKnowledgePadForUserFromRequest(knowledge_pads,\n
\'active_pad_url\')\n
return active_knowledge_pad, knowledge_pads\n
</string> </value>
"""\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......@@ -112,9 +156,13 @@ return active_knowledge_pad, knowledge_pads\n
<string>default_pad_group</string>
<string>_getattr_</string>
<string>context</string>
<string>isAnon</string>
<string>len</string>
<string>_getitem_</string>
<string>_getiter_</string>
<string>active_knowledge_pad</string>
<string>active_pad</string>
<string>None</string>
<string>active_knowledge_pad</string>
<string>knowledge_pad</string>
</tuple>
</value>
......
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="EditorField" module="Products.ERP5Form.EditorField"/>
<tuple/>
</tuple>
<global name="EditorField" module="Products.ERP5Form.EditorField"/>
</pickle>
<pickle>
<dictionary>
......@@ -300,19 +297,13 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/ERP5Site_viewHomeAreaRenderer</string> </value>
<value> <string>python:here.ERP5Site_viewHomeAreaRenderer(mode= \'erp5_front\', default_pad_group=\'\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -37,15 +37,14 @@
<value> <unicode encoding="cdata"><![CDATA[
<tal:block \n
tal:define="mode python: \'erp5_front\';\n
default_pad_group python: \'\';\n
knowledge_pads python:\n
here.ERP5Site_getKnowledgePadListForUser(mode=mode);\n
tal:define="mode python: options.get(\'mode\', \'erp5_front\');\n
default_pad_group python: options.get(\'default_pad_group\', \'\');\n
knowledge_pads python: here.ERP5Site_getKnowledgePadListForUser(mode=mode);\n
struct python: here.ERP5Site_getActiveKnowledgePadForUser(knowledge_pads);\n
global active_knowledge_pad python: struct[0];\n
knowledge_pads python: struct[1];\n
hasUserActivity python:\n
here.ERP5Site_hasUserActivity(active_knowledge_pad,\n
columns python: options.get(\'columns\', 3);\n
hasUserActivity python: here.ERP5Site_hasUserActivity(active_knowledge_pad,\n
mode=mode,\n
default_pad_group=default_pad_group);\n
isAnon python: here.portal_membership.isAnonymousUser();\n
......@@ -62,46 +61,44 @@
\n
<div id="gadget_area_wrapper">\n
\n
<div tal:condition="isAnon">\n
<h3 i18n:translate="" i18n:domain="ui"> You are not logged in.</h3>\n
<h5><a href="login_form" i18n:translate="" i18n:domain="ui">Log in</a></h5>\n
</div>\n
<tal:block tal:condition="python: not createDefaultPadForUser and \n
not waitForActivitiesOnServer and\n
active_knowledge_pad is not None">\n
\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/knowledge_pad_security_check"> Security check\n
</span>\n
\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/disable_server_integration"> Disable slot</span>\n
\n
<tal:block tal:condition="python: not isAnon and \n
not createDefaultPadForUser and \n
not waitForActivitiesOnServer">\n
<!-- Pad navigation -->\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/navigation"/>\n
\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/navigation"> Navigation\n
</span>\n
<tal:block tal:condition="not: isAnon"> \n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/knowledge_pad_security_check"/> \n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/disable_server_integration"/>\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/disable_server_integration"/> \n
</tal:block>\n
\n
<!-- Render active Knowledge pad -->\n
<span tal:condition="active_knowledge_pad"\n
tal:replace="structure python: active_knowledge_pad.KnowledgePad_viewDashboardWidget(real_context=here,\n
cancel_url=cancel_url)"/>\n
tal:replace="structure python: active_knowledge_pad.KnowledgePad_viewDashboardWidget(\n
columns=columns,\n
real_context=here,\n
cancel_url=cancel_url)"/>\n
\n
<!-- Dialogs -->\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/hidden_dialogs"> Dialogs\n
</span>\n
<!-- Hidden dialogs -->\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/hidden_dialogs"/>\n
\n
</tal:block>\n
\n
<!-- Show message that default pad is being prepared. -->\n
<div tal:condition="python: waitForActivitiesOnServer and \n
isUserAllowedToCreateKnowledgePads">\n
<div class="wait_block">\n
<h2 i18n:translate="" i18n:domain="ui"> \n
Please wait until your home is being updated.</h2>\n
<p i18n:translate="" i18n:domain="ui"> You\'ll be automatically redirected.</p>\n
<script type="text/javascript">\n
checkForActivitiesOnServer(5000, \'view\', \'erp5_front\', \'\');\n
</script>\n
</div>\n
<script type="text/javascript" \n
tal:content="string: checkForActivitiesOnServer(5000, \'view\', \'${mode}\', \'\');"/>\n
</div>\n
</div>\n
\n
<!-- Create (asynch) default pad. -->\n
<div tal:condition="python: not waitForActivitiesOnServer and \n
isUserAllowedToCreateKnowledgePads and\n
createDefaultPadForUser">\n
......@@ -110,12 +107,9 @@
Please wait until your tab is being prepared.\n
</h2>\n
<p i18n:translate="" i18n:domain="ui"> You\'ll be automatically redirected.</p>\n
<script type="text/javascript">\n
createDefaultPadOnServer(5000,\n
\'ERP5Site_createDefaultKnowledgePadListForUser\',\n
\'\',\n
\'view\', \'erp5_front\');\n
</script>\n
<script type="text/javascript"\n
tal:content="string: createDefaultPadOnServer(5000, \'ERP5Site_createDefaultKnowledgePadListForUser\',\n
\'\', \'view\', \'${mode}\');"/>\n
</div>\n
</div>\n
\n
......
......@@ -47,7 +47,7 @@
knowledge_pads python: here.ERP5Site_getKnowledgePadListForUser(\n
mode=mode,\n
default_pad_group=default_pad_group);\n
struct python: here.WebSite_getActiveKnowledgePadForUser(knowledge_pads, \n
struct python: here.ERP5Site_getActiveKnowledgePadForUser(knowledge_pads, \n
default_pad_group);\n
active_knowledge_pad python: struct[0];\n
knowledge_pads python: struct[1];\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</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 encoding="cdata"><![CDATA[
isAnon = context.portal_membership.isAnonymousUser()\n
if isAnon and len(knowledge_pads)>=1:\n
# for anonymous we return the first one found \n
return knowledge_pads[0], knowledge_pads\n
\n
# use info from REQUEST\n
active_pad, knowledge_pads = \\\n
context.ERP5Site_getActiveKnowledgePadForUserFromRequest(knowledge_pads,\n
\'active_pad_url\')\n
if active_pad is not None and active_pad.getValidationState() in (\'visible\', \'public\',):\n
return active_pad, knowledge_pads\n
\n
# use info from REQUEST\n
active_knowledge_pad, knowledge_pads = \\\n
context.ERP5Site_getActiveKnowledgePadForUserFromRequest(knowledge_pads,\n
\'override_catalog\')\n
if active_knowledge_pad is not None:\n
return active_knowledge_pad, knowledge_pads\n
\n
# first filter if we have a custom Pad for the context\n
for knowledge_pad in knowledge_pads:\n
if knowledge_pad.getPublicationSectionValue() == context and \\\n
knowledge_pad.getValidationState() in (\'visible\', \'public\',):\n
if (knowledge_pad.getPublicationSectionValue().getPortalType() == \'Web Site\' and \\\n
default_pad_group is None):\n
# return default active front page pad\n
return knowledge_pad, knowledge_pads\n
elif (knowledge_pad.getPublicationSectionValue() == context and \\\n
knowledge_pad.getGroup() == default_pad_group):\n
# some Web Section can have a customized EXPLICILY "sticked" Pad\n
return knowledge_pad, knowledge_pads\n
\n
# no customized version found for this context so\n
# try finding pad by group\n
for knowledge_pad in knowledge_pads:\n
if knowledge_pad.getGroup() == default_pad_group and \\\n
knowledge_pad.getValidationState() in (\'visible\', \'public\',):\n
return knowledge_pad, knowledge_pads\n
\n
return None, knowledge_pads\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>knowledge_pads = [], default_pad_group = None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>knowledge_pads</string>
<string>default_pad_group</string>
<string>_getattr_</string>
<string>context</string>
<string>isAnon</string>
<string>len</string>
<string>_getitem_</string>
<string>_getiter_</string>
<string>active_pad</string>
<string>None</string>
<string>active_knowledge_pad</string>
<string>knowledge_pad</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<list/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_getActiveKnowledgePadForUser</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get active knowledge pad for user</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ERP5Form" module="Products.ERP5Form.Form"/>
<tuple/>
</tuple>
</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></string> </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>knowledge_pads</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/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSite_viewHomeAreaForm</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>ERP5Site_viewHomeArea</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></string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<tal:block \n
tal:define="mode python: \'web_front\';\n
default_pad_group python: \'\';\n
knowledge_pads python: \n
here.ERP5Site_getKnowledgePadListForUser(mode=mode);\n
struct python: here.WebSite_getActiveKnowledgePadForUser(knowledge_pads);\n
active_knowledge_pad python: struct[0];\n
knowledge_pads python: struct[1];\n
hasUserActivity python: here.ERP5Site_hasUserActivity(\n
\t active_knowledge_pad,\n
mode=mode,\n
default_pad_group=default_pad_group);\n
isAnon python: here.portal_membership.isAnonymousUser();\n
columns python: options.get(\'columns\', 3);\n
createDefaultPadForUser python: len(knowledge_pads)==0 and\n
not hasUserActivity;\n
waitForActivitiesOnServer python: active_knowledge_pad is None and\n
hasUserActivity;\n
isUserAllowedToCreateKnowledgePads\n
context/Base_isUserAllowedToUseKnowledgePad;\n
isKnowledgePadTemplateUsed python: \n
request.get(\'is_knowledge_pad_template_used\', 0);\n
isAnonymousKnowledgePadUsed python: request.get(\'use_anonymous_knowledge_pad\', False);\n
cancel_url here/absolute_url;">\n
\n
<tal:block tal:condition="python: not createDefaultPadForUser and \n
not waitForActivitiesOnServer and\n
active_knowledge_pad is not None">\n
\n
<tal:block tal:condition="not: isAnon"> \n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/disable_server_integration"> Disable slot</span>\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/navigation"> \n
Navigation</span>\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/hidden_dialogs">\n
Dialogs</span>\n
</tal:block>\n
<div tal:condition="active_knowledge_pad"\n
tal:content="structure python: active_knowledge_pad.KnowledgePad_viewDashboardWidget(columns=columns,\n
real_context=here,\n
cancel_url=cancel_url)"/> \n
</tal:block>\n
\n
<div tal:condition="python: not isAnon and \n
waitForActivitiesOnServer\n
and isUserAllowedToCreateKnowledgePads">\n
\n
<div class="wait_block">\n
<h2 i18n:translate="" i18n:domain="ui"> \n
Please wait until your home is being updated.</h2>\n
<p i18n:translate="" i18n:domain="ui"> You\'ll be automatically redirected.</p>\n
<script type="text/javascript">\n
checkForActivitiesOnServer(5000, \'view\', \'web_front\', \'\');\n
</script>\n
</div>\n
\n
</div>\n
\n
<div tal:condition="python: not isAnon and \n
createDefaultPadForUser \n
and isUserAllowedToCreateKnowledgePads">\n
<div class="wait_block">\n
<h2 i18n:translate="" i18n:domain="ui"> \n
Please wait until your tab is being prepared.\n
</h2>\n
<p i18n:translate="" i18n:domain="ui"> You\'ll be automatically redirected.</p>\n
<script type="text/javascript">\n
createDefaultPadOnServer(5000,\n
\'ERP5Site_createDefaultKnowledgePadListForUser\', \'\',\n
\'view\', \'web_front\');\n
</script>\n
</div>\n
</div>\n
\n
<span metal:use-macro="container/Base_viewKnowledgePadMacroLibrary/macros/knowledge_pad_security_check"> Security check\n
</span>\n
\n
</tal:block>\n
]]></unicode> </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>WebSite_viewHomeAreaFormRenderer</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>
628
\ No newline at end of file
630
\ 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