Remove the IP CQ Overview page.

Clean up (remove) supporting code.

Change-Id: I8cf22d45cdc6f0eb845dd5e68c5c3d9c3b9177ed
diff --git a/classes/IPZilla.class.inc b/classes/IPZilla.class.inc
deleted file mode 100644
index 3feea60..0000000
--- a/classes/IPZilla.class.inc
+++ /dev/null
@@ -1,323 +0,0 @@
-<?php
-/*******************************************************************************
- * Copyright (c) 2017 Eclipse Foundation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-require_once(dirname(__FILE__) . '/../classes/Project.class.php');
-require_once(dirname(__FILE__) . '/../classes/common.php');
-require_once(dirname(__FILE__) . '/../classes/database.inc');
-
-class IPZilla {
- var $cqs = array();
-
- public static function getInstance() {
-  $ipzilla = new IPZilla();
-  $ipzilla->load();
-
-  return $ipzilla;
- }
-
- public function getCq($id) {
-  return @$this->cqs[$id];
- }
-
- public function rootCqsDo($function) {
-  foreach($this->cqs as $cq) {
-   if ($cq->isRoot()) $function($cq);
-  }
- }
-
- public function asArray() {
-  $data = array();
-  $this->rootCqsDo(function($cq) use (&$data) {
-   $data[$cq->getId()] = $cq->asArray();
-  });
-  return $data;
- }
-
- private function load() {
-  $sql = "
-    select
-      cq.id, cq.root, cq.project, cq.name,
-      cq.version, cq.description,
-      cq.cq_type, cq.dd_type, cq.created,
-      cq.status, cq.resolution, cq.state,
-      cq.licenses, cq.spdx, cq.keywords,
-      group_concat(piggyback.id) as piggybacks
-    from CQ as cq
-     left join CQ as piggyback on cq.id != piggyback.id and cq.id=piggyback.root
-    where cq.state in ('approved', 'license_certified')
-     and cq.cq_type in ('thirdparty', 'piggyback')
-    group by cq.id
-";
-
-  query('dashboard', $sql, array(), function($row) {
-   $this->cqs[$row['id']] = new CQ($this, $row);
-  });
-
-  $this->initialize();
-  $this->loadFilePatterns();
-  $this->loadMvnPatterns();
-  $this->loadExpressions();
- }
-
- private function initialize() {
-//   foreach($this->cqs as $cq) {
-//    if ($cq->isRoot()) continue;
-//    $cq->getRoot()->data['piggybacks'][$cq->getId()] = $cq->getProjectId() ;
-//   }
- }
-
- private function loadFilePatterns() {
-  query('dashboard', 'select distinct cq, pattern from CQBundleMap', array(), function($row) {
-   if ($cq = @$this->cqs[$row['cq']]) {
-    $cq->addFilePattern($row['pattern']);
-    $cq->data['bundles'][] = $row['pattern'];
-   }
-  });
-
-  query('dashboard', 'select distinct cq, name, version, file from CQOrbit', array(), function($row) {
-   if ($cq = @$this->cqs[$row['cq']]) {
-    $cq->addFilePattern($row['file']);
-    $cq->data['orbit'][] = $row;
-   }
-  });
- }
-
- private function loadMvnPatterns() {
-  $sql = "
-    select distinct
-      mvn.cq,
-      mvn.pattern,
-      group_concat(distinct r.cq) as related
-    from CQMavenMap as mvn
-      join CQMavenMap as r
-        on mvn.groupid=r.groupid
-          and mvn.artifactid=r.artifactid
-    group by mvn.cq;
-  ";
-  query('dashboard', $sql, array(), function($row) use (&$maven) {
-   if ($cq = @$this->cqs[$row['cq']]) {
-    $cq->addMvnPattern($row['pattern']);
-    $cq->data['related'] = explode(',', $row['related']);
-   }
-  });
- }
- private function loadExpressions() {
- 	$sql = "
-    select distinct
-      cq,
-      expression
-    from CQExpression;
-  ";
- 	query('dashboard', $sql, array(), function($row) {
- 		if ($cq = @$this->cqs[$row['cq']]) {
- 			$cq->data['expressions'][] = $row['expression'];
- 		}
- 	});
- }
-}
-
-class CQ {
- var $ipzilla;
- var $data;
- var $root;
- var $keywords;
-
- public function __construct($ipzilla, $data) {
-  $this->ipzilla = $ipzilla;
-  $this->data = $data;
-
-  // Cache information
-  $this->keywords = preg_split('/\s*,\s*/',$this->data['keywords']);
- }
-
- public function getId() {
-  return $this->data['id'];
- }
-
- public function getName() {
-  return $this->data['name'];
- }
-
- public function getVersion() {
-  return $this->data['version'];
- }
-
- public function getDescription() {
-  return $this->data['description'];
- }
-
- public function getLicenses() {
-  return $this->data['licenses'];
- }
-
- public function getSPDX() {
-  return $this->data['spdx'];
- }
-
- public function getProject() {
-  return Project::getProject($this->getProjectId());
- }
-
- public function getProjectId() {
-  return $this->data['project'];
- }
-
- public function getPiggybackIds() {
-  if (empty($this->data['piggybacks'])) return array();
-  return explode(',', $this->data['piggybacks']);
- }
-
- public function getPiggybacks() {
-  $piggybacks = array();
-  foreach($this->getPiggybackIds() as $id) {
-   if ($cq = $this->ipzilla->getCq($id)) {
-    $piggybacks[] = $cq;
-   }
-  }
-  return $piggybacks;
- }
-
- public function getState() {
-  return $this->data['state'];
- }
-
- public function getStatus() {
-  return $this->data['status'];
- }
-
- public function getResolution() {
-  return $this->data['resolution'];
- }
-
- public function getKeywords() {
-  return $this->data['keywords'];
- }
-
- public function getFilePatterns() {
-  return @$this->data['filePatterns'];
- }
-
- public function getMvnPatterns() {
-  return @$this->data['mvnPatterns'];
- }
-
- public function getType() {
-  return $this->data['cq_type'];
- }
-
- public function getDueDiligenceType() {
-  return $this->data['dd_type'];
- }
-
- public function isRoot() {
-  return $this == $this->getRoot();
- }
-
- public function getRoot() {
-  if ($id = $this->getRootId()) {
-   return $this->ipzilla->getCQ($id);
-  }
-  return $this;
- }
-
- public function getRootId() {
-  return $this->data['root'];
- }
-
- public function getParent() {
-  if ($id = $this->getParentId()) {
-   return $this->ipzilla->getCq($id);
-  }
-  return null;
- }
-
- private function getParentId() {
-  if (preg_match ( '/\W(?:\(ATO|PB|Orbit)[^\d\)]*([0-9]+)/i', $this->getDescription(), $matches)) {
-   return $matches [1];
-  }
-  return null;
- }
-
- public function isResolved() {
-  if (!$this->getStatus()) return false;
-  return in_array($this->getStatus(), array('RESOLVED', 'VERIFIED', 'CLOSED'));
- }
-
- public function isFixed() {
-  if (!$this->isResolved()) return false;
-  return $this->getResolution() == 'FIXED';
- }
-
- public function isApproved() {
-  if (!$this->isResolved()) return false;
-  return $this->getState() == 'approved';
- }
-
- public function isProjectCode() {
-  return in_array('projectcode', $this->keywords);
- }
-
- public function isThirdParty() {
-  return in_array('thirdparty', $this->keywords);
- }
-
- function asArray() {
-  return $this->data;
- }
-
- function addFilePattern($value) {
-  if (preg_match('/(\S*\/)?([\w\.\-]+)[_-]((?:\d+\.){3})(.*\.)?jar/', $value, $matches)) {
-   $pattern = $matches[1] . $matches[2] . '_' . $matches[3];
-   $regex = $matches[1] . $matches[2] . '[_-]' . $matches[3];
-   $regex = str_replace('.', '\.', $regex);
-   $regex = str_replace('/', '\/', $regex);
-   $regex = $regex . '(.*\.)?jar';
-   $pattern = "$pattern*.jar";
-
-   $this->data['filePatterns'][$pattern] = $regex;
-
-   // Only generate a source bundle mapping if this isn't a source bundle.
-   if (!preg_match('/\.source$/', $matches[2])) {
-    $sourcePattern = $matches[1] . $matches[2]. '.source_' . $matches[3];
-    $sourceRegex = $matches[1] . $matches[2] . '.source[_-]' . $matches[3];
-    $sourceRegex = str_replace('.', '\.', $sourceRegex);
-    $regex = str_replace('/', '\/', $regex);
-    $sourceRegex = $sourceRegex . '(.*\.)?jar';
-    $sourcePattern = "$sourcePattern*.jar";
-
-    $this->data['filePatterns'][$pattern] = $regex;
-   }
-  } else {
-   $pattern = $value;
-   $regex = str_replace('.', '\.', $pattern);
-   $regex = str_replace('/', '\/', $regex);
-
-   $this->data['filePatterns'][$pattern] = $regex;
-  }
- }
-
- function addMvnPattern($value) {
-  if (isset($this->data['mvnPatterns']) && in_array($value, $this->data['mvnPatterns'])) return;
-  $this->data['mvnPatterns'][] = $value;
- }
-
- function getRelatedCqs() {
-  $related = array();
-  if (isset($this->data['related'])){
-   foreach($this->data['related'] as $id) {
-    if ($id == $this->getId()) continue;
-    if ($cq = $this->ipzilla->getCQ($id)) {
-     $related[] = $cq;
-    }
-   }
-  }
-  return $related;
- }
-}
-?>
\ No newline at end of file
diff --git a/export/ipzilla.json.php b/export/ipzilla.json.php
deleted file mode 100755
index 9423bef..0000000
--- a/export/ipzilla.json.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/*****************************************************************
- * Copyright (c) 2017 Eclipse Foundation and others.
- *
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *****************************************************************/
-require_once(dirname(__FILE__) . "/../../eclipse.org-common/system/app.class.php");
-
-require_once(dirname(__FILE__) . '/../classes/IPZilla.class.inc');
-require_once(dirname(__FILE__) . '/../classes/common.php');
-require_once(dirname(__FILE__) . '/../classes/debug.php');
-
-$App = new App();
-
-mustBeEclipseFoundationCaller();
-
-header("Content-type: application/json");
-
-$ipzilla = IPZilla::getInstance();
-
-$output = json_encode($ipzilla->asArray(), JSON_PRETTY_PRINT);
-if ($output === false) echo json_last_error_msg();
-
-echo $output;
-?>
diff --git a/tools/_projectCommon.php b/tools/_projectCommon.php
index 4530c02..77db096 100755
--- a/tools/_projectCommon.php
+++ b/tools/_projectCommon.php
@@ -42,9 +42,8 @@
 
 $Nav->addNavSeparator("Project Tools", "index.php$parameters");
 
