312 |
312 |
# removed role ?
|
313 |
313 |
roles.append(htmltext('<em>%s</em>') % _('Unknown role (%s)') % role_id)
|
314 |
314 |
r += htmltext(', ').join(roles)
|
315 |
|
if self.formdef.always_advertise:
|
316 |
|
r += htmltext(' (%s)') % _('Always advertise')
|
317 |
315 |
else:
|
318 |
316 |
r += '-'
|
319 |
317 |
r += ' '
|
... | ... | |
342 |
340 |
r += htmltext('<li>%s</li>') % _('Keep workflow status and history private')
|
343 |
341 |
if self.formdef.only_allow_one:
|
344 |
342 |
r += htmltext('<li>%s</li>') % _('Only allow one form per user')
|
|
343 |
if self.formdef.roles and self.formdef.always_advertise:
|
|
344 |
r += htmltext('<li>%s</li>') % _('Advertise to unlogged users')
|
345 |
345 |
if self.formdef.enable_tracking_codes:
|
346 |
346 |
r += htmltext('<li>%s</li>') % _('Has support for tracking codes')
|
347 |
347 |
if self.formdef.disabled:
|
... | ... | |
449 |
449 |
element_kwargs = {str('render_br'): False,
|
450 |
450 |
str('options'): [(None, str('---')),
|
451 |
451 |
(logged_users_role().id, logged_users_role().name)] + get_user_roles()})
|
452 |
|
form.add(CheckboxWidget, 'always_advertise', title=_('Always advertise'),
|
453 |
|
value=self.formdef.always_advertise)
|
454 |
452 |
form.add_submit('submit', _('Submit'))
|
455 |
453 |
form.add_submit('cancel', _('Cancel'))
|
456 |
454 |
if form.get_widget('cancel').parse():
|
... | ... | |
465 |
463 |
r += form.render()
|
466 |
464 |
return r.getvalue()
|
467 |
465 |
else:
|
468 |
|
self.formdef.always_advertise = form.get_widget('always_advertise').parse()
|
469 |
466 |
roles = form.get_widget('roles').parse()
|
470 |
467 |
if roles:
|
471 |
468 |
self.formdef.roles = [x for x in roles if x]
|
... | ... | |
567 |
564 |
form.add(CheckboxWidget, 'only_allow_one',
|
568 |
565 |
title=_('Only allow one form per user'),
|
569 |
566 |
value=self.formdef.only_allow_one)
|
|
567 |
kwargs = {}
|
|
568 |
if not self.formdef.roles:
|
|
569 |
kwargs['disabled'] = 'disabled'
|
|
570 |
form.add(CheckboxWidget, 'always_advertise',
|
|
571 |
title=_('Advertise to unlogged users'),
|
|
572 |
value=self.formdef.always_advertise,
|
|
573 |
**kwargs)
|
570 |
574 |
form.add(CheckboxWidget, 'enable_tracking_codes',
|
571 |
575 |
title=_('Enable support for tracking codes'),
|
572 |
576 |
value=self.formdef.enable_tracking_codes)
|
... | ... | |
591 |
595 |
return redirect('.')
|
592 |
596 |
|
593 |
597 |
if form.is_submitted() and not form.has_errors():
|
594 |
|
for f in ('confirmation', 'only_allow_one', 'disabled',
|
|
598 |
attrs = ['confirmation', 'only_allow_one', 'disabled',
|
595 |
599 |
'enable_tracking_codes', 'private_status_and_history',
|
596 |
|
'disabled_redirection', 'publication_date', 'expiration_date'):
|
|
600 |
'disabled_redirection', 'publication_date',
|
|
601 |
'expiration_date']
|
|
602 |
if self.formdef.roles:
|
|
603 |
attrs.append('always_advertise')
|
|
604 |
for f in attrs:
|
597 |
605 |
widget = form.get_widget(f)
|
598 |
606 |
if widget:
|
599 |
607 |
setattr(self.formdef, str(f), widget.parse())
|
600 |
|
-
|