From a80a15de48a861808ad95037dae20257af3effb2 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Thu, 19 Oct 2006 16:06:11 +0000 Subject: [PATCH] Cache navigation box. Cache duration: 5 minutes, because of worklists in "my favourites" menu. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10838 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ERP5Site_renderCachedNavigationBox.xml | 149 ++++++++++++++++ .../navigation_box_render.xml | 162 ++++++++++++++++++ .../template_erp5_xhtml_style.xml | 92 +--------- .../bootstrap/erp5_xhtml_style/bt/revision | 2 +- 4 files changed, 314 insertions(+), 91 deletions(-) create mode 100644 product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ERP5Site_renderCachedNavigationBox.xml create mode 100644 product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/navigation_box_render.xml diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ERP5Site_renderCachedNavigationBox.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ERP5Site_renderCachedNavigationBox.xml new file mode 100644 index 0000000000..35b25c7cff --- /dev/null +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/ERP5Site_renderCachedNavigationBox.xml @@ -0,0 +1,149 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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>from Products.ERP5Type.Cache import CachingMethod\n +navigation_box_render = context.navigation_box_render\n +navigation_box_render = CachingMethod(navigation_box_render, ("ERP5Site_renderCachedNavigationBox", context.portal_membership.getAuthenticatedMember().getUserName()), cache_duration=300)\n +return navigation_box_render()\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></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>0</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>Products.ERP5Type.Cache</string> + <string>CachingMethod</string> + <string>_getattr_</string> + <string>context</string> + <string>navigation_box_render</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_renderCachedNavigationBox</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/navigation_box_render.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/navigation_box_render.xml new file mode 100644 index 0000000000..f9f61a68b3 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/navigation_box_render.xml @@ -0,0 +1,162 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PageTemplates.ZopePageTemplate</string> + <string>ZopePageTemplate</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>__ac_local_roles__</string> </key> + <value> + <none/> + </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_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> <string encoding="cdata"><![CDATA[ + +<tal:block tal:define="actions python: here.getPortalObject().portal_actions.listFilteredActionsFor(here)">\n + <span class="first">\n + <span id="favourites">\n + <select name="select_favorite"\n + tal:define="ordered_global_actions python:here.getOrderedGlobalActionList(actions[\'global\']);\n + user_actions actions/user;"\n + tal:attributes="onChange string:submitAction(this.form,\'Base_doFavorite\')">\n + <option selected="selected" value=""\n + i18n:translate="" i18n:domain="ui">My favourites</option>\n + <tal:block tal:repeat="action ordered_global_actions">\n + <option tal:condition="action/disabled"\n + disabled="disabled">-- <tal:block tal:content="action/title" i18n:translate="" i18n:domain="ui" /> --</option>\n + <tal:block tal:condition="not:action/disabled"\n + tal:define="name python: action.get(\'name\', \'\');\n + index python: name.find(\' (\');">\n + <option tal:condition="python: index >= 0"\n + tal:attributes="value action/url"><tal:block tal:content="python: name[:index]" i18n:translate="" i18n:domain="ui"></tal:block><tal:block tal:replace="python: name[index:]" /></option>\n + <option tal:condition="python: index < 0"\n + tal:attributes="value action/url"\n + tal:content="action/name"\n + i18n:translate="" i18n:domain="ui"></option>\n + </tal:block>\n + </tal:block>\n + <tal:block tal:condition="user_actions">\n + <option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">User</tal:block> --</option>\n + <option tal:repeat="action user_actions"\n + tal:content="action/name"\n + tal:attributes="value action/url"\n + i18n:translate="" i18n:domain="ui"></option>\n + </tal:block>\n + </select>\n + <button type="submit" name="Base_doFavorite:method" title="Select Favorite"\n + i18n:attributes="title" i18n:domain="ui">\n + <span class="image"></span>\n + <span class="description"\n + i18n:translate="" i18n:domain="ui">Select Favorite</span>\n + </button>\n + </span>\n + <span class="separator"></span>\n + <span id="modules">\n + <select name="select_module"\n + tal:define="module_list here/ERP5Site_getModuleItemList;"\n + tal:attributes="onChange string:submitAction(this.form,\'Base_doModule\')">\n + <option selected="selected" value="" i18n:translate="" i18n:domain="ui">ERP5 Modules</option>\n + <option tal:repeat="module module_list"\n + tal:attributes="value python: module[1]"\n + tal:content="python: module[0]"\n + tal:omit-tag="nothing"/>\n + </select>\n + <button type="submit" name="Base_doModule:method" title="Select Module"\n + i18n:attributes="title" i18n:domain="ui">\n + <span class="image"></span>\n + <span class="description"\n + i18n:translate="" i18n:domain="ui">Select Module</span>\n + </button>\n + </span>\n + </span>\n + <span class="second">\n + <span id="language">\n + <select name="select_language"\n + tal:attributes="onChange string:submitAction(this.form,\'Base_doLanguage\')">\n + <option value=""\n + i18n:translate="" i18n:domain="ui">My language</option>\n + <option tal:repeat="language python: here.Localizer.get_languages_map()"\n + tal:omit-tag="nothing"\n + tal:attributes="value language/id;\n + selected python: language[\'selected\'] and \'selected\' or nothing;"\n + tal:content="python: here.Localizer.erp5_ui.gettext(language[\'title\'], lang=language[\'id\'])" />\n + </select>\n + <button type="submit" name="Base_doLanguage:method" title="Select Language"\n + i18n:attributes="title" i18n:domain="ui">\n + <span class="image"></span>\n + <span class="description"\n + i18n:translate="" i18n:domain="ui">Select Language</span>\n + </button>\n + </span>\n + <span class="separator"></span>\n + <span id="search">\n + <input type="text" name="SearchableText" />\n + <button type="submit" name="Base_viewSearchResultList:method" title="Search"\n + i18n:attributes="title" i18n:domain="ui">\n + <span class="image"></span>\n + <span class="description"\n + i18n:translate="" i18n:domain="ui">Search</span>\n + </button>\n + </span>\n + </span>\n + <p class="clear"></p>\n +</tal:block> + +]]></string> </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>navigation_box_render</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml index ea6af24749..46f86f8b2f 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/template_erp5_xhtml_style.xml @@ -111,96 +111,8 @@ IDEAS:\n tal:attributes="name python: \'%s:method\' % (form_action, )" />\n <tal:block metal:use-macro="global_definitions_macros/http_definitions"/>\n <div id="bars">\n - <div id="main_bar">\n - <span class="first">\n - <span id="favourites">\n - <select name="select_favorite"\n - tal:define="ordered_global_actions python:here.getOrderedGlobalActionList(actions[\'global\']);\n - user_actions actions/user;"\n - tal:attributes="onChange string:submitAction(this.form,\'${url}/Base_doFavorite\')">\n - <option selected="selected" value=""\n - i18n:translate="" i18n:domain="ui">My favourites</option>\n - <tal:block tal:condition="ordered_global_actions">\n - <tal:block tal:repeat="action ordered_global_actions">\n - <option tal:condition="action/disabled"\n - disabled="disabled">-- <tal:block tal:content="action/title" i18n:translate="" i18n:domain="ui" /> --</option>\n - <tal:block tal:condition="not:action/disabled"\n - tal:define="name python: action.get(\'name\', \'\');\n - index python: name.find(\' (\');">\n - <option tal:condition="python: index >= 0"\n - tal:attributes="value action/url"><tal:block tal:content="python: name[:index]" i18n:translate="" i18n:domain="ui"></tal:block><tal:block tal:replace="python: name[index:]" /></option>\n - <option tal:condition="python: index < 0"\n - tal:attributes="value action/url"\n - tal:content="action/name"\n - i18n:translate="" i18n:domain="ui"></option>\n - </tal:block>\n - </tal:block>\n - </tal:block>\n - <tal:block tal:condition="user_actions">\n - <option disabled="disabled">-- <tal:block i18n:translate="" i18n:domain="ui">User</tal:block> --</option>\n - <option tal:repeat="action user_actions"\n - tal:content="action/name"\n - tal:attributes="value action/url"\n - i18n:translate="" i18n:domain="ui"></option>\n - </tal:block>\n - </select>\n - <button type="submit" name="Base_doFavorite:method" title="Select Favorite"\n - i18n:attributes="title" i18n:domain="ui">\n - <span class="image"></span>\n - <span class="description"\n - i18n:translate="" i18n:domain="ui">Select Favorite</span>\n - </button>\n - </span>\n - <span class="separator"></span>\n - <span id="modules">\n - <select name="select_module"\n - tal:define="module_list here/ERP5Site_getModuleItemList;"\n - tal:attributes="onChange string:submitAction(this.form,\'${url}/Base_doModule\')">\n - <option selected="selected" value="" i18n:translate="" i18n:domain="ui">ERP5 Modules</option>\n - <option tal:repeat="module module_list"\n - tal:attributes="value python: module[1]"\n - tal:content="python: module[0]"\n - tal:omit-tag="nothing"/>\n - </select>\n - <button type="submit" name="Base_doModule:method" title="Select Module"\n - i18n:attributes="title" i18n:domain="ui">\n - <span class="image"></span>\n - <span class="description"\n - i18n:translate="" i18n:domain="ui">Select Module</span>\n - </button>\n - </span>\n - </span>\n - <span class="second">\n - <span id="language">\n - <select name="select_language"\n - tal:attributes="onChange string:submitAction(this.form,\'${url}/Base_doLanguage\')">\n - <option value=""\n - i18n:translate="" i18n:domain="ui">My language</option>\n - <option tal:repeat="language python: here.Localizer.get_languages_map()"\n - tal:omit-tag="nothing"\n - tal:attributes="value language/id;\n - selected python: language[\'selected\'] and \'selected\' or nothing;"\n - tal:content="python: here.Localizer.erp5_ui.gettext(language[\'title\'], lang=language[\'id\'])" />\n - </select>\n - <button type="submit" name="Base_doLanguage:method" title="Select Language"\n - i18n:attributes="title" i18n:domain="ui">\n - <span class="image"></span>\n - <span class="description"\n - i18n:translate="" i18n:domain="ui">Select Language</span>\n - </button>\n - </span>\n - <span class="separator"></span>\n - <span id="search">\n - <input type="text" name="SearchableText" />\n - <button type="submit" name="Base_viewSearchResultList:method" title="Search"\n - i18n:attributes="title" i18n:domain="ui">\n - <span class="image"></span>\n - <span class="description"\n - i18n:translate="" i18n:domain="ui">Search</span>\n - </button>\n - </span>\n - </span>\n - <p class="clear"></p>\n + <div id="main_bar"\n + tal:content="structure here/ERP5Site_renderCachedNavigationBox">\n </div>\n <div id="context_bar">\n <tal:block metal:define-slot="context_bar"/>\n diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision index 8006072089..74de09f2e7 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision +++ b/product/ERP5/bootstrap/erp5_xhtml_style/bt/revision @@ -1 +1 @@ -272 \ No newline at end of file +274 \ No newline at end of file -- 2.30.9