class WMtable(tables.Table): tableid = "emails" styles = "table-condensed" idkey = "imapid" select = tables.ImgColumn( "select", cssclass="draggable left", width="2%", defvalue="%spics/grippy.png" % settings.STATIC_URL, header="<input type='checkbox' name='toggleselect' id='toggleselect' />" ) flags = tables.ImgColumn("flags", width="4%") withatts = tables.ImgColumn("withatts", width="2%") subject = tables.Column("subject", label=ugettext_lazy("Subject"), width="50%", limit=60) from_ = tables.Column("from", width="20%", label=ugettext_lazy("From"), limit=30) date = tables.Column("date", width="15%", label=ugettext_lazy("Date")) cols_order = ["select", "withatts", "flags", "subject", "from_", "date"] def parse(self, header, value): if value is None: return "" try: value = getattr(IMAPheader, "parse_%s" % header)(value) except AttributeError: pass return value
class WMtable(tables.Table): """ Webmail listing table. """ tableid = "emails" styles = "table-condensed" idkey = "imapid" drag = tables.ImgColumn( "drag", cssclass="draggable left", width="1%", defvalue="%spics/grippy.png" % settings.STATIC_URL, header="<input type='checkbox' name='toggleselect' id='toggleselect' />" ) selection = tables.SelectionColumn("selection", safe=True, width='1%', header=None, sortable=False) flags = tables.ImgColumn("flags", width="3%") withatts = tables.ImgColumn("withatts", width="2%") subject = tables.Column("subject", label=ugettext_lazy("Subject"), width="50%", limit=60, cssclass="openable") from_ = tables.Column("from", width="20%", label=ugettext_lazy("From"), limit=30, cssclass="openable") date = tables.Column("date", width="15%", label=ugettext_lazy("Date"), cssclass="openable") cols_order = [ "drag", "selection", "withatts", "flags", "subject", "from_", "date" ] def parse(self, header, value): if value is None: return "" try: value = getattr(imapheader, "parse_%s" % header)(value) except AttributeError: pass return value
class Qtable(tables.Table): tableid = "emails" styles = "table-condensed" idkey = "mailid" selection = tables.SelectionColumn("selection", safe=True, width='5px', header=None, sortable=False) type = tables.Column("type", align="center", width="30px", sort_order="type", safe=True) rstatus = tables.ImgColumn("rstatus", width='25px', sortable=False) score = tables.Column("score", label=ugettext_lazy("Score"), limit=6, sort_order="score", cssclass="openable") to = tables.Column("to", label=ugettext_lazy("To"), sort_order="to", cssclass="openable") from_ = tables.Column("from", label=ugettext_lazy("From"), limit=30, sort_order="from", cssclass="openable") subject = tables.Column("subject", label=ugettext_lazy("Subject"), limit=40, sort_order="subject", cssclass="openable") time = tables.Column("date", label=ugettext_lazy("Date"), sort_order="date", cssclass="openable") cols_order = [ 'selection', 'type', 'rstatus', 'score', 'to', 'from_', 'subject', 'time' ] def parse_type(self, value): color = 'important' if value in ['S', 'V'] else 'warning' return '<span class="label label-%s">%s</span>' % (color, value) def parse_date(self, value): return datetime.fromtimestamp(value)
class Qtable(tables.Table): tableid = "emails" styles = "table-condensed" idkey = "mailid" type = tables.Column( "type", align="center", width="30px", ) rstatus = tables.ImgColumn("rstatus", width='25px') from_ = tables.Column("from", label=ugettext_lazy("From"), limit=30) subject = tables.Column("subject", label=ugettext_lazy("Subject"), limit=40) time = tables.Column("date", label=ugettext_lazy("Date")) to = tables.Column("to", label=ugettext_lazy("To"), sortable=False) cols_order = [] def parse_date(self, value): return datetime.fromtimestamp(value)