changeset 213:ffaf11b6c429

text_x_arnica: removed internal definition of DataBrowserWidget.format
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 01 Sep 2008 09:51:16 +0200
parents bb2f7c52d1d7
children e7bf7e714d13
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 2 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Tue Aug 05 17:19:07 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Mon Sep 01 09:51:16 2008 +0200
@@ -36,93 +36,6 @@
 
 parser_name = __name__.split('.')[-1]
 
-
-class _DataBrowserWidget(DataBrowserWidget):
-    """ we have to remove the used form in format otherwise the needed form elements
-        becomes a nested form and this raises lots of strict html4.01 errors.
-    """
-    def format(self):
-        fmt = self.request.formatter
-        result = []
-        havefilters = False
-        for col in self.data.columns:
-            if col.autofilter:
-                havefilters = True
-                break
-        if havefilters:
-            result.append(fmt.rawHTML('<input type="submit" value="%s" %s>' % (self._filter, self._name('submit'))))
-
-        result.append(fmt.table(1, id='%stable' % self.data_id))
-
-        # add header line
-        if self._show_header:
-            result.append(fmt.table_row(1))
-            for idx in range(len(self.data.columns)):
-                col = self.data.columns[idx]
-                if col.hidden:
-                    continue
-                result.append(fmt.table_cell(1))
-                result.append(fmt.strong(1))
-                result.append(col.label or col.name)
-                result.append(fmt.strong(0))
-                if col.autofilter:
-                    result.append(fmt.linebreak(False))
-                    select = """<select %s onchange="dbw_update_search('%s');">%s</select>""" % (
-                                      self._name('filter%d' % idx),
-                                      self.data_id,
-                                      self._filteroptions(idx))
-                    result.append(fmt.rawHTML(select))
-                result.append(fmt.table_cell(0))
-            result.append(fmt.table_row(0))
-
-        # add data
-        self.data.reset()
-        row = self.data.next()
-        if row is not None:
-            filters = [None] * len(row)
-            if havefilters:
-                for idx in range(len(row)):
-                    name = '%sfilter%d' % (self.data_id, idx)
-                    if name in self.request.form:
-                        filters[idx] = self.request.form[name][0]
-                        if filters[idx] == self._all:
-                            filters[idx] = None
-        while row:
-            hidden = False
-            if havefilters:
-                # check if row needs to be hidden due to filtering
-                for idx in range(len(row)):
-                    if filters[idx]:
-                        if isinstance(row[idx], tuple):
-                            data = unicode(row[idx][1])
-                        else:
-                            data = unicode(row[idx])
-                        if data != '' and filters[idx] == self._notempty:
-                            continue
-                        if data == '' and filters[idx] == self._empty:
-                            continue
-                        if data != filters[idx]:
-                            hidden = True
-                            break
-            if not hidden:
-                result.append(fmt.table_row(1))
-                for idx in range(len(row)):
-                    if self.data.columns[idx].hidden:
-                        continue
-                    if isinstance(row[idx], tuple):
-                        result.append(fmt.table_cell(1, abbr=unicode(row[idx][1])))
-                        result.append(unicode(row[idx][0]))
-                    else:
-                        result.append(fmt.table_cell(1))
-                        result.append(unicode(row[idx]))
-                    result.append(fmt.table_cell(0))
-                result.append(fmt.table_row(0))
-            row = self.data.next()
-        result.append(fmt.table(0))
-
-        return ''.join(result)
-
-
 def arnica_settings(target_page=u'', columns=4, file_regex=u'.',
                     image_for_webnail=False,
                     show_text=True, show_date=True, show_tools=False,
@@ -683,9 +596,9 @@
         # adds the last row if it is not filled up
         if result:
             data.addRow(tuple(result))
-        browser = _DataBrowserWidget(self.request, show_header=False)
+        browser = DataBrowserWidget(self.request, show_header=False)
         browser.setData(data)
-        return browser.format()
+        return browser.render(method="POST")
 
     def format(self, formatter):
         """ parser output """