changeset 1118:505ad860856a

Added table header for archive content listing.
author Julian Brost <julian.brost@googlemail.com>
date Sun, 04 Dec 2011 02:38:30 +0100
parents f2d8c602dbb6
children 17e7a75503d6
files MoinMoin/converter/_table.py MoinMoin/converter/archive_in.py
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/_table.py	Sun Dec 04 00:42:48 2011 +0100
+++ b/MoinMoin/converter/_table.py	Sun Dec 04 02:38:30 2011 +0100
@@ -14,10 +14,21 @@
     """
     Mixin to support building a DOM table.
     """
-    def build_dom_table(self, rows):
+    def build_dom_table(self, rows, head=None, cls=None):
         """
         Build a DOM table with data from <rows>.
         """
+        table = moin_page.table()
+        if cls is not None:
+            table.attrib[moin_page('class')] = cls
+        if head is not None:
+            table_head = moin_page.table_header()
+            table_row = moin_page.table_row()
+            for cell in head:
+                table_cell = moin_page.table_cell(children=[cell, ])
+                table_row.append(table_cell)
+            table_head.append(table_row)
+            table.append(table_head)
         table_body = moin_page.table_body()
         for row in rows:
             table_row = moin_page.table_row()
@@ -25,5 +36,6 @@
                 table_cell = moin_page.table_cell(children=[cell, ])
                 table_row.append(table_cell)
             table_body.append(table_row)
-        return moin_page.table(children=[table_body, ])
+        table.append(table_body)
+        return table
 
--- a/MoinMoin/converter/archive_in.py	Sun Dec 04 00:42:48 2011 +0100
+++ b/MoinMoin/converter/archive_in.py	Sun Dec 04 02:38:30 2011 +0100
@@ -17,6 +17,7 @@
 from MoinMoin import log
 logging = log.getLogger(__name__)
 
+from MoinMoin.i18n import _, L_, N_
 from MoinMoin.util.iri import Iri
 from MoinMoin.util.tree import moin_page, xlink
 
@@ -55,7 +56,7 @@
                          self.process_datetime(dt),
                          self.process_name(name),
                         ) for size, dt, name in contents]
-            return self.build_dom_table(contents)
+            return self.build_dom_table(contents, head=[_("Size"), _("Date"), _("Name")], cls='zebra')
         except ArchiveException as err:
             logging.exception("An exception within archive file handling occurred:")
             # XXX we also use a table for error reporting, could be