From d2cdec6be03037269c41b1726252c9d1420a13a5 Mon Sep 17 00:00:00 2001 From: Gianluca Montecchi Date: Mon, 27 Jul 2009 23:59:40 +0200 Subject: [PATCH] Moved all the implementation into the html.py file Implemented the creation of the index for active and inactive bugs, with detail for earch of them --- .../b1a772a0-241f-42fc-8209-765162485b0a/body | 1 + .../values | 8 + .../c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/body | 1 + .../values | 11 + .../d74a6a82-6a08-472b-86d8-b1546c4d460f/body | 1 + .../values | 8 + becommands/html.py | 465 ++++++++++++++++-- becommands/html_data.py | 328 ------------ 8 files changed, 465 insertions(+), 358 deletions(-) create mode 100644 .be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/body create mode 100644 .be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/values create mode 100644 .be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/body create mode 100644 .be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/values create mode 100644 .be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/body create mode 100644 .be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/values delete mode 100644 becommands/html_data.py diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/body b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/body new file mode 100644 index 0000000..2e6c9cb --- /dev/null +++ b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/body @@ -0,0 +1 @@ +commento \n su due righe diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/values b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/values new file mode 100644 index 0000000..b6abe1f --- /dev/null +++ b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/b1a772a0-241f-42fc-8209-765162485b0a/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Wed, 22 Jul 2009 21:48:23 +0000 + + +From: Gianluca Montecchi + diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/body b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/body new file mode 100644 index 0000000..6db3446 --- /dev/null +++ b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/body @@ -0,0 +1 @@ +Identato diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/values b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/values new file mode 100644 index 0000000..2b282c0 --- /dev/null +++ b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/c1b9bc11-71e1-473e-ad9c-cfba0a2533d5/values @@ -0,0 +1,11 @@ +Content-type: text/plain + + +Date: Mon, 27 Jul 2009 20:08:02 +0000 + + +From: Gianluca Montecchi + + +In-reply-to: d74a6a82-6a08-472b-86d8-b1546c4d460f + diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/body b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/body new file mode 100644 index 0000000..bea1060 --- /dev/null +++ b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/body @@ -0,0 +1 @@ +Commento normale diff --git a/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/values b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/values new file mode 100644 index 0000000..e26b88e --- /dev/null +++ b/.be/bugs/4ddf1313-bb3c-45d3-8dca-79ed5830d606/comments/d74a6a82-6a08-472b-86d8-b1546c4d460f/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Wed, 22 Jul 2009 20:05:15 +0000 + + +From: Gianluca Montecchi + diff --git a/becommands/html.py b/becommands/html.py index b0441b9..3f6d923 100644 --- a/becommands/html.py +++ b/becommands/html.py @@ -19,8 +19,8 @@ # 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, time +#from html_data import * +import os, re, time, string __desc__ = __doc__ @@ -55,19 +55,24 @@ def execute(args, test=False): st = {} se = {} stime = {} - bugs = [] + bugs_active = [] + bugs_inactive = [] for s in status_list: st[s] = 0 for b in bd: stime[b.uuid] = b.time if b.status in ["open", "test", "unconfirmed", "assigned"]: - bugs.append(b) + bugs_active.append(b) + else: + bugs_inactive.append(b) st[b.status] += 1 ordered_bug_list = sorted([(value,key) for (key,value) in stime.items()]) + ordered_bug_list_in = sorted([(value,key) for (key,value) in stime.items()]) #open_bug_list = sorted([(value,key) for (key,value) in bugs.items()]) html_gen = BEHTMLGen(bd) - html_gen.create_index_file(out_dir, st, bugs, ordered_bug_list) + html_gen.create_index_file(out_dir, st, bugs_active, ordered_bug_list, "active") + html_gen.create_index_file(out_dir, st, bugs_inactive, ordered_bug_list, "inactive") def get_parser(): parser = cmdutil.CmdOptionParser("be open OUTPUT_DIR") @@ -86,7 +91,363 @@ class BEHTMLGen(): self.index_value = "" self.bd = bd - def create_index_file(self, out_dir_path, summary, bugs, ordered_bug): + self.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; + } + + .comment { + padding: 20px; + margin: auto; + padding-top: 20px; + margin-top: 0; + } + + .commentF { + padding: 0px; + margin: auto; + padding-top: 20px; + paddin-bottom: 40px; + margin-top: 0; + } + + tb { + border = 1; + } + + .open-row { + background-color: #e9e9e2; + width: 5%; + } + + .assigned-row { + background-color: #f9f9f9; + width: 5%; + } + + + .test-row { + background-color: #f9f9f9; + width: 5%; + } + + .unconfirmed-row { + background-color: #f9f9f9; + width: 5%; + } + + .fixed-row { + background-color: #f9f9f9; + width: 5%; + } + + .closed-row { + background-color: #f9f9f9; + width: 5%; + } + + .wontfix-row { + background-color: #f9f9f9; + width: 5%; + } + + + .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; + + } + + + .selected-cell { + background-color: #e9e9e2; + } + + .plain-cell { + 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 { + } + """ + + self.index_first = """ + + + BugsEverywhere Issue Tracker + + + + + + +
+

