diff options
author | Gianluca Montecchi <gian@grys.it> | 2009-10-08 00:41:31 +0200 |
---|---|---|
committer | Gianluca Montecchi <gian@grys.it> | 2009-10-08 00:41:31 +0200 |
commit | 32a16930caa09094b97069f08d504fa5d0f9514a (patch) | |
tree | a22e40665c0b2967630eb4b522254f201254c2af /becommands/html.py | |
parent | c65661ce0bcacf67169faf3f62d495a1e8269aa8 (diff) | |
download | bugseverywhere-32a16930caa09094b97069f08d504fa5d0f9514a.tar.gz |
Template system v1 completed
Diffstat (limited to 'becommands/html.py')
-rw-r--r-- | becommands/html.py | 345 |
1 files changed, 315 insertions, 30 deletions
diff --git a/becommands/html.py b/becommands/html.py index f943258..084aa64 100644 --- a/becommands/html.py +++ b/becommands/html.py @@ -94,7 +94,7 @@ def get_parser(): parser = cmdutil.CmdOptionParser("be html [options]") parser.add_option("-o", "--output", metavar="export_dir", dest="outdir", help="Set the output path, default is ./html_export", default="html_export") - parser.add_option("-t", "--template", metavar="template", dest="template", + parser.add_option("-t", "--template-dir", metavar="template", dest="template", help="Use a different template, default is empty", default=None) parser.add_option("-v", "--verbose", action="store_true", metavar="verbose", dest="verbose", help="Verbose output, default is no", default=False) @@ -134,35 +134,283 @@ class BEHTMLGen(): self.template = "default" else: self.template = template - FI = open("./templates/%s/style.css"%self.template) - self.css_file = FI.read() - FI.close() + + self.css_file = """ + body { + font-family: "lucida grande", "sans serif"; + color: #333; + width: auto; + margin: auto; + } + + + div.main { + padding: 20px; + margin: auto; + padding-top: 0; + margin-top: 1em; + background-color: #fcfcfc; + } + + .comment { + padding: 20px; + margin: auto; + padding-top: 20px; + margin-top: 0; + } + + .commentF { + padding: 0px; + margin: auto; + padding-top: 0px; + paddin-bottom: 20px; + margin-top: 0; + } + + tb { + border = 1; + } + + .wishlist-row { + background-color: #B4FF9B; + width: auto; + } + + .minor-row { + background-color: #FCFF98; + width: auto; + } + + + .serious-row { + background-color: #FFB648; + width: auto; + } + + .critical-row { + background-color: #FF752A; + width: auto; + } + + .fatal-row { + background-color: #FF3300; + width: auto; + } + + .person { + font-family: courier; + } + + a, a:visited { + background: inherit; + text-decoration: none; + } + + a { + color: #003d41; + } + + a:visited { + color: #553d41; + } + + ul { + list-style-type: none; + padding: 0; + } + + p { + width: auto; + } + + .inline-status-image { + position: relative; + top: 0.2em; + } + + .dimmed { + color: #bbb; + } + + table { + border-style: 10px solid #313131; + border-spacing: 0; + width: auto; + } + + table.log { + } + + td { + border-width: 0; + border-style: none; + padding-right: 0.5em; + padding-left: 0.5em; + width: auto; + } + + .td_sel { + background-color: #afafaf; + border: 1px solid #afafaf; + font-weight:bold; + padding-right: 1em; + padding-left: 1em; + + } + + .td_nsel { + border: 0px; + padding-right: 1em; + padding-left: 1em; + } + + tr { + vertical-align: top; + width: auto; + } + + h1 { + padding: 0.5em; + background-color: #305275; + margin-top: 0; + margin-bottom: 0; + color: #fff; + margin-left: -20px; + margin-right: -20px; + } + + wid { + text-transform: uppercase; + font-size: smaller; + margin-top: 1em; + margin-left: -0.5em; + /*background: #fffbce;*/ + /*background: #628a0d;*/ + padding: 5px; + color: #305275; + } + + .attrname { + text-align: right; + font-size: smaller; + } + + .attrval { + color: #222; + } + + .issue-closed-fixed { + background-image: "green-check.png"; + } + + .issue-closed-wontfix { + background-image: "red-check.png"; + } + + .issue-closed-reorg { + background-image: "blue-check.png"; + } + + .inline-issue-link { + text-decoration: underline; + } + + img { + border: 0; + } + + + div.footer { + font-size: small; + padding-left: 20px; + padding-right: 20px; + padding-top: 5px; + padding-bottom: 5px; + margin: auto; + background: #305275; + color: #fffee7; + } + + .footer a { + color: #508d91; + } + + + .header { + font-family: "lucida grande", "sans serif"; + font-size: smaller; + background-color: #a9a9a9; + text-align: left; + + padding-right: 0.5em; + padding-left: 0.5em; + + } + + + .selected-cell { + background-color: #e9e9e2; + } + + .plain-cell { + background-color: #f9f9f9; + } + + + .logcomment { + padding-left: 4em; + font-size: smaller; + } + + .id { + font-family: courier; + } + + .table_bug { + background-color: #afafaf; + border: 2px solid #afafaf; + } + + .message { + } + + .progress-meter-done { + background-color: #03af00; + } + + .progress-meter-undone { + background-color: #ddd; + } + + .progress-meter { + } + """ self.index_first = """ - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>BugsEverywhere Issue Tracker</title> - <meta http-equiv="Content-Type" content="text/html; charset=%s" /> - <link rel="stylesheet" href="style.css" type="text/css" /> - </head> - <body> - - - <div class="main"> - <h1>BugsEverywhere Bug List</h1> - <p></p> - <table> - - <tr> - <td class="%%s"><a href="index.html">Active Bugs</a></td> - <td class="%%s"><a href="index_inactive.html">Inactive Bugs</a></td> - </tr> - - </table> - <table class="table_bug"> - <tbody> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>BugsEverywhere Issue Tracker</title> + <meta http-equiv="Content-Type" content="text/html; charset=%s" /> + <link rel="stylesheet" href="style.css" type="text/css" /> + </head> + <body> + + + <div class="main"> + <h1>BugsEverywhere Bug List</h1> + <p></p> + <table> + + <tr> + <td class="%%s"><a href="index.html">Active Bugs</a></td> + <td class="%%s"><a href="index_inactive.html">Inactive Bugs</a></td> + </tr> + + </table> + <table class="table_bug"> + <tbody> """ % self.bd.encoding self.bug_line =""" @@ -195,8 +443,6 @@ class BEHTMLGen(): <tbody> """ % self.bd.encoding - - self.detail_line =""" <tr> <td align="right">%s</td><td>%s</td> @@ -241,6 +487,45 @@ class BEHTMLGen(): </html> """ + if template != None: + try: + FI = open("%s/style.css"%self.template) + self.css_file = FI.read() + FI.close() + except: + pass + try: + FI = open("%s/index_first.tpl"%self.template) + self.index_first = FI.read() + FI.close() + except: + pass + try: + FI.open("%s/bug_line.tpl"%self.template) + self.bug_line = FI.read() + FI.close() + except: + pass + try: + FI.open("%s/detail_first.tpl"%self.template) + self.detail_first = FI.read() + FI.close() + except: + pass + try: + FI = open("%s/index_last.tpl"%self.template) + self.index_last = FI.read() + FI.close() + except: + pass + try: + FI = open("%s/detail_last.tpl"%self.template) + self.d_last = FI.read() + FI.close() + except: + pass + + def create_index_file(self, out_dir_path, summary, bugs, ordered_bug, fileid, encoding): try: |