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 ExtensionsTable(tables.Table): idkey = "id" selection = tables.SelectionColumn("selection", width="4%", header=False) label = tables.Column("label", label=ugettext_lazy("Name"), width="15%") version = tables.Column("version", label=ugettext_lazy("Version"), width="6%") descr = tables.Column("description", label=ugettext_lazy("Description")) cols_order = ["selection", "label", "version", "descr"]
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" 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)
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 DomainsTable(tables.Table): tableid = "objects_table" idkey = "id" styles = "table" name = tables.LinkColumn( "name", label=ugettext_lazy("Name"), urlpattern="modoboa.extensions.admin.views.domain.editdomain", title=_("Edit domain"), modal=True, modalcb="admin.domainform_cb", sortable=True, sort_order="name") domaliases = tables.Column("domainalias_set", label=ugettext_lazy("Alias(es)"), safe=True, sortable=True, sort_order="domainalias__name") actions = tables.ActionColumn("actions", label=ugettext_lazy("Actions"), defvalue=domain_actions) cols_order = ["name", "domaliases", "actions"] def __init__(self, request, doms): super(DomainsTable, self).__init__(request) self.populate(self._rows_from_model(doms)) def parse_domainalias_set(self, aliases): if not len(aliases.all()): return "---" res = "" for da in aliases.all(): res += "%s<br/>" % da.name return res def row_class(self, request, domain): if not domain.enabled: return "muted" return ""