BugsEverywhere Bug List

+ + + + +

Active Bugs

Inactive Bugs

+ + + """ + + self.bug_line =""" + + + + + + + + """ + + self.detail_first = """ + + + BugsEverywhere Issue Tracker + + + + + + +
+

BugsEverywhere Bug List

+

Bug: _bug_id_

+
%s%s%s%s%s
+ + """ + + + + self.detail_line =""" + + + + """ + + self.index_last = """ + +
%s%s
+ +
+ + + + + + """ + + self.comment_section = """ + """ + + self.begin_comment_section =""" + + Comments: + + + """ + + + self.end_comment_section =""" + + + """ + + self.detail_last = """ + + + +

Back to Index

+ + + + """ + + + def create_index_file(self, out_dir_path, summary, bugs, ordered_bug, fileid): try: os.stat(out_dir_path) except: @@ -96,7 +457,7 @@ class BEHTMLGen(): raise cmdutil.UsageError, "Cannot create output directory." try: FO = open(out_dir_path+"/style.css", "w") - FO.write(css_file) + FO.write(self.css_file) FO.close() except: raise cmdutil.UsageError, "Cannot create the style.css file." @@ -107,15 +468,18 @@ class BEHTMLGen(): pass try: - FO = open(out_dir_path+"/index.html", "w") + if fileid == "active": + FO = open(out_dir_path+"/index.html", "w") + if fileid == "inactive": + FO = open(out_dir_path+"/index_inactive.html", "w") except: raise cmdutil.UsageError, "Cannot create the index.html file." - FO.write(index_first) + FO.write(self.index_first) c = 0 t = len(bugs) - 1 for l in range(t, -1, -1): - line = bug_line%(bugs[l].status, + line = self.bug_line%(bugs[l].status, bugs[l].uuid, bugs[l].uuid[0:3], bugs[l].uuid, bugs[l].status, bugs[l].uuid, bugs[l].severity, @@ -124,11 +488,11 @@ class BEHTMLGen(): ) FO.write(line) c += 1 - self.CreateDetailFile(bugs[l], out_dir_path) - FO.write(index_last) + self.CreateDetailFile(bugs[l], out_dir_path, fileid) + FO.write(self.index_last) - def CreateDetailFile(self, bug, out_dir_path): + def CreateDetailFile(self, bug, out_dir_path, fileid): f = "%s.html"%bug.uuid p = out_dir_path+"/bugs/"+f try: @@ -136,26 +500,67 @@ class BEHTMLGen(): except: raise cmdutil.UsageError, "Cannot create the detail html file." - detail_first_ = re.sub('_bug_id_', bug.uuid[0:3], detail_first) + detail_first_ = re.sub('_bug_id_', bug.uuid[0:3], self.detail_first) FD.write(detail_first_) - bug_ = self.bd.bug_from_shortname(bug.uuid[0:3]) + bug_ = self.bd.bug_from_shortname(bug.uuid) bug_.load_comments(load_full=True) + + FD.write(self.detail_line%("ID : ", bug.uuid)) + FD.write(self.detail_line%("Short name : ", bug.uuid[0:3])) + FD.write(self.detail_line%("Severity : ", bug.severity)) + FD.write(self.detail_line%("Status : ", bug.status)) + FD.write(self.detail_line%("Assigned : ", bug.assigned)) + FD.write(self.detail_line%("Target : ", bug.target)) + FD.write(self.detail_line%("Reporter : ", bug.reporter)) + FD.write(self.detail_line%("Creator : ", bug.creator)) + FD.write(self.detail_line%("Created : ", bug.time_string)) + FD.write(self.detail_line%("Summary : ", bug.summary)) + FD.write("
") + FD.write(self.begin_comment_section) + tr = [] + b = '' + level = 0 for i in bug_.comments(): - print i.uuid, i.in_reply_to - - FD.write(detail_line%("ID : ", bug.uuid)) - FD.write(detail_line%("Short name : ", bug.uuid[0:3])) - FD.write(detail_line%("Severity : ", bug.severity)) - FD.write(detail_line%("Status : ", bug.status)) - FD.write(detail_line%("Assigned : ", bug.assigned)) - FD.write(detail_line%("Target : ", bug.target)) - FD.write(detail_line%("Reporter : ", bug.reporter)) - FD.write(detail_line%("Creator : ", bug.creator)) - FD.write(detail_line%("Created : ", bug.time_string)) - FD.write(detail_line%("Summary : ", bug.summary)) - FD.write("") - FD.write(detail_last) - FD.close() \ No newline at end of file + if not isinstance(i.in_reply_to,str): + first = True + a = i.string_thread(flatten=False) + d = re.split('\n',a) + for x in range(0,len(d)): + hr = "" + if re.match(" *--------- Comment ---------",d[x]): + com = """ + %s
+ %s
+ %s
+ %s
+ %s
+ """%(d[x+1],d[x+2],d[x+3],d[x+4],d[x+5]) + l = re.sub("--------- Comment ---------", "", d[x]) + ll = l.split(" ") + la = l + ba = "" + if len(la) > level: + FD.write("
") + if len(la) < level: + FD.write("
") + if len(la) == 0: + if not first : + FD.write("") + first = False + FD.write("
") + level = len(la) + x += 5 + FD.write(com) + FD.write("
") + FD.write("
") + FD.write(self.end_comment_section) + if fileid == "active": + FD.write(self.detail_last%"../index.html") + if fileid == "inactive": + FD.write(self.detail_last%"../index_inactive.html") + FD.close() + + \ No newline at end of file diff --git a/becommands/html_data.py b/becommands/html_data.py deleted file mode 100644 index 68445cd..0000000 --- a/becommands/html_data.py +++ /dev/null @@ -1,328 +0,0 @@ - -__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; -} - -tb { -border = 1; -} - -.open-row { -background-color: #e9e9e2; -width: 5%; -} - -.assigned-row { -background-color: #f9f9f9; -width: 5%; -} - - -.test-row { -background-color: #f9f9f9; -width: 5%; -} - -.unconfirmed-row { -background-color: #f9f9f9; -width: 5%; -} - -.fixed-row { -background-color: #f9f9f9; -width: 5%; -} - -.closed-row { -background-color: #f9f9f9; -width: 5%; -} - -.wontfix-row { -background-color: #f9f9f9; -width: 5%; -} - - -.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; - -} - - -.selected-cell { -background-color: #e9e9e2; -} - -.plain-cell { -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 { -} -""" - -index_first = """ - - -BugsEverywhere Issue Tracker - - - - - - -
-

BugsEverywhere Bug List

-

Open Bugs

- - -""" - -bug_line =""" - - - - - - - -""" - -detail_first = """ - - -BugsEverywhere Issue Tracker - - - - - - -
-

BugsEverywhere Bug List

-

Bug: _bug_id_

-
%s%s%s%s%s
- -""" - - - -detail_line =""" - - - -""" - -index_last = """ - -
%s%s
- -
- -

Show all bugs

- - - - - -""" - -detail_last = """ - - - - - -

Back to Index

- - - - - -""" \ No newline at end of file -- 2.26.2