From 904699686f73cb712e49921acbd09b95ee60d580 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 1 Feb 2010 16:13:40 +0100 Subject: Unsuccesful attempt to make logging available. --- BugZappers_data.json | 1 + bugzillaBugTriage.js | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/BugZappers_data.json b/BugZappers_data.json index 81c7353..1d03b6f 100644 --- a/BugZappers_data.json +++ b/BugZappers_data.json @@ -88,6 +88,7 @@ ], "queryButton": true, "upstreamButton": false, + "submitsLogging": false, "upstreamBugzillas": [ ], diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index 48748af..171f8fc 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -86,6 +86,7 @@ var signatureFedoraString = ""; // TODO we should have an array SpecialFlags instead of multiple Boolean variables var queryButtonAvailable = false; var upstreamButtonAvailable = false; +var logSubmits = false; var chipIDsGroupings = []; var AddrArray = []; var PCI_ID_Array = []; @@ -135,6 +136,7 @@ loadJSON(jsonDataURL, function (response) { defAssigneeList = response.defaultAssignee; queryButtonAvailable = response.queryButton; upstreamButtonAvailable = response.upstreamButton; + logSubmits = response.submitsLogging; upstreamBugzillasArray = response.upstreamBugzillas; chipIDsGroupings = response.chipIDsGroupings; topRow = response.topRow; @@ -222,6 +224,71 @@ isInList = function(mbr, list) { return (list.indexOf(mbr) !== -1); }; +writeALine = function(filename,text) { + +// jetpack.tabs.focused.contentWindow.wrappedJSObject.netscape.security. +// this.netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + +// var fileContractId = "@mozilla.org/file/local;1"; +// var fileInterface = Components.interfaces.nsILocalFile; +// netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); +// var localFileClass = Components.classes[fileContractId]; +// var file = localFileClass.createInstance(fileInterface); +// var desk = Components.classes["@mozilla.org/file/directory_service;1"] +// .getService(Components.interfaces.nsIProperties) +// .get("Desk", Components.interfaces.nsIFile); + +// try { +// desk.append(name); +// } catch (exp) { +// alert("Bad file name"); +// return; +// } + +// name = desk.path; + +// try { +// file.initWithPath(name); +// } catch (exp) { +// alert("Bad file name"); +// return; +// } + +// try { +// file.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420); +// } catch (exp) { +// // +// } + +// var stream = Components.classes["@mozilla.org/network/file-output-stream;1"] +// .createInstance(Components.interfaces.nsIFileOutputStream); + +// try { +// stream.init(file, 0x02 | 0x08 | 0x20, 0666, 0); +// } catch (exp) { +// alert("Cannot create file"); +// return; +// } + +// stream.write(data, data.length); +// stream.close(); +} + + + + + + + + + + + + + + +} + // ============================================================================ // Color management methods // originally from @@ -450,6 +517,12 @@ Color.prototype.lightColor = function() { //==================================================================================== // BzPage's methods +BzPage.prototype.getLogTime = function() { + // FIXME to be implemented + var today = new Date(); + return today.toDateString(); +} + /** * Check for the presence of a keyword * @@ -1774,6 +1847,18 @@ function BzPage(doc) { } , false); } + + // logging all submits for timesheet + if (logSubmits) { + var that = this; + this.dok.forms.namedItem("changeform").addEventListener("submit", + function () { + // write the record to the log + var logTime = this.getLogTime(); + console.log("today's date is " + logTime); + console.log(logTime + ": " + that.bugNo); + },false); + } this.setBranding(); this.checkComments(); -- cgit