testData class cleanup. Move some test related functions into the class as

static functions.  Clean up some variable names.
This commit is contained in:
Chris Morgan
2006-07-10 15:39:21 +00:00
committed by WineHQ
parent 5f4998194a
commit cd5a620d88
2 changed files with 43 additions and 47 deletions

View File

@@ -18,7 +18,7 @@ function global_admin_menu() {
$g->add("View Maintainer Queue (".getQueuedMaintainerCount().")", BASE."admin/adminMaintainerQueue.php"); $g->add("View Maintainer Queue (".getQueuedMaintainerCount().")", BASE."admin/adminMaintainerQueue.php");
$g->add("View Maintainer Entries (".getMaintainerCount().")", BASE."admin/adminMaintainers.php"); $g->add("View Maintainer Entries (".getMaintainerCount().")", BASE."admin/adminMaintainers.php");
$g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")", BASE."admin/adminBugs.php"); $g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")", BASE."admin/adminBugs.php");
$g->add("View Test Results Queue (".getNumberOfQueuedTests().")", BASE."admin/adminTestResults.php"); $g->add("View Test Results Queue (".testData::getNumberOfQueuedTests().")", BASE."admin/adminTestResults.php");
$g->addmisc(" "); $g->addmisc(" ");
$g->add("Users Management", BASE."admin/adminUsers.php"); $g->add("Users Management", BASE."admin/adminUsers.php");

View File

@@ -525,11 +525,11 @@ class testData{
echo '</td></tr>',"\n"; echo '</td></tr>',"\n";
// Installs // Installs
echo '<tr><td class=color0><b>Installs?</b></td><td class=color0>',"\n"; echo '<tr><td class=color0><b>Installs?</b></td><td class=color0>',"\n";
make_Installs_list("sInstalls", $this->sInstalls); testData::make_Installs_list("sInstalls", $this->sInstalls);
echo '</td></tr>',"\n"; echo '</td></tr>',"\n";
// Runs // Runs
echo '<tr><td class=color1><b>Runs?</b></td><td class=color0>',"\n"; echo '<tr><td class=color1><b>Runs?</b></td><td class=color0>',"\n";
make_Runs_list("sRuns", $this->sRuns); testData::make_Runs_list("sRuns", $this->sRuns);
echo '</td></tr>',"\n"; echo '</td></tr>',"\n";
// Rating // Rating
echo '<tr><td class="color0"><b>Rating</b></td><td class="color0">',"\n"; echo '<tr><td class="color0"><b>Rating</b></td><td class="color0">',"\n";
@@ -668,63 +668,59 @@ class testData{
echo "</table>","\n"; echo "</table>","\n";
echo html_frame_end(); echo html_frame_end();
} }
}
/* Get the number of TestResults in the database */ /* Get the number of TestResults in the database */
function getNumberOfQueuedTests() function getNumberOfQueuedTests()
{ {
$sQuery = "SELECT count(*) as num_tests $sQuery = "SELECT count(*) as num_tests
FROM testResults, appVersion FROM testResults, appVersion
WHERE appVersion.versionId=testResults.versionId WHERE appVersion.versionId=testResults.versionId
and appVersion.queued='false' and appVersion.queued='false'
and testResults.queued='true';"; and testResults.queued='true';";
$hResult = query_parameters($sQuery); $hResult = query_parameters($sQuery);
if($hResult) if($hResult)
{ {
$oRow = mysql_fetch_object($hResult); $oRow = mysql_fetch_object($hResult);
return $oRow->num_tests; return $oRow->num_tests;
}
return 0;
} }
return 0;
}
function make_Installs_list($varname, $cvalue) function make_Installs_list($sVarname, $sSelectedValue)
{
echo "<select name='$varname'>\n";
echo "<option value=\"\">Choose ...</option>\n";
$aRating = array("Yes", "No", "N/A");
$iMax = count($aRating);
for($i=0; $i < $iMax; $i++)
{ {
if($aRating[$i] == $cvalue) echo "<select name='$sVarname'>\n";
echo "<option value='".$aRating[$i]."' selected>".$aRating[$i]."\n"; echo "<option value=\"\">Choose ...</option>\n";
else $aRating = array("Yes", "No", "N/A");
echo "<option value='".$aRating[$i]."'>".$aRating[$i]."\n"; $iMax = count($aRating);
for($i=0; $i < $iMax; $i++)
{
if($aRating[$i] == $sSelectedValue)
echo "<option value='".$aRating[$i]."' selected>".$aRating[$i]."\n";
else
echo "<option value='".$aRating[$i]."'>".$aRating[$i]."\n";
}
echo "</select>\n";
} }
echo "</select>\n";
}
function make_Runs_list($varname, $cvalue) function make_Runs_list($sVarname, $sSelectedValue)
{
echo "<select name='$varname'>\n";
echo "<option value=\"\">Choose ...</option>\n";
$aRating = array("Yes", "No", "Not Installable");
$iMax = count($aRating);
for($i=0; $i < $iMax; $i++)
{ {
if($aRating[$i] == $cvalue) echo "<select name='$sVarname'>\n";
echo "<option value='".$aRating[$i]."' selected>".$aRating[$i]."\n"; echo "<option value=\"\">Choose ...</option>\n";
else $aRating = array("Yes", "No", "Not Installable");
echo "<option value='".$aRating[$i]."'>".$aRating[$i]."\n"; $iMax = count($aRating);
}
echo "</select>\n";
}
for($i=0; $i < $iMax; $i++)
{
if($aRating[$i] == $sSelectedValue)
echo "<option value='".$aRating[$i]."' selected>".$aRating[$i]."\n";
else
echo "<option value='".$aRating[$i]."'>".$aRating[$i]."\n";
}
echo "</select>\n";
}
}
?> ?>