Initial implementation of the html repository export.
authorgianluca <gian@galactica>
Fri, 3 Jul 2009 22:57:18 +0000 (00:57 +0200)
committergianluca <gian@galactica>
Fri, 3 Jul 2009 22:57:18 +0000 (00:57 +0200)
Creation of the index file

.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/values [new file with mode: 0644]
.be/bugs/8385a1fb-63df-4ca6-81cd-28ede83bb0c2/values [new file with mode: 0644]
.be/bugs/9b1a0e71-4f7d-40b1-ab32-18496bf19a3f/values [new file with mode: 0644]
.be/bugs/c271a802-d324-48a6-b01d-63e4a72aa43e/values [new file with mode: 0644]
.be/bugs/d8dba78d-f82a-4674-9003-a0ec569b4a96/values [new file with mode: 0644]
becommands/html.py [new file with mode: 0644]
becommands/html_data.py [new file with mode: 0644]

diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/values b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/values
new file mode 100644 (file)
index 0000000..95b83ee
--- /dev/null
@@ -0,0 +1,17 @@
+creator: gianluca <gian@galactica>
+
+
+reporter: gianluca <gian@galactica>
+
+
+severity: minor
+
+
+status: open
+
+
+summary: Bug di test
+
+
+time: Fri, 03 Jul 2009 20:19:36 +0000
+
diff --git a/.be/bugs/8385a1fb-63df-4ca6-81cd-28ede83bb0c2/values b/.be/bugs/8385a1fb-63df-4ca6-81cd-28ede83bb0c2/values
new file mode 100644 (file)
index 0000000..e7284bc
--- /dev/null
@@ -0,0 +1,17 @@
+creator: gianluca <gian@galactica>
+
+
+reporter: gianluca <gian@galactica>
+
+
+severity: minor
+
+
+status: open
+
+
+summary: Add the html files for the status detail
+
+
+time: Fri, 03 Jul 2009 22:56:09 +0000
+
diff --git a/.be/bugs/9b1a0e71-4f7d-40b1-ab32-18496bf19a3f/values b/.be/bugs/9b1a0e71-4f7d-40b1-ab32-18496bf19a3f/values
new file mode 100644 (file)
index 0000000..900a347
--- /dev/null
@@ -0,0 +1,17 @@
+creator: gianluca <gian@galactica>
+
+
+reporter: gianluca <gian@galactica>
+
+
+severity: minor
+
+
+status: open
+
+
+summary: Add the html files for the severity detail
+
+
+time: Fri, 03 Jul 2009 22:56:19 +0000
+
diff --git a/.be/bugs/c271a802-d324-48a6-b01d-63e4a72aa43e/values b/.be/bugs/c271a802-d324-48a6-b01d-63e4a72aa43e/values
new file mode 100644 (file)
index 0000000..03ebb00
--- /dev/null
@@ -0,0 +1,17 @@
+creator: gianluca <gian@galactica>
+
+
+reporter: gianluca <gian@galactica>
+
+
+severity: minor
+
+
+status: open
+
+
+summary: Add a verbose option?
+
+
+time: Fri, 03 Jul 2009 21:17:41 +0000
+
diff --git a/.be/bugs/d8dba78d-f82a-4674-9003-a0ec569b4a96/values b/.be/bugs/d8dba78d-f82a-4674-9003-a0ec569b4a96/values
new file mode 100644 (file)
index 0000000..dc96c5b
--- /dev/null
@@ -0,0 +1,17 @@
+creator: gianluca <gian@galactica>
+
+
+reporter: gianluca <gian@galactica>
+
+
+severity: wishlist
+
+
+status: open
+
+
+summary: Add the possibility to specify the repository Directory ?
+
+
+time: Fri, 03 Jul 2009 21:18:13 +0000
+
diff --git a/becommands/html.py b/becommands/html.py
new file mode 100644 (file)
index 0000000..cc64c7d
--- /dev/null
@@ -0,0 +1,107 @@
+# Copyright (C) 2005-2009 Aaron Bentley and Panometrics, Inc.
+#                         Marien Zwart <marienz@gentoo.org>
+#                         Thomas Gerigk <tgerigk@gmx.de>
+#                         W. Trevor King <wking@drexel.edu>
+# <abentley@panoramicfeedback.com>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+"""Re-open a bug"""
+from libbe import cmdutil, bugdir, bug
+from html_data import *
+import os,  re
+
+__desc__ = __doc__
+
+def execute(args, test=False):
+    """
+    >>> import os
+    >>> bd = bugdir.simple_bug_dir()
+    >>> os.chdir(bd.root)
+    >>> print bd.bug_from_shortname("b").status
+    closed
+    >>> execute(["b"], test=True)
+    >>> bd._clear_bugs()
+    >>> print bd.bug_from_shortname("b").status
+    open
+    """
+    parser = get_parser()
+    options, args = parser.parse_args(args)
+    cmdutil.default_complete(options, args, parser,
+                             bugid_args={0: lambda bug : bug.active==False})
+    if len(args) == 0:
+        out_dir = './html_export'
+        print "Creating the html output in ./html_export"
+    else:
+        out_dir = args[0]
+    if len(args) > 1:
+        raise cmdutil.UsageError, "Too many arguments."
+    
+    bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test)
+    bd.load_all_bugs()
+    status_list = bug.status_values
+    severity_list = bug.severity_values
+    st = {}
+    se = {}
+    
+    for s in status_list:
+        st[s] = 0
+    for s in severity_list:
+        se[s] = 0
+    for b in bd:
+        st[b.status] += 1
+        se[b.severity] += 1
+    create_index_file(out_dir,  st,  se)
+
+def create_index_file(out_dir_path,  summary,  severity):
+    try:
+        os.stat(out_dir_path)
+    except:
+        try:
+            os.mkdir(out_dir_path)
+        except:
+            raise  cmdutil.UsageError, "Cannot create output directory."
+    try:
+        FO = open(out_dir_path+"/style.css", "w")
+        FO.write(css_file)
+        FO.close()
+    except:
+        raise  cmdutil.UsageError, "Cannot create the style.css file."
+    value = html_index
+    for stat in summary:
+        rep = "_"+stat+"_"
+        val = str(summary[stat])
+        value = re.sub(rep,  val,  value)
+    for sev in severity:
+        rep = "_"+sev+"_"
+        val = str(severity[sev])
+        value = re.sub(rep,  val, value)
+    try:
+        FO = open(out_dir_path+"/index.html", "w")
+        FO.write(value)
+        FO.close()
+    except:
+        raise  cmdutil.UsageError, "Cannot create the index.html file."
+    
+    
+def get_parser():
+    parser = cmdutil.CmdOptionParser("be open OUTPUT_DIR")
+    return parser
+
+longhelp="""
+Generate a set of html pages.
+"""
+
+def help():
+    return get_parser().help_str() + longhelp
diff --git a/becommands/html_data.py b/becommands/html_data.py
new file mode 100644 (file)
index 0000000..db3d1c0
--- /dev/null
@@ -0,0 +1,395 @@
+
+__desc__ = __doc__
+
+css_file = """
+body {
+font-family: "lucida grande", "sans serif";
+color: #333;
+width: 60em;
+margin: auto;
+}
+
+
+div.main {
+padding: 20px;
+margin: auto;
+padding-top: 0;
+margin-top: 1em;
+background-color: #fcfcfc;
+}
+
+
+.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: 40em;
+}
+
+.inline-status-image {
+position: relative;
+top: 0.2em;
+}
+
+.dimmed {
+color: #bbb;
+}
+
+table {
+border-style: none;
+border-spacing: 0;
+}
+
+table.log {
+}
+
+
+td {
+border-width: 0;
+border-style: none;
+padding-right: 0.5em;
+padding-left: 0.5em;
+}
+
+tr {
+vertical-align: top;
+}
+
+h1 {
+padding: 0.5em;
+background-color: #305275;
+margin-top: 0;
+margin-bottom: 0;
+color: #fff;
+margin-left: -20px;
+margin-right: -20px;  
+}
+
+h2 {
+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;
+
+}
+
+
+.even-row {
+background-color: #e9e9e2;
+}
+
+.odd-row {
+background-color: #f9f9f9;
+}
+
+.backptr {
+font-size: smaller;
+width: 100%;
+text-align: left;
+padding-bottom: 1em;
+margin-top: 0;
+}
+
+.logcomment {
+padding-left: 4em;
+font-size: smaller;
+}
+
+.id {
+font-family: courier;
+}
+
+.description {
+background: #f2f2f2;
+padding-left: 1em;
+padding-right: 1em;
+padding-top: 0.5em;
+padding-bottom: 0.5em;
+}
+
+.message {
+}
+
+.littledate {
+font-size: smaller;
+}
+
+.progress-meter-done {
+background-color: #03af00;
+}
+
+.progress-meter-undone {
+background-color: #ddd;
+}
+
+.progress-meter {
+}
+"""
+
+html_index = """
+<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=utf-8" />
+<link rel="stylesheet" href="style.css" type="text/css" />
+</head>
+<body>
+
+
+<div class="main">
+<h1>BugsEverywhere Issue Tracker</h1>
+<table>
+<tbody>
+<tr>
+<td>
+  <h2>Issues list by status</h2>
+  <table>
+    <tbody>
+        <tr class="even-row">
+            <td>
+                <a href="unconfirmed.html">unconfirmed</a>
+            </td>
+            <td align="right">
+                _unconfirmed_ 
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="odd-row">
+            <td>
+                <a href="open.html">open</a>
+            </td>
+            <td align="right">
+                _open_ 
+            </td>
+            <td>
+                 issues
+            </td>
+        </tr>
+        <tr class="even-row">
+            <td>
+                <a href="assigned.html">assigned</a>
+            </td>
+            <td align="right">
+                _assigned_
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="odd-row">
+            <td>
+                <a href="test.html">test</a>
+            </td>
+            <td align="right">
+                _test_
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="even-row">
+            <td>
+                <a href="closed.html">closed</a>
+            </td>
+            <td align="right">
+                _closed_
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="odd-row">
+            <td>
+                <a href="fixed.html">fixed</a>
+            </td>
+            <td align="right">
+                _fixed_
+            </td>
+            <td>
+                 issues
+            </td>
+        </tr>
+        <tr class="even-row">
+            <td>
+                <a href="wontfix.html">wontfix</a>
+            </td>
+            <td align="right">
+                _wontfix_
+            </td>
+            <td>
+                 issues
+            </td>
+        </tr>
+        <tr class="odd-row">
+            <td>
+                <a href="disabled.html">disabled</a>
+            </td>
+            <td align="right">
+                _disabled_
+            </td>
+            <td>
+                 issues
+            </td>
+        </tr>    
+    </tbody>
+  </table>
+</td>
+<td>
+
+  <h2>Open issues by severity</h2>
+  <table>
+    <tbody>
+        <tr class="even-row">
+            <td>
+                <a href="serious.html">serious</a>
+            </td>
+            <td align="right">
+                _serious_ 
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="odd-row">
+            <td>
+                <a href="critical.html">critical</a>
+            </td>
+            <td align="right">
+                _critical_ 
+            </td>
+            <td>
+                 issues
+            </td>
+        </tr>
+        <tr class="even-row">
+            <td>
+                <a href="fatal.html">fatal</a>
+            </td>
+            <td align="right">
+                _fatal_
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="odd-row">
+            <td>
+                <a href="wishlist.html">wishlist</a>
+            </td>
+            <td align="right">
+                _wishlist_
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+        <tr class="even-row">
+            <td>
+                <a href="minor.html">minor</a>
+            </td>
+            <td align="right">
+                _minor_
+            </td>
+            <td>
+                issues
+            </td>
+        </tr>
+    </tbody>
+  </table>
+</td>
+</tr>
+</tbody>
+</table>
+
+</div>
+
+<div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a>.</div>
+
+
+</body>
+</html>
+"""
+