Ejemplo n.º 1
0
 def default(self, *args, **kw):
     page = Page(str(self.dbsess))
     page.addMenu()
     page.append(html.P('args=' + repr(args)))
     page.append(html.P('kw=' + repr(kw)))
     page.addFooter()
     return str(page)
Ejemplo n.º 2
0
def main(args):
    root_url = args[0]
    report_list_file = urllib.urlopen(root_url + '/' + args[1])
    report_list = []
    for line in report_list_file:
        line = line.strip()
        report_list.append(root_url + '/' + line)

    htTable = ht.TABLE()
    for i in range(5):
        report = PackageReport(report_list[i])
        ##print report
        htTable.append(report.toHtml())
    print ht.HTML(ht.BODY(htTable))
Ejemplo n.º 3
0
    def addMenu(self):
        div = html.DIV(klass="menu")
        self.append(div)

        p = html.P("Menu:")
        div.append(p)
        p.append(html.BR())
        p.append(html.A("home", href="/"))
        p.append(html.BR())
        p.append(html.A("foo", href="foo/bar/baz"))
        p.append(html.BR())
        p.append(html.A("reports", href="report"))
Ejemplo n.º 4
0
    def report(self, *args,**kw):
        doc=self.beginResponse(title="report()")
        if len(args) > 0:
            tcl=self.dbsess.getTableClass(args[0])
            if tcl is not None:
                self.dbsess.showViewGrid(tcl,*args[1:],**kw)
            else:
                self.dbsess.warning("%s : no such table",args[0])
                #doc.append(html.P(args[0]+" : no such table"))
                
            return self.endResponse()
        list=html.UL(); doc.append(list)
        for table in self.dbsess.db.app.getTableList():
            li=html.LI() ; list.append(li)
            li.append(html.A(table.getLabel(),
                             href="report/"+table.getTableName()))
            li.append(" (%d rows)" %
                len(self.dbsess.query(table._instanceClass)))

        return self.endResponse()
Ejemplo n.º 5
0
 def toHtml(self):
     """Eventually, this method will return the HTML text for
     representing this report as an HTML table row
     """
     tableRow = ht.TR()
     tableRow.append(ht.TD(self.name))
     tableRow.append(ht.TD(self.version))
     ## FIXME: want to use CSS classes and not define color explicitly
     status = ht.FONT(self.status, color=self.statusColor)
     tableRow.append(ht.TD(ht.A(status, href=self.outputUrl)))
     return tableRow
Ejemplo n.º 6
0
def showReport(doc, rpt):
    rpt.setupReport()
    table = html.TABLE(title=rpt.getTitle())
    doc.append(table)

    tr = html.TR()
    table.append(tr)
    for col in rpt.columns:
        tr.append(html.TH(col.getLabel()))

    for row in rpt:
        tr = html.TR()
        table.append(tr)
        for col in rpt.columns:
            v = col.getCellValue(row)
            if v is None:
                tr.append(html.TD(" "))
            else:
                s = text2html(col.format(v).decode())
                tr.append(html.TD(s))
Ejemplo n.º 7
0
 def renderButton(self,btn):
     if btn.enabled:
         self.append(html.A(label2txt(btn.getLabel()),
                            href=cherrypy.request.path+"/"+btn.name))
     else:
         self.append(btn.label2txt(getLabel()))
Ejemplo n.º 8
0
 def p(self,txt):
     self.append(html.P(txt))
Ejemplo n.º 9
0
 def index(self):
     doc = self.beginResponse(title="index()")
     doc.append(html.P("This is the top-level page"))
     return self.endResponse()
Ejemplo n.º 10
0
 def addFooter(self):
     div = html.DIV(klass="footer")
     self.append(div)
     div.append(html.P("foo " + cherrypy.request.base + " bar"))
Ejemplo n.º 11
0
 def setup(self):
     div = html.DIV(klass="title")
     self.append(div)
     div.append(html.H1(self.title))
Ejemplo n.º 12
0
 def __init__(self, title, *args, **kw):
     self.title = html.TITLE(title)
     Document.__init__(self, *args, **kw)