Commit e55fef28 authored by Mayoro Diagne's avatar Mayoro Diagne

Do not add empty section in getSectionList of documentations

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24078 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1bf517b4
No related merge requests found
...@@ -63,50 +63,71 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper): ...@@ -63,50 +63,71 @@ class BusinessTemplateDocumentationHelper(DocumentationHelper):
""" """
Returns a list of documentation sections Returns a list of documentation sections
""" """
return map(lambda x: x.__of__(self), [ section_list = []
DocumentationSection( if self.getPortalTypeURIList() != []:
id='portal_type', section_list.append(
title='Portal Types', DocumentationSection(
class_name='PortalTypeDocumentationHelper', id='portal_type',
uri_list=self.getPortalTypeURIList(), title='Portal Types',
), class_name='PortalTypeDocumentationHelper',
DocumentationSection( uri_list=self.getPortalTypeURIList(),
id='dc_workflow', )
title='DC Workflows', )
class_name='DCWorkflowDocumentationHelper', if self.getDCWorkflowURIList() != []:
uri_list=self.getDCWorkflowURIList(), section_list.append(
), DocumentationSection(
DocumentationSection( id='dc_workflow',
id='interaction_workflow', title='DC Workflows',
title='Interaction Workflows', class_name='DCWorkflowDocumentationHelper',
class_name='InteractionWorkflowDocumentationHelper', uri_list=self.getDCWorkflowURIList(),
uri_list=self.getInteractionWorkflowURIList(), )
), )
DocumentationSection( if self.getInteractionWorkflowURIList() != []:
id='skin_folder', section_list.append(
title='Skin Folders', DocumentationSection(
class_name='SkinFolderDocumentationHelper', id='interaction_workflow',
uri_list=self.getSkinFolderURIList(), title='Interaction Workflows',
), class_name='InteractionWorkflowDocumentationHelper',
DocumentationSection( uri_list=self.getInteractionWorkflowURIList(),
id='module', )
title='Module', )
class_name='PortalTypeInstanceDocumentationHelper', if self.getSkinFolderURIList() != []:
uri_list=self.getModuleURIList(), section_list.append(
), DocumentationSection(
DocumentationSection( id='skin_folder',
id='catalog_method', title='Skin Folders',
title='Catalog Method', class_name='SkinFolderDocumentationHelper',
class_name='CatalogMethodDocumentationHelper', uri_list=self.getSkinFolderURIList(),
uri_list=self.getCatalogMethodURIList(), )
), )
DocumentationSection( if self.getModuleURIList() != []:
id='base_category', section_list.append(
title='Base Category', DocumentationSection(
class_name='BaseCategoryDocumentationHelper', id='module',
uri_list=self.getBaseCategoryURIList(), title='Module',
), class_name='PortalTypeInstanceDocumentationHelper',
]) uri_list=self.getModuleURIList(),
)
)
if self.getCatalogMethodURIList() != []:
section_list.append(
DocumentationSection(
id='catalog_method',
title='Catalog Method',
class_name='CatalogMethodDocumentationHelper',
uri_list=self.getCatalogMethodURIList(),
)
)
if self.getBaseCategoryURIList() != []:
section_list.append(
DocumentationSection(
id='base_category',
title='Base Category',
class_name='BaseCategoryDocumentationHelper',
uri_list=self.getBaseCategoryURIList(),
)
)
return map(lambda x: x.__of__(self), section_list)
# Specific methods # Specific methods
security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' ) security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' )
......
...@@ -105,44 +105,62 @@ class DCWorkflowDocumentationHelper(DocumentationHelper): ...@@ -105,44 +105,62 @@ class DCWorkflowDocumentationHelper(DocumentationHelper):
""" """
Returns a list of documentation sections Returns a list of documentation sections
""" """
return map(lambda x: x.__of__(self), [ section_list = []
DocumentationSection( if self.getStateUriList() != []:
id='state', section_list.append(
title='Workflow States', DocumentationSection(
class_name='DCWorkflowStateDocumentationHelper', id='state',
uri_list=self.getStateUriList(), title='Workflow States',
), class_name='DCWorkflowStateDocumentationHelper',
DocumentationSection( uri_list=self.getStateUriList(),
id='transition', )
title='Workflow Transitions', )
class_name='DCWorkflowTransitionDocumentationHelper', if self.getTransitionUriList() != []:
uri_list=self.getTransitionUriList(), section_list.append(
), DocumentationSection(
DocumentationSection( id='transition',
id='variable', title='Workflow Transitions',
title='Workflow Variables', class_name='DCWorkflowTransitionDocumentationHelper',
class_name='DCWorkflowVariableDocumentationHelper', uri_list=self.getTransitionUriList(),
uri_list=self.getVariableUriList(), )
), )
DocumentationSection( if self.getVariableUriList() != []:
id='permission', section_list.append(
title='Workflow Permissions', DocumentationSection(
class_name='DCWorkflowPermissionDocumentationHelper', id='variable',
uri_list=self.getPermissionUriList(), title='Workflow Variables',
), class_name='DCWorkflowVariableDocumentationHelper',
DocumentationSection( uri_list=self.getVariableUriList(),
id='worklist', )
title='Workflow Worklists', )
class_name='DCWorkflowWorklistDocumentationHelper', if self.getPermissionUriList() != []:
uri_list=self.getWorklistUriList(), section_list.append(
), DocumentationSection(
DocumentationSection( id='permission',
id='script', title='Workflow Permissions',
title='Workflow Scripts', class_name='DCWorkflowPermissionDocumentationHelper',
class_name='DCWorkflowScriptDocumentationHelper', uri_list=self.getPermissionUriList(),
uri_list=self.getScriptUriList(), )
), )
]) if self.getWorklistUriList() != []:
section_list.append(
DocumentationSection(
id='worklist',
title='Workflow Worklists',
class_name='DCWorkflowWorklistDocumentationHelper',
uri_list=self.getWorklistUriList(),
)
)
if self.getScriptUriList() != []:
section_list.append(
DocumentationSection(
id='script',
title='Workflow Scripts',
class_name='DCWorkflowScriptDocumentationHelper',
uri_list=self.getScriptUriList(),
)
)
return map(lambda x: x.__of__(self), section_list)
# Specific methods # Specific methods
security.declareProtected( Permissions.AccessContentsInformation, 'getStateIdList' ) security.declareProtected( Permissions.AccessContentsInformation, 'getStateIdList' )
......
...@@ -97,56 +97,89 @@ class PortalTypeDocumentationHelper(DocumentationHelper): ...@@ -97,56 +97,89 @@ class PortalTypeDocumentationHelper(DocumentationHelper):
""" """
Returns a list of documentation sections Returns a list of documentation sections
""" """
return map(lambda x: x.__of__(self), [ section_list = []
DocumentationSection( if self.getActionUriList() != []:
id='action', section_list.append(
title='Actions', DocumentationSection(
class_name='PortalTypeActionDocumentationHelper', id='action',
uri_list=self.getActionUriList(), title='Actions',
), class_name='PortalTypeActionDocumentationHelper',
DocumentationSection( uri_list=self.getActionUriList(),
id='role', )
title='Role Definitions', )
class_name='PortalTypeRoleDocumentationHelper', if self.getRoleUriList() != []:
uri_list=self.getRoleUriList(), section_list.append(
), DocumentationSection(
DocumentationSection( id='role',
id='allowed_content_type', title='Role Definitions',
title='Allowed Content Type', class_name='PortalTypeRoleDocumentationHelper',
class_name='PortalTypeDocumentationHelper', uri_list=self.getRoleUriList(),
uri_list=self.getAllowedContentTypeURIList(), )
), )
DocumentationSection( if self.getRoleUriList() != []:
id='hidden_content_type', section_list.append(
title='Hidden Content Type', DocumentationSection(
class_name='PortalTypeDocumentationHelper', id='role',
uri_list=self.getHiddenContentTypeURIList(), title='Role Definitions',
), class_name='PortalTypeRoleDocumentationHelper',
DocumentationSection( uri_list=self.getRoleUriList(),
id='property_sheet', )
title='Property Sheet', )
class_name='PortalTypePropertySheetDocumentationHelper', if self.getAllowedContentTypeURIList() != []:
uri_list=self.getPropertySheetURIList(), section_list.append(
), DocumentationSection(
DocumentationSection( id='allowed_content_type',
id='workflow_method', title='Allowed Content Type',
title='Workflow Method', class_name='PortalTypeDocumentationHelper',
class_name='WorkflowMethodDocumentationHelper', uri_list=self.getAllowedContentTypeURIList(),
uri_list=self.getWorkflowMethodUriList(inherited=0), )
), )
DocumentationSection( if self.getHiddenContentTypeURIList() != []:
id='accessor', section_list.append(
title='Accessor', DocumentationSection(
class_name='AccessorMethodDocumentationHelper', id='hidden_content_type',
uri_list=self.getAccessorMethodUriList(inherited=0), title='Hidden Content Type',
), class_name='PortalTypeDocumentationHelper',
DocumentationSection( uri_list=self.getHiddenContentTypeURIList(),
id='class_method', )
title='Class Methods', )
class_name='ClassMethodDocumentationHelper', if self.getPropertySheetURIList() != []:
uri_list=self.getClassMethodURIList(inherited=0), section_list.append(
), DocumentationSection(
]) id='property_sheet',
title='Property Sheet',
class_name='PortalTypePropertySheetDocumentationHelper',
uri_list=self.getPropertySheetURIList(),
)
)
if self.getWorkflowMethodUriList(inherited=0) != []:
section_list.append(
DocumentationSection(
id='workflow_method',
title='Workflow Method',
class_name='WorkflowMethodDocumentationHelper',
uri_list=self.getWorkflowMethodUriList(inherited=0),
)
)
if self.getAccessorMethodUriList(inherited=0) != []:
section_list.append(
DocumentationSection(
id='accessor',
title='Accessor',
class_name='AccessorMethodDocumentationHelper',
uri_list=self.getAccessorMethodUriList(inherited=0),
)
)
if self.getClassMethodURIList(inherited=0) != []:
section_list.append(
DocumentationSection(
id='class_method',
title='Class Methods',
class_name='ClassMethodDocumentationHelper',
uri_list=self.getClassMethodURIList(inherited=0),
)
)
return map(lambda x: x.__of__(self), section_list)
# Specific methods # Specific methods
security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' ) security.declareProtected( Permissions.AccessContentsInformation, 'getDescription' )
......
...@@ -68,26 +68,35 @@ class PortalTypeInstanceDocumentationHelper(DocumentationHelper): ...@@ -68,26 +68,35 @@ class PortalTypeInstanceDocumentationHelper(DocumentationHelper):
""" """
Returns a list of documentation sections Returns a list of documentation sections
""" """
return [ section_list = []
DocumentationSection( if self.getWorkflowMethodURIList(inherited=0) != []:
id='workflow_method', section_list.append(
title='Workflow Method', DocumentationSection(
class_name='WorkflowMethodDocumentationHelper', id='workflow_method',
uri_list=self.getWorkflowMethodURIList(inherited=0), title='Workflow Method',
), class_name='WorkflowMethodDocumentationHelper',
DocumentationSection( uri_list=self.getWorkflowMethodURIList(inherited=0),
id='accessor', )
title='Accessor', )
class_name='AccessorMethodDocumentationHelper', if self.getAccessorMethodURIList(inherited=0) != []:
uri_list=self.getAccessorMethodURIList(inherited=0), section_list.append(
), DocumentationSection(
DocumentationSection( id='accessor',
id='class_method', title='Accessor',
title='Class Methods', class_name='AccessorMethodDocumentationHelper',
class_name='ClassMethodDocumentationHelper', uri_list=self.getAccessorMethodURIList(inherited=0),
uri_list=self.getClassMethodURIList(inherited=0), )
).__of__(self.getInstance()), )
] if self.getClassMethodURIList(inherited=0) != []:
section_list.append(
DocumentationSection(
id='class_method',
title='Class Methods',
class_name='ClassMethodDocumentationHelper',
uri_list=self.getClassMethodURIList(inherited=0),
)
)
return map(lambda x: x.__of__(self.getInstance()), section_list)
# Specific methods # Specific methods
security.declareProtected( Permissions.AccessContentsInformation, 'getPortalType' ) security.declareProtected( Permissions.AccessContentsInformation, 'getPortalType' )
......
...@@ -48,32 +48,44 @@ class SkinFolderDocumentationHelper(DocumentationHelper): ...@@ -48,32 +48,44 @@ class SkinFolderDocumentationHelper(DocumentationHelper):
""" """
Returns a list of documentation sections Returns a list of documentation sections
""" """
return map(lambda x: x.__of__(self), [ section_list = []
DocumentationSection( if self.getFileURIList(meta_type='ERP5 Form') != []:
id='erp5_form', section_list.append(
title='ERP5 Form', DocumentationSection(
class_name='ERP5FormDocumentationHelper', id='erp5_form',
uri_list=self.getFileURIList(meta_type='ERP5 Form'), title='ERP5 Form',
), class_name='ERP5FormDocumentationHelper',
DocumentationSection( uri_list=self.getFileURIList(meta_type='ERP5 Form'),
id='zsql_method', )
title='Z SQL Method', )
class_name='ZSQLMethodDocumentationHelper', if self.getFileURIList(meta_type='Z SQL Method') != []:
uri_list=self.getFileURIList(meta_type='Z SQL Method'), section_list.append(
), DocumentationSection(
DocumentationSection( id='zsql_method',
id='page_template', title='Z SQL Method',
title='Page Template', class_name='ZSQLMethodDocumentationHelper',
class_name='PageTemplateDocumentationHelper', uri_list=self.getFileURIList(meta_type='Z SQL Method'),
uri_list=self.getFileURIList(meta_type='Page Template'), )
), )
DocumentationSection( if self.getFileURIList(meta_type='Page Template') != []:
id='script_python', section_list.append(
title='Script (Python)', DocumentationSection(
class_name='ScriptPythonDocumentationHelper', id='page_template',
uri_list=self.getFileURIList(meta_type='Script (Python)'), title='Page Template',
), class_name='PageTemplateDocumentationHelper',
]) uri_list=self.getFileURIList(meta_type='Page Template'),
)
)
if self.getFileURIList(meta_type='Script (Python)') != []:
section_list.append(
DocumentationSection(
id='script_python',
title='Script (Python)',
class_name='ScriptPythonDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Script (Python)'),
)
)
return map(lambda x: x.__of__(self), section_list)
security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
......
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