diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-02-20 03:23:27 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-02-20 03:23:27 +0100 |
commit | 35067b1111ec50471e670eb0d264ca29d9f66692 (patch) | |
tree | 1340b038ac0330a4ab5e3627f8f59e926f40b5d1 /lib | |
parent | bd116ff3ac5cc62bbd85ef7036bc64f3f14ce794 (diff) | |
download | bugzilla-triage-35067b1111ec50471e670eb0d264ca29d9f66692.tar.gz |
Most of logger recovered.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libbugzilla.js | 2 | ||||
-rw-r--r-- | lib/logger.js | 43 |
2 files changed, 16 insertions, 29 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index c13c61d..23b6869 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -372,6 +372,8 @@ exports.initialize = function initialize(config, callback) { if ("submitsLogging" in config.gJSONData.configData && config.gJSONData.configData.submitsLogging) { + console.log("initialize : submitsLogin = " + + config.gJSONData.configData.submitsLogging); logger.initialize(JSON.parse(selfMod.data.load( "bugzillalabelAbbreviations.json"))); } diff --git a/lib/logger.js b/lib/logger.js index 2b2277a..faceca2 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -9,6 +9,7 @@ var prompts = require("prompts"); var apiUtils = require("api-utils"); var xrpc = require("xmlrpc"); var myStorage = require("simple-storage"); +var libbz = require("libbugzilla"); var EmptyLogsColor = "rgb(0, 255, 0)"; var FullLogsColor = "rgb(0, 40, 103)"; @@ -70,17 +71,19 @@ function getBugzillaAbbr(url) { } exports.generateTimeSheet = function generateTimeSheet() { - // Logger.prototype.generateTimeSheet = function(body) { - // var doc = body.ownerDocument; - // this.timeSheetRecordsPrinter(body, myStorage.storage.logs); + var docHTML = timeSheetRecordsPrinter(myStorage.storage.logs); + libbz.openURLInNewTab("data:text/html;charset=utf-8," + docHTML); }; -function timeSheetRecordsPrinter(body, records) { +function timeSheetRecordsPrinter(records) { var commentBugRE = new RegExp("[bB]ug\\s+([0-9]+)","g"); // sort the records into temporary array var tmpArr = []; + var outStr = '<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">' + + "<html><head><title>Status report</title></head><body>" + + "<h1>TimeSheet</h1>\n"; - for ( var i in records) { + for (var i in records) { if (records.hasOwnProperty(i)) { tmpArr.push( [ i, records[i] ]); } @@ -99,38 +102,20 @@ function timeSheetRecordsPrinter(body, records) { var bugNo = utilMod.getBugNo(x.url); if (dayStr != currentDay) { currentDay = dayStr; - body.innerHTML += "<hr/><p><strong>" + currentDay - + "</strong></p>"; + outStr += "<hr/><p><strong>" + currentDay + + "</strong></p>\n"; } // replace "bug ####" with a hyperlink to the current bugzilla var comment = x.comment.replace(commentBugRE, "<a href='http://"+host+"/show_bug.cgi?id=$1'>$&</a>"); - body.innerHTML += "<p><em><a href='" + outStr += "<p><em><a href='" + x.url + "'>Bug " + BZName + "/" + bugNo + ": " + x.title + "</a>" - + " </em>\n<br/>" + comment + "</p>"; - }); -} - -/** - * - */ -function createBlankPage(ttl, bodyBuildCB) { - var title = ttl || "Yet another untitled page"; - var that = this; - - var logTab = tabs.open({ - url: "about:blank", - inBackground: true, - onOpen: function (tab) { - var otherDoc = tab.contentDocument; - otherDoc.title = title; - otherDoc.body.innerHTML = "<h1>" + title + "</h1>"; - bodyBuildCB.call(that, otherDoc.body); - tabs.activeTab = tab; - } + + " </em>\n<br/>" + comment + "</p>\n"; }); + outStr += "</body></html>"; + return outStr; } |