Use objectManager for new test results

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-16 23:10:08 +00:00
committed by WineHQ
parent a309317347
commit 46df59f063
4 changed files with 90 additions and 22 deletions

View File

@@ -347,12 +347,16 @@ class distribution {
// Name
echo '<tr valign=top><td class="color1" width="20%"><b>Distribution Name</b></td>',"\n";
echo '<td class="color0"><input type=text name="sName" value="'.$this->sName.'" size="50"></td></tr>',"\n";
echo '<td class="color0"><input type=text name="sDistribution" value="'.$this->sName.'" size="50"></td></tr>',"\n";
// Url
echo '<tr valign=top><td class="color1"><b>Distribution Url</b></td>',"\n";
echo '<td class="color0"><input type=text name="sUrl" value="'.$this->sUrl.'" size="50"></td></tr>',"\n";
echo '<input type="hidden" name="iDistributionId" value="'.$this->iDistributionId.'">',"\n";
if($this->iDistributionId)
{
echo '<input type="hidden" name="iDistributionId" '.
'value="'.$this->iDistributionId.'">',"\n";
}
echo "</table>\n";
}
@@ -362,7 +366,7 @@ class distribution {
function GetOutputEditorValues($aValues)
{
$this->iDistributionId = $aValues['iDistributionId'];
$this->sName = $aValues['sName'];
$this->sName = $aValues['sDistribution'];
$this->sUrl = $aValues['sUrl'];
}

View File

@@ -63,15 +63,6 @@ class testData{
// Creates a new Test Results.
function create()
{
// Security, if we are not an administrator or a maintainer the test result must be queued.
$oVersion = new Version($this->iVersionId);
if(!$_SESSION['current']->hasPriv("admin") &&
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
$this->sQueued = 'true';
else
$this->sQueued = 'false';
$hResult = query_parameters("INSERT INTO testResults (versionId, whatWorks, whatDoesnt,".
"whatNotTested, testedDate, distributionId, testedRelease,".
"installs, runs, testedRating, comments, submitterId, queued)".
@@ -80,8 +71,9 @@ class testData{
$this->iVersionId, $this->shWhatWorks, $this->shWhatDoesnt,
$this->shWhatNotTested, $this->sTestedDate, $this->iDistributionId,
$this->sTestedRelease, $this->sInstalls, $this->sRuns,
$this->sTestedRating, $this->sComments, $_SESSION['current']->iUserId,
$this->sQueued);
$this->sTestedRating, $this->sComments,
$_SESSION['current']->iUserId,
$this->canEdit() ? "false" : "true");
if($hResult)
{
$this->iTestingId = mysql_insert_id();
@@ -489,8 +481,16 @@ class testData{
}
// show the fields for editing
function outputEditor($sDistribution="", $bNewDist=false)
function outputEditor()
{
global $aClean;
/* Fill in some values */
if(!$this->iVersionId)
$this->iVersionId = $aClean['iVersionId'];
if(!$this->sTestedDate)
$this->sTestedDate = date('Y-m-d H:i:s');
HtmlAreaLoaderScript(array("Test1", "Test2", "Test3"));
$sName = version::fullName($this->iVersionId);
@@ -516,11 +516,11 @@ class testData{
echo '<tr valign=top><td class="color1"></td><td class="color0"><p/>YYYY-MM-DD HH:MM:SS</td></tr>',"\n";
// Distribution
echo '<tr valign=top><td class="color0"><b>Distribution</b></td class="color0">',"\n";
if ($bNewDist)
{
echo '<td class="color0"><input type=text name="sDistribution" value="'.$sDistribution.'" size="20"></td></tr>',"\n";
echo '<tr><td class=color0><b></b></td>',"\n";
}
echo '<td class="color0">If yours is not on the list, please add it using the form '.
'below</td></tr>',"\n";
echo '<tr><td class=color0><b></b></td>',"\n";
echo '<td class=color0>',"\n";
distribution::make_distribution_list("iDistributionId", $this->iDistributionId);
echo '</td></tr>',"\n";
@@ -823,7 +823,7 @@ class testData{
{
if($_SESSION['current']->hasPriv("admin"))
return TRUE;
else if($this->iTestingId)
else if($this->iVersionId)
{
$oVersion = new version($this->iVersionId);
if($_SESSION['current']->hasAppVersionModifyPermission($oVersion))

View File

@@ -0,0 +1,62 @@
<?php
class testData_queue
{
var $oTestData;
var $oDistribution;
function testData_queue($iTestId = null)
{
$this->oTestData = new testData($iTestId);
$this->oDistribution = new distribution($this->oTestData->iDistributionId);
}
function create()
{
if(!$this->oTestData->iDistributionId)
{
$this->oDistribution->create();
$this->oTestData->iDistributionId = $this->oDistribution->iDistributionId;
}
$this->oTestData->create();
}
function update()
{
$this->oTestData->update();
$this->oDistribution->update();
}
function outputEditor()
{
$this->oTestData->outputEditor();
/* If the testData is already associated with a distribution and the distribution is
un-queued, there is no need to display the distribution form here */
if(!$this->oTestData->iDistributionId or $this->oDistributionId->sQueued != "false")
$this->oDistribution->outputEditor();
}
function getOutputEditorValues($aClean)
{
$this->oTestData->getOutputEditorValues($aClean);
$this->oDistribution->getOutputEditorValues($aClean);
}
function checkOutputEditorInput($aClean)
{
return $this->oTestData->checkOutputEditorInput($aClean);
}
function canEdit()
{
return $this->oTestData->canEdit();
}
function objectDisplayAddItemHelp()
{
$this->oTestData->objectDisplayAddItemHelp();
}
}
?>

View File

@@ -897,7 +897,9 @@ class Version {
}
if($_SESSION['current']->isLoggedIn())
{
echo '<form method=post name=sMessage action=testResults.php?sSub=view&iVersionId='.$this->iVersionId.'>';
echo '<form method=post name=sMessage action=objectManager.php?'.
'sClass=testData_queue&sAction=add&iVersionId='.$this->iVersionId.
'&sTitle=Add+Test+Data>';
echo '<input type=submit value="Add Test Data" class="button" />';
echo '</form>';
} else