''' # do not insert trailing space or \n here !
-
- def call(self, etype, ptype, peid, rtype, role='subject', **kwargs):
- """
- :param etype: the entity type being created in the inline form
- :param parent: the parent entity hosting the inline form
- :param rtype: the relation bridging `etype` and `parent`
- :param role: the role played by the `parent` in the relation
- """
- try:
- entity = self.vreg.etype_class(etype)(self.req, None, None)
- except:
- self.w(self.req._('no such entity type %s') % etype)
- return
- self.edit_form(entity, ptype, peid, rtype, role, **kwargs)
-
-
-class InlineEntityEditionForm(InlineFormMixIn, EditionForm):
- id = 'inline-edition'
- __select__ = non_final_entity() & match_kwargs('ptype', 'peid', 'rtype')
-
- EDITION_BODY = u'''\
-
''' # do not insert trailing space or \n here !
-
- rel_input = u''''''
-
- def call(self, **kwargs):
- """redefine default View.call() method to avoid automatic
- insertions of
between each row of
- the resultset
- """
- rset = self.rset
- for i in xrange(len(rset)):
- self.wview(self.id, rset, row=i, **kwargs)
-
- def cell_call(self, row, col, ptype, peid, rtype, role='subject', **kwargs):
- """
- :param parent: the parent entity hosting the inline form
- :param rtype: the relation bridging `etype` and `parent`
- :param role: the role played by the `parent` in the relation
- """
- entity = self.entity(row, col)
- self.edit_form(entity, ptype, peid, rtype, role, **kwargs)
-
-
- def form_context(self, entity, kwargs):
- ctx = super(InlineEntityEditionForm, self).form_context(entity, kwargs)
- if self.keep_entity(entity):
- ctx['rinput'] = self.rel_input % ctx
- ctx['todelete'] = u''
- else:
- ctx['rinput'] = u''
- ctx['todelete'] = u'checked="checked"'
- ctx['count'] = entity.row + 1
- return ctx
class CopyEditionForm(EditionForm):