Commit c2cee8c3 authored by Vincent Pelletier's avatar Vincent Pelletier

Add "default_layout" support, so the website layout knows howto behave when...

Add "default_layout" support, so the website layout knows howto behave when displaying a form (needed buttons & hidden fields,...).
Fixed some functions returning overcomplicated paths or returning just a title.
Improved breadcrumb generation : now can also use the short title if present.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6296 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e6b2e24e
......@@ -219,7 +219,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value> <string>Short description that will appear in the search result list.</string> </value>
</item>
<item>
<key> <string>editable</string> </key>
......
......@@ -71,10 +71,10 @@
html_list = []\n
\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
text = None\n
for property in (\'title\', \'short_title\', \'id\'):\n
if text in (None, \'\') and hasattr(crumb, property):\n
text = getattr(crumb, property)\n
html_list.append(\'<a href="%s">%s</a>\' % (crumb.WebSite_getUrl(), text))\n
\n
return \' &gt; \'.join(html_list)\n
......@@ -127,6 +127,9 @@ return \' &gt; \'.join(html_list)\n
<string>crumb</string>
<string>None</string>
<string>text</string>
<string>property</string>
<string>hasattr</string>
<string>getattr</string>
</tuple>
</value>
</item>
......
......@@ -66,9 +66,10 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>document = context.WebSite_getDocumentValue()\n
<value> <string>#XXX This script should be named WebSite_getDocument\n
document = context.WebSite_getDocumentValue()\n
if document is not None:\n
return document.WebSite_getUrl()\n
return \'%s/%s\' % (context.WebSite_getSection(),document.getReference())\n
return context.WebSite_getUrl()\n
</string> </value>
</item>
......
......@@ -70,6 +70,8 @@
if portal_type == \'Web Site\':\n
return None\n
if portal_type == \'Web Section\':\n
if context.REQUEST[\'editable_mode\']:\n
return context\n
return context.getDefaultSourceValue()\n
return context\n
</string> </value>
......@@ -122,6 +124,7 @@ return context\n
<string>context</string>
<string>portal_type</string>
<string>None</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -68,7 +68,7 @@
<key> <string>_body</string> </key>
<value> <string>section = context.WebSite_getSectionValue()\n
if section is not None:\n
return section.getTitle()\n
return section.WebSite_getUrl()\n
return None\n
</string> </value>
</item>
......
......@@ -55,16 +55,18 @@
<value> <string encoding="cdata"><![CDATA[
<tal:block metal:define-macro="global_definition"\n
tal:define="filtered_actions python:context.portal_actions.listFilteredActionsFor(context);\n
tal:define="document context/WebSite_getDocumentValue">\n
<tal:block tal:define="filtered_actions python:document.portal_actions.listFilteredActionsFor(document);\n
object_actions filtered_actions/object_action | nothing;\n
global object_actions python: context.WebSite_replaceActionUrl(object_actions);\n
global object_actions python: document.WebSite_replaceActionUrl(object_actions);\n
workflow_actions filtered_actions/workflow | nothing;\n
global workflow_actions python: context.WebSite_replaceActionUrl(workflow_actions);\n
global workflow_actions python: document.WebSite_replaceActionUrl(workflow_actions);\n
jump_actions filtered_actions/object_jump | nothing;\n
global jump_actions python: context.WebSite_replaceActionUrl(jump_actions);\n
global jump_actions python: document.WebSite_replaceActionUrl(jump_actions);\n
view_actions filtered_actions/object_view | nothing;\n
global view_actions python: context.WebSite_replaceActionUrl(view_actions);\n
"/>
global view_actions python: document.WebSite_replaceActionUrl(view_actions);\n
"/>\n
</tal:block>
]]></string> </value>
</item>
......
......@@ -59,7 +59,8 @@
ignore_layout request/ignore_layout | nothing;\n
editable_mode request/editable_mode | nothing;\n
layout_form python:not(layout_form_id) or ignore_layout or getattr(here, layout_form_id, None);\n
layout_id layout_form/pt | string:view_master;">\n
default_layout string:view_master;\n
layout_id layout_form/pt | default_layout;">\n
<tal:block metal:use-macro="python:getattr(here,layout_id).macros[\'master\']">\n
<tal:block metal:fill-slot="main">\n
<tal:block tal:condition="python:(not editable_mode) and (not ignore_layout) and default_content is not None">\n
......@@ -67,10 +68,6 @@
global form python:here.WebPage_view;\n
global default_content_title python:here.getTitle()"/>\n
</tal:block>\n
<tal:block tal:replace="here/getPath"/><br/>\n
<tal:block tal:condition="not: editable_mode">not </tal:block>editable_mode<br/>\n
<tal:block tal:condition="not: ignore_layout">not </tal:block>ignore_layout<br/>\n
<tal:block tal:replace="default_content/getPath"/><br/>\n
<tal:block metal:use-macro="here/form_view/macros/form_render" />\n
</tal:block>\n
</tal:block>\n
......
Web Page Module | list_ui
Web Page Module | sort_on
Web Page Module | view
Web Page | history
Web Page | list
Web Page | metadata
Web Page | related
Web Page | render
Web Page | view
Web Section | history
Web Section | metadata
Web Section | predicate
Web Section | section
......@@ -13,6 +15,7 @@ Web Section | view
Web Site Module | list_ui
Web Site Module | sort_on
Web Site Module | view
Web Site | history
Web Site | metadata
Web Site | predicate
Web Site | view
\ 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