-$Nav->addNavSeparator("IP", null);
-$Nav->addCustomNav("CQ Overview", "/projects/tools/ip_cq_overview.php$parameters", "_self", 2);
 if ($id = @$_GET['id']) {
+  $Nav->addNavSeparator("IP", null);
   require_once ($_SERVER['DOCUMENT_ROOT'] . "/projects/classes/Project.class.php");
   if ($project = Project::getProject($id)) {
     $url = $project->getUrl();
diff --git a/tools/ip_cq_overview.php b/tools/ip_cq_overview.php
deleted file mode 100644
index 6c0abb9..0000000
--- a/tools/ip_cq_overview.php
+++ /dev/null
@@ -1,180 +0,0 @@
-<?php
-/*******************************************************************************
- * Copyright (c) 2010, 2017 Eclipse Foundation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v2.0
- * which available at http://www.eclipse.org/legal/epl-2.0
- *******************************************************************************/
-
-require_once(dirname(__FILE__) . "/../../eclipse.org-common/system/app.class.php");
-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/IPZilla.class.inc");
-require_once(dirname(__FILE__) . "/../classes/common.php");
-require_once(dirname(__FILE__) . "/../classes/debug.php");
-
-$App = new App();
-$Nav = new Nav();
-$Menu = new Menu();
-
-mustBeCommitter();
-
-include($App->getProjectCommon());
-
-// Preload all of the active projects to speed things up a bit.
-$projects = Project::getActiveProjects();
-
-function getProjectLink($id) {
- global $projects;
-
- if (isset($projects[$id])) {
-  $project = $projects[$id];
-  $url = $project->getUrl();
-  $name = $project->getFormalName();
- } else {
-  $url = "https://projects.eclipse.org/projects/{$id}";
-  $name = $id;
- }
-
- return "<a href=\"{$url}\">{$name}</a>";
-}
-
-$ipzilla = IPZilla::getInstance();
-
-function display_cq($cq) {
-  if (!$cq->isApproved()) return;
-  echo "<div class=\"cq\">";
-  if ($cq->isProjectCode()) {
-   $icon = 'eclipse.gif';
-   $title = 'An EPL-licensed contribution to an Eclipse project';
-  } elseif ($cq->isThirdParty()) {
-   $icon = 'library.png';
-   $title = 'A third-party library';
-  } else {
-   return;
-  }
-
-  $description = htmlentities($cq->getDescription());
-  $name = htmlentities($cq->getName());
-  $version = htmlentities($cq->getVersion());
-
-  $header = $name;
-  if ($version) $header = "$header $version";
-
-  echo "<h4 id=\"{$cq->getId()}\"><img src=\"/projects/images/$icon\" title=\"$title\"></img>
-   <a href=\"https://dev.eclipse.org/ipzilla/show_bug.cgi?id={$cq->getId()}\">CQ&nbsp;{$cq->getId()}</a>
-   $header</h4><p>$description<p>";
-  echo "<div class=\"cq-info\">";
-
-  echo "<p>Name: {$cq->getName()}</p>";
-  echo "<p>Version: {$cq->getVersion()}</p>";
-  echo "<p>Due Diligence Type: {$cq->getDueDiligenceType()}</p>";
-  echo "<p>Keywords: {$cq->getKeywords()}</p>";
-  echo "<p>License(s): {$cq->getLicenses()}</p>";
-  echo "<p>SPDX: {$cq->getSPDX()}</p>";
-
-  $link = getProjectLink($cq->getProjectId());
-  echo "<p>Created by: {$link}</p>";
-
-  displayPiggybacks($cq);
-  displayFilePatterns($cq);
-  displayMavenPatterns($cq);
-  displayRelated($cq);
-
-  echo "</div>";
-  echo "</div>";
-}
-
-function displayFilePatterns($cq) {
- if ($cq->getFilePatterns()) {
-  echo "<p>File patterns:</p>";
-  echo "<ul>";
-  foreach($cq->getFilePatterns() as $pattern => $regex) {
-   echo "<li>$pattern</li>";
-  }
-  echo "</ul>";
- }
-}
-
-function displayMavenPatterns($cq) {
- if ($patterns = $cq->getMvnPatterns()) {
-  echo "<p>Maven patterns:</p>";
-  echo "<ul>";
-  foreach($patterns as $pattern) {
-   echo "<li>$pattern</li>";
-  }
-  echo "</ul>";
- }
-}
-
-function displayPiggybacks($cq) {
- if ($piggybacks = $cq->getPiggybacks()) {
-  echo "<p>Also used by:</p>";
-  echo "<ul>";
-  foreach($piggybacks as $piggyback) {
-   $link = getProjectLink($piggyback->getProjectId());
-   echo "<li>{$link} (<a href=\"https://dev.eclipse.org/ipzilla/show_bug.cgi?id={$piggyback->getId()}\">{$piggyback->getId()}</a>)</li>";
-  }
-  echo "</ul>";
- }
-}
-
-function displayRelated($cq) {
- if ($related = $cq->getRelatedCqs()) {
-  usort($related, 'compareCqsBySemanticVersion');
-  echo "<p>See also:</p>";
-  echo "<ul>";
-  foreach($related as $each){
-   echo "<li><a href=\"#{$each->getId()}\">{$each->getId()}</a> {$each->getName()} {$each->getVersion()}</li>";
-  }
-  echo "</ul>";
- }
-}
-
-function compareCqsBySemanticVersion($a, $b) {
- return compareSemanticVersion($a->getVersion(), $b->getVersion());
-}
-
-ob_start();
-
-$pageKeywords = "";
-$pageTitle = "An Overview of Contribution Questionnaires";
-$pageAuthor = "Wayne Beaton";
-?>
-
-<div id="midcolumn">
-<div class="homeitem">
-<h1><?= $pageTitle ?></h1>
-
-<p>This page display information about contribution questionnaires (CQs),
-including the hierarchical relationship of the various &quot;piggy-back&quot;.
-Where known, the file patterns for any JAR'd bundles associated with
-the CQs are indicated.</p>
-
-<style>
-.cq table {border-width:0;margin-top:1em;margin-bottom:5px}
-.cq tr {vertical-align:top}
-.cq p {margin:0}
-.cq-info {margin-left:2em}
-.cq-info p ul {margin-top:0px;margin-bottom:}
-.cq-info li {margin:0}
-</style>
-
-
-<?php
-
-$ipzilla->rootCqsDo(function($cq) {
- display_cq($cq);
-});
-
-?>
-
-</div>
-</div>
-
-<?php
-$html = ob_get_contents();
-ob_end_clean();
-$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
-?>
\ No newline at end of file