--- a/web/views/editforms.py Mon Aug 03 09:37:13 2009 +0200
+++ b/web/views/editforms.py Mon Aug 03 10:50:57 2009 +0200
@@ -62,8 +62,8 @@
if entity.eid in done:
continue
done.add(entity.eid)
- subform = self.vreg.select('forms', 'base', self.req, entity=entity,
- mainform=False)
+ subform = self.vreg['forms'].select('base', self.req, entity=entity,
+ mainform=False)
self.form_add_subform(subform)
@@ -83,8 +83,8 @@
% _('this action is not reversible!'))
# XXX above message should have style of a warning
w(u'<h4>%s</h4>\n' % _('Do you want to delete the following element(s) ?'))
- form = self.vreg.select('forms', self.id, req, rset=self.rset,
- onsubmit=onsubmit)
+ form = self.vreg['forms'].select(self.id, req, rset=self.rset,
+ onsubmit=onsubmit)
w(u'<ul>\n')
for entity in self.rset.entities():
# don't use outofcontext view or any other that may contain inline edition form
@@ -127,12 +127,10 @@
return lzone or self._defaultlandingzone % {'msg' : xml_escape(self.req._(self._landingzonemsg))}
def _build_renderer(self, entity, rtype, role):
- return self.vreg.select_object('formrenderers', 'base', self.req,
- entity=entity,
- display_label=False, display_help=False,
- display_fields=[(rtype, role)],
- table_class='', button_bar_class='buttonbar',
- display_progress_div=False)
+ return self.vreg['formrenderers'].select(
+ 'base', self.req, entity=entity, display_label=False,
+ display_help=False, display_fields=[(rtype, role)], table_class='',
+ button_bar_class='buttonbar', display_progress_div=False)
def cell_call(self, row, col, rtype=None, role='subject',
reload=False, # controls reloading the whole page after change
@@ -207,12 +205,12 @@
% event_data)
cancelclick = "hideInlineEdit(%s,\'%s\',\'%s\')" % (
entity.eid, rtype, divid)
- form = self.vreg.select('forms', 'base', self.req, entity=entity,
- domid='%s-form' % divid, cssstyle='display: none',
- onsubmit=onsubmit, action='#',
- form_buttons=[SubmitButton(),
- Button(stdmsgs.BUTTON_CANCEL,
- onclick=cancelclick)])
+ form = self.vreg['forms'].select('base', self.req, entity=entity,
+ domid='%s-form' % divid, cssstyle='display: none',
+ onsubmit=onsubmit, action='#',
+ form_buttons=[SubmitButton(),
+ Button(stdmsgs.BUTTON_CANCEL,
+ onclick=cancelclick)])
field = guess_field(entity.e_schema, entity.schema.rschema(rtype), role)
form.append_field(field)
w = self.w
@@ -243,12 +241,12 @@
Button(stdmsgs.BUTTON_CANCEL,
onclick="hideInlineEdit(%s,\'%s\',\'%s\')" % (
eid, rtype, divid))]
- form = self.vreg.select('forms', 'edition', self.req, rset=self.rset,
- row=row, col=col, form_buttons=buttons,
- attrcategories=self.attrcategories,
- domid='%s-form' % divid, action='#',
- cssstyle='display: none',
- onsubmit=onsubmit % event_data)
+ form = self.vreg['forms'].select('edition', self.req, rset=self.rset,
+ row=row, col=col, form_buttons=buttons,
+ attrcategories=self.attrcategories,
+ domid='%s-form' % divid, action='#',
+ cssstyle='display: none',
+ onsubmit=onsubmit % event_data)
w = self.w
w(u'<div class="field">')
w(u'<div id="%s" style="display: inline">' % divid)
@@ -278,9 +276,9 @@
def render_form(self, entity):
"""fetch and render the form"""
self.form_title(entity)
- form = self.vreg.select('forms', 'edition', self.req, rset=entity.rset,
- row=entity.row, col=entity.col, entity=entity,
- submitmsg=self.submited_message())
+ form = self.vreg['forms'].select('edition', self.req, rset=entity.rset,
+ row=entity.row, col=entity.col, entity=entity,
+ submitmsg=self.submited_message())
self.init_form(form, entity)
self.w(form.form_render(formvid=u'edition'))
@@ -397,9 +395,10 @@
kwargs.setdefault('__redirectrql', rset.printable_rql())
super(TableEditForm, self).__init__(req, rset, **kwargs)
for row in xrange(len(self.rset)):
- form = self.vreg.select('forms', 'edition', self.req, rset=self.rset,
- row=row, attrcategories=('primary',),
- mainform=False)
+ form = self.vreg['forms'].select('edition', self.req,
+ rset=self.rset, row=row,
+ attrcategories=('primary',),
+ mainform=False)
# XXX rely on the EntityCompositeFormRenderer to put the eid input
form.remove_field(form.field_by_name('eid'))
self.form_add_subform(form)
@@ -415,7 +414,7 @@
should be the eid
"""
#self.form_title(entity)
- form = self.vreg.select('forms', self.id, self.req, rset=self.rset)
+ form = self.vreg['forms'].select(self.id, self.req, rset=self.rset)
self.w(form.form_render())
@@ -446,9 +445,9 @@
def render_form(self, entity, peid, rtype, role, **kwargs):
"""fetch and render the form"""
- form = self.vreg.select('forms', 'edition', self.req, entity=entity,
- form_renderer_id='inline', mainform=False,
- copy_nav_params=False)
+ form = self.vreg['forms'].select('edition', self.req, entity=entity,
+ form_renderer_id='inline',
+ mainform=False, copy_nav_params=False)
self.add_hiddens(form, entity, peid, rtype, role)
divid = '%s-%s-%s' % (peid, rtype, entity.eid)
title = self.schema.rschema(rtype).display_name(self.req, role)