MDL-19579 code coverage - xhtml compliant fixes

This commit is contained in:
stronk7 2009-06-23 16:50:03 +00:00
parent 4bf4e9443d
commit f33e30fb8d
5 changed files with 39 additions and 19 deletions

View File

@ -14,5 +14,7 @@ Added:
Our changes: /// Look for "moodle" in code
* src/parser/PHPParser.php - comment some debug lines causing some notices in moodle
* src/reporter/HtmlCoverageReporter.php, src/reporter/html/indexheader.html,
src/reporter/html/header.html, src/reporter/html/footer.html - various xhtml fixes
20090621 - Eloy Lafuente (stronk7): Original import of 0.8.2 release

View File

@ -200,17 +200,23 @@
$str = "";
$str .= '<h1>Details</h1> <table class="spikeDataTable" cellpadding="4" cellspacing="0" border="0" id="table2sort" width="800">';
$str .= '<thead>';
$str .= '<tr><td class="spikeDataTableHeadLeft" id="sortCell0" rowspan="2" style="white-space:nowrap" width="52%"><a id="sortCellLink0" class="headerlink" href="javascript:sort(0)" title="Sort Ascending">File Name </a></td>';
// start moodle modification: xhtml links
$str .= '<tr><td class="spikeDataTableHeadLeft" id="sortCell0" rowspan="2" style="white-space:nowrap" width="52%"><a id="sortCellLink0" class="headerlink" href="#" onclick="javascript:sort(0)" title="Sort Ascending">File Name </a></td>';
// end moodle modification
$str .= '<td colspan="4" class="spikeDataTableHeadCenter">Lines</td>';
$str .= '<td class="spikeDataTableHeadCenterLast" id="sortCell5" rowspan="2" width="16%" style="white-space:nowrap"><a id="sortCellLink5" class="headerlink" href="javascript:sort(5, \'percentage\')" title="Sort Ascending">Code Coverage </a></td>';
// start moodle modification: xhtml links
$str .= '<td class="spikeDataTableHeadCenterLast" id="sortCell5" rowspan="2" width="16%" style="white-space:nowrap"><a id="sortCellLink5" class="headerlink" href="#" onclick="javascript:sort(5, \'percentage\')" title="Sort Ascending">Code Coverage </a></td>';
// end moodle modification
$str .= '</tr>';
// Second row - subheadings
$str .= '<tr>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell1" style="white-space:nowrap" width="8%"><a id="sortCellLink1" title="Sort Ascending" class="headerlink" href="javascript:sort(1, \'number\')">Total </a></td>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell2" style="white-space:nowrap" width="9%"><a id="sortCellLink2" title="Sort Ascending" class="headerlink" href="javascript:sort(2, \'number\')">Covered </a></td>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell3" style="white-space:nowrap" width="8%"><a id="sortCellLink3" title="Sort Ascending" class="headerlink" href="javascript:sort(3, \'number\')">Missed </a></td>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell4" style="white-space:nowrap" width="10%"><a id="sortCellLink4" title="Sort Ascending" class="headerlink" href="javascript:sort(4, \'number\')">Executable </a></td>';
// start moodle modification: xhtml links
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell1" style="white-space:nowrap" width="8%"><a id="sortCellLink1" title="Sort Ascending" class="headerlink" href="#" onclick="javascript:sort(1, \'number\')">Total </a></td>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell2" style="white-space:nowrap" width="9%"><a id="sortCellLink2" title="Sort Ascending" class="headerlink" href="#" onclick="javascript:sort(2, \'number\')">Covered </a></td>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell3" style="white-space:nowrap" width="8%"><a id="sortCellLink3" title="Sort Ascending" class="headerlink" href="#" onclick="javascript:sort(3, \'number\')">Missed </a></td>';
$str .= '<td class="spikeDataTableSubHeadCenter" id="sortCell4" style="white-space:nowrap" width="10%"><a id="sortCellLink4" title="Sort Ascending" class="headerlink" href="#" onclick="javascript:sort(4, \'number\')">Executable </a></td>';
// end moodle modification
$str .= '</tr>';
$str .= '</thead>';
return $str;
@ -273,8 +279,11 @@
$str .= '<table border="0" cellpadding="0" cellspacing="0" id="contentBox" width="800"> <tr>';
$str .= '<td align="left" valign="top"><h1>Summary</h1>';
$str .= '<table class="spikeVerticalTable" cellpadding="4" cellspacing="0" width="800" style="margin-bottom:10px" border="0">';
// start moodle modification: xhtml
$str .= '<tr>';
$str .= '<td width="380" class="spikeVerticalTableHead" style="font-size:14px">Overall Code Coverage&nbsp;</td>';
$str .= '<td class="spikeVerticalTableCell" style="font-size:14px" colspan="2"><strong>' . $this->getGrandCodeCoveragePercentage() . '%</td>';
$str .= '<td class="spikeVerticalTableCell" style="font-size:14px" colspan="2"><strong>' . $this->getGrandCodeCoveragePercentage() . '%</strong></td>';
// end moodle modification
$str .= '</tr><tr>';
@ -569,9 +578,11 @@
protected function writeFileTableHead() {
$filestr = "";
$filestr .= '<td width="10%"class="coverageDetailsHead" >Line #</td>';
$filestr .= '<td width="10%" class="coverageDetailsHead">Frequency</td>';
$filestr .= '<td width="80%" class="coverageDetailsHead">Source Line</td>';
// start moodle modification: xhtml + column widths
$filestr .= '<tr><td width="5%"class="coverageDetailsHead" >Line #</td>';
$filestr .= '<td width="5%" class="coverageDetailsHead">Frequency</td>';
$filestr .= '<td width="90%" class="coverageDetailsHead">Source Line</td></tr>';
// end moodle modification
return $filestr;
}
@ -631,6 +642,11 @@
* @access protected
*/
protected function preserveSpacing($string) {
// start moodle modification: xhtml
if (empty($string)) {
return '&nbsp;';
}
// end moodle modification
$string = htmlspecialchars($string);
$string = str_replace(" ", "&nbsp;", $string);
$string = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $string);

View File

@ -1,5 +1,7 @@
</td></tr>
</table>
</td>
</tr>
</table>
</div>
</body>

View File

@ -1,4 +1,5 @@
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Spike PHPCoverage Details: %%filename%%</title>
@ -9,8 +10,7 @@
<table border="0" cellpadding="2" cellspacing="0" id="contentBox" width="100%">
<tr>
<td align="left" valign="top"><h1>Spike PHPCoverage Details: %%filename%%</h1>
</td>
<td align="left" valign="top"><h1>Spike PHPCoverage Details: %%filename%%</h1></td>
</tr>
<tr>
<td>

View File

@ -1,10 +1,11 @@
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>%%heading%%</title>
<link href="css/%%style%%" rel="stylesheet" type="text/css"/>
<script language="JavaScript" type="text/javascript" src="js/sort_spikesource.js"> </script>
<script language="JavaScript" type="text/javascript">
<script type="text/javascript" src="js/sort_spikesource.js"> </script>
<script type="text/javascript">
var tableSorter = null;
@ -35,7 +36,6 @@ function expandAll() { tableSorter.expandAllChildren(); }
<table id="navBox" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style=""><img align="bottom" name="logo" src="images/spikesource/phpcoverage.gif" alt="home" border="0" height="82" width="800"/></td>
</td>
</tr>
</table>