Commit 48a82614 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for description in local roles


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5223 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent add6e495
...@@ -99,6 +99,7 @@ class RoleInformation( SimpleItem ): ...@@ -99,6 +99,7 @@ class RoleInformation( SimpleItem ):
info = {} info = {}
info['id'] = self.id info['id'] = self.id
info['name'] = self.Title() info['name'] = self.Title()
info['description'] = self.Description()
info['category'] = self.getCategory() info['category'] = self.getCategory()
info['base_category'] = self.getBaseCategory() info['base_category'] = self.getBaseCategory()
info['base_category_script'] = self.getBaseCategoryScript() info['base_category_script'] = self.getBaseCategoryScript()
......
...@@ -67,6 +67,7 @@ class RoleProviderBase: ...@@ -67,6 +67,7 @@ class RoleProviderBase:
a1 = {} a1 = {}
a1['id'] = a.getId() # The Role Id (ex. Assignor) a1['id'] = a.getId() # The Role Id (ex. Assignor)
a1['description'] = a.Description() # The Role Description (ex. a person in charge of assigning orders)
a1['name'] = a.Title() # The name of this role definition (ex. Assignor at company X) a1['name'] = a.Title() # The name of this role definition (ex. Assignor at company X)
a1['category'] = a.getCategory() or [] # Category definition a1['category'] = a.getCategory() or [] # Category definition
a1['base_category'] = a.getBaseCategory() # Base Category Definition a1['base_category'] = a.getBaseCategory() # Base Category Definition
...@@ -84,6 +85,7 @@ class RoleProviderBase: ...@@ -84,6 +85,7 @@ class RoleProviderBase:
security.declareProtected( ManagePortal, 'addRole' ) security.declareProtected( ManagePortal, 'addRole' )
def addRole( self def addRole( self
, id , id
, description
, name , name
, condition , condition
, category , category
...@@ -101,6 +103,7 @@ class RoleProviderBase: ...@@ -101,6 +103,7 @@ class RoleProviderBase:
new_roles = self._cloneRoles() new_roles = self._cloneRoles()
new_role = RoleInformation( id=str(id) new_role = RoleInformation( id=str(id)
, description=description
, title=str(name) , title=str(name)
, condition=c_expr , condition=c_expr
, category=category.split('\n') , category=category.split('\n')
...@@ -226,10 +229,11 @@ class RoleProviderBase: ...@@ -226,10 +229,11 @@ class RoleProviderBase:
""" Extract an RoleInformation from the funky form properties. """ Extract an RoleInformation from the funky form properties.
""" """
id = str( properties.get( 'id_%d' % index, '' ) ) id = str( properties.get( 'id_%d' % index, '' ) )
description = str( properties.get( 'description_%d' % index, '' ) )
name = str( properties.get( 'name_%d' % index, '' ) ) name = str( properties.get( 'name_%d' % index, '' ) )
condition = str( properties.get( 'condition_%d' % index, '' ) ) condition = str( properties.get( 'condition_%d' % index, '' ) )
category = properties.get( 'category_%d' % index, '' ).split('\n') category = properties.get( 'category_%d' % index, '' ).split('\n')
base_category = properties.get( 'base_category_%d' % index, '' ).split() base_category = properties.get( 'base_category_%d' % index, '' ).split()
base_category_script = str( properties.get( 'base_category_script_%d' % index, '' ) ) base_category_script = str( properties.get( 'base_category_script_%d' % index, '' ) )
if not name: if not name:
...@@ -240,6 +244,7 @@ class RoleProviderBase: ...@@ -240,6 +244,7 @@ class RoleProviderBase:
return RoleInformation( id=id return RoleInformation( id=id
, title=name , title=name
, description=description
, condition=condition , condition=condition
, category=category , category=category
, base_category=base_category , base_category=base_category
......
...@@ -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">
<textarea rows="3" cols="80" name="description_&dtml-index;">&dtml-description;</textarea>
</div>
</td>
</tr>
<tr> <tr>
<td></td> <td></td>
<td> <td>
...@@ -103,7 +117,7 @@ ...@@ -103,7 +117,7 @@
</td> </td>
<td> <td>
<div class="form-element"> <div class="form-element">
<textarea rows="4" cols="80" name="category_&dtml-index;"><dtml-var "'\n'.join(category)"></textarea> <textarea rows="3" cols="80" name="category_&dtml-index;"><dtml-var "'\n'.join(category)"></textarea>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -165,6 +179,20 @@ Add a role ...@@ -165,6 +179,20 @@ Add a role
</td> </td>
</tr> </tr>
<tr>
<td></td>
<td>
<div class="form-label">
Description
</div>
</td>
<td>
<div class="form-element">
<textarea rows="3" cols="80" name="description"></textarea>
</div>
</td>
</tr>
<tr> <tr>
<td></td> <td></td>
<td> <td>
...@@ -216,7 +244,7 @@ Add a role ...@@ -216,7 +244,7 @@ Add a role
</td> </td>
<td> <td>
<div class="form-element"> <div class="form-element">
<textarea rows="4" cols="80" name="category"></textarea> <textarea rows="3" cols="80" name="category"></textarea>
</div> </div>
</td> </td>
</tr> </tr>
......
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