equal
deleted
inserted
replaced
367 def call(self, columns=None): |
367 def call(self, columns=None): |
368 if self.css_files: |
368 if self.css_files: |
369 self._cw.add_css(self.css_files) |
369 self._cw.add_css(self.css_files) |
370 _ = self._cw._ |
370 _ = self._cw._ |
371 self.columns = columns or self.columns |
371 self.columns = columns or self.columns |
372 ecls = self._cw.vreg['etypes'].etype_class(self.cw_rset.description[0][0]) |
372 sample = self.cw_rset.get_entity(0, 0) |
373 self.w(u'<table class="%s">' % self.table_css) |
373 self.w(u'<table class="%s">' % self.table_css) |
374 self.table_header(ecls) |
374 self.table_header(sample) |
375 self.w(u'<tbody>') |
375 self.w(u'<tbody>') |
376 for row in xrange(self.cw_rset.rowcount): |
376 for row in xrange(self.cw_rset.rowcount): |
377 self.cell_call(row=row, col=0) |
377 self.cell_call(row=row, col=0) |
378 self.w(u'</tbody>') |
378 self.w(u'</tbody>') |
379 self.w(u'</table>') |
379 self.w(u'</table>') |
394 onmouseout="removeElementClass(this, 'highlighted')">""") |
394 onmouseout="removeElementClass(this, 'highlighted')">""") |
395 line = u''.join(u'<td>%%(%s)s</td>' % col for col in self.columns) |
395 line = u''.join(u'<td>%%(%s)s</td>' % col for col in self.columns) |
396 self.w(line % infos) |
396 self.w(line % infos) |
397 self.w(u'</tr>\n') |
397 self.w(u'</tr>\n') |
398 |
398 |
399 def table_header(self, ecls): |
399 def table_header(self, sample): |
400 """builds the table's header""" |
400 """builds the table's header""" |
401 self.w(u'<thead><tr>') |
401 self.w(u'<thead><tr>') |
402 _ = self._cw._ |
|
403 for column in self.columns: |
402 for column in self.columns: |
404 meth = getattr(self, 'header_for_%s' % column, None) |
403 meth = getattr(self, 'header_for_%s' % column, None) |
405 if meth: |
404 if meth: |
406 colname = meth(ecls) |
405 colname = meth(sample) |
407 else: |
406 else: |
408 colname = _(column) |
407 colname = self._cw._(column) |
409 self.w(u'<th>%s</th>' % xml_escape(colname)) |
408 self.w(u'<th>%s</th>' % xml_escape(colname)) |
410 self.w(u'</tr></thead>\n') |
409 self.w(u'</tr></thead>\n') |
411 |
410 |
412 |
411 |