[Erp5-report] r28154 - in /erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style: SkinTemplat...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jul 23 15:08:38 CEST 2009


Author: ivan
Date: Thu Jul 23 15:08:37 2009
New Revision: 28154

URL: http://svn.erp5.org?rev=28154&view=rev
Log:
Avoid calculating possible tabs for erp5_tabber.js and add all tabs as this will improve its rendering time.
Fix bad caching and move it to script level.

Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getConfiguredStatusDict.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/erp5_tabber.js.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getConfiguredStatusDict.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getConfiguredStatusDict.xml?rev=28154&r1=28153&r2=28154&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getConfiguredStatusDict.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getConfiguredStatusDict.xml [utf8] Thu Jul 23 15:08:37 2009
@@ -53,30 +53,41 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string># Probe known skins to determine whether erp5_base and erp5_dms are installed.\n
-basic_mode = (getattr(context, \'Currency_view\', None) is not None)\n
-dms_mode = (getattr(context, \'DocumentModule_viewDocumentList\', None) is not None)\n
-\n
-express_pref_dict = context.ERP5Site_getExpressPreferenceDict()\n
-subscription_status = express_pref_dict.get(\'subscription_status\')\n
-configuration_status = express_pref_dict.get(\'configuration_status\')\n
-user_id = express_pref_dict.get(\'user_id\')\n
-\n
-SUPPORT_ENABLED = \'support_enabled\'\n
-SUPPORT_DISABLED = \'support_disabled\'\n
-ADVERTISEMENT_ENABLED = \'advertisement_enabled\'\n
+            <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
 \n
 portal = context.getPortalObject()\n
 \n
-if getattr(portal, \'portal_wizard\', None) is None:\n
-  express_mode = SUPPORT_DISABLED\n
-elif subscription_status:\n
-  if user_id:\n
-    express_mode = SUPPORT_ENABLED\n
+def getConfiguredStatusDict():\n
+\n
+  # Probe known skins to determine whether erp5_base and erp5_dms are installed.\n
+  basic_mode = (getattr(context, \'Currency_view\', None) is not None)\n
+  dms_mode = (getattr(context, \'DocumentModule_viewDocumentList\', None) is not None)\n
+\n
+  express_pref_dict = context.ERP5Site_getExpressPreferenceDict()\n
+  subscription_status = express_pref_dict.get(\'subscription_status\')\n
+  configuration_status = express_pref_dict.get(\'configuration_status\')\n
+  user_id = express_pref_dict.get(\'user_id\')\n
+\n
+  SUPPORT_ENABLED = \'support_enabled\'\n
+  SUPPORT_DISABLED = \'support_disabled\'\n
+  ADVERTISEMENT_ENABLED = \'advertisement_enabled\'\n
+\n
+  if getattr(portal, \'portal_wizard\', None) is None:\n
+    express_mode = SUPPORT_DISABLED\n
+  elif subscription_status:\n
+    if user_id:\n
+      express_mode = SUPPORT_ENABLED\n
+    else:\n
+      express_mode = SUPPORT_DISABLED\n
   else:\n
-    express_mode = SUPPORT_DISABLED\n
-else:\n
-  express_mode = ADVERTISEMENT_ENABLED\n
+    express_mode = ADVERTISEMENT_ENABLED\n
+  return basic_mode, dms_mode, express_mode\n
+\n
+getConfiguredStatusDict = CachingMethod(getConfiguredStatusDict, \\\n
+                                        id = \'ERP5Site_getConfiguredStatusDict\', \\\n
+                                        cache_factory = \'erp5_ui_long\')\n
+\n
+basic_mode, dms_mode, express_mode = getConfiguredStatusDict()\n
 \n
 # One more test for express\n
 # If a user uses an account for configurator, only express tab will be displayed.\n
@@ -136,25 +147,22 @@
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
-                            <string>getattr</string>
+                            <string>Products.ERP5Type.Cache</string>
+                            <string>CachingMethod</string>
+                            <string>_getattr_</string>
                             <string>context</string>
-                            <string>None</string>
+                            <string>portal</string>
+                            <string>getConfiguredStatusDict</string>
+                            <string>_getiter_</string>
                             <string>basic_mode</string>
                             <string>dms_mode</string>
-                            <string>_getattr_</string>
-                            <string>express_pref_dict</string>
-                            <string>subscription_status</string>
-                            <string>configuration_status</string>
-                            <string>user_id</string>
-                            <string>SUPPORT_ENABLED</string>
-                            <string>SUPPORT_DISABLED</string>
-                            <string>ADVERTISEMENT_ENABLED</string>
-                            <string>portal</string>
                             <string>express_mode</string>
                             <string>member</string>
                             <string>list</string>
                             <string>role_list</string>
                             <string>group_list</string>
+                            <string>getattr</string>
+                            <string>None</string>
                             <string>getGroups</string>
                             <string>False</string>
                           </tuple>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml?rev=28154&r1=28153&r2=28154&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_getTabList.xml [utf8] Thu Jul 23 15:08:37 2009
@@ -55,13 +55,13 @@
             <key> <string>_body</string> </key>
             <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
 \n
-def getTabList(status_dict, info_dict):\n
+def getTabList(status_dict, info_dict, add_all_tabs):\n
   tab_list = []\n
-  basic_mode = status_dict[\'basic_mode\']\n
-  dms_mode = status_dict[\'dms_mode\']\n
-  express_mode = status_dict[\'express_mode\']\n
-\n
-  if dms_mode:\n
+  basic_mode = status_dict.get(\'basic_mode\', 1)\n
+  dms_mode = status_dict.get(\'dms_mode\', 1)\n
+  express_mode = status_dict.get(\'express_mode\', 1)\n
+\n
+  if dms_mode or add_all_tabs:\n
     tab_list.append({\'id\': \'quick_search_tab\',\n
                      \'icon\': \'tab_icon/access_search.png\',\n
                      \'renderer\': \'ERP5Site_renderQuickSearchDialog\',\n
@@ -72,59 +72,64 @@
                      \'renderer\': \'ERP5Site_renderContributionDialog\',\n
                      \'title\': \'Contribute\'})\n
 \n
-  if basic_mode:\n
-    if info_dict.get(\'view\'):\n
+  if basic_mode or add_all_tabs:\n
+    if info_dict.get(\'view\') or add_all_tabs:\n
       tab_list.append({\'id\': \'browse_tab\',\n
                        \'icon\': \'tab_icon/list.png\',\n
                        \'renderer\': \'ERP5Site_renderViewActionList\',\n
                        \'title\': \'Browse\'})\n
-    if info_dict.get(\'add\'):\n
+    if info_dict.get(\'add\') or add_all_tabs:\n
       tab_list.append({\'id\': \'document_creation_tab\',\n
                        \'icon\': \'tab_icon/filenew.png\',\n
                        \'renderer\': \'ERP5Site_renderDocumentCreationActionList\',\n
                        \'title\': \'New\'})\n
 \n
-    if info_dict.get(\'search\'):\n
+    if info_dict.get(\'search\') or add_all_tabs:\n
       tab_list.append({\'id\': \'document_search_tab\',\n
                        \'icon\': \'tab_icon/filefind.png\',\n
                        \'renderer\': \'ERP5Site_renderDocumentSearchActionList\',\n
                        \'title\': \'Dig\'})\n
 \n
-    if info_dict.get(\'report\'):\n
+    if info_dict.get(\'report\') or add_all_tabs:\n
       tab_list.append({\'id\': \'report_tab\',\n
                        \'icon\': \'tab_icon/webexport.png\',\n
                        \'renderer\': \'ERP5Site_renderReportActionList\',\n
                        \'title\': \'Reports\'})\n
 \n
-    if info_dict.get(\'print\'):\n
+    if info_dict.get(\'print\') or add_all_tabs:\n
       tab_list.append({\'id\': \'printout_tab\',\n
                        \'icon\': \'tab_icon/ps.png\',\n
                        \'renderer\': \'ERP5Site_renderPrintActionList\',\n
                        \'title\': \'Printouts\'})\n
 \n
-    if info_dict.get(\'exchange\'):\n
+    if info_dict.get(\'exchange\') or add_all_tabs:\n
       tab_list.append({\'id\': \'exchange_tab\',\n
                        \'icon\': \'tab_icon/imp-exp.png\',\n
                        \'renderer\': \'ERP5Site_renderExchangeActionList\',\n
                        \'title\': \'Exchange\'})\n
 \n
-  if express_mode in (\'support_enabled\', \'advertisement_enabled\'):\n
+  if express_mode in (\'support_enabled\', \'advertisement_enabled\') or add_all_tabs:\n
     tab_list.append({\'id\': \'express_support_tab\',\n
                      \'icon\': \'tab_icon/support.png\',\n
                      \'renderer\': \'ERP5Site_renderExpressSupport\',\n
                      \'title\': \'Express Support\'})\n
   return tab_list\n
 \n
+\n
+status_dict = {}\n
+info_dict = {}\n
+if not add_all_tabs:\n
+  # we have to calculate possible tabs\n
+  status_dict = context.ERP5Site_getConfiguredStatusDict()\n
+  info_dict = context.ERP5Site_getCategorizedModuleActionInformationDict()\n
+\n
 getTabList = CachingMethod(getTabList, \\\n
                            id = \'ERP5Site_getTabListInternal\', \\\n
                            cache_factory = \'erp5_ui_long\')\n
 \n
-ERP5Site_getConfiguredStatusDict = CachingMethod(context.ERP5Site_getConfiguredStatusDict, \\\n
-                                                 id = \'ERP5Site_getConfiguredStatusDict\', \\\n
-                                                 cache_factory = \'erp5_ui_long\')\n
-\n
-return getTabList(status_dict = ERP5Site_getConfiguredStatusDict(), \\\n
-                  info_dict = context.ERP5Site_getCategorizedModuleActionInformationDict())\n
+return getTabList(status_dict = status_dict, \\\n
+                  info_dict = info_dict, \\\n
+                  add_all_tabs = add_all_tabs)\n
 </string> </value>
         </item>
         <item>
@@ -135,7 +140,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string></string> </value>
+            <value> <string>add_all_tabs=0</string> </value>
         </item>
         <item>
             <key> <string>errors</string> </key>
@@ -155,18 +160,20 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>0</int> </value>
+                        <value> <int>1</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
                         <value>
                           <tuple>
+                            <string>add_all_tabs</string>
                             <string>Products.ERP5Type.Cache</string>
                             <string>CachingMethod</string>
                             <string>getTabList</string>
+                            <string>status_dict</string>
+                            <string>info_dict</string>
                             <string>_getattr_</string>
                             <string>context</string>
-                            <string>ERP5Site_getConfiguredStatusDict</string>
                           </tuple>
                         </value>
                     </item>
@@ -178,7 +185,9 @@
         <item>
             <key> <string>func_defaults</string> </key>
             <value>
-              <none/>
+              <tuple>
+                <int>0</int>
+              </tuple>
             </value>
         </item>
         <item>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/erp5_tabber.js.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/erp5_tabber.js.xml?rev=28154&r1=28153&r2=28154&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/erp5_tabber.js.xml [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/erp5_tabber.js.xml [utf8] Thu Jul 23 15:08:37 2009
@@ -85,7 +85,7 @@
 \n
   var mapping = {\n
   <tal:block \n
-  tal:replace="structure python: \',\\n\'.join([\'%s: \\x22%s\\x22\' %(x[\'id\'], x[\'renderer\']) for x in context.ERP5Site_getTabList()])"></tal:block>\n
+  tal:replace="structure python: \',\\n\'.join([\'%s: \\x22%s\\x22\' %(x[\'id\'], x[\'renderer\']) for x in context.ERP5Site_getTabList(add_all_tabs=1)])"></tal:block>\n
   };\n
 \n
   var url = mapping[this.parentNode.id];\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision?rev=28154&r1=28153&r2=28154&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision [utf8] (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_xhtml_style/bt/revision [utf8] Thu Jul 23 15:08:37 2009
@@ -1,1 +1,1 @@
-783
+784




More information about the Erp5-report mailing list