--- a/web/views/baseforms.py Wed Apr 08 13:13:53 2009 +0200
+++ b/web/views/baseforms.py Wed Apr 08 13:14:33 2009 +0200
@@ -455,96 +455,6 @@
}
ctx.update(local_ctx)
return ctx
-
-
-class InlineEntityCreationForm(InlineFormMixIn, CreationForm):
- id = 'inline-creation'
- __select__ = (match_kwargs('ptype', 'peid', 'rtype')
- & specified_etype_implements('Any'))
-
- EDITION_BODY = u'''\
-<div id="div-%(parenteid)s-%(rtype)s-%(eid)s" class="inlinedform">
- <div class="iformBody">
- <div class="iformTitle"><span>%(title)s</span> #<span class="icounter">1</span> [<a href="javascript: removeInlineForm('%(parenteid)s', '%(rtype)s', '%(eid)s'); noop();">%(removemsg)s</a>]</div>
- <fieldset class="subentity">
- %(attrform)s
- %(relattrform)s
- </fieldset>
- </div>
- <fieldset class="hidden" id="fs-%(parenteid)s-%(rtype)s-%(eid)s">
-%(base)s
- <input type="hidden" value="%(novalue)s" name="edit%(so)s-%(rtype)s:%(parenteid)s" />
- <input id="rel-%(parenteid)s-%(rtype)s-%(eid)s" type="hidden" value="%(eid)s" name="%(rtype)s:%(parenteid)s" />
- </fieldset>
-</div>''' # 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'''\
-<div onclick="restoreInlinedEntity('%(parenteid)s', '%(rtype)s', '%(eid)s')" id="div-%(parenteid)s-%(rtype)s-%(eid)s" class="inlinedform">
-<div id="notice-%(parenteid)s-%(rtype)s-%(eid)s" class="notice">%(notice)s</div>
-<div class="iformTitle"><span>%(title)s</span> #<span class="icounter">%(count)s</span> [<a href="javascript: removeInlinedEntity('%(parenteid)s', '%(rtype)s', '%(eid)s'); noop();">%(removemsg)s</a>]</div>
- <div class="iformBody">
- <fieldset class="subentity">
- %(attrform)s
- </fieldset>
- %(relattrform)s
- </div>
- <fieldset id="fs-%(parenteid)s-%(rtype)s-%(eid)s">
-%(base)s
- <input type="hidden" value="%(eid)s" name="edit%(so)s-%(rtype)s:%(parenteid)s" />
- %(rinput)s
- </fieldset>
-</div>''' # do not insert trailing space or \n here !
-
- rel_input = u'''<input id="rel-%(parenteid)s-%(rtype)s-%(eid)s" type="hidden" value="%(eid)s" name="%(rtype)s:%(parenteid)s" />'''
-
- def call(self, **kwargs):
- """redefine default View.call() method to avoid automatic
- insertions of <div class="section"> 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):