Add a governance documents status table.

Change-Id: I1ee6a2b9bc726dad672ae7889c175b53c74d455f
diff --git a/tools/documentation.php b/tools/documentation.php
index 1c7ec31..c2a777d 100644
--- a/tools/documentation.php
+++ b/tools/documentation.php
@@ -12,6 +12,7 @@
 require_once (dirname ( __FILE__ ) . "/../../eclipse.org-common/system/nav.class.php");
 require_once (dirname ( __FILE__ ) . "/../../eclipse.org-common/system/menu.class.php");
 require_once dirname(__FILE__) . "/../classes/Project.class.php";
+require_once dirname(__FILE__) . "/../classes/database.inc";
 require_once dirname(__FILE__) . "/../classes/common.php";
 require_once dirname(__FILE__) . "/../classes/debug.php";
 $App = new App ();
@@ -75,7 +76,85 @@
 	echo "</form>";
 }
 
+function dumpProjectDocumentStatusTable($id) {
+
+	$sql = "
+		select
+			gr.project, gr.path, pm.type, pm.file
+		from GitRepo as gr
+			left join ProjectMetadata as pm on gr.path=pm.path
+		where gr.project=':id:'
+		order by gr.path";
+	$args = array(':id:' => $id);
+	$repositories = array();
+	query('dashboard', $sql, $args, function($row) use (&$repositories) {
+		$repositories[$row['path']][$row['type']] = $row['file'];
+	});
+
+	$types = array('README','CONDUCT','CONTRIBUTING','LICENSE','NOTICES','SECURITY');
+
+	echo "<div class=\"metadata\">";
+	echo "<table><tbody>";
+
+	echo "<tr><th>Repository</th>";
+	foreach($types as $type) {
+		echo "<th>{$type}</th>";
+	}
+	echo "</tr>";
+	foreach($repositories as $path => $data) {
+		if (preg_match('/([^\/]+)$/', $path, $matches)) {
+			$name = $matches[1];
+		}
+		echo "<tr><td><a href=\"{$path}\">{$name}</a></td>";
+		foreach($types as $type) {
+			$status = $data[$type] ? "<span class=\"provided\">&check;</span>" : "<span class=\"not-provided\">&#x2715;</span>";
+			echo "<td>{$status}</td>";
+		}
+		echo "</tr>";
+	}
+	echo "</tbody></table>";
+	echo "</div>";
+}
+
+
 ?>
+<style>
+.metadata table {
+  width:100%;
+}
+
+.metadata td, .metadata th {
+  border: 1px solid #ddd;
+  padding: 8px;
+  white-space: nowrap;
+}
+
+.metadata tr:nth-child(even){background-color: #f2f2f2;}
+
+.metadata th {
+  padding-top: 12px;
+  padding-bottom: 12px;
+  text-align: left;
+  background-color: #040404;
+  color: white;
+}
+
+.metadata tbody tr td:first-child {
+  text-overflow: clip;
+  width: 20%;
+  min-width: 20%;
+  max-width: 20%;
+}
+
+.metadata span.provided {
+	color: green;
+}
+
+.metadata span.not-provided {
+	color: red;
+}
+
+</style>
 <div id="maincontent">
 	<div id="midcolumn">
 		<h1><?= $pageTitle ?></h1>
@@ -105,6 +184,21 @@
 		?>
 			<h2><?php echo $project->getFormalName(); ?></h2>
 
+			<p>
+				The Eclipse Foundation periodically scans project Git repositories to
+				harvest various metadata. These scans look for the existence of the
+				various sorts of documentation that are required for governance purposes
+				or are strongly recommended to help adopters and contributors acquaint
+				themselves and otherwise be successful with the project.
+			</p>
+			<p>
+				This feature is <strong>experimental</strong> and under development.
+				Please report any issues that you discover here by opening an issue
+				on <a href="https://gitlab.eclipse.org/eclipsefdn/emo-team/emo/-/issues">EMO GitLab</a>.
+			</p>
+
+			<?php dumpProjectDocumentStatusTable($project->getId()); ?>
+
 			<h3 id="copyright">Copyright and License Header</h3>
 			<p>
 				Where possible, all source code, property files, and metadata files