コード例 #1
0
 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)
コード例 #2
0
ファイル: xmlgen.py プロジェクト: BackupTheBerlios/paella-svn
 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)
コード例 #3
0
ファイル: xmlgen.py プロジェクト: BackupTheBerlios/paella-svn
 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
コード例 #4
0
 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)
コード例 #5
0
ファイル: machine.py プロジェクト: pombredanne/paella-svn
 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
コード例 #6
0
ファイル: xmlgen.py プロジェクト: pombredanne/paella-svn
 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'))
コード例 #7
0
    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)
コード例 #8
0
ファイル: main.py プロジェクト: BackupTheBerlios/paella-svn
 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)
コード例 #9
0
ファイル: xmlgen.py プロジェクト: BackupTheBerlios/paella-svn
 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)
コード例 #10
0
ファイル: machine.py プロジェクト: pombredanne/paella-svn
 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)
コード例 #11
0
 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)
コード例 #12
0
    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
コード例 #13
0
 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')
コード例 #14
0
 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)
コード例 #15
0
class ClientInfoDoc(BaseDocument):
    def __init__(self, app):
        BaseDocument.__init__(self, app)
        self.manager = ClientManager(self.app)
        self.body.setAttribute('text', '#000000')
        self.body.setAttribute('background', 'Time-For-Lunch-2.jpg')

    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)
コード例 #16
0
 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)
コード例 #17
0
 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)
コード例 #18
0
 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)
コード例 #19
0
 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)
コード例 #20
0
 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')
コード例 #21
0
 def append_row(self, element):
     tr = BaseElement('tr')
     self.appendChild(tr)
     td = BaseElement('td')
     tr.appendChild(td)
     td.appendChild(element)