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 ):
info = {}
info['id'] = self.id
info['name'] = self.Title()
info['description'] = self.Description()
info['category'] = self.getCategory()
info['base_category'] = self.getBaseCategory()
info['base_category_script'] = self.getBaseCategoryScript()
......
......@@ -67,6 +67,7 @@ class RoleProviderBase:
a1 = {}
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['category'] = a.getCategory() or [] # Category definition
a1['base_category'] = a.getBaseCategory() # Base Category Definition
......@@ -84,6 +85,7 @@ class RoleProviderBase:
security.declareProtected( ManagePortal, 'addRole' )
def addRole( self
, id
, description
, name
, condition
, category
......@@ -101,6 +103,7 @@ class RoleProviderBase:
new_roles = self._cloneRoles()
new_role = RoleInformation( id=str(id)
, description=description
, title=str(name)
, condition=c_expr
, category=category.split('\n')
......@@ -226,10 +229,11 @@ class RoleProviderBase:
""" Extract an RoleInformation from the funky form properties.
"""
id = str( properties.get( 'id_%d' % index, '' ) )
description = str( properties.get( 'description_%d' % index, '' ) )
name = str( properties.get( 'name_%d' % index, '' ) )
condition = str( properties.get( 'condition_%d' % index, '' ) )
category = properties.get( 'category_%d' % index, '' ).split('\n')
base_category = properties.get( 'base_category_%d' % index, '' ).split()
category = properties.get( 'category_%d' % index, '' ).split('\n')
base_category = properties.get( 'base_category_%d' % index, '' ).split()
base_category_script = str( properties.get( 'base_category_script_%d' % index, '' ) )
if not name:
......@@ -240,6 +244,7 @@ class RoleProviderBase:
return RoleInformation( id=id
, title=name
, description=description
, condition=condition
, category=category
, base_category=base_category
......
......@@ -52,6 +52,20 @@
</td>
</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>
<td></td>
<td>
......@@ -103,7 +117,7 @@
</td>
<td>
<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>
</td>
</tr>
......@@ -165,6 +179,20 @@ Add a role
</td>
</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>
<td></td>
<td>
......@@ -216,7 +244,7 @@ Add a role
</td>
<td>
<div class="form-element">
<textarea rows="4" cols="80" name="category"></textarea>
<textarea rows="3" cols="80" name="category"></textarea>
</div>
</td>
</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