Make it W3C compatible

templates\index.tpl
@@ -27,9 +27,9 @@
<div id="tree">
<div id="treeHeader">
<a href="index.html" class='fileLink'>CodeBrowser</a>
</div>
- <?php echo $treeList; ?>
+<?php echo $treeList; ?>
</div>
<div id="treeToggle" style="background-image: url('img/treeToggle-extended.png');"></div>
</div>
<div id="contentBox" style="display: inline-block; margin: 15px;">
@@ -55,17 +55,17 @@
$occuringErrorTypes = array_keys(array_filter($occuringErrorTypes));
// Print the tables head
-echo '<tr class="head">';
-echo '<th><strong>File</strong></td>';
-echo '<th width="50px" align="center"><strong>Errors</strong></td>';
-echo '<th width="50px" align="center"><strong>Warnings</strong></td>';
+echo ' <tr class="head">' . PHP_EOL;
+echo ' <th><strong>File</strong></th>' . PHP_EOL;
+echo ' <th width="50px" align="center"><strong>Errors</strong></th>' . PHP_EOL;
+echo ' <th width="50px" align="center"><strong>Warnings</strong></th>' . PHP_EOL;
foreach ($occuringErrorTypes as $errorType) {
- echo "<th width='70px' align='center'><strong>$errorType</strong></td>";
+ echo " <th width='70px' align='center'><strong>$errorType</strong></th>" . PHP_EOL;
}
-echo '</tr>';
+echo ' </tr>' . PHP_EOL;
// Print the file table
foreach ($fileList as $filename => $f) {
$tag = $oddrow ? 'odd' : 'even';
@@ -80,20 +80,20 @@
foreach ($f->getIssues() as $issue) {
$counts[$issue->foundBy] += 1;
}
- echo "<tr class='$tag'>";
- echo "<td><a class='fileLink' href='./$shortName.html'>$shortName</a></td>";
- echo "<td align='center'><span class='errorCount'>$errors</span></td>";
- echo "<td align='center'><span class='warningCount'>$warnings</span></td>";
+ echo " <tr class='$tag'>" . PHP_EOL;
+ echo " <td><a class='fileLink' href='./$shortName.html'>$shortName</a></td>" . PHP_EOL;
+ echo " <td align='center'><span class='errorCount'>$errors</span></td>" . PHP_EOL;
+ echo " <td align='center'><span class='warningCount'>$warnings</span></td>" . PHP_EOL;
foreach ($counts as $count) {
- echo "<td align='center'>$count</td>";
+ echo " <td align='center'>$count</td>" . PHP_EOL;
}
- echo "</tr>";
+ echo " </tr>" . PHP_EOL;
}
?>
</table>
- </div
+ </div>
</div>
</body>
</html>
View\ViewAbstract.php
@@ -185,9 +185,11 @@
*/
$curDir = CbIOHelper::getCommonPathPrefix(array_keys($fileList));
$preLen = strlen($curDir);
- $ret = '<ul>';
+ $indentStep = 4;
+ $indent = $indentStep;
+ $ret = '<ul>' . PHP_EOL;
foreach ($fileList as $name => $file) {
$dir = dirname($name) . DIRECTORY_SEPARATOR;
// Go back until the file is somewhere below curDir
@@ -198,9 +200,14 @@
0,
strrpos($curDir, DIRECTORY_SEPARATOR, -2) + 1
//strrpos($curDir, DIRECTORY_SEPARATOR)
);
- $ret .= '</ul></li>';
+ $indent -= $indentStep;
+ $ret .= str_pad(' ', $indent);
+ $ret .= '</ul>' . PHP_EOL;
+ $indent -= $indentStep;
+ $ret .= str_pad(' ', $indent);
+ $ret .= '</li>' . PHP_EOL;
}
if ($dir !== $curDir) {
// File is in a subdir of current directory
@@ -226,9 +233,14 @@
$count .= $errors;
$count .= '</span>|<span class="warningCount">';
$count .= $warnings . '</span>)';
}
- $ret .= "<li><a class='treeDir'>$dirName $count</a><ul>";
+ $ret .= str_pad(' ', $indent);
+ $ret .= "<li><a class='treeDir'>$dirName $count</a>" . PHP_EOL;
+ $indent += $indentStep;
+ $ret .= str_pad(' ', $indent);
+ $ret .= "<ul>" . PHP_EOL;
+ $indent += $indentStep;
}
}
$name = str_replace('\\', '/', $name);
@@ -242,14 +254,24 @@
$count .= $file->getWarningCount();
$count .= '</span>)';
}
- $ret .= '<li class="php" ><a class="fileLink" href="';
+ $ret .= str_pad(' ', $indent);
+ $ret .= '<li class="php"><a class="fileLink" href="';
$ret .= $hrefPrefix . $shortName . '.html">';
- $ret .= "$fileName $count</a></li>";
+ $ret .= "$fileName $count</a></li>" . PHP_EOL;
}
- $ret .= '</ul>';
+ while ($indent > $indentStep) {
+ $indent -= $indentStep;
+ $ret .= str_pad(' ', $indent);
+ $ret .= '</ul>' . PHP_EOL;
+ $indent -= $indentStep;
+ $ret .= str_pad(' ', $indent);
+ $ret .= '</li>' . PHP_EOL;
+ }
+
+ $ret .= '</ul>' . PHP_EOL;
return $ret;
}
/**