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 __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 __init__(self, row): BaseElement.__init__(self, 'tr') table = BaseElement('table') top = BaseElement('tr', bgcolor='DarkSeaGreen') table.appendChild(top) mid = BaseElement('tr', bgcolor='DarkSeaGreen3') table.appendChild(mid) bottom = BaseElement('tr', bgcolor='DarkSeaGreen2') table.appendChild(bottom) action = TextElement('td', row.action) action.setAttribute('align', 'left') posted = TextElement('td', row.posted) posted.setAttribute('align', 'right') top.appendChild(action) top.appendChild(posted) mid.appendChild(TextElement('td', row.workdone)) instatus = TextElement('td', row.instatus) outstatus = TextElement('td', row.outstatus) instatus.setAttribute('align', 'left') outstatus.setAttribute('align', 'right') bottom.appendChild(instatus) bottom.appendChild(outstatus) self.appendChild(top) self.appendChild(mid) self.appendChild(bottom) if row.instatus != row.outstatus: bottom.setAttribute('bgcolor', 'GoldenRod')
def __init__(self, info): troubleid = info['troubleid'] problem = info['problem'] worktodo = info['worktodo'] status = info['status'] posted = info['posted'] BaseElement.__init__(self, 'div') self.setAttribute('id', 'trouble-%d' % troubleid) self.setAttribute('class', 'troubleinfo') self.title = TitleTable('%s\nStatus: %s' % (problem, status)) self.client = TextElement('h3', 'Client: %s' % info['client']) self.posted = TextElement('b', 'Created: %s' % posted) self.worktodo = TextElement('p', worktodo) self.appendChild(self.title) self.appendChild(self.client) self.appendChild(BR()) self.appendChild(self.posted) self.appendChild(self.worktodo) self.anchor = Anchor('show.trouble.%d' % troubleid, 'show') self.assign = Anchor('assign.trouble.%d' % troubleid, 'assign') node = BaseElement('table') node.setAttribute('width', '100%') node.setAttribute('align', 'center') self.appendChild(node ) row = BaseElement('tr') row.appendChild(TextElement('td', self.anchor)) td = TextElement('td', self.assign) td.setAttribute('align', 'right') row.appendChild(td) node.appendChild(row)
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, 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, 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, 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) 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) 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, 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 __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, 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, 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 __init__(self, title): BaseElement.__init__(self, 'table') self.setAttribute('border', '1') #self.setAttribute('width', '100%') self.setAttribute('cellpadding', '2') self.setAttribute('cellspacing', '0') self.setAttribute('bgcolor', 'IndianRed') row = BaseElement('tr') td = BaseElement('td') self.appendChild(row) row.appendChild(td) font = BaseElement('font') font.setAttribute('color', 'gold') td.appendChild(font) element = TextElement('b', title) font.appendChild(element)
def __init__(self, title): BaseElement.__init__(self, "table") self.setAttribute("border", "1") # self.setAttribute('width', '100%') self.setAttribute("cellpadding", "2") self.setAttribute("cellspacing", "0") self.setAttribute("bgcolor", "cornsilk4") row = BaseElement("tr") td = BaseElement("td") self.appendChild(row) row.appendChild(td) font = BaseElement("font") font.setAttribute("color", "gold") td.appendChild(font) element = TextElement("b", title) font.appendChild(element)
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 __init__(self, ticketid, title, author, created): BaseElement.__init__(self, "div") self.setAttribute("id", "ticket-%d" % ticketid) self.setAttribute("class", "ticketinfo") self.title = TitleTable(title) # self.title = TextElement('h4', title) self.author = TextElement("h5", "Author: %s" % author) self.created = TextElement("h5", "Created: %s" % created) self.appendChild(self.title) self.appendChild(self.author) self.appendChild(self.created) self.anchor = Anchor("show.ticket.%d" % ticketid, "show") self.assign = Anchor("assign.ticket.%d" % ticketid, "assign") node = BaseElement("table") node.setAttribute("width", "100%") node.setAttribute("align", "center") self.appendChild(node) row = BaseElement("tr") row.appendChild(TextElement("td", self.anchor)) td = TextElement("td", self.assign) td.setAttribute("align", "right") row.appendChild(td) node.appendChild(row)
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, client): BaseElement.__init__(self, 'head') self.client = client node = TextElement('h1', client) self.appendChild(node) self.appendChild(BaseElement('hr'))
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 __init__(self, ticketid): BaseElement.__init__(self, "table") row = BaseElement("tr") self.anchor = Anchor("show.ticket.%d" % ticketid, "show") self.assign = Anchor("assign.ticket.%d" % ticketid, "assign")
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, troubleid): BaseElement.__init__(self, 'h3') self.append = Anchor('new.action.none', 'append') self.appendChild(self.append)
def __init__(self, **atts): BaseElement.__init__(self, 'table', width='100%') self.appendChild(TR()) self.firstChild.appendChild(BaseElement('td', **atts))
def __init__(self, actionrows): BaseElement.__init__(self, 'table') for row in actionrows: self.appendChild(ActionTableRow(row))
def __init__(self, ticketid): BaseElement.__init__(self, "h3") self.respond = Anchor("new.action.none", "respond") self.appendChild(self.respond)
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 __init__(self, db, tagname, **atts): BaseElement.__init__(self, tagname, **atts) self.db = db
def __init__(self, record, **atts): BaseElement.__init__(self, 'p', **atts) node = Text() node.data = self.makeParagraph(record) self.appendChild(node)