# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1239986706 -7200 # Node ID 04b7afb14b5046100915290dd01ae157579396a6 # Parent 56764b1b488765645be9cafe6f87404c5962867a new style security management forms diff -r 56764b1b4887 -r 04b7afb14b50 web/views/management.py --- a/web/views/management.py Fri Apr 17 18:44:17 2009 +0200 +++ b/web/views/management.py Fri Apr 17 18:45:06 2009 +0200 @@ -1,4 +1,4 @@ -"""management and error screens +"""security management and error screens :organization: Logilab @@ -12,27 +12,16 @@ from cubicweb.selectors import yes, none_rset, match_user_groups from cubicweb.view import AnyRsetView, StartupView, EntityView from cubicweb.common.uilib import html_traceback, rest_traceback -from cubicweb.web import INTERNAL_FIELD_VALUE, eid_param, stdmsgs -from cubicweb.web.widgets import StaticComboBoxWidget +from cubicweb.web import formwidgets +from cubicweb.web.form import FieldsForm, EntityFieldsForm +from cubicweb.web.formfields import guess_field +from cubicweb.web.formrenderers import HTableFormRenderer _ = unicode SUBMIT_MSGID = _('Submit bug report') MAIL_SUBMIT_MSGID = _('Submit bug report by mail') -def begin_form(w, entity, redirectvid, redirectpath=None, msg=None): - w(u'
\n') + msg = self.req._('ownerships have been changed') + form = EntityFieldsForm(self.req, None, entity=entity, submitmsg=msg, + form_buttons=[formwidgets.SubmitButton()], + __redirectvid='security', + __redirectpath=entity.rest_path()) + field = guess_field(entity.__class__, self.schema.rschema('owned_by')) + form.append_field(field) + self.w(form.form_render()) def owned_by_information(self, entity): ownersrset = entity.related('owned_by') @@ -147,32 +135,24 @@ newperm = self.vreg.etype_class('CWPermission')(self.req, None) newperm.eid = self.req.varmaker.next() w(u'%s
' % _('add a new permission')) - begin_form(w, newperm, 'security', entity.rest_path()) - w(u'' - % (eid_param('edito-require_permission', newperm.eid), INTERNAL_FIELD_VALUE)) - w(u'' - % (eid_param('require_permission', newperm.eid), entity.eid)) - w(u'%s | %s | %s | |
---|---|---|---|
%s | \n' % wdg.edit_render(newperm)) - wdg = newperm.get_widget('label') - w(u'%s | \n' % wdg.edit_render(newperm)) - wdg = newperm.get_widget('require_group') - w(u'%s | \n' % wdg.edit_render(newperm)) - w(u'%s |