diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-04-16 20:55:52 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:44:43 +0200 |
commit | 4d29c8b4eb1f3e66da8d60fd1f42f3e4c06d2b39 (patch) | |
tree | 538b0ad2a635afce9db068ca6b8fb82ab50711bb /lib | |
parent | 03eb77511381d3648bc4375d16e4b55cdb7dd0b3 (diff) | |
download | bugzilla-triage-4d29c8b4eb1f3e66da8d60fd1f42f3e4c06d2b39.tar.gz |
Generate better <title> for the timesheet.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/logger.js | 14 | ||||
-rw-r--r-- | lib/xmlrpc.js | 43 |
2 files changed, 36 insertions, 21 deletions
diff --git a/lib/logger.js b/lib/logger.js index 19fabb5..7e0c516 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -79,13 +79,25 @@ exports.generateTimeSheet = function generateTimeSheet() { }; function timeSheetRecordsPrinter(records) { + function leadingZero(n) { + // pads a single number with a leading zero. Heh. + var s = n.toString(); + if (s.length === 1) { + s = "0" + s; + } + return s; + } + var commentBugRE = new RegExp("[bB]ug\\s+([0-9]+)","g"); // sort the records into temporary array var tmpArr = []; + var today = new Date(); + var todayStr = today.getFullYear()+"-"+leadingZero(today.getMonth()+1)+ + "-"+leadingZero(today.getDate()); var outStr = '<!DOCTYPE html>' + "<html><head>\n"+ "<meta charset='utf-8'/>\n"+ - "<title>Status report</title>\n</head>\n<body>\n" + + "<title>TimeSheet-"+ todayStr + "</title>\n</head>\n<body>\n" + "<h1>TimeSheet</h1>\n"; for (var i in records) { diff --git a/lib/xmlrpc.js b/lib/xmlrpc.js index 8b71f32..6576f31 100644 --- a/lib/xmlrpc.js +++ b/lib/xmlrpc.js @@ -26,6 +26,29 @@ * not an instance of SAME Array. */ +var dateToISO8601 = exports.dateToISO8601 = function dateToISO8601(date) { + function leadingZero(n) { + // pads a single number with a leading zero. Heh. + if (n.length === 1) { + n = "0" + n; + } + return n; + } + + // wow I hate working with the Date object + console.log("date = " + date); + var year = date.getYear(); + var month = leadingZero(date.getMonth()); + var day = leadingZero(date.getDate()); + var time = leadingZero(date.getHours()) + + ":" + leadingZero(date.getMinutes()) + + ":" + leadingZero(date.getSeconds()); + + var converted = year + month + day + "T" + time; + console.log("date = " + converted); + return converted; +}; + var XMLRPCMessage = exports.XMLRPCMessage = function XMLRPCMessage(methodname) { this.method = methodname || "system.listMethods"; this.params = []; @@ -115,26 +138,6 @@ XMLRPCMessage.prototype.doBooleanXML = function (data) { }; XMLRPCMessage.prototype.doDateXML = function (data) { - function leadingZero(n) { - // pads a single number with a leading zero. Heh. - if (n.length === 1) { - n = "0" + n; - } - return n; - } - function dateToISO8601(date) { - // wow I hate working with the Date object - var year = date.getYear(); - var month = this.leadingZero(date.getMonth()); - var day = this.leadingZero(date.getDate()); - var time = this.leadingZero(date.getHours()) + - ":" + this.leadingZero(date.getMinutes()) + - ":" + this.leadingZero(date.getSeconds()); - - var converted = year + month + day + "T" + time; - return converted; - } - var xml = "<dateTime.iso8601>"; xml += dateToISO8601(data); xml += "</dateTime.iso8601>"; |