<?php
/*
* Copyright (c) 2005, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*/
/*
This file allows an admin to list the current releases
and runs, to delete some entries or to add new ones.
We create an array with:
----------------------------------------------------------------------------------
| modules | TS releases | TS description | RUNs | RUN Descriptions |
----------------------------------------------------------------------------------
| opts | 1.5.0 | This is the... | Fedora Core 3 | Run on IA32 ... |
| <info> | <delete*> | <edit> | <delete> | <edit> |
| | | |----------------------------------|
| | | | Solaris 10 | Run on ... |
| | | | <delete> | <edit> |
| | | |----------------------------------|
| | | | <add new> | |
| |-------------------------------------------------------------------|
| | <add new> | | | |
|--------------------------------------------------------------------------------|
| ltp | 200412 | This is... | <add new> | |
| <info> | <delete> | <edit> | | |
| |-------------------------------------------------------------------|
| | <add new> | | | |
|--------------------------------------------------------------------------------|
| nfsv4 | <add new> | | | |
| <info> | | | | |
|--------------------------------------------------------------------------------|
*/
$root="../";
$_PAGE["title"]="TSLP Administration Interface";
/* Output header page */
require($root."header.inc.php");
/* We'll need functions defined in other files */
require($root."database.inc.php");
require($root."functions.inc.php");
require($root."admin/tar.inc.php"); /* Handle tar files */
/* We'll need the database connexion */
db_init();
/* Initialize the plugins modules */
require($root."admin/modules.inc.php");
$tslp = new testsuite();
/* Query the modules list first */
$modules=$tslp->list_modules();
/* We copy some variables from the POST array to the GET array */
if (isset($_POST["action"]))
{
$_GET["action"]=$_POST["action"];
if (isset($_POST["add_run"]))
$_GET["add_run"] = $_POST["add_run"];
if (isset($_POST["module"]))
$_GET["module"] = $_POST["module"];
if (isset($_POST["tsid"]))
$_GET["tsid"] = $_POST["tsid"];
if (isset($_POST["run_name"]))
$_GET["run_name"] = $_POST["run_name"];
if (isset($_POST["run_descr"]))
$_GET["run_descr"] = $_POST["run_descr"];
if (isset($_POST["add_ts"]))
$_GET["add_ts"] = $_POST["add_ts"];
if (isset($_POST["ts_name"]))
$_GET["ts_name"] = $_POST["ts_name"];
if (isset($_POST["ts_descr"]))
$_GET["ts_descr"] = $_POST["ts_descr"];
}
/* Parse the GET parameters if any */
if (isset($_GET["action"]))
{
if (0)
{
echo "<hr><pre>\n";
print_r($_GET);
echo "</pre><hr>\n";
}
if (isset($_GET["info_mod"]))
$_GET["module"]=$_GET["info_mod"];
/* Check module coherency */
if (isset($_GET["add_ts"]) || isset($_GET["delete_ts"])
|| isset($_GET["add_run"]) || isset($_GET["delete_run"])
|| isset($_GET["info_mod"]))
{
if (!isset($_GET["module"]))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
if (!in_array($_GET["module"], $modules))
{
echo "<b>Module <i>".$_GET["module"]."</i> unavailable.</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
$tslp->select_module($_GET["module"]) or die("Invalid plugin");
}
/*****************************
*** Module information ***
*****************************/
if (isset($_GET["info_mod"]))
{
echo "<table border=\"1\">\n";
echo " <tr>\n";
echo " <td align=\"center\">\n";
echo " <b>Module Informations</b>\n";
echo " </td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
echo $tslp->module_info();
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<p><a href=\"index.php\">Go back</a> to administration.</p>\n";
}
/*****************************
*** Add new test suite ***
*****************************/
if (isset($_GET["add_ts"]))
{
/* Check Step 3 parameters and eventually fall back to step 2 */
if (!isset($_GET["ts_name"]))
$_GET["ts_name"]="";
if (!isset($_GET["ts_descr"]))
$_GET["ts_descr"]="";
// if (!isset($_GET["ts_root"]))
// $_GET["ts_root"]="";
if (($_GET["action"] == 2)
&& ( !trim($_GET["ts_name"])
|| !isset($_FILES['tsarchive'])))
{
echo "<p>Please fill all <b>(*) fields.</b></p>\n";
$_GET["action"] = 1;
}
if ($_GET["action"] == 2)
{
/* Check the uploaded file type */
if (!isset($_FILES['tsarchive']))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
if (( $_FILES['tsarchive']['type'] != "application/x-gzip-compressed")
&& ($_FILES['tsarchive']['type'] != "application/x-tar")
&& ($_FILES['tsarchive']['type'] != "application/x-gzip"))
{
echo "<b>You have to supply the testsuite in a tar gzip'd format (got '".htmlentities($_FILES['tsarchive']['type'])."').</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
/* Set a longer execution time */
set_time_limit(60);
/* Try expanding the archive */
$tar = new Archive_Tar($_FILES['tsarchive']['tmp_name']);
$tar->setErrorHandling(PEAR_ERROR_PRINT);
$tmpdir = $root."ts/".time();
if (!$tar->extractModify($tmpdir, ""))
{
echo "<b>Archive extraction failed.</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
/* Find directory name from inside archive, if any */
/* 1 - check the files are inside a subdirectory */
if (!is_dir($tmpdir."/conformance/interface"))
{
/* 2 - open the directory where files were extracted */
if ($dh = opendir($tmpdir))
{
/* 3 - list the files. We assume there is only 1 directory here */
while (($file = readdir($dh)) !== false)
{
if (($file == ".") || ($file == ".."))
continue;
if (is_dir($tmpdir."/".$file))
{
$tmpdir .= "/".$file;
break;
}
echo "<b>Unexpected entry in archive: $file</b>";
db_fini();
require($root."footer.inc.php");
die();
}
/* 4 - close the directory */
closedir($dh);
}
else
{
echo "<b>Unable to open temporary directory $tmpdir</b>";
db_fini();
require($root."footer.inc.php");
die();
}
}
/* Here we're in step 2 in process: ready to proceed */
echo "<pre>\n";
$tmp = $tslp->TS_parse($_GET["ts_name"], $_GET["ts_descr"], $tmpdir);
echo "</pre>\n";
if (!$tmp)
{
$_GET["action"] = 1;
echo "<p><b>Error:</b> <i>".$tslp->last_error."</i>.</p>\n";
}
/* In any case, remove the extracted archive now. */
function deldir($dir) {
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
rmdir($dir);
}
deldir($tmpdir);
}
if ($_GET["action"] < 2)
{
/* Output the new testsuite form */
echo "<form enctype=\"multipart/form-data\" method=\"POST\">\n";
echo " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"16777216\">";
echo " <input type=\"hidden\" name=\"action\" value=\"2\">\n";
echo " <input type=\"hidden\" name=\"add_ts\" value=\"add\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"".$_GET["module"]."\">\n";
?>
<table border="1" align="center" width="80%">
<tr>
<td colspan="2" align="center">
<h3>Add a new release in database.</h3>
</td>
</tr>
<tr>
<td>Selected module:</td>
<td><b><?php echo $_GET["module"]; ?></b></td>
</tr>
<tr>
<td>New release name(*):</td>
<td><input type="text" name="ts_name" maxlength="30" size="80" value=<?php echo "\"".$_GET["ts_name"]."\""; ?>></td>
</tr>
<tr>
<td>New release description:</td>
<td><textarea name="ts_descr" rows="3" cols="79"><?php echo $_GET["ts_descr"]; ?></textarea></td>
</tr>
<tr>
<td>New release archive (tar.gz format):</td>
<td><input name="tsarchive" type="file"></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" name="send" value="Send"></td>
</tr>
</table>
<p><a href="index.php">Go back</a> to administration index.</p>
<?php
echo "</form>\n";
db_fini();
require($root."footer.inc.php");
die();
}
}
/*****************************
*** Edit test suite ***
*****************************/
if (isset($_GET["edit_ts"]))
{
if (!isset($_GET["tsid"]))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
if ($_GET["action"] == 2)
{
$sql= " UPDATE opts_versions "
." SET ver_comment=".stringToDB($_GET["ts_descr"])
." WHERE ver_id=".$_GET["tsid"]
." AND ver_module=".stringToDB($_GET["module"]);
$tmp = db_execute_insert($sql);
if (!$tmp)
{
$_GET["action"] = 1;
echo "<p><b>An error occured,</b> release NOT changed.</p>\n";
}
}
/* Ask new description */
if ($_GET["action"] < 2)
{
/* Output the new testsuite form */
echo "<form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"2\">\n";
echo " <input type=\"hidden\" name=\"edit_ts\" value=\"del\">\n";
echo " <input type=\"hidden\" name=\"tsid\" value=\"".$_GET["tsid"]."\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"".$_GET["module"]."\">\n";
$sql= " SELECT ver_name, ver_comment "
." FROM opts_versions"
." WHERE ver_id=".$_GET["tsid"]
." AND ver_module=".stringToDB($_GET["module"]);
$release = db_execute_select($sql);
if (!$release)
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
?>
<table border="1" align="center" width="80%">
<tr>
<td colspan="2" align="center">
<h3>Edit a release description.</h3>
</td>
</tr>
<tr>
<td>Release name:</td>
<td><?php echo stringFromDB($release[0]["ver_name"]); ?></td>
</tr>
<tr>
<td>Release description:</td>
<td><textarea name="ts_descr" rows="3" cols="79"><?php echo $release[0]["ver_comment"]; ?></textarea></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" name="Change" value="confirm"></td>
</tr>
</table>
<p><a href="index.php">Go back</a> to administration index.</p>
<?php
echo "</form>\n";
db_fini();
require($root."footer.inc.php");
die();
}
}
/*****************************
*** Delete test suite ***
*****************************/
if (isset($_GET["delete_ts"]))
{
if (!isset($_GET["tsid"]))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
/* We already confirmed the deletion */
if ($_GET["action"] == 2)
{
echo "<pre>\n";
$tmp = $tslp->TS_delete($_GET["tsid"]);
echo "</pre>\n";
if (!$tmp)
{
$_GET["action"] = 1;
echo "<p><b>Error:</b> <i>".$tslp->last_error."</i>.</p>\n";
}
}
/* Require confirmation */
if ($_GET["action"] < 2)
{
/* Output the new testsuite form */
echo "<form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"2\">\n";
echo " <input type=\"hidden\" name=\"delete_ts\" value=\"del\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"".$_GET["module"]."\">\n";
echo " <input type=\"hidden\" name=\"tsid\" value=\"".$_GET["tsid"]."\">\n";
$sql= " SELECT ver_name, ver_comment "
." FROM opts_versions"
." WHERE ver_id=".$_GET["tsid"]
." AND ver_module=".stringToDB($_GET["module"]);
$release = db_execute_select($sql);
if (!$release)
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
?>
<table border="1" align="center" width="80%">
<tr>
<td colspan="2" align="center">
<h3>Delete a release from database.</h3>
</td>
</tr>
<tr>
<td>Release name:</td>
<td><?php echo stringFromDB($release[0]["ver_name"]); ?></td>
</tr>
<tr>
<td>Release description:</td>
<td><pre><?php echo stringFromDB($release[0]["ver_comment"]); ?></pre></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" name="Delete" value="confirm"></td>
</tr>
</table>
<p><a href="index.php">Go back</a> to administration index.</p>
<?php
echo "</form>\n";
db_fini();
require($root."footer.inc.php");
die();
}
}
/*****************************
*** Add run ***
*****************************/
if (isset($_GET["add_run"]))
{
if (!isset($_GET["tsid"]))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
/* Check Step 3 parameters and eventually fall back to step 2 */
if (!isset($_GET["run_name"]))
$_GET["run_name"]="";
if (!isset($_GET["run_descr"]))
$_GET["run_descr"]="";
if ($_GET["action"] == 2)
{
if (!isset($_FILES['logfile']))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
$log = file_get_contents($_FILES['logfile']['tmp_name']);
if (!$log)
{
$_GET["action"] = 1;
echo "<p>Unable to read the file ".$_FILES['logfile']['name']."</p>\n";
}
if ((!trim($_GET["run_name"])
|| !trim($_GET["run_descr"])
|| !$log))
{
echo "<p>Please fill all <b>(*) fields.</b></p>\n";
$_GET["action"] = 1;
}
}
if ($_GET["action"] == 2)
{
/* Here we're in step 2 in process: ready to proceed */
echo "<pre>\n";
$tmp = $tslp->RUN_parse($_GET["run_name"], $_GET["run_descr"], $_GET["tsid"], $log);
echo "</pre>\n";
if (!$tmp)
{
$_GET["action"] = 1;
echo "<p><b>Error:</b> <i>".$tslp->last_error."</i>.</p>\n";
}
}
if ($_GET["action"] < 2)
{
/* Output the new testsuite form */
echo "<form enctype=\"multipart/form-data\" method=\"POST\">\n";
echo " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"16777216\">";
echo " <input type=\"hidden\" name=\"action\" value=\"2\">\n";
echo " <input type=\"hidden\" name=\"add_run\" value=\"add\">\n";
echo " <input type=\"hidden\" name=\"tsid\" value=\"".$_GET["tsid"]."\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"".$_GET["module"]."\">\n";
$sql= " SELECT ver_name "
." FROM opts_versions"
." WHERE ver_id=".$_GET["tsid"]
." AND ver_module=".stringToDB($_GET["module"]);
$release = db_execute_select($sql);
if (!$release)
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
?>
<table border="1" align="center" width="80%">
<tr>
<td colspan="2" align="center">
<h3>Add a new run logfile in database.</h3>
</td>
</tr>
<tr>
<td>Selected module:</td>
<td><b><?php echo $_GET["module"]; ?></b></td>
</tr>
<tr>
<td>Selected testsuite release:</td>
<td><b><?php echo $release[0]["ver_name"]; ?></b></td>
</tr>
<tr>
<td>New run name(*):</td>
<td><input type="text" name="run_name" maxlength="30" size="80" value=<?php echo "\"".$_GET["run_name"]."\""; ?>></td>
</tr>
<tr>
<td>New release description:</td>
<td><textarea name="run_descr" rows="3" cols="79"><?php echo $_GET["run_descr"]; ?></textarea></td>
</tr>
<tr>
<td>Log file (*):</td>
<td>Upload this file: <input name="logfile" type="file"></td>
</tr>
<tr>
<td colspan="2" align=center><input type="submit" name="send" value="Send"></td>
</tr>
</table>
<p><a href="index.php">Go back</a> to administration index.</p>
<?php
echo "</form>\n";
db_fini();
require($root."footer.inc.php");
die();
}
}
/*****************************
*** Edit run ***
*****************************/
if (isset($_GET["edit_run"]))
{
if (!isset($_GET["runid"]))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
if ($_GET["action"] == 2)
{
$sql= " UPDATE opts_run "
." SET run_comments=".stringToDB($_GET["run_descr"])
." WHERE run_id=".$_GET["runid"];
$tmp = db_execute_insert($sql);
if (!$tmp)
{
$_GET["action"] = 1;
echo "<p><b>An error occured,</b> run NOT changed.</p>\n";
}
}
/* Ask new description */
if ($_GET["action"] < 2)
{
/* Output the new testsuite form */
echo "<form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"2\">\n";
echo " <input type=\"hidden\" name=\"edit_run\" value=\"edit\">\n";
echo " <input type=\"hidden\" name=\"runid\" value=\"".$_GET["runid"]."\">\n";
$sql= " SELECT run_name, run_comments "
." FROM opts_run"
." WHERE run_id=".$_GET["runid"];
$run = db_execute_select($sql);
if (!$run)
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
?>
<table border="1" align="center" width="80%">
<tr>
<td colspan="2" align="center">
<h3>Edit a run logfile description.</h3>
</td>
</tr>
<tr>
<td>Run name:</td>
<td><?php echo stringFromDB($run[0]["run_name"]); ?></td>
</tr>
<tr>
<td>Run description:</td>
<td><textarea name="run_descr" rows="3" cols="79"><?php echo $run[0]["run_comments"]; ?></textarea></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" name="Change" value="confirm"></td>
</tr>
</table>
<p><a href="index.php">Go back</a> to administration index.</p>
<?php
echo "</form>\n";
db_fini();
require($root."footer.inc.php");
die();
}
}
/*****************************
*** Delete run ***
*****************************/
if (isset($_GET["delete_run"]))
{
if (!isset($_GET["runid"]))
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
/* We already confirmed the deletion */
if ($_GET["action"] == 2)
{
echo "<pre>\n";
$tmp = $tslp->RUN_delete($_GET["runid"]);
echo "</pre>\n";
if (!$tmp)
{
$_GET["action"] = 1;
echo "<p><b>Error:</b> <i>".$tslp->last_error."</i>.</p>\n";
}
}
/* Require confirmation */
if ($_GET["action"] < 2)
{
/* Output the new testsuite form */
echo "<form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"2\">\n";
echo " <input type=\"hidden\" name=\"delete_run\" value=\"del\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"".$_GET["module"]."\">\n";
echo " <input type=\"hidden\" name=\"runid\" value=\"".$_GET["runid"]."\">\n";
$sql= " SELECT run_name, run_comments "
." FROM opts_run"
." WHERE run_id=".$_GET["runid"];
$run = db_execute_select($sql);
if (!$run)
{
echo "<b>Invalid parameters</b>\n";
db_fini();
require($root."footer.inc.php");
die();
}
?>
<table border="1" align="center" width="80%">
<tr>
<td colspan="2" align="center">
<h3>Delete a run from database.</h3>
</td>
</tr>
<tr>
<td>Run name:</td>
<td><?php echo stringFromDB($run[0]["run_name"]); ?></td>
</tr>
<tr>
<td>Release description:</td>
<td><?php echo stringFromDB($run[0]["run_comments"]); ?></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" name="Delete" value="confirm"></td>
</tr>
</table>
<p><a href="index.php">Go back</a> to administration index.</p>
<?php
echo "</form>\n";
db_fini();
require($root."footer.inc.php");
die();
}
}
}
/* We are building the global array */
/* list the releases and runs from the database */
$sql= " SELECT ver_name, ver_comment, ver_id, ver_module "
." FROM opts_versions"
." ORDER BY ver_id DESC";
$release_table = db_execute_select($sql);
$sql= " SELECT DISTINCT run_id, run_name, run_comments"
." FROM opts_run"
." ORDER BY run_id";
$allrun_table = db_execute_select($sql);
$orphaned=array();
foreach ($allrun_table as $myrow)
$orphaned[$myrow["run_id"]]=$myrow["run_name"];
$sql= " SELECT DISTINCT run_name, run_id, run_comments, ver_name, ver_module "
." FROM opts_run, opts_run_results, opts_version_descriptions, opts_versions "
." WHERE run_id=res_run"
." AND res_testcase=descr_id"
." AND descr_version=ver_id"
." ORDER BY ver_name";
$run_table = db_execute_select($sql);
/* Sort all this information into an array */
$DATA=array();
foreach ($modules as $module)
$DATA[$module]=array( "module"=>strip_tags($tslp->module_info("title", $module)),
"TS"=>array(),
"count"=>1); /* We count the "add new TS line here" */
foreach ($release_table as $release)
{
if (!isset($DATA[$release["ver_module"]]["TS"]))
/* This release' module is not available */
$DATA[$release["ver_module"]]=array("TS"=>array(), "count"=>0);
$DATA[$release["ver_module"]]["TS"][$release["ver_name"]]=
array("id"=>$release["ver_id"],
"comment"=>$release["ver_comment"],
"RUNS"=>array(),
"count"=>1); /* count the "add new run" here */
$DATA[$release["ver_module"]]["count"] += 1;
}
foreach ($run_table as $run)
{
unset($orphaned[$run["run_id"]]);
if (!isset($DATA[$run["ver_module"]]))
/* This run's module is not available -- really abnormal */
$DATA[$run["ver_module"]]=array("TS"=>array(),"count"=>0);
if (!isset($DATA[$run["ver_module"]]["TS"][$run["ver_name"]]))
/* This run belongs to no testsuite */
$DATA[$run["ver_module"]]["TS"][$run["ver_name"]]=array("RUNS"=>array(),"count"=>0);
$DATA[$run["ver_module"]]["TS"][$run["ver_name"]]["RUNS"][$run["run_id"]]=
array( "run_name"=>$run["run_name"],
"run_comments"=>$run["run_comments"]);
$DATA[$run["ver_module"]]["count"] += 1;
$DATA[$run["ver_module"]]["TS"][$run["ver_name"]]["count"] += 1;
}
//echo "<hr><pre>\n";
//print_r($DATA);
//echo "</pre><hr>\n";
if ($orphaned)
{
echo "<p>The database contains <b>".count($orphaned)."</b> orphaned runs.</p>\n";
}
/* We're ready to build the array */
?>
<table border="1" valign="top">
<tr>
<td title="TestSuite Module" align="center"><b>Module</b></td>
<td title="TestSuite Release Name" align="center"><b>TS Release</b></td>
<td title="TestSuite Decription" align="center"><b>TS Description</b></td>
<td title="Execution Log Name" align="center"><b>RUN</b></td>
<td title="Execution Log Description" align="center"><b>RUN Description</b></td>
</tr>
<?php
/* Output the array content */
foreach ($DATA as $module => $mod_data)
{
$plugged=isset($mod_data["module"]);
$tags=0;
echo " <tr>\n";
echo " <td";
if ($mod_data["count"])
echo " rowspan=\"".$mod_data["count"]."\"";
if ($plugged)
echo " title=\"".$mod_data["module"]."\"";
echo " align=\"center\" valign=\"top\">\n";
echo "<p>".$module."</p>\n";
if ($plugged)
{
echo "<p>\n";
echo " <form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"1\">\n";
echo " <input type=\"hidden\" name=\"info_mod\" value=\"$module\">\n";
echo " <input type=\"Submit\" name=\"about\" value=\"About\">\n";
echo " </form>\n";
echo "</p>";
}
else
echo "<p>Unsupported module</p>\n";
echo " </td>\n";
if ($plugged)
{
echo " <td align=\"center\" colspan=\"2\">\n";
echo " <form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"1\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"$module\">\n";
echo " <input type=\"submit\" name=\"add_ts\" value=\"Add New Testsuite Version\">\n";
echo " </form>\n";
echo " </td>\n";
echo " <td colspan=\"2\"> </td>\n";
echo " </tr>\n";
}
foreach ($mod_data["TS"] as $ts_name => $ts_data)
{
if ($plugged || ($tags > 0))
echo " <tr>\n";
$known=isset($ts_data["id"]);
if ($plugged && $known)
{
echo " <form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"1\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"$module\">\n";
echo " <input type=\"hidden\" name=\"tsid\" value=\"".$ts_data["id"]."\">\n";
}
echo " <td";
if ($ts_data["count"])
echo " rowspan=\"".$ts_data["count"]."\"";
echo " align=\"center\" valign=\"top\">\n";
echo "<p><code>".$ts_name."</code></p>\n";
if (!$known)
echo " <p><i>Unknown TS</i></p>\n";
else
{
echo " <p><input type=\"Submit\" name=\"delete_ts\" value=\"Delete\"";
if ((!$plugged) || ($ts_data["count"] > 1))
echo " disabled";
echo "></p>\n";
}
echo " </td>\n";
echo " <td";
if ($ts_data["count"])
echo " rowspan=\"".$ts_data["count"]."\"";
echo " valign=\"top\" align=\"center\">\n";
echo "<p><font size='-1'>".$ts_data["comment"]."</font></p>\n";
if ($known)
{
echo " <p><input type=\"Submit\" name=\"edit_ts\" value=\"Edit\"";
if (!$plugged)
echo " disabled";
echo "></p>\n";
}
echo "</td>\n";
/* Add new run if we are in a known TS */
if ($known)
{
echo " <td align=\"center\" colspan=\"2\">";
echo " <input type=\"submit\" name=\"add_run\" value=\"Add New Logfile\"></td>\n";
echo " </tr>\n";
}
echo "</form>\n";
foreach ($ts_data["RUNS"] as $run_id => $run_data)
{
if ($known || ($tags > 1))
echo " <tr>\n";
echo " <form method=\"GET\">\n";
echo " <input type=\"hidden\" name=\"action\" value=\"1\">\n";
echo " <input type=\"hidden\" name=\"runid\" value=\"".$run_id."\">\n";
echo " <input type=\"hidden\" name=\"module\" value=\"$module\">\n";
echo " <td valign=\"top\" align=\"center\">\n";
echo " <p><code>".$run_data["run_name"]."</code></p>\n";
echo " <p><input type=\"submit\" name=\"delete_run\" value=\"Delete\"></p>\n";
echo " </td>\n";
echo " <td valign=\"top\" align=\"center\">\n";
echo " <p><font size='-1'>".$run_data["run_comments"]."</font></p>\n";
echo " <p><input type=\"submit\" name=\"edit_run\" value=\"Edit\"></p>\n";
echo " </td>\n";
echo " </form>\n";
echo " </tr>\n";
$tags = 2;
}
$tags = 1;
}
}
echo "</table>\n";
/* End of file */
db_fini();
require($root."footer.inc.php");
?>