Commit f3e6aa93 authored by Sebastien Robin's avatar Sebastien Robin

- Add support of description for portal types actions

- Display this description into the documentation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24441 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b5a6f3ec
......@@ -42,10 +42,6 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
def __init__(self, uri):
self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self):
"""
......@@ -74,6 +70,13 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
"""
return getattr(self.getDocumentedObject(), "title", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getTitle' )
def getDescription(self):
"""
Returns the title of the documentation helper
"""
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getPermissions' )
def getPermissions(self):
"""
......
......@@ -52,6 +52,20 @@
</td>
</tr>
<tr>
<td></td>
<td>
<div class="form-label">
Description
</div>
</td>
<td>
<div class="form-element">
<input type="text" name="description_&dtml-index;" value="&dtml-description;" size="80"/>
</div>
</td>
</tr>
<tr>
<td></td>
<td>
......@@ -221,6 +235,20 @@ Add an action
</td>
</tr>
<tr>
<td></td>
<td>
<div class="form-label">
Description
</div>
</td>
<td>
<div class="form-element">
<input type="text" name="description" value="" size="80"/>
</div>
</td>
</tr>
<tr>
<td></td>
<td>
......
......@@ -63,6 +63,7 @@ if 1:
info = {}
info['id'] = self.id
info['name'] = self.Title()
info['description'] = self.getDescription()
expr = self.getActionExpression()
__traceback_info__ = (info['id'], info['name'], expr)
action_obj = self._getActionObject()
......@@ -113,6 +114,12 @@ if 1:
"""
return getattr(self, 'priority', 1.0)
def getDescription( self ):
"""
Return the priority of the action
"""
return getattr(self, 'description', '')
def clone( self ):
""" Return a newly-created AI just like us.
......@@ -150,6 +157,7 @@ ActionInformation.getAction = getAction
ActionInformation._getIconObject = _getIconObject
ActionInformation.getIconExpression = getIconExpression
ActionInformation.setIconExpression = setIconExpression
ActionInformation.getDescription = getDescription
ActionInformation.getPriority = getPriority
ActionInformation.clone = clone
ActionInformation.getMapping = getMapping
......
......@@ -29,6 +29,8 @@ def ActionProviderBase_manage_editActionsForm( self, REQUEST, manage_tabs_messag
a1 = {}
a1['id'] = a.getId()
a1['title'] = a1['name'] = a.Title()
if hasattr(a, 'getDescription'):
a1['description'] = a.getDescription()
p = a.getPermissions()
a1['permissions'] = p
if p:
......@@ -59,6 +61,7 @@ def ActionProviderBase_manage_editActionsForm( self, REQUEST, manage_tabs_messag
def ActionProviderBase_addAction( self
, id
, name
, description
, action
, condition
, permission
......@@ -84,6 +87,7 @@ def ActionProviderBase_addAction( self
new_action = ActionInformation( id=str(id)
, title=str(name)
, description=str(description)
, action=a_expr
, icon=i_expr
, condition=c_expr
......@@ -107,6 +111,7 @@ def ActionProviderBase_extractAction( self, properties, index ):
"""
id = str( properties.get( 'id_%d' % index, '' ) )
name = str( properties.get( 'name_%d' % index, '' ) )
description = str( properties.get( 'description_%d' % index, '' ) )
action = str( properties.get( 'action_%d' % index, '' ) )
icon = str( properties.get( 'icon_%d' % index, '' ) )
condition = str( properties.get( 'condition_%d' % index, '' ) )
......@@ -144,6 +149,7 @@ def ActionProviderBase_extractAction( self, properties, index ):
return ActionInformation( id=id
, title=name
, description=description
, action=action
, icon=icon
, condition=condition
......
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