web/views/formrenderers.py
branchstable
changeset 3513 c002f6488631
parent 3510 bf746bf4a394
child 3518 11ce4682187d
equal deleted inserted replaced
3512:2ceaa4e40348 3513:c002f6488631
   309     id = 'composite'
   309     id = 'composite'
   310 
   310 
   311     _main_display_fields = None
   311     _main_display_fields = None
   312 
   312 
   313     def render_fields(self, w, form, values):
   313     def render_fields(self, w, form, values):
   314         if not form.is_subform:
   314         if form.parent_form is None:
   315             w(u'<table class="listing">')
   315             w(u'<table class="listing">')
   316             subfields = [field for field in form.forms[0].fields
   316             subfields = [field for field in form.forms[0].fields
   317                          if self.display_field(form, field)
   317                          if self.display_field(form, field)
   318                          and field.is_visible()]
   318                          and field.is_visible()]
   319             if subfields:
   319             if subfields:
   325                              onclick="setCheckboxesState('eid', this.checked)"))
   325                              onclick="setCheckboxesState('eid', this.checked)"))
   326                 for field in subfields:
   326                 for field in subfields:
   327                     w(u'<th>%s</th>' % self.req._(field.label))
   327                     w(u'<th>%s</th>' % self.req._(field.label))
   328                 w(u'</tr>')
   328                 w(u'</tr>')
   329         super(EntityCompositeFormRenderer, self).render_fields(w, form, values)
   329         super(EntityCompositeFormRenderer, self).render_fields(w, form, values)
   330         if not form.is_subform:
   330         if form.parent_form is None:
   331             w(u'</table>')
   331             w(u'</table>')
   332             if self._main_display_fields:
   332             if self._main_display_fields:
   333                 super(EntityCompositeFormRenderer, self)._render_fields(
   333                 super(EntityCompositeFormRenderer, self)._render_fields(
   334                     self._main_display_fields, w, form)
   334                     self._main_display_fields, w, form)
   335 
   335 
   336     def _render_fields(self, fields, w, form):
   336     def _render_fields(self, fields, w, form):
   337         if form.is_subform:
   337         if form.parent_form is not None:
   338             entity = form.edited_entity
   338             entity = form.edited_entity
   339             values = form.form_previous_values
   339             values = form.form_previous_values
   340             qeid = eid_param('eid', entity.eid)
   340             qeid = eid_param('eid', entity.eid)
   341             cbsetstate = "setCheckboxesState2('eid', %s, 'checked')" % \
   341             cbsetstate = "setCheckboxesState2('eid', %s, 'checked')" % \
   342                          xml_escape(dumps(entity.eid))
   342                          xml_escape(dumps(entity.eid))