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
...@@ -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 = []
if self.getPortalTypeURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='portal_type', id='portal_type',
title='Portal Types', title='Portal Types',
class_name='PortalTypeDocumentationHelper', class_name='PortalTypeDocumentationHelper',
uri_list=self.getPortalTypeURIList(), uri_list=self.getPortalTypeURIList(),
), )
)
if self.getDCWorkflowURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='dc_workflow', id='dc_workflow',
title='DC Workflows', title='DC Workflows',
class_name='DCWorkflowDocumentationHelper', class_name='DCWorkflowDocumentationHelper',
uri_list=self.getDCWorkflowURIList(), uri_list=self.getDCWorkflowURIList(),
), )
)
if self.getInteractionWorkflowURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='interaction_workflow', id='interaction_workflow',
title='Interaction Workflows', title='Interaction Workflows',
class_name='InteractionWorkflowDocumentationHelper', class_name='InteractionWorkflowDocumentationHelper',
uri_list=self.getInteractionWorkflowURIList(), uri_list=self.getInteractionWorkflowURIList(),
), )
)
if self.getSkinFolderURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='skin_folder', id='skin_folder',
title='Skin Folders', title='Skin Folders',
class_name='SkinFolderDocumentationHelper', class_name='SkinFolderDocumentationHelper',
uri_list=self.getSkinFolderURIList(), uri_list=self.getSkinFolderURIList(),
), )
)
if self.getModuleURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='module', id='module',
title='Module', title='Module',
class_name='PortalTypeInstanceDocumentationHelper', class_name='PortalTypeInstanceDocumentationHelper',
uri_list=self.getModuleURIList(), uri_list=self.getModuleURIList(),
), )
)
if self.getCatalogMethodURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='catalog_method', id='catalog_method',
title='Catalog Method', title='Catalog Method',
class_name='CatalogMethodDocumentationHelper', class_name='CatalogMethodDocumentationHelper',
uri_list=self.getCatalogMethodURIList(), uri_list=self.getCatalogMethodURIList(),
), )
)
if self.getBaseCategoryURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='base_category', id='base_category',
title='Base Category', title='Base Category',
class_name='BaseCategoryDocumentationHelper', class_name='BaseCategoryDocumentationHelper',
uri_list=self.getBaseCategoryURIList(), 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 = []
if self.getStateUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='state', id='state',
title='Workflow States', title='Workflow States',
class_name='DCWorkflowStateDocumentationHelper', class_name='DCWorkflowStateDocumentationHelper',
uri_list=self.getStateUriList(), uri_list=self.getStateUriList(),
), )
)
if self.getTransitionUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='transition', id='transition',
title='Workflow Transitions', title='Workflow Transitions',
class_name='DCWorkflowTransitionDocumentationHelper', class_name='DCWorkflowTransitionDocumentationHelper',
uri_list=self.getTransitionUriList(), uri_list=self.getTransitionUriList(),
), )
)
if self.getVariableUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='variable', id='variable',
title='Workflow Variables', title='Workflow Variables',
class_name='DCWorkflowVariableDocumentationHelper', class_name='DCWorkflowVariableDocumentationHelper',
uri_list=self.getVariableUriList(), uri_list=self.getVariableUriList(),
), )
)
if self.getPermissionUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='permission', id='permission',
title='Workflow Permissions', title='Workflow Permissions',
class_name='DCWorkflowPermissionDocumentationHelper', class_name='DCWorkflowPermissionDocumentationHelper',
uri_list=self.getPermissionUriList(), uri_list=self.getPermissionUriList(),
), )
)
if self.getWorklistUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='worklist', id='worklist',
title='Workflow Worklists', title='Workflow Worklists',
class_name='DCWorkflowWorklistDocumentationHelper', class_name='DCWorkflowWorklistDocumentationHelper',
uri_list=self.getWorklistUriList(), uri_list=self.getWorklistUriList(),
), )
)
if self.getScriptUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='script', id='script',
title='Workflow Scripts', title='Workflow Scripts',
class_name='DCWorkflowScriptDocumentationHelper', class_name='DCWorkflowScriptDocumentationHelper',
uri_list=self.getScriptUriList(), 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 = []
if self.getActionUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='action', id='action',
title='Actions', title='Actions',
class_name='PortalTypeActionDocumentationHelper', class_name='PortalTypeActionDocumentationHelper',
uri_list=self.getActionUriList(), uri_list=self.getActionUriList(),
), )
)
if self.getRoleUriList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='role', id='role',
title='Role Definitions', title='Role Definitions',
class_name='PortalTypeRoleDocumentationHelper', class_name='PortalTypeRoleDocumentationHelper',
uri_list=self.getRoleUriList(), uri_list=self.getRoleUriList(),
), )
)
if self.getRoleUriList() != []:
section_list.append(
DocumentationSection(
id='role',
title='Role Definitions',
class_name='PortalTypeRoleDocumentationHelper',
uri_list=self.getRoleUriList(),
)
)
if self.getAllowedContentTypeURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='allowed_content_type', id='allowed_content_type',
title='Allowed Content Type', title='Allowed Content Type',
class_name='PortalTypeDocumentationHelper', class_name='PortalTypeDocumentationHelper',
uri_list=self.getAllowedContentTypeURIList(), uri_list=self.getAllowedContentTypeURIList(),
), )
)
if self.getHiddenContentTypeURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='hidden_content_type', id='hidden_content_type',
title='Hidden Content Type', title='Hidden Content Type',
class_name='PortalTypeDocumentationHelper', class_name='PortalTypeDocumentationHelper',
uri_list=self.getHiddenContentTypeURIList(), uri_list=self.getHiddenContentTypeURIList(),
), )
)
if self.getPropertySheetURIList() != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='property_sheet', id='property_sheet',
title='Property Sheet', title='Property Sheet',
class_name='PortalTypePropertySheetDocumentationHelper', class_name='PortalTypePropertySheetDocumentationHelper',
uri_list=self.getPropertySheetURIList(), uri_list=self.getPropertySheetURIList(),
), )
)
if self.getWorkflowMethodUriList(inherited=0) != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='workflow_method', id='workflow_method',
title='Workflow Method', title='Workflow Method',
class_name='WorkflowMethodDocumentationHelper', class_name='WorkflowMethodDocumentationHelper',
uri_list=self.getWorkflowMethodUriList(inherited=0), uri_list=self.getWorkflowMethodUriList(inherited=0),
), )
)
if self.getAccessorMethodUriList(inherited=0) != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='accessor', id='accessor',
title='Accessor', title='Accessor',
class_name='AccessorMethodDocumentationHelper', class_name='AccessorMethodDocumentationHelper',
uri_list=self.getAccessorMethodUriList(inherited=0), uri_list=self.getAccessorMethodUriList(inherited=0),
), )
)
if self.getClassMethodURIList(inherited=0) != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='class_method', id='class_method',
title='Class Methods', title='Class Methods',
class_name='ClassMethodDocumentationHelper', class_name='ClassMethodDocumentationHelper',
uri_list=self.getClassMethodURIList(inherited=0), 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 = []
if self.getWorkflowMethodURIList(inherited=0) != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='workflow_method', id='workflow_method',
title='Workflow Method', title='Workflow Method',
class_name='WorkflowMethodDocumentationHelper', class_name='WorkflowMethodDocumentationHelper',
uri_list=self.getWorkflowMethodURIList(inherited=0), uri_list=self.getWorkflowMethodURIList(inherited=0),
), )
)
if self.getAccessorMethodURIList(inherited=0) != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='accessor', id='accessor',
title='Accessor', title='Accessor',
class_name='AccessorMethodDocumentationHelper', class_name='AccessorMethodDocumentationHelper',
uri_list=self.getAccessorMethodURIList(inherited=0), uri_list=self.getAccessorMethodURIList(inherited=0),
), )
)
if self.getClassMethodURIList(inherited=0) != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='class_method', id='class_method',
title='Class Methods', title='Class Methods',
class_name='ClassMethodDocumentationHelper', class_name='ClassMethodDocumentationHelper',
uri_list=self.getClassMethodURIList(inherited=0), uri_list=self.getClassMethodURIList(inherited=0),
).__of__(self.getInstance()), )
] )
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 = []
if self.getFileURIList(meta_type='ERP5 Form') != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='erp5_form', id='erp5_form',
title='ERP5 Form', title='ERP5 Form',
class_name='ERP5FormDocumentationHelper', class_name='ERP5FormDocumentationHelper',
uri_list=self.getFileURIList(meta_type='ERP5 Form'), uri_list=self.getFileURIList(meta_type='ERP5 Form'),
), )
)
if self.getFileURIList(meta_type='Z SQL Method') != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='zsql_method', id='zsql_method',
title='Z SQL Method', title='Z SQL Method',
class_name='ZSQLMethodDocumentationHelper', class_name='ZSQLMethodDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Z SQL Method'), uri_list=self.getFileURIList(meta_type='Z SQL Method'),
), )
)
if self.getFileURIList(meta_type='Page Template') != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='page_template', id='page_template',
title='Page Template', title='Page Template',
class_name='PageTemplateDocumentationHelper', class_name='PageTemplateDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Page Template'), uri_list=self.getFileURIList(meta_type='Page Template'),
), )
)
if self.getFileURIList(meta_type='Script (Python)') != []:
section_list.append(
DocumentationSection( DocumentationSection(
id='script_python', id='script_python',
title='Script (Python)', title='Script (Python)',
class_name='ScriptPythonDocumentationHelper', class_name='ScriptPythonDocumentationHelper',
uri_list=self.getFileURIList(meta_type='Script (Python)'), 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