From d078c17d5462b1c870709ec5cc8c0693780f6ac7 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Wed, 15 Mar 2006 14:11:39 +0000 Subject: [PATCH] Implement erp5_web API. Remove useless pythons scripts (related to a specific use of erp5_web). Fix WebSite_createContent. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6105 20353a03-c40f-0410-a6d1-a30d3c3de9de --- bt5/erp5_web/LocalRolesTemplateItem/.xml | 2 +- .../ModuleTemplateItem/web_page_module.xml | 96 +++------- .../ModuleTemplateItem/web_site_module.xml | 96 +++------- .../PathTemplateItem/erp5_deferred_mysql.xml | 2 +- .../erp5_web/WebSection_view/listbox.xml | 2 +- .../erp5_web/WebSite_createContent.xml | 37 ++-- .../erp5_web/WebSite_getBreadcrumb.xml | 36 ++-- ...ist.xml => WebSite_getBreadcrumbValue.xml} | 42 +++-- .../erp5_web/WebSite_getDocument.xml | 169 ++++++++++++++++++ .../WebSite_getDocumentPhysicalPath.xml | 153 ++++++++++++++++ ...Section.xml => WebSite_getDocumentUrl.xml} | 30 ++-- .../erp5_web/WebSite_getDocumentValue.xml | 152 ++++++++++++++++ ...t.xml => WebSite_getDocumentValueList.xml} | 8 +- .../erp5_web/WebSite_getSection.xml | 148 +++++++++++++++ .../erp5_web/WebSite_getSectionValue.xml | 153 ++++++++++++++++ .../portal_skins/erp5_web/WebSite_getSite.xml | 4 +- .../portal_skins/erp5_web/WebSite_getUrl.xml | 161 +++++++++++++++++ .../erp5_web/WebSite_globalDefinition.xml | 90 ++++++++++ .../erp5_web/WebSite_replaceActionUrl.xml | 159 ++++++++++++++++ .../erp5_web/section_form_view.xml | 9 +- 20 files changed, 1321 insertions(+), 228 deletions(-) rename bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/{WebSite_getMainSectionList.xml => WebSite_getBreadcrumbValue.xml} (80%) create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocument.xml create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentPhysicalPath.xml rename bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/{WebSite_getMainSection.xml => WebSite_getDocumentUrl.xml} (84%) create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValue.xml rename bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/{WebSite_getDocumentList.xml => WebSite_getDocumentValueList.xml} (95%) create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSection.xml create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSectionValue.xml create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getUrl.xml create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_globalDefinition.xml create mode 100755 bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_replaceActionUrl.xml diff --git a/bt5/erp5_web/LocalRolesTemplateItem/.xml b/bt5/erp5_web/LocalRolesTemplateItem/.xml index 9ce7af19be..6986525ec1 100755 --- a/bt5/erp5_web/LocalRolesTemplateItem/.xml +++ b/bt5/erp5_web/LocalRolesTemplateItem/.xml @@ -1,6 +1,6 @@ <local_roles_item> <local_roles> - <role id='jp'> + <role id='vincent'> <item>Owner</item> </role> </local_roles> diff --git a/bt5/erp5_web/ModuleTemplateItem/web_page_module.xml b/bt5/erp5_web/ModuleTemplateItem/web_page_module.xml index 99eb545993..0bd2f4b394 100755 --- a/bt5/erp5_web/ModuleTemplateItem/web_page_module.xml +++ b/bt5/erp5_web/ModuleTemplateItem/web_page_module.xml @@ -19,9 +19,6 @@ <permission> <name>Access session data</name> </permission> - <permission> - <name>AccessContentsInformation</name> - </permission> <permission> <name>Add Accelerated HTTP Cache Managers</name> </permission> @@ -29,10 +26,10 @@ <name>Add BTreeFolder2s</name> </permission> <permission> - <name>Add Base18 Tools</name> + <name>Add Browser Id Manager</name> </permission> <permission> - <name>Add Browser Id Manager</name> + <name>Add CMF Action Icons Tools</name> </permission> <permission> <name>Add CMF Active Processs</name> @@ -40,32 +37,38 @@ <permission> <name>Add CMF Caching Policy Managers</name> </permission> + <permission> + <name>Add CMF Calendar Tools</name> + </permission> <permission> <name>Add CMF Core Tools</name> </permission> + <permission> + <name>Add CMF Default Tools</name> + </permission> <permission> <name>Add CMF Report Tools</name> </permission> <permission> - <name>Add CMF Sites</name> + <name>Add CMF Setup Tools</name> </permission> <permission> - <name>Add CMFActivity Tools</name> + <name>Add CMF Sites</name> </permission> <permission> - <name>Add CMFCalendar Tools</name> + <name>Add CMF Unique Id Tools</name> </permission> <permission> - <name>Add CMFCategory Tools</name> + <name>Add CMFActivity Tools</name> </permission> <permission> - <name>Add CMFDefault Tools</name> + <name>Add CMFCategory Tools</name> </permission> <permission> <name>Add CMFMailIn Tools</name> </permission> <permission> - <name>Add CMFWiki Comment</name> + <name>Add Configured CMF Sites</name> </permission> <permission> <name>Add Content Type Registrys</name> @@ -115,9 +118,6 @@ <permission> <name>Add ERP5Form Tools</name> </permission> - <permission> - <name>Add ERP5Shop Tools</name> - </permission> <permission> <name>Add ERP5SyncML Tools</name> </permission> @@ -151,9 +151,6 @@ <permission> <name>Add Localizers</name> </permission> - <permission> - <name>Add MMM Shop Toolss</name> - </permission> <permission> <name>Add MailHost objects</name> </permission> @@ -173,7 +170,7 @@ <name>Add Pluggable Index</name> </permission> <permission> - <name>Add Portal ZSyncer Tools</name> + <name>Add Plugin Registrys</name> </permission> <permission> <name>Add Python Scripts</name> @@ -226,9 +223,6 @@ <permission> <name>Add ZODB Mount Points</name> </permission> - <permission> - <name>Add ZSyncers</name> - </permission> <permission> <name>Add Zope Tutorials</name> </permission> @@ -247,15 +241,9 @@ <permission> <name>Add portal topics</name> </permission> - <permission> - <name>Add shop category</name> - </permission> <permission> <name>Change Browser Id Manager</name> </permission> - <permission> - <name>Change CMFWiki Regulations</name> - </permission> <permission> <name>Change DTML Documents</name> </permission> @@ -319,6 +307,9 @@ <permission> <name>Change configuration</name> </permission> + <permission> + <name>Change local roles</name> + </permission> <permission> <name>Change permissions</name> </permission> @@ -331,15 +322,9 @@ <permission> <name>Change proxy roles</name> </permission> - <permission> - <name>Checkout shopping cart</name> - </permission> <permission> <name>Copy or Move</name> </permission> - <permission> - <name>Create CMFWiki Page</name> - </permission> <permission> <name>Create Transient Objects</name> </permission> @@ -355,12 +340,6 @@ <permission> <name>Download ExtFile/ExtImage</name> </permission> - <permission> - <name>Download Product</name> - </permission> - <permission> - <name>Edit CMFWiki Page</name> - </permission> <permission> <name>Edit Factories</name> </permission> @@ -397,9 +376,15 @@ <permission> <name>Manage Access Rules</name> </permission> + <permission> + <name>Manage Groups</name> + </permission> <permission> <name>Manage Transient Object Container</name> </permission> + <permission> + <name>Manage Translation Services</name> + </permission> <permission> <name>Manage Vocabulary</name> </permission> @@ -415,12 +400,6 @@ <permission> <name>Manage ZCatalogIndex Entries</name> </permission> - <permission> - <name>Manage currencies</name> - </permission> - <permission> - <name>Manage extensions</name> - </permission> <permission> <name>Manage languages</name> </permission> @@ -433,30 +412,15 @@ <permission> <name>Manage properties</name> </permission> - <permission> - <name>Manage shop</name> - </permission> - <permission> - <name>Manage shop catalog</name> - </permission> - <permission> - <name>Manage shop category</name> - </permission> <permission> <name>Manage users</name> </permission> - <permission> - <name>Manage_messages</name> - </permission> <permission> <name>Modify Cookie Crumblers</name> </permission> <permission> <name>Modify portal content</name> </permission> - <permission> - <name>Move CMFWiki Page</name> - </permission> <permission> <name>Open/Close Database Connection</name> </permission> @@ -484,6 +448,9 @@ <permission> <name>Search ZCatalog</name> </permission> + <permission> + <name>Search for principals</name> + </permission> <permission> <name>Set own password</name> </permission> @@ -532,15 +499,6 @@ <permission> <name>WebDAV access</name> </permission> - <permission> - <name>ZSyncer: Use ZSyncer</name> - </permission> - <permission> - <name>ZopeProfiler: manage</name> - </permission> - <permission> - <name>ZopeProfiler: view</name> - </permission> </permission_list> <portal_type>Web Page Module</portal_type> <title>Web Pages</title> diff --git a/bt5/erp5_web/ModuleTemplateItem/web_site_module.xml b/bt5/erp5_web/ModuleTemplateItem/web_site_module.xml index a2471405a1..d3e269261e 100755 --- a/bt5/erp5_web/ModuleTemplateItem/web_site_module.xml +++ b/bt5/erp5_web/ModuleTemplateItem/web_site_module.xml @@ -19,9 +19,6 @@ <permission> <name>Access session data</name> </permission> - <permission> - <name>AccessContentsInformation</name> - </permission> <permission> <name>Add Accelerated HTTP Cache Managers</name> </permission> @@ -29,10 +26,10 @@ <name>Add BTreeFolder2s</name> </permission> <permission> - <name>Add Base18 Tools</name> + <name>Add Browser Id Manager</name> </permission> <permission> - <name>Add Browser Id Manager</name> + <name>Add CMF Action Icons Tools</name> </permission> <permission> <name>Add CMF Active Processs</name> @@ -40,32 +37,38 @@ <permission> <name>Add CMF Caching Policy Managers</name> </permission> + <permission> + <name>Add CMF Calendar Tools</name> + </permission> <permission> <name>Add CMF Core Tools</name> </permission> + <permission> + <name>Add CMF Default Tools</name> + </permission> <permission> <name>Add CMF Report Tools</name> </permission> <permission> - <name>Add CMF Sites</name> + <name>Add CMF Setup Tools</name> </permission> <permission> - <name>Add CMFActivity Tools</name> + <name>Add CMF Sites</name> </permission> <permission> - <name>Add CMFCalendar Tools</name> + <name>Add CMF Unique Id Tools</name> </permission> <permission> - <name>Add CMFCategory Tools</name> + <name>Add CMFActivity Tools</name> </permission> <permission> - <name>Add CMFDefault Tools</name> + <name>Add CMFCategory Tools</name> </permission> <permission> <name>Add CMFMailIn Tools</name> </permission> <permission> - <name>Add CMFWiki Comment</name> + <name>Add Configured CMF Sites</name> </permission> <permission> <name>Add Content Type Registrys</name> @@ -115,9 +118,6 @@ <permission> <name>Add ERP5Form Tools</name> </permission> - <permission> - <name>Add ERP5Shop Tools</name> - </permission> <permission> <name>Add ERP5SyncML Tools</name> </permission> @@ -151,9 +151,6 @@ <permission> <name>Add Localizers</name> </permission> - <permission> - <name>Add MMM Shop Toolss</name> - </permission> <permission> <name>Add MailHost objects</name> </permission> @@ -173,7 +170,7 @@ <name>Add Pluggable Index</name> </permission> <permission> - <name>Add Portal ZSyncer Tools</name> + <name>Add Plugin Registrys</name> </permission> <permission> <name>Add Python Scripts</name> @@ -226,9 +223,6 @@ <permission> <name>Add ZODB Mount Points</name> </permission> - <permission> - <name>Add ZSyncers</name> - </permission> <permission> <name>Add Zope Tutorials</name> </permission> @@ -247,15 +241,9 @@ <permission> <name>Add portal topics</name> </permission> - <permission> - <name>Add shop category</name> - </permission> <permission> <name>Change Browser Id Manager</name> </permission> - <permission> - <name>Change CMFWiki Regulations</name> - </permission> <permission> <name>Change DTML Documents</name> </permission> @@ -319,6 +307,9 @@ <permission> <name>Change configuration</name> </permission> + <permission> + <name>Change local roles</name> + </permission> <permission> <name>Change permissions</name> </permission> @@ -331,15 +322,9 @@ <permission> <name>Change proxy roles</name> </permission> - <permission> - <name>Checkout shopping cart</name> - </permission> <permission> <name>Copy or Move</name> </permission> - <permission> - <name>Create CMFWiki Page</name> - </permission> <permission> <name>Create Transient Objects</name> </permission> @@ -355,12 +340,6 @@ <permission> <name>Download ExtFile/ExtImage</name> </permission> - <permission> - <name>Download Product</name> - </permission> - <permission> - <name>Edit CMFWiki Page</name> - </permission> <permission> <name>Edit Factories</name> </permission> @@ -397,9 +376,15 @@ <permission> <name>Manage Access Rules</name> </permission> + <permission> + <name>Manage Groups</name> + </permission> <permission> <name>Manage Transient Object Container</name> </permission> + <permission> + <name>Manage Translation Services</name> + </permission> <permission> <name>Manage Vocabulary</name> </permission> @@ -415,12 +400,6 @@ <permission> <name>Manage ZCatalogIndex Entries</name> </permission> - <permission> - <name>Manage currencies</name> - </permission> - <permission> - <name>Manage extensions</name> - </permission> <permission> <name>Manage languages</name> </permission> @@ -433,30 +412,15 @@ <permission> <name>Manage properties</name> </permission> - <permission> - <name>Manage shop</name> - </permission> - <permission> - <name>Manage shop catalog</name> - </permission> - <permission> - <name>Manage shop category</name> - </permission> <permission> <name>Manage users</name> </permission> - <permission> - <name>Manage_messages</name> - </permission> <permission> <name>Modify Cookie Crumblers</name> </permission> <permission> <name>Modify portal content</name> </permission> - <permission> - <name>Move CMFWiki Page</name> - </permission> <permission> <name>Open/Close Database Connection</name> </permission> @@ -484,6 +448,9 @@ <permission> <name>Search ZCatalog</name> </permission> + <permission> + <name>Search for principals</name> + </permission> <permission> <name>Set own password</name> </permission> @@ -532,15 +499,6 @@ <permission> <name>WebDAV access</name> </permission> - <permission> - <name>ZSyncer: Use ZSyncer</name> - </permission> - <permission> - <name>ZopeProfiler: manage</name> - </permission> - <permission> - <name>ZopeProfiler: view</name> - </permission> </permission_list> <portal_type>Web Site Module</portal_type> <title>Web Sites</title> diff --git a/bt5/erp5_web/PathTemplateItem/erp5_deferred_mysql.xml b/bt5/erp5_web/PathTemplateItem/erp5_deferred_mysql.xml index 362aff6cc2..fa4db72dfb 100755 --- a/bt5/erp5_web/PathTemplateItem/erp5_deferred_mysql.xml +++ b/bt5/erp5_web/PathTemplateItem/erp5_deferred_mysql.xml @@ -26,7 +26,7 @@ </item> <item> <key> <string>connection_string</string> </key> - <value> <string>erp5 erp5 erp5</string> </value> + <value> <string>website2 erp5 erp5</string> </value> </item> <item> <key> <string>id</string> </key> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_view/listbox.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_view/listbox.xml index 1d9cdbd33e..138a249a74 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_view/listbox.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_view/listbox.xml @@ -565,7 +565,7 @@ <dictionary> <item> <key> <string>method_name</string> </key> - <value> <string>WebSite_getDocumentList</string> </value> + <value> <string>WebSite_getDocumentValueList</string> </value> </item> </dictionary> </pickle> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_createContent.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_createContent.xml index 32306b3b11..cfa46c121b 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_createContent.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_createContent.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>Python_magic</string> </key> - <value> <string encoding="base64">O/INCg==</string> </value> + <value> <string encoding="base64">bfINCg==</string> </value> </item> <item> <key> <string>Script_magic</string> </key> @@ -66,29 +66,27 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>if create or duplicate:\n - type_name=\'Web Page\'\n -else:\n + <value> <string>portal_type = context.getPortalType()\n +if portal_type not in (\'Web Page\', \'Web Section\'):\n + context.log(\'WebSite_createContent\', \'Unable to clone type %s. Nothing done.\' % type_name)\n return\n \n request = context.REQUEST\n \n -module = context.getDefaultModule(portal_type=type_name)\n +module = context.getDefaultModule(portal_type=portal_type)\n new_id = module.generateNewId()\n -new_content = module.newContent(portal_type=type_name,\n +new_content = module.newContent(portal_type=portal_type,\n container=module,\n id=str(new_id))\n new_content.setCategories(context.getCategories())\n new_content.setReference(reference)\n -new_content.setTitle(title)\n new_content.setShortTitle(short_title)\n new_content.setVersion(version)\n -#new_content.setLanguage(language)\n -if duplicate:\n - new_content.setTextContent(context.getTextContent())\n +new_content.setLanguage(language)\n +new_content.setTextContent(context.getTextContent())\n \n -#redirect_url = new_content.WebSite_getDocumentUrl()\n -redirect_url = "%s/%s" % (request.URL2,new_content.getReference())\n +redirect_url = new_content.WebSite_getDocumentUrl()\n +context.log(\'WebSite_createContent\',\'redirect_url = %s\' % redirect_url)\n return request.RESPONSE.redirect( redirect_url )\n </string> </value> </item> @@ -100,7 +98,7 @@ return request.RESPONSE.redirect( redirect_url )\n </item> <item> <key> <string>_filepath</string> </key> - <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_createContent</string> </value> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_createContent</string> </value> </item> <item> <key> <string>_owner</string> </key> @@ -110,7 +108,7 @@ return request.RESPONSE.redirect( redirect_url )\n </item> <item> <key> <string>_params</string> </key> - <value> <string>reference=\'\', version=\'\', language=\'\', title=\'\', short_title=\'\', create=None, duplicate=None</string> </value> + <value> <string>parent_url=\'\', reference=\'\', version=\'\', language=\'\', short_title=\'\'</string> </value> </item> <item> <key> <string>errors</string> </key> @@ -130,22 +128,21 @@ return request.RESPONSE.redirect( redirect_url )\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>7</int> </value> + <value> <int>5</int> </value> </item> <item> <key> <string>co_varnames</string> </key> <value> <tuple> + <string>parent_url</string> <string>reference</string> <string>version</string> <string>language</string> - <string>title</string> <string>short_title</string> - <string>create</string> - <string>duplicate</string> - <string>type_name</string> <string>_getattr_</string> <string>context</string> + <string>portal_type</string> + <string>type_name</string> <string>request</string> <string>module</string> <string>new_id</string> @@ -169,8 +166,6 @@ return request.RESPONSE.redirect( redirect_url )\n <string></string> <string></string> <string></string> - <none/> - <none/> </tuple> </value> </item> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumb.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumb.xml index 7a065a7b89..0f5cfc32fc 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumb.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumb.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>Python_magic</string> </key> - <value> <string encoding="base64">O/INCg==</string> </value> + <value> <string encoding="base64">bfINCg==</string> </value> </item> <item> <key> <string>Script_magic</string> </key> @@ -68,23 +68,16 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ -current_section = context\n -if current_section.getPortalType() in (\'Web Site\', \'Web Section\'):\n - breadcrumb_list = []\n -else:\n - breadcrumb_list = [\'<a href="%s">%s</a>\' % (current_section.WebSite_getDocumentUrl(), current_section.getTitle())]\n -while current_section is not None and current_section.getPortalType() != \'Web Site\':\n - if current_section.getPortalType() == \'Web Section\':\n - breadcrumb_list.append(\'<a href="%s">%s</a>\' % (current_section.WebSite_getDocumentUrl(), current_section.getTitle()))\n - previous_section = current_section\n - current_section = current_section.getParent()\n +html_list = []\n \n -if current_section.getPortalType() == \'Web Site\':\n - breadcrumb_list.append(\'<a href="%s">%s</a>\' % (current_section.WebSite_getDocumentUrl(), current_section.getTitle()))\n +for crumb in context.WebSite_getBreadcrumbValue():\n + if crumb.getTitle() is None or crumb.getTitle() == \'\':\n + text = crumb.getId()\n + else:\n + text = crumb.getTitle()\n + html_list.append(\'<a href="%s">%s</a>\' % (crumb.WebSite_getUrl(), text))\n \n -breadcrumb_list.reverse()\n -\n -return \' > \'.join(breadcrumb_list)\n +return \' > \'.join(html_list)\n ]]></string> </value> @@ -97,7 +90,7 @@ return \' > \'.join(breadcrumb_list)\n </item> <item> <key> <string>_filepath</string> </key> - <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_getBreadcrumb</string> </value> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getBreadcrumb</string> </value> </item> <item> <key> <string>_params</string> </key> @@ -127,12 +120,13 @@ return \' > \'.join(breadcrumb_list)\n <key> <string>co_varnames</string> </key> <value> <tuple> - <string>context</string> - <string>current_section</string> + <string>html_list</string> + <string>_getiter_</string> <string>_getattr_</string> - <string>breadcrumb_list</string> + <string>context</string> + <string>crumb</string> <string>None</string> - <string>previous_section</string> + <string>text</string> </tuple> </value> </item> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSectionList.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumbValue.xml similarity index 80% rename from bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSectionList.xml rename to bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumbValue.xml index dcec647ab5..7e8ab13c37 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSectionList.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getBreadcrumbValue.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>Python_magic</string> </key> - <value> <string encoding="base64">O/INCg==</string> </value> + <value> <string encoding="base64">bfINCg==</string> </value> </item> <item> <key> <string>Script_magic</string> </key> @@ -66,18 +66,19 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>current_section = context\n -if current_section.getPortalType() == \'Web Section\':\n - previous_section = current_section\n -else:\n - previous_section = None\n -while current_section is not None and current_section.getPortalType() != \'Web Site\':\n - if current_section.getPortalType() == \'Web Section\':\n - previous_section = current_section\n - current_section = current_section.getParent()\n + <value> <string>crumb = context\n +crumb_list = []\n \n -section_list = current_section.objectValues(portal_type = \'Web Section\', sort_on=\'int_index\')\n -return filter(lambda x: x.isVisible(), section_list)\n +while hasattr(crumb,\'getPortalType\'):\n + crumb_list.append(crumb)\n + if crumb.getPortalType() == \'Web Site\':\n + crumb = None # Don\'t go higher than the first Web Site found\n + else:\n + crumb = crumb.getParent()\n +\n +crumb_list.reverse()\n +\n +return crumb_list\n </string> </value> </item> <item> @@ -88,7 +89,13 @@ return filter(lambda x: x.isVisible(), section_list)\n </item> <item> <key> <string>_filepath</string> </key> - <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_getMainSectionList</string> </value> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getBreadcrumbValue</string> </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> </item> <item> <key> <string>_params</string> </key> @@ -119,12 +126,11 @@ return filter(lambda x: x.isVisible(), section_list)\n <value> <tuple> <string>context</string> - <string>current_section</string> + <string>crumb</string> + <string>crumb_list</string> + <string>hasattr</string> <string>_getattr_</string> - <string>previous_section</string> <string>None</string> - <string>section_list</string> - <string>filter</string> </tuple> </value> </item> @@ -141,7 +147,7 @@ return filter(lambda x: x.isVisible(), section_list)\n </item> <item> <key> <string>id</string> </key> - <value> <string>WebSite_getMainSectionList</string> </value> + <value> <string>WebSite_getBreadcrumbValue</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocument.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocument.xml new file mode 100755 index 0000000000..f2762c4552 --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocument.xml @@ -0,0 +1,169 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>portal_catalog = portal.portal_catalog\n +\n +# First try to get a published document\n +matching_document_list = portal_catalog(reference = \'%s\' % name, portal_type=(\'Web Page\',), validation_state=\'published\')\n +if len(matching_document_list):\n + return matching_document_list[0].getObject()\n +# Then try to get any document\n +matching_document_list = portal_catalog(reference = \'%s\' % name, portal_type=(\'Web Page\',))\n +if len(matching_document_list):\n + return matching_document_list[0].getObject()\n +return None\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getDocument</string> </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>portal, name</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </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>portal</string> + <string>name</string> + <string>_getattr_</string> + <string>portal_catalog</string> + <string>matching_document_list</string> + <string>len</string> + <string>_getitem_</string> + <string>None</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>WebSite_getDocument</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentPhysicalPath.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentPhysicalPath.xml new file mode 100755 index 0000000000..c864b1cadc --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentPhysicalPath.xml @@ -0,0 +1,153 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>if reference_path is None:\n + reference_path = context\n +if context.WebSite_getDocumentValue() is not None:\n + return "%s/%s" % (reference_path.WebSite_getSectionValue().WebSite_getUrl(),context.WebSite_getDocumentValue().getRelativeUrl())\n +return None\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getDocumentPhysicalPath</string> </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>reference_path = 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>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>reference_path</string> + <string>None</string> + <string>context</string> + <string>_getattr_</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSite_getDocumentPhysicalPath</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSection.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml similarity index 84% rename from bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSection.xml rename to bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml index e9332c4f30..84c359a2db 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getMainSection.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentUrl.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>Python_magic</string> </key> - <value> <string encoding="base64">O/INCg==</string> </value> + <value> <string encoding="base64">bfINCg==</string> </value> </item> <item> <key> <string>Script_magic</string> </key> @@ -66,17 +66,9 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>current_section = context\n -if current_section.getPortalType() == \'Web Section\':\n - previous_section = current_section\n -else:\n - previous_section = None\n -while current_section is not None and current_section.getPortalType() != \'Web Site\':\n - if current_section.getPortalType() == \'Web Section\':\n - previous_section = current_section\n - current_section = current_section.getParent()\n -\n -return previous_section\n + <value> <string>if context.WebSite_getDocumentValue() is not None:\n + return context.WebSite_getDocumentValue().WebSite_getUrl()\n +return context.WebSite_getUrl()\n </string> </value> </item> <item> @@ -87,7 +79,13 @@ return previous_section\n </item> <item> <key> <string>_filepath</string> </key> - <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_getMainSection</string> </value> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getDocumentUrl</string> </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> </item> <item> <key> <string>_params</string> </key> @@ -117,10 +115,8 @@ return previous_section\n <key> <string>co_varnames</string> </key> <value> <tuple> - <string>context</string> - <string>current_section</string> <string>_getattr_</string> - <string>previous_section</string> + <string>context</string> <string>None</string> </tuple> </value> @@ -138,7 +134,7 @@ return previous_section\n </item> <item> <key> <string>id</string> </key> - <value> <string>WebSite_getMainSection</string> </value> + <value> <string>WebSite_getDocumentUrl</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValue.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValue.xml new file mode 100755 index 0000000000..e7e471acee --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValue.xml @@ -0,0 +1,152 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>portal_type = context.getPortalType()\n +if portal_type == \'Web Site\':\n + return None\n +if portal_type == \'Web Section\':\n + return context.getDefaultSourceValue()\n +return context\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getDocumentValue</string> </value> + </item> + <item> + <key> <string>_owner</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>_getattr_</string> + <string>context</string> + <string>portal_type</string> + <string>None</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>WebSite_getDocumentValue</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentList.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValueList.xml similarity index 95% rename from bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentList.xml rename to bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValueList.xml index e38a6b1b9d..a8f244b952 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentList.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getDocumentValueList.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>Python_magic</string> </key> - <value> <string encoding="base64">O/INCg==</string> </value> + <value> <string encoding="base64">bfINCg==</string> </value> </item> <item> <key> <string>Script_magic</string> </key> @@ -76,7 +76,7 @@ def content_cmp(c1, c2):\n c2_value = c2.getObject() \n #if hasattr(c1, \'getShortTitle\') and c1.getShortTitle() == \'Overview\': return -1\n #if hasattr(c2, \'getShortTitle\') and c2.getShortTitle() == \'Overview\': return 1\n - return cmp(c1_value.getIntIndex(), c2_value.getIntIndex()) \n + return cmp(c1_value.getIntIndex(), c2_value.getIntIndex())\n \n if context.getMembershipCriterionCategoryList():\n domain = DomainSelection(domain_dict = {\'web_site\': context})\n @@ -120,7 +120,7 @@ return brain_list\n </item> <item> <key> <string>_filepath</string> </key> - <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_getDocumentList</string> </value> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getDocumentValueList</string> </value> </item> <item> <key> <string>_params</string> </key> @@ -186,7 +186,7 @@ return brain_list\n </item> <item> <key> <string>id</string> </key> - <value> <string>WebSite_getDocumentList</string> </value> + <value> <string>WebSite_getDocumentValueList</string> </value> </item> <item> <key> <string>warnings</string> </key> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSection.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSection.xml new file mode 100755 index 0000000000..d83a689445 --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSection.xml @@ -0,0 +1,148 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>if context.WebSite_getSectionValue() is not None:\n + return context.WebSite_getSectionValue().getTitle()\n +return None\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getSection</string> </value> + </item> + <item> + <key> <string>_owner</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>_getattr_</string> +<string>context</string> + <string>None</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>WebSite_getSection</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSectionValue.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSectionValue.xml new file mode 100755 index 0000000000..3dcdfffb07 --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSectionValue.xml @@ -0,0 +1,153 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>while context is not None and context.getPortalType() not in (\'Web Section\', \'Web Site\'):\n + context = context.getParent()\n +\n +if context is None:\n + return None\n +if context.getPortalType() == \'Web Site\':\n + return None\n +return context\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getSectionValue</string> </value> + </item> + <item> + <key> <string>_owner</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>context</string> + <string>None</string> + <string>_getattr_</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>WebSite_getSectionValue</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSite.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSite.xml index 6db201108e..2bc1dedcd1 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSite.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getSite.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>Python_magic</string> </key> - <value> <string encoding="base64">O/INCg==</string> </value> + <value> <string encoding="base64">bfINCg==</string> </value> </item> <item> <key> <string>Script_magic</string> </key> @@ -81,7 +81,7 @@ return current_section\n </item> <item> <key> <string>_filepath</string> </key> - <value> <string>Script (Python):/nexedi/portal_skins/erp5_web/WebSite_getSite</string> </value> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getSite</string> </value> </item> <item> <key> <string>_owner</string> </key> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getUrl.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getUrl.xml new file mode 100755 index 0000000000..767261ff7a --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_getUrl.xml @@ -0,0 +1,161 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>path_list = []\n +\n +for crumb in context.WebSite_getBreadcrumbValue():\n + if crumb.getPortalType() == \'Web Site\':\n + path_list = [context.WebSite_getSite().absolute_url()]\n + elif hasattr(crumb, \'default_reference\') and \\\n + crumb.getPortalType() == \'Web Page\' and \\\n + \'Module\' not in crumb.getParent().getPortalType():\n + path_list.append(crumb.getReference())\n + else:\n + path_list.append(crumb.getId())\n +\n +return \'/\'.join(path_list)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_getUrl</string> </value> + </item> + <item> + <key> <string>_owner</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>path_list</string> + <string>_getiter_</string> + <string>_getattr_</string> + <string>context</string> + <string>crumb</string> + <string>hasattr</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>WebSite_getUrl</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_globalDefinition.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_globalDefinition.xml new file mode 100755 index 0000000000..d889886575 --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_globalDefinition.xml @@ -0,0 +1,90 @@ +<?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>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_text</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<tal:block metal:define-macro="global_definition"\n + tal:define="filtered_actions python:context.portal_actions.listFilteredActionsFor(context);\n + object_actions filtered_actions/object_action | nothing;\n + global object_actions python: context.WebSite_replaceActionUrl(object_actions);\n + workflow_actions filtered_actions/workflow | nothing;\n + global workflow_actions python: context.WebSite_replaceActionUrl(workflow_actions);\n + jump_actions filtered_actions/object_jump | nothing;\n + global jump_actions python: context.WebSite_replaceActionUrl(jump_actions);\n + view_actions filtered_actions/object_view | nothing;\n + global view_actions python: context.WebSite_replaceActionUrl(view_actions);\n +"/> + +]]></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>WebSite_globalDefinition</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_replaceActionUrl.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_replaceActionUrl.xml new file mode 100755 index 0000000000..0e3db06eb2 --- /dev/null +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSite_replaceActionUrl.xml @@ -0,0 +1,159 @@ +<?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> <string encoding="base64">bfINCg==</string> </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>if action is not None:\n + for pos in range(len(action)):\n + if action[pos].has_key(\'url\'):\n + #context.log(\'WebSite_replaceActionUrl\',\'before : %s\' % action[pos][\'url\'])\n + action[pos].update({\'url\' : action[pos][\'url\'].replace(context.absolute_url(),context.WebSite_getDocumentPhysicalPath())})\n + context.log(\'WebSite_replaceActionUrl\',\'after : %s\' % action[pos][\'url\'])\n +\n +return action\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> <string>Script (Python):/erp5/portal_skins/erp5_web/WebSite_replaceActionUrl</string> </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>action</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>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>action</string> + <string>None</string> + <string>_getiter_</string> + <string>range</string> + <string>len</string> + <string>pos</string> + <string>_getattr_</string> + <string>_getitem_</string> + <string>context</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>WebSite_replaceActionUrl</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/section_form_view.xml b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/section_form_view.xml index fa76d6f1ae..7c81341524 100755 --- a/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/section_form_view.xml +++ b/bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/section_form_view.xml @@ -64,10 +64,11 @@ <tal:block metal:fill-slot="main">\n <tal:block tal:condition="not: editable_mode">\n <tal:block tal:condition="python:(not ignore_layout) and default_content">\n - <tal:block tal:define="global here python:default_content;\n - global form python:here.WebPage_view;\n - global default_content_title python:here.getTitle()" />\n - <tal:block metal:use-macro="here/form_view/macros/form_render" />\n + <tal:block tal:define="here python:default_content;\n + form python:here.WebPage_view;\n + default_content_title python:here.getTitle()">\n + <tal:block metal:use-macro="here/form_view/macros/form_render" />\n + </tal:block>\n </tal:block>\n <tal:block tal:condition="python: ignore_layout or (not default_content)">\n <tal:block metal:use-macro="here/form_view/macros/form_render" />\n -- 2.30.9