Commit 0b79c351 authored by Nicolas Delaby's avatar Nicolas Delaby

Add new Render Method getTranslatedIndentedTitle

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17393 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2c85667b
...@@ -188,7 +188,7 @@ class Category(Folder): ...@@ -188,7 +188,7 @@ class Category(Folder):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getIndentedTitle') 'getIndentedTitle')
def getIndentedTitle(self): def getIndentedTitle(self, item_method = 'getTitle'):
""" """
Returns title or id, indented from base_category. Returns title or id, indented from base_category.
""" """
...@@ -205,12 +205,20 @@ class Category(Folder): ...@@ -205,12 +205,20 @@ class Category(Folder):
if path_len >= 2: if path_len >= 2:
logical_title_list.append(' ' * 4 * (path_len - 1)) logical_title_list.append(' ' * 4 * (path_len - 1))
logical_title = self.getTitle() logical_title = getattr(self, item_method)()
if logical_title in [None, '']: if logical_title in [None, '']:
logical_title = self.getId() logical_title = self.getId()
logical_title_list.append(logical_title) logical_title_list.append(logical_title)
return ''.join(logical_title_list) return ''.join(logical_title_list)
security.declareProtected(Permissions.AccessContentsInformation,
'getTranslatedIndentedTitle')
def getTranslatedIndentedTitle(self):
"""
Returns translated logical path, started under base category.
"""
return self.getIndentedTitle(item_method='getTranslatedTitle')
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildValueList') 'getCategoryChildValueList')
def getCategoryChildValueList(self, recursive=1, include_if_child=1, def getCategoryChildValueList(self, recursive=1, include_if_child=1,
...@@ -403,6 +411,17 @@ class Category(Folder): ...@@ -403,6 +411,17 @@ class Category(Folder):
return self.getCategoryChildItemList(recursive=recursive, return self.getCategoryChildItemList(recursive=recursive,
display_id='indented_title', base=base, **kw) display_id='indented_title', base=base, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildTranslatedIndentedTitleItemList')
def getCategoryChildTranslatedIndentedTitleItemList(self,
recursive=1, base=0, **kw):
"""
Returns a list of tuples by parsing recursively all categories in a
given list of base categories. Uses getIndentedTitle as default method
"""
return self.getCategoryChildItemList(recursive=recursive,
display_id='translated_indented_title', base=base, **kw)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getCategoryChildIdItemList') 'getCategoryChildIdItemList')
def getCategoryChildIdItemList(self, recursive=1, base=0, **kw): def getCategoryChildIdItemList(self, recursive=1, base=0, **kw):
......
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