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 _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 set_machine_type(self, machine_type): clause = Eq('machine_type', machine_type) self.clear_body() title = SimpleTitleElement('MachineType: %s' % machine_type, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(TextElement('h1', 'Machine Disks')) rows = self.cursor.select(table='machine_disks', clause=clause) fields = ['diskname', 'device'] disktable = self._make_table(fields, rows) disktable.header.firstChild.setAttribute('bgcolor', 'cornsilk3') self.body.appendChild(disktable) modrows = self.cursor.select(table='machine_modules', clause=clause, order=['ord']) if len(modrows): self.body.appendChild(TextElement('h1', 'Machine Modules')) modtable = self._make_table(['module', 'ord'], modrows) modtable.header.firstChild.setAttribute('bgcolor', 'cornsilk3') self.body.appendChild(modtable) self._make_footer_anchors('machine_type', machine_type)
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 set_filesystem(self, filesystem): clause = Eq('filesystem', filesystem) self.clear_body() title = SimpleTitleElement('Filesystem: %s' % filesystem, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(TextElement('h2', 'Filesystem Mounts')) rows = self.cursor.select(table='filesystem_mounts', clause=clause, order=['ord']) fields = ['mnt_name', 'partition', 'ord'] mounttable = self._make_table(fields, rows, bgcolor='DarkSeaGreen') self.body.appendChild(mounttable) self._make_footer_anchors('filesystem', filesystem)
def __init__(self, conn, suite): self.conn = conn self.cursor = StatementCursor(self.conn, name='_Trait_') Element.__init__(self, 'trait') self.desc_element = TextElement('description', None) self.parent_element = Element('parents') self.pkg_element = Element('packages') self.env_element = Element('environ') self.templ_element = Element('templates') self.scripts_element = Element('scripts') self.appendChild(self.desc_element) self.appendChild(self.parent_element) self.appendChild(self.pkg_element) self.appendChild(self.env_element) self.appendChild(self.templ_element) self.appendChild(self.scripts_element) self.set_suite(suite)
def __init__(self, text): TextElement.__init__(self, 'td', text)
def __init__(self, data): TextElement.__init__(self, "p", data)
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, data): TextElement.__init__(self, 'p', data)
def __init__(self, text): TextElement.__init__(self, "td", text)