def _make_table(self, context, fields, rows, **atts): table = BaseElement('table', bgcolor='MediumOrchid3', **atts) table.context = context self._add_table_header(table, fields + ['command']) for row in rows: self._add_table_row(table, fields, row) return table
def _make_table(self, context, fields, rows, **atts): table = BaseElement("table", bgcolor="MediumOrchid3", **atts) table.context = context self._add_table_header(table, fields + ["command"]) for row in rows: self._add_table_row(table, fields, row) return table
def _add_table_header(self, table, fields, **atts): th = BaseElement('th', **atts) trow = TR() th.appendChild(trow) for field in fields: trow.appendChild(TxtTD(Bold(field))) table.appendChild(th) table.header = th
def __init__(self, troubleid, info): BaseElement.__init__(self, 'p') self.created = TextElement('h4', 'Created: %s' % info['posted']) self.appendChild(self.created) p = BaseElement('p') refresh = Anchor('refresh.page.%d' % troubleid, 'refresh') p.appendChild(refresh) self.appendChild(p)
def __init__(self, fields, row, **atts): BaseElement.__init__(self, 'table', **atts) for field in fields: trow = TR() p = TxtTD(field) trow.appendChild(p) a = TxtTD(row[field]) trow.appendChild(a) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, 'table', **atts) for row in rows: trow = TR() p = TxtTD(row.package) trow.appendChild(p) a = TxtTD(row.action) trow.appendChild(a) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, "table", **atts) hrow = TR() hrow.appendChild(TxtTD(Bold("Trait"))) hrow.appendChild(TxtTD(Bold("Order"))) self.appendChild(hrow) for row in rows: trow = TR() trow.appendChild(TxtTD(row.trait)) trow.appendChild(TxtTD(row.ord)) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, 'table', **atts) hrow = TR() hrow.appendChild(TxtTD(Bold('Trait'))) hrow.appendChild(TxtTD(Bold('Order'))) self.appendChild(hrow) for row in rows: trow = TR() trow.appendChild(TxtTD(row.trait)) trow.appendChild(TxtTD(row.ord)) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, 'table', **atts) for row in rows: trow = TR() fake_template = ',,,'.join([row.package, row.template.replace('.', ',')]) ta = Anchor('show.template.%s' % fake_template, row.template) td = TD() td.appendChild(ta) trow.appendChild(td) p = TxtTD(row.package) trow.appendChild(p) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, "table", **atts) for row in rows: trow = TR() fake_template = ",,,".join([row.package, row.template.replace(".", ",")]) ta = Anchor("show.template.%s" % fake_template, row.template) td = TD() td.appendChild(ta) trow.appendChild(td) p = TxtTD(row.package) trow.appendChild(p) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, "table", **atts) hrow = TR(bgcolor="MistyRose3") hrow.appendChild(TxtTD("Trait")) hrow.appendChild(TxtTD("Name")) hrow.appendChild(TxtTD("Value")) self.appendChild(hrow) for row in rows: trow = TR() trow.appendChild(TxtTD(row.trait)) trow.appendChild(TxtTD(row.name)) trow.appendChild(TxtTD(row.value)) self.appendChild(trow)
def __init__(self, rows, **atts): BaseElement.__init__(self, 'table', **atts) hrow = TR(bgcolor='MistyRose3') hrow.appendChild(TxtTD('Trait')) hrow.appendChild(TxtTD('Name')) hrow.appendChild(TxtTD('Value')) self.appendChild(hrow) for row in rows: trow = TR() trow.appendChild(TxtTD(row.trait)) trow.appendChild(TxtTD(row.name)) trow.appendChild(TxtTD(row.value)) self.appendChild(trow)
def __init__(self, fields, idcol, action, record, **atts): BaseElement.__init__(self, 'table', **atts) self.record = record refdata = None if hasattr(record, '_refdata'): refdata = record._refdata for field in fields: row = BaseElement('tr') key = TD(bgcolor='DarkSeaGreen') key.appendChild(Bold(field)) row.appendChild(key) val = TD() if refdata is not None and field in refdata.cols: ridcol = refdata.cols[field] refrec = refdata.data[field][record[ridcol]] node = refdata.object[field](refrec) if action: url = '.'.join(map(str, [action, field, record[idcol]])) val.appendChild(Anchor(url, node)) else: val.appendChild(node) elif action: url = '.'.join(map(str, [action, field, record[idcol]])) val.appendChild(Anchor(url, record[field])) else: node = Text() node.data = record[field] val.appendChild(node) row.appendChild(val) self.val = val self.key = key self.appendChild(row)
def append_row(self, name, value): tr = BaseElement('tr') self.appendChild(tr) ttd = BaseElement('td') vtd = BaseElement('td') ttd.appendChild(Bold(name)) vtd.appendChild(TextElement('p', value)) tr.appendChild(ttd) tr.appendChild(vtd) row = self.firstChild row.setAttribute('bgcolor', 'cornsilk')
def __init__(self, clientid, section, text): BaseElement.__init__(self, 'h4') node = Text() node.data = text self.appendChild(node) p = BaseElement('p') self.new = Anchor('new.%s.%s' % (section, clientid), 'new') self.edit = Anchor('edit.%s.%s' % (section, clientid), 'edit') p.appendChild(self.new) p.appendChild(BaseElement('br')) p.appendChild(self.edit) self.appendChild(p)
def set_machine(self, machine): self.machine.set_machine(machine) self.clear_body() title = SimpleTitleElement('Machine: %s' % machine, bgcolor='IndianRed', width='100%') self.body.appendChild(title) mtable = BaseElement('table') for k,v in self.machine.current.items(): trow = TR() trow.appendChild(TxtTD(Bold(k))) trow.appendChild(TxtTD(v)) mtable.appendChild(trow) self.body.appendChild(mtable) self.body.appendChild(SectionTitle('Machine Type')) self.body.appendChild(SectionTitle('Kernel')) self.body.appendChild(SectionTitle('Profile')) self.body.appendChild(SectionTitle('Filesystem'))
def __init__(self, subject, action, author, posted): BaseElement.__init__(self, "table") # self.app = app self.setAttribute("border", "0") self.setAttribute("width", "100%") self.setAttribute("cellpadding", "2") self.setAttribute("cellspacing", "0") self.setAttribute("bgcolor", "cornsilk4") row = BaseElement("tr") self.appendChild(row) td = self._subjectdata(subject, action) row.appendChild(td) row = BaseElement("tr") self.appendChild(row) row.setAttribute("bgcolor", "bisque4") td = self._subjectdata(author, posted) row.appendChild(td)
def set_machine(self, machine): self.machine.set_machine(machine) self.clear_body() title = SimpleTitleElement("Machine: %s" % machine, bgcolor="IndianRed", width="100%") self.body.appendChild(title) mtable = BaseElement("table") for k, v in self.machine.current.items(): trow = TR() trow.appendChild(TxtTD(Bold(k))) trow.appendChild(TxtTD(v)) mtable.appendChild(trow) self.body.appendChild(mtable) newanchor = Anchor("new.machine.foo", "new") editanchor = Anchor("edit.machine.%s" % machine, "edit") self.body.appendChild(HR()) self.body.appendChild(editanchor) self.body.appendChild(BR()) self.body.appendChild(newanchor)
def __init__(self, ticketid, row): BaseElement.__init__(self, "p") self.author = TextElement("h5", "Author: %s" % row.author) self.created = TextElement("h5", "Created: %s" % row.created) # node = TextElement('h2', row.title) # self.appendChild(node) self.appendChild(self.created) self.appendChild(self.author) p = BaseElement("p") refresh = Anchor("refresh.page.%d" % ticketid, "refresh") assign = Anchor("assign.ticket.%d" % ticketid, "assign") p.appendChild(refresh) p.appendChild(BaseElement("br")) p.appendChild(assign) self.appendChild(p)
def set_machine(self, machine): self.machine.set_machine(machine) self.clear_body() title = SimpleTitleElement('Machine: %s' % machine, bgcolor='IndianRed', width='100%') self.body.appendChild(title) mtable = BaseElement('table') for k,v in self.machine.current.items(): trow = TR() trow.appendChild(TxtTD(Bold(k))) trow.appendChild(TxtTD(v)) mtable.appendChild(trow) self.body.appendChild(mtable) newanchor = Anchor('new.machine.foo', 'new') editanchor = Anchor('edit.machine.%s' % machine, 'edit') self.body.appendChild(HR()) self.body.appendChild(editanchor) self.body.appendChild(BR()) self.body.appendChild(newanchor)
def set_machine(self, machine): self.machine.set_machine(machine) self.clear_body() title = SimpleTitleElement('Machine: %s' % machine, bgcolor='IndianRed', width='100%') self.body.appendChild(title) mtable = BaseElement('table') for k, v in self.machine.current.items(): trow = TR() trow.appendChild(TxtTD(Bold(k))) trow.appendChild(TxtTD(v)) mtable.appendChild(trow) self.body.appendChild(mtable) newanchor = Anchor('new.machine.foo', 'new') editanchor = Anchor('edit.machine.%s' % machine, 'edit') self.body.appendChild(HR()) self.body.appendChild(editanchor) self.body.appendChild(BR()) self.body.appendChild(newanchor)
def setID(self, clientid): cdata = self.manager.getClientInfo(clientid) cdata['addresses'].set_refobject('address', AddressRecord) self.current = clientid self.clear_body() #make header #self.header = ClientHeaderElement(cdata['client']) self.header = ClientTitleElement(cdata['client']) self.body.appendChild(self.header) #make main table self.mtable = BaseElement('table') self.mtable.appendChild(BaseElement('tr')) self.body.appendChild(self.mtable) #append contacts header conheader = ClientSectionHeader(self.current, 'contact', 'Contacts:') self.mtable.firstChild.appendChild(TextElement('td', conheader)) self.contacts = ContactDoc(self.app) self.mtable.firstChild.appendChild(TextElement('td', self.contacts)) #append locations header row = BaseElement('tr') locheader = ClientSectionHeader(self.current, 'location', 'Locations:') row.appendChild(TextElement('td', locheader)) self.locations = LocationDoc(self.app) self.mtable.appendChild(row) row.appendChild(TextElement('td', self.locations)) #insert the contacts, locations and tickets self.contacts.set_records(cdata['contacts'], action=None) self.locations.set_records(cdata['locations'], action=None) for node in self.contacts.records.values(): node.setAttribute('bgcolor', 'DarkSeaGreen3') for node in self.locations.records.values(): node.setAttribute('bgcolor', 'DarkSeaGreen3') self.records = cdata #append tag data #check for tag data tags = self.manager.getTags(clientid) row = BaseElement('tr') tagdoc = ClientTagTableElement(clientid, tags) row.appendChild(tagdoc) self.mtable.appendChild(row) newtrouble = Anchor('new.trouble.%s' % clientid, 'new trouble') self.body.appendChild(newtrouble)
def __init__(self, db, tagname, **atts): BaseElement.__init__(self, tagname, **atts) self.db = db
def _make_table(self, fields, rows, **atts): table = BaseElement('table', **atts) self._add_table_header(table, fields) for row in rows: self._add_table_row(table, fields, row) return table
def _subjectdata(self, subject, action): td = BaseElement("td") font = BaseElement("font") font.setAttribute("color", "gold") element = TextElement("b", subject) font.appendChild(element) td.appendChild(font) font = BaseElement("font") font.setAttribute("color", "yellow") element = Text() font.appendChild(element) element.data = "(%s)" % action td.appendChild(font) return td
def __init__(self, client): BaseElement.__init__(self, 'head') self.client = client node = TextElement('h1', client) self.appendChild(node) self.appendChild(BaseElement('hr'))
def __init__(self, tags): BaseElement.__init__(self, 'table') self.setAttribute('border', '0') for name, value in tags.items(): self.append_row(name, value)
def __init__(self, clientid, tags): BaseElement.__init__(self, 'table') title = ClientTagTitleElement(clientid) rows = ClientTagTableRowsElement(tags) self.append_row(title) self.append_row(rows)
def __init__(self, app, **atts): BaseElement.__init__(self, 'html', **atts) self.app = app self.conn = app.conn self.body = Body() self.appendChild(self.body)
def append_row(self, element): tr = BaseElement('tr') self.appendChild(tr) td = BaseElement('td') tr.appendChild(td) td.appendChild(element)
def __init__(self, **atts): BaseElement.__init__(self, 'table', width='100%') self.appendChild(TR()) self.firstChild.appendChild(BaseElement('td', **atts))
def __init__(self, record, **atts): BaseElement.__init__(self, 'p', **atts) node = Text() node.data = self.makeParagraph(record) self.appendChild(node)