]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19579 code coverage - xhtml compliant fixes
authorstronk7 <stronk7>
Tue, 23 Jun 2009 16:50:03 +0000 (16:50 +0000)
committerstronk7 <stronk7>
Tue, 23 Jun 2009 16:50:03 +0000 (16:50 +0000)
lib/spikephpcoverage/readme_moodle.txt
lib/spikephpcoverage/src/reporter/HtmlCoverageReporter.php
lib/spikephpcoverage/src/reporter/html/footer.html
lib/spikephpcoverage/src/reporter/html/header.html
lib/spikephpcoverage/src/reporter/html/indexheader.html

index e56eb8a5b3e18f156835f20a72aeb1a24eb65f71..29179d4240d5c07c3649dd8d9e56c3ba6af03191 100644 (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
index c5d7f346840a288778efaccc09f9dbd4f0e99d9b..c7df05a3ea8f87d57f0246729b2b759b91acd7eb 100644 (file)
             $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;
             $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>';
 
         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;
         }
 
         * @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);
index 9b66de5e118e26b9edade25d1185fcb87d122aae..4e9169e8ea002080400a028431e2800abeb1d4c2 100644 (file)
@@ -1,5 +1,7 @@
-</td></tr>
-  </table>
+
+          </td>
+        </tr>
+      </table>
 
     </div>
   </body>
index 41cdf4e17b1a34e0b861fcfe9db453c5ce011d90..248e1fcc7b0dc5d34c0e6fe4ed4a5d2efaa77e10 100644 (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>
index cb0702083bec33fef02f7a1b60e52c034e7368be..674220b8e8b4721139c648f220795c72f37b9e34 100644 (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>