admin: add popup to edit read access

This commit is contained in:
Frédéric Péters 2012-08-14 14:42:43 +02:00
parent b0fe3d1f8f
commit 23c7018894
1 changed files with 32 additions and 7 deletions

View File

@ -275,7 +275,7 @@ class FormDefPage(Directory):
'archive', 'invite', 'enable', 'workflow', 'category',
'recipient', ('workflow-options', 'workflow_options'),
('workflow-status-remapping', 'workflow_status_remapping'),
'roles', 'title', 'options']
'roles', 'title', 'options', ('acl-read', 'acl_read')]
def __init__(self, component):
try:
@ -355,12 +355,13 @@ class FormDefPage(Directory):
'(<a href="roles" rel="popup">%s</a>)' % _('change')
'</li>'
if self.formdef.acl_read:
'<li>%s ' % _('Read Access:')
'%s</li>' % {'none': _('None'),
'owner': _('Owner'),
'roles': _('Roles'),
'all': _('Everybody')}.get(self.formdef.acl_read, 'none')
'<li>%s ' % _('Read Access:')
'%s' % {'none': _('None'),
'owner': _('Owner'),
'roles': _('Roles'),
'all': _('Everybody')}.get(self.formdef.acl_read, 'none')
' '
'(<a href="acl-read" rel="popup">%s</a>)' % _('change')
'</ul>'
'</div>'
'</div>'
@ -508,6 +509,30 @@ class FormDefPage(Directory):
'<p>%s</p>' % _('Choose a title for this form')
form.render()
def acl_read [html] (self):
form = Form(enctype='multipart/form-data')
form.add(SingleSelectWidget, 'acl_read', title=_('Read Access'),
options=[
(str('none'), _('None')),
(str('owner'), _('Owner')),
(str('roles'), _('Roles')),
(str('all'), _('Everybody'))],
value=self.formdef.acl_read)
form.add_submit('submit', _('Submit'))
form.add_submit('cancel', _('Cancel'))
if form.get_widget('cancel').parse():
return redirect('.')
if form.is_submitted() and not form.has_errors():
self.formdef.acl_read = form.get_widget('acl_read').parse()
self.formdef.store()
redirect('.')
get_response().breadcrumb.append( ('acl-read', _('Read Access')) )
html_top('forms', title=self.formdef.name)
'<p>%s</p>' % _('Select who is granted a read access.')
form.render()
def options [html] (self):
form = Form(enctype='multipart/form-data')
form.add(CheckboxWidget, 'confirmation', title=_('Include confirmation page'),