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): ...@@ -42,10 +42,6 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
def __init__(self, uri): def __init__(self, uri):
self.uri = uri self.uri = uri
security.declareProtected(Permissions.AccessContentsInformation, 'getDescription')
def getDescription(self):
return getattr(self.getDocumentedObject(), "description", '')
security.declareProtected(Permissions.AccessContentsInformation, 'getType' ) security.declareProtected(Permissions.AccessContentsInformation, 'getType' )
def getType(self): def getType(self):
""" """
...@@ -74,6 +70,13 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper): ...@@ -74,6 +70,13 @@ class PortalTypeActionDocumentationHelper(DocumentationHelper):
""" """
return getattr(self.getDocumentedObject(), "title", '') 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' ) security.declareProtected(Permissions.AccessContentsInformation, 'getPermissions' )
def getPermissions(self): def getPermissions(self):
""" """
......
...@@ -52,6 +52,20 @@ ...@@ -52,6 +52,20 @@
</td> </td>
</tr> </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> <tr>
<td></td> <td></td>
<td> <td>
...@@ -221,6 +235,20 @@ Add an action ...@@ -221,6 +235,20 @@ Add an action
</td> </td>
</tr> </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> <tr>
<td></td> <td></td>
<td> <td>
......
...@@ -63,6 +63,7 @@ if 1: ...@@ -63,6 +63,7 @@ if 1:
info = {} info = {}
info['id'] = self.id info['id'] = self.id
info['name'] = self.Title() info['name'] = self.Title()
info['description'] = self.getDescription()
expr = self.getActionExpression() expr = self.getActionExpression()
__traceback_info__ = (info['id'], info['name'], expr) __traceback_info__ = (info['id'], info['name'], expr)
action_obj = self._getActionObject() action_obj = self._getActionObject()
...@@ -113,6 +114,12 @@ if 1: ...@@ -113,6 +114,12 @@ if 1:
""" """
return getattr(self, 'priority', 1.0) return getattr(self, 'priority', 1.0)
def getDescription( self ):
"""
Return the priority of the action
"""
return getattr(self, 'description', '')
def clone( self ): def clone( self ):
""" Return a newly-created AI just like us. """ Return a newly-created AI just like us.
...@@ -150,6 +157,7 @@ ActionInformation.getAction = getAction ...@@ -150,6 +157,7 @@ ActionInformation.getAction = getAction
ActionInformation._getIconObject = _getIconObject ActionInformation._getIconObject = _getIconObject
ActionInformation.getIconExpression = getIconExpression ActionInformation.getIconExpression = getIconExpression
ActionInformation.setIconExpression = setIconExpression ActionInformation.setIconExpression = setIconExpression
ActionInformation.getDescription = getDescription
ActionInformation.getPriority = getPriority ActionInformation.getPriority = getPriority
ActionInformation.clone = clone ActionInformation.clone = clone
ActionInformation.getMapping = getMapping ActionInformation.getMapping = getMapping
......
...@@ -29,6 +29,8 @@ def ActionProviderBase_manage_editActionsForm( self, REQUEST, manage_tabs_messag ...@@ -29,6 +29,8 @@ def ActionProviderBase_manage_editActionsForm( self, REQUEST, manage_tabs_messag
a1 = {} a1 = {}
a1['id'] = a.getId() a1['id'] = a.getId()
a1['title'] = a1['name'] = a.Title() a1['title'] = a1['name'] = a.Title()
if hasattr(a, 'getDescription'):
a1['description'] = a.getDescription()
p = a.getPermissions() p = a.getPermissions()
a1['permissions'] = p a1['permissions'] = p
if p: if p:
...@@ -59,6 +61,7 @@ def ActionProviderBase_manage_editActionsForm( self, REQUEST, manage_tabs_messag ...@@ -59,6 +61,7 @@ def ActionProviderBase_manage_editActionsForm( self, REQUEST, manage_tabs_messag
def ActionProviderBase_addAction( self def ActionProviderBase_addAction( self
, id , id
, name , name
, description
, action , action
, condition , condition
, permission , permission
...@@ -84,6 +87,7 @@ def ActionProviderBase_addAction( self ...@@ -84,6 +87,7 @@ def ActionProviderBase_addAction( self
new_action = ActionInformation( id=str(id) new_action = ActionInformation( id=str(id)
, title=str(name) , title=str(name)
, description=str(description)
, action=a_expr , action=a_expr
, icon=i_expr , icon=i_expr
, condition=c_expr , condition=c_expr
...@@ -107,6 +111,7 @@ def ActionProviderBase_extractAction( self, properties, index ): ...@@ -107,6 +111,7 @@ def ActionProviderBase_extractAction( self, properties, index ):
""" """
id = str( properties.get( 'id_%d' % index, '' ) ) id = str( properties.get( 'id_%d' % index, '' ) )
name = str( properties.get( 'name_%d' % index, '' ) ) name = str( properties.get( 'name_%d' % index, '' ) )
description = str( properties.get( 'description_%d' % index, '' ) )
action = str( properties.get( 'action_%d' % index, '' ) ) action = str( properties.get( 'action_%d' % index, '' ) )
icon = str( properties.get( 'icon_%d' % index, '' ) ) icon = str( properties.get( 'icon_%d' % index, '' ) )
condition = str( properties.get( 'condition_%d' % index, '' ) ) condition = str( properties.get( 'condition_%d' % index, '' ) )
...@@ -144,6 +149,7 @@ def ActionProviderBase_extractAction( self, properties, index ): ...@@ -144,6 +149,7 @@ def ActionProviderBase_extractAction( self, properties, index ):
return ActionInformation( id=id return ActionInformation( id=id
, title=name , title=name
, description=description
, action=action , action=action
, icon=icon , icon=icon
, condition=condition , 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