Commit fc01af6e authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added a propertysheet so that the display of default page in a section can be...

Added a propertysheet so that the display of default page in a section can be turned off. This is useful for example to define translatable content through web pages in relation with a web section, although the web section should display a list of items. (ex. news, press, products in a shop, etc.)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22294 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a6b2010
...@@ -175,6 +175,7 @@ class WebSection(Domain, PermanentURLMixIn): ...@@ -175,6 +175,7 @@ class WebSection(Domain, PermanentURLMixIn):
custom_render_method_id = self.getCustomRenderMethodId() custom_render_method_id = self.getCustomRenderMethodId()
if custom_render_method_id is not None: if custom_render_method_id is not None:
return getattr(self, custom_render_method_id)() return getattr(self, custom_render_method_id)()
if self.isDefaultPageDisplayed():
# The following could be moved to a typed based method for more flexibility # The following could be moved to a typed based method for more flexibility
document = self.getDefaultDocumentValue() document = self.getDefaultDocumentValue()
if document is None: if document is None:
...@@ -222,8 +223,6 @@ class WebSection(Domain, PermanentURLMixIn): ...@@ -222,8 +223,6 @@ class WebSection(Domain, PermanentURLMixIn):
result = self._getTypeBasedMethod('getDefaultDocumentValue', result = self._getTypeBasedMethod('getDefaultDocumentValue',
fallback_script_id='WebSection_getDefaultDocumentValue')() fallback_script_id='WebSection_getDefaultDocumentValue')()
if result is not None:
result = result.__of__(self)
if cache is not None: if cache is not None:
cache[key] = result cache[key] = result
...@@ -253,8 +252,6 @@ class WebSection(Domain, PermanentURLMixIn): ...@@ -253,8 +252,6 @@ class WebSection(Domain, PermanentURLMixIn):
result = self._getTypeBasedMethod('getDocumentValueList', result = self._getTypeBasedMethod('getDocumentValueList',
fallback_script_id='WebSection_getDocumentValueList')(**kw) fallback_script_id='WebSection_getDocumentValueList')(**kw)
if result is not None:
result = [doc.__of__(self) for doc in result]
if cache is not None: if cache is not None:
cache[key] = result cache[key] = result
......
...@@ -57,6 +57,11 @@ class WebSection: ...@@ -57,6 +57,11 @@ class WebSection:
'description' : 'Defines visibility of current section.', 'description' : 'Defines visibility of current section.',
'type' : 'boolean', 'type' : 'boolean',
'mode' : 'rw' }, 'mode' : 'rw' },
{ 'id' : 'default_page_displayed',
'description' : 'Defines whether the default page should be displayed.',
'type' : 'boolean',
'default' : 1,
'mode' : 'rw' },
{ 'id' : 'custom_render_method_id', { 'id' : 'custom_render_method_id',
'description' : 'ID of a page template, script, form or any callable object' 'description' : 'ID of a page template, script, form or any callable object'
'which overrides the default rendering of the section', 'which overrides the default rendering of the section',
...@@ -77,7 +82,7 @@ class WebSection: ...@@ -77,7 +82,7 @@ class WebSection:
{ 'id' : 'authorization_forced', { 'id' : 'authorization_forced',
'description' : 'Force authorization for anonymous user if document can not be found.', 'description' : 'Force authorization for anonymous user if document can not be found.',
'type' : 'boolean', 'type' : 'boolean',
'default': 0, 'default' : 0,
'mode' : 'rw' }, 'mode' : 'rw' },
) )
......
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