added rest of the graphs, and fixed event bubbling issues

This commit is contained in:
tmont 2009-07-01 05:48:53 +00:00
parent a283acd7be
commit 0557fc93dd
3 changed files with 32 additions and 15 deletions

View File

@ -345,6 +345,7 @@
$info .= '<td class="coverage-ratio" style="background-color: ' . $percentageData[1] . '">' . $subdata['cloc'] . ' / ' . ($subdata['loc'] - $subdata['dloc']) . '</td>'; $info .= '<td class="coverage-ratio" style="background-color: ' . $percentageData[1] . '">' . $subdata['cloc'] . ' / ' . ($subdata['loc'] - $subdata['dloc']) . '</td>';
$info .= "<td class=\"coverage-percentage\" style=\"background-color: $percentageData[1]\">$percentageData[0]%</td>"; $info .= "<td class=\"coverage-percentage\" style=\"background-color: $percentageData[1]\">$percentageData[0]%</td>";
$info .= "</tr>\n"; $info .= "</tr>\n";
$info .= '<tr class="coverage-graph"><td colspan="3"><img alt="Code Coverage results" src="' . self::getDataUri($subdata['loc'], $subdata['dloc'], $subdata['cloc']) . '"/></td></tr>';
} }
//regular files in current directory //regular files in current directory
@ -354,6 +355,7 @@
$info .= '<td class="coverage-ratio" style="background-color: ' . $percentageData[1] . '">' . $fileData['cloc'] . ' / ' . ($fileData['loc'] - $fileData['dloc']) . '</td>'; $info .= '<td class="coverage-ratio" style="background-color: ' . $percentageData[1] . '">' . $fileData['cloc'] . ' / ' . ($fileData['loc'] - $fileData['dloc']) . '</td>';
$info .= "<td class=\"coverage-percentage\" style=\"background-color: $percentageData[1]\">$percentageData[0]%</td>"; $info .= "<td class=\"coverage-percentage\" style=\"background-color: $percentageData[1]\">$percentageData[0]%</td>";
$info .= "</tr>\n"; $info .= "</tr>\n";
$info .= '<tr class="coverage-graph"><td colspan="3"><img alt="Code Coverage results" src="' . self::getDataUri($fileData['loc'], $fileData['dloc'], $fileData['cloc']) . '"/></td></tr>';
} }
$temp = str_replace( $temp = str_replace(

View File

@ -21,7 +21,7 @@
<p>${file.link}</p> <p>${file.link}</p>
</div> </div>
<div id="directory-coverage"> <div id="summary">
<table> <table>
<colgroup> <colgroup>
<col style="width:50%"/> <col style="width:50%"/>

View File

@ -30,23 +30,25 @@
toggler.style.cursor = "pointer"; toggler.style.cursor = "pointer";
toggler.onmouseover = function() { toggler.onmouseover = function() {
var child = this.firstChild; var th = this.getElementsByTagName("th")[0];
do { th.style.backgroundColor = "#990099";
if (child.nodeName === "TD" || child.nodeName === "TH") { th.style.color = "#FFFFFF";
child.style.backgroundColor = "#990099"; var a = th.getElementsByTagName("a");
child.style.color = "#FFFFFF"; if (a.length > 0) {
} a[0].style.backgroundColor = "#990099";
} while (child = child.nextSibling); a[0].style.color = "#FFFFFF";
}
} }
toggler.onmouseout = function() { toggler.onmouseout = function() {
var child = this.firstChild; var th = this.getElementsByTagName("th")[0];
do { th.style.backgroundColor = "";
if (child.nodeName === "TD" || child.nodeName === "TH") { th.style.color = "";
child.style.backgroundColor = ""; var a = th.getElementsByTagName("a");
child.style.color = ""; if (a.length > 0) {
} a[0].style.backgroundColor = "";
} while (child = child.nextSibling); a[0].style.color = "";
}
} }
toggler.onclick = function() { toggler.onclick = function() {
@ -54,6 +56,19 @@
this.nextSibling.nextSibling.style.display = (display === "none") ? "table-row" : "none"; this.nextSibling.nextSibling.style.display = (display === "none") ? "table-row" : "none";
} }
//cancel event bubbling on the anchors
var a = toggler.getElementsByTagName("a");
for (var j = 0, jlen = a.length; j < jlen; j++) {
a[j].onclick = function(e) {
e = e || window.event;
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
}
}
graphs[i].style.display = "none"; graphs[i].style.display = "none";
} }
} }