aboutsummaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-07-15 23:59:22 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-07-15 23:59:22 +0200
commit4ef203c974e889b74e4064ee04eddc55ba7b8c08 (patch)
tree22b5ea787ef725f72df213f06d3bb0b3971369ed /data
parentf7b140c8797fa2b2d4ef838c38f7404647705f56 (diff)
downloadbugzilla-triage-4ef203c974e889b74e4064ee04eddc55ba7b8c08.tar.gz
Stabilization to make it merged to next.
Diffstat (limited to 'data')
-rw-r--r--data/tweaks/bug-page-mod.js259
1 files changed, 138 insertions, 121 deletions
diff --git a/data/tweaks/bug-page-mod.js b/data/tweaks/bug-page-mod.js
index d1a4abd..ece4f36 100644
--- a/data/tweaks/bug-page-mod.js
+++ b/data/tweaks/bug-page-mod.js
@@ -276,6 +276,8 @@ function displayCommentActions (comment, historyItem) {
function processHistoryItem(objects, itemRaw) {
console.log("processHistoryItem: itemRaw = " + itemRaw.toSource());
+return ; // FIXME just to get rid of this unfinished and unanalyzed function
+
var idx = itemRaw.when; // Given the mid-air protection we could assume
// history time to be unique per second.
if (idx in objects.attachment) {
@@ -288,134 +290,149 @@ function processHistoryItem(objects, itemRaw) {
displayRemainingActions(itemRaw);
// =====================================================
-// var commentHead = commentTimes[j].parentNode;
+ var commentHead = commentTimes[j].parentNode;
-// var mainUser = commentHead.querySelector(".bz_comment_user a.email")
-// .href
-// .substr(7);
-// var user = trimContent(item[0]);
-// var mainTime = trimContent(commentTimes[j]);
-// var time = trimContent(item[1]);
-// var inline = (mainUser == user && time == mainTime);
+ var mainUser = commentHead.querySelector(".bz_comment_user a.email")
+ .href
+ .substr(7);
+ var user = trimContent(item[0]);
+ var mainTime = trimContent(commentTimes[j]);
+ var time = trimContent(item[1]);
-// var currentDiv = document.createElement("div");
-// var userPrefix = '';
-// if (inline) {
-// // assume that the change was made by the same user
-// commentHead.appendChild(currentDiv);
-// currentDiv.setAttribute("class", "bztw_inlinehistory");
-// } else {
-// // the change was made by another user
-// if (!reachedEnd) {
-// var parentDiv = commentHead.parentNode;
-// if (parentDiv.previousElementSibling &&
-// parentDiv.previousElementSibling.className.indexOf("bztw_history") >= 0) {
-// currentDiv = parentDiv.previousElementSibling;
-// } else {
-// parentDiv.parentNode.insertBefore(currentDiv, parentDiv);
-// }
-// } else {
-// var parentDiv = commentHead.parentNode;
-// if (parentDiv.nextElementSibling &&
-// parentDiv.nextElementSibling.className.indexOf("bztw_history") >= 0) {
-// currentDiv = parentDiv.nextElementSibling;
-// } else {
-// parentDiv.parentNode.appendChild(currentDiv);
-// }
-// }
-// currentDiv.setAttribute("class", "bz_comment bztw_history");
-// userPrefix += "<a class=\"email\" href=\"mailto:" +
-// htmlEncode(trimContent(item[0])) + "\" title=\"" +
-// htmlEncode(trimContent(item[1])) +"\">" +
-// getUserName(trimContent(item[0])) + "</a>: ";
-// }
-// // check to see if this is a flag setting
-// flagsFound = findFlag(item);
-// for (var idx = 0; idx < flagsFound.length; ++idx) {
-// var flag = flagsFound[idx];
-// flagOccurrences[flag] = 'flag' + flagCounter;
-// if (inline) {
-// var anchor = document.createElement("a");
-// anchor.setAttribute("name", "flag" + flagCounter);
-// commentHead.insertBefore(anchor, commentHead.firstChild);
-// } else {
-// userPrefix += '<a name="flag' + flagCounter + '"></a>';
-// }
-// ++flagCounter;
-// }
+// =====================================================================
+// $$$ FIXME the change is made by commenter? is that it?
+ var inline = (mainUser == user && time == mainTime);
-// var attachmentFlagAnchors = AttachmentFlagHandler.handleItem(user, item);
-// if (inline) {
-// for (var idx = 0; idx < attachmentFlagAnchors.length; ++idx) {
-// var anchor = document.createElement("a");
-// anchor.setAttribute("name", attachmentFlagAnchors[idx]);
-// commentHead.insertBefore(anchor, commentHead.firstChild);
-// }
-// } else {
-// userPrefix += attachmentFlagAnchors.map(function(name) '<a name="' + name + '"></a>').join("");
-// }
-// var ccOnly = (trimContent(item[2]) == 'CC');
-// var ccPrefix = ccOnly ? '<span class="bztw_cc bztw_historyitem">' :
-// '<span class="bztw_historyitem">',
-// ccSuffix = '</span>';
-// var html = userPrefix +
-// ccPrefix +
-// transformType(trimContent(item[2]), trimContent(item[3]),
-// trimContent(item[4])) + ": " +
-// formatTransition(trimContent(item[3]), trimContent(item[4]),
-// trimContent(item[2]), iframe.contentDocument);
+// §§§§ This is a function addToInlineHistory or something TODO
+ var currentDiv = document.createElement("div");
+ var userPrefix = '';
+ if (inline) {
+ // assume that the change was made by the same user // XXX? §§§
+ commentHead.appendChild(currentDiv);
+ currentDiv.setAttribute("class", "bztw_inlinehistory");
+ } else {
+ // the change was made by another user
+ if (!reachedEnd) {
+ var parentDiv = commentHead.parentNode;
+ if (parentDiv.previousElementSibling &&
+ parentDiv.previousElementSibling.className.indexOf("bztw_history") >= 0) {
+ currentDiv = parentDiv.previousElementSibling;
+ } else {
+ parentDiv.parentNode.insertBefore(currentDiv, parentDiv);
+ }
+ } else {
+ var parentDiv = commentHead.parentNode;
+ if (parentDiv.nextElementSibling &&
+ parentDiv.nextElementSibling.className.indexOf("bztw_history") >= 0) {
+ currentDiv = parentDiv.nextElementSibling;
+ } else {
+ parentDiv.parentNode.appendChild(currentDiv);
+ }
+ }
+ currentDiv.setAttribute("class", "bz_comment bztw_history");
+ userPrefix += "<a class=\"email\" href=\"mailto:" +
+ htmlEncode(trimContent(item[0])) + "\" title=\"" +
+ htmlEncode(trimContent(item[1])) +"\">" +
+ getUserName(trimContent(item[0])) + "</a>: ";
+ }
+ // XXX END OF if (inline) CONSTRUCT
-// var nextItemsCount = item[0].rowSpan;
-// for (var k = 1; k < nextItemsCount; ++k) {
-// ccOnly = false;
-// item = historyItems[++i].querySelectorAll("td")
-// ccPrefix = (trimContent(item[0]) == 'CC') ?
-// '<span class="bztw_cc bztw_historyitem">' : '<span class="bztw_historyitem">';
-// // avoid showing a trailing semicolon if the previous entry
-// // wasn't a CC and this one is
-// var prefix = ccSuffix + ccPrefix;
-// // check to see if this is a flag setting
-// flagsFound = findFlag(item);
-// for (var idx = 0; idx < flagsFound.length; ++idx) {
-// var flag = flagsFound[idx];
-// flagOccurrences[flag] = 'flag' + flagCounter;
-// if (inline) {
-// var anchor = document.createElement("a");
-// anchor.setAttribute("name", "flag" + flagCounter);
-// commentHead.insertBefore(anchor, commentHead.firstChild);
-// } else {
-// prefix += '<a name="flag' + flagCounter + '"></a>';
-// }
-// ++flagCounter;
-// }
+// XXX flags
+ // check to see if this is a flag setting
+ flagsFound = findFlag(item); // XXX findFlag call 2
+ // XXX Add <a name> around every flag comment
+ for (var idx = 0; idx < flagsFound.length; ++idx) {
+ var flag = flagsFound[idx];
+ flagOccurrences[flag] = 'flag' + flagCounter;
+ if (inline) {
+ var anchor = document.createElement("a");
+ anchor.setAttribute("name", "flag" + flagCounter);
+ commentHead.insertBefore(anchor, commentHead.firstChild);
+ } else {
+ userPrefix += '<a name="flag' + flagCounter + '"></a>';
+ }
+ ++flagCounter;
+ }
-// var attachmentFlagAnchors = AttachmentFlagHandler.handleItem(user, item);
-// if (inline) {
-// for (var idx = 0; idx < attachmentFlagAnchors.length; ++idx) {
-// var anchor = document.createElement("a");
-// anchor.setAttribute("name", attachmentFlagAnchors[idx]);
-// commentHead.insertBefore(anchor, commentHead.firstChild);
-// }
-// } else {
-// prefix += attachmentFlagAnchors.map(function(name) '<a name="' + name + '"></a>').join("");
-// }
+// XXX attachments
+ var attachmentFlagAnchors = AttachmentFlagHandler.handleItem(user, item);
+ if (inline) {
+ for (var idx = 0; idx < attachmentFlagAnchors.length; ++idx) {
+ var anchor = document.createElement("a");
+ anchor.setAttribute("name", attachmentFlagAnchors[idx]);
+ commentHead.insertBefore(anchor, commentHead.firstChild);
+ }
+ } else {
+ userPrefix += attachmentFlagAnchors.map(function(name) '<a name="' + name + '"></a>').join("");
+ }
-// html += prefix +
-// transformType(trimContent(item[0]), trimContent(item[1]),
-// trimContent(item[2])) + ": " +
-// formatTransition(trimContent(item[1]), trimContent(item[2]),
-// trimContent(item[0]), iframe.contentDocument);
-// }
-// html += ccSuffix;
-// if (ccOnly) {
-// html = '<div class="bztw_cc">' + html + '</div>';
-// } else {
-// html = '<div>' + html + '</div>';
-// }
-// currentDiv.innerHTML += html;
-// // FIXME here used to be a break;
-// }
+// XXX just adding/removing sometbody from CC list
+ var ccOnly = (trimContent(item[2]) == 'CC');
+ var ccPrefix = ccOnly ? '<span class="bztw_cc bztw_historyitem">' :
+ '<span class="bztw_historyitem">',
+ ccSuffix = '</span>';
+ var html = userPrefix +
+ ccPrefix +
+ transformType(trimContent(item[2]), trimContent(item[3]),
+ trimContent(item[4])) + ": " +
+ formatTransition(trimContent(item[3]), trimContent(item[4]),
+ trimContent(item[2]), iframe.contentDocument);
+
+//
+ var nextItemsCount = item[0].rowSpan;
+ for (var k = 1; k < nextItemsCount; ++k) {
+ // XXX doing once more the same for non-first elements of the imte array.
+ ccOnly = false;
+ item = historyItems[++i].querySelectorAll("td")
+ ccPrefix = (trimContent(item[0]) == 'CC') ?
+ '<span class="bztw_cc bztw_historyitem">' : '<span class="bztw_historyitem">';
+ // avoid showing a trailing semicolon if the previous entry
+ // wasn't a CC and this one is
+ var prefix = ccSuffix + ccPrefix;
+ // check to see if this is a flag setting
+ flagsFound = findFlag(item); // TODO findFlag call 1
+ for (var idx = 0; idx < flagsFound.length; ++idx) {
+ var flag = flagsFound[idx];
+ flagOccurrences[flag] = 'flag' + flagCounter;
+ if (inline) {
+ var anchor = document.createElement("a");
+ anchor.setAttribute("name", "flag" + flagCounter);
+ commentHead.insertBefore(anchor, commentHead.firstChild);
+ } else {
+ prefix += '<a name="flag' + flagCounter + '"></a>';
+ }
+ ++flagCounter;
+ }
+
+ var attachmentFlagAnchors = AttachmentFlagHandler.handleItem(user, item);
+ if (inline) {
+ for (var idx = 0; idx < attachmentFlagAnchors.length; ++idx) {
+ var anchor = document.createElement("a");
+ anchor.setAttribute("name", attachmentFlagAnchors[idx]);
+ commentHead.insertBefore(anchor, commentHead.firstChild);
+ }
+ } else {
+ prefix += attachmentFlagAnchors.map(function(name) '<a name="' + name + '"></a>').join("");
+ }
+
+ // END OF THE SAME STUFF FOR NON-FIRST ITEMS
+
+ html += prefix +
+ transformType(trimContent(item[0]), trimContent(item[1]),
+ trimContent(item[2])) + ": " +
+ formatTransition(trimContent(item[1]), trimContent(item[2]),
+ trimContent(item[0]), iframe.contentDocument);
+ }
+ html += ccSuffix;
+ if (ccOnly) {
+ html = '<div class="bztw_cc">' + html + '</div>';
+ } else {
+ html = '<div>' + html + '</div>';
+ }
+ // Add the new stuff to the place below the top of the comment div
+ currentDiv.innerHTML += html;
+ // FIXME here used to be a break;
}
// ===================================================