2005-10-17 03:59:24 +00:00
|
|
|
<?php
|
|
|
|
|
/**************************************************/
|
|
|
|
|
/* code to submit, view and resubmit Test Results */
|
|
|
|
|
/**************************************************/
|
|
|
|
|
|
2006-07-07 18:14:53 +00:00
|
|
|
require("path.php");
|
2005-10-17 03:59:24 +00:00
|
|
|
require(BASE."include/incl.php");
|
2006-07-07 18:14:53 +00:00
|
|
|
require_once(BASE."include/tableve.php");
|
|
|
|
|
require_once(BASE."include/application.php");
|
2006-07-12 00:29:35 +00:00
|
|
|
require_once(BASE."include/testData.php");
|
2006-07-21 04:21:04 +00:00
|
|
|
require_once(BASE."include/distribution.php");
|
2005-10-17 03:59:24 +00:00
|
|
|
|
2006-07-16 05:39:56 +00:00
|
|
|
//deny access if not logged on
|
|
|
|
|
if(!$_SESSION['current']->isLoggedIn())
|
|
|
|
|
util_show_error_page_and_exit("Insufficient privileges to create test results. Are you sure you are logged in?");
|
|
|
|
|
|
2006-07-08 05:02:22 +00:00
|
|
|
|
2006-07-06 17:27:54 +00:00
|
|
|
if ($aClean['sSub'])
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2006-06-17 06:10:10 +00:00
|
|
|
$oTest = new testData($aClean['iTestingId']);
|
|
|
|
|
if($aClean['iVersionId'])
|
|
|
|
|
$oTest->iVersionId = $aClean['iVersionId'];
|
2005-10-17 03:59:24 +00:00
|
|
|
$errors = "";
|
|
|
|
|
|
2006-12-31 19:39:41 +00:00
|
|
|
// Submit or Resubmit the new test results
|
2006-07-06 17:27:54 +00:00
|
|
|
if (($aClean['sSub'] == 'Submit') || ($aClean['sSub'] == 'Resubmit'))
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2007-01-04 02:35:01 +00:00
|
|
|
$errors = $oTest->CheckOutputEditorInput($aClean);
|
|
|
|
|
$oTest->GetOutputEditorValues($aClean); // retrieve the values from the current $aClean
|
2005-10-17 03:59:24 +00:00
|
|
|
if(empty($errors))
|
|
|
|
|
{
|
2006-06-17 06:10:10 +00:00
|
|
|
if(!$aClean['iDistributionId'])
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2006-06-17 06:10:10 +00:00
|
|
|
if(!empty($aClean['sDistribution']) )
|
2006-01-17 02:33:14 +00:00
|
|
|
{
|
|
|
|
|
$oDistribution = new distribution();
|
2006-06-17 06:10:10 +00:00
|
|
|
$oDistribution->sName = $aClean['sDistribution'];
|
2006-01-17 02:33:14 +00:00
|
|
|
$oDistribution->create();
|
|
|
|
|
$oTest->iDistributionId = $oDistribution->iDistributionId;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
if($aClean['sSub'] == 'Submit')
|
2006-01-17 02:33:14 +00:00
|
|
|
{
|
2007-01-07 05:15:33 +00:00
|
|
|
$oTest->create();
|
2006-07-06 17:27:54 +00:00
|
|
|
} else if($aClean['sSub'] == 'Resubmit')
|
2006-01-17 02:33:14 +00:00
|
|
|
{
|
|
|
|
|
$oTest->update(true);
|
2007-01-07 05:15:33 +00:00
|
|
|
$oTest->ReQueue();
|
2005-10-17 03:59:24 +00:00
|
|
|
}
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
2005-10-17 03:59:24 +00:00
|
|
|
} else
|
|
|
|
|
{
|
2006-07-06 17:27:54 +00:00
|
|
|
$aClean['sSub'] = 'view';
|
2005-10-17 03:59:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-31 19:39:41 +00:00
|
|
|
// Delete test results
|
2006-07-06 17:27:54 +00:00
|
|
|
if ($aClean['sSub'] == 'Delete')
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2007-01-07 05:15:33 +00:00
|
|
|
if($aClean['iTestingId'])
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2006-06-17 06:10:10 +00:00
|
|
|
$oTest = new testData($aClean['iTestingId']);
|
2005-10-17 03:59:24 +00:00
|
|
|
$oTest->delete();
|
|
|
|
|
}
|
2007-01-07 05:15:33 +00:00
|
|
|
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
2005-10-17 03:59:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// is this an old test?
|
2007-01-07 05:15:33 +00:00
|
|
|
if($aClean['iTestingId'])
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2006-12-31 19:39:41 +00:00
|
|
|
// make sure the user has permission to view this test result
|
2006-01-23 02:10:31 +00:00
|
|
|
$oVersion = new Version($oTest->iVersionId);
|
2005-10-17 03:59:24 +00:00
|
|
|
if(!$_SESSION['current']->hasPriv("admin") &&
|
2006-01-23 02:10:31 +00:00
|
|
|
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion)&&
|
2005-10-17 03:59:24 +00:00
|
|
|
!(($_SESSION['current']->iUserId == $oTest->iSubmitterId) && !($oTest->sQueued == 'false')))
|
|
|
|
|
{
|
2006-07-06 18:44:56 +00:00
|
|
|
util_show_error_page_and_exit("Insufficient privileges.");
|
2005-10-17 03:59:24 +00:00
|
|
|
} else
|
2007-01-07 05:15:33 +00:00
|
|
|
{
|
|
|
|
|
$oVersion = new Version($oTest->iVersionId);
|
|
|
|
|
}
|
2005-10-17 03:59:24 +00:00
|
|
|
} else
|
|
|
|
|
{
|
2006-06-17 06:10:10 +00:00
|
|
|
$oTest->iVersionId = $aClean['iVersionId'];
|
2007-01-07 05:15:33 +00:00
|
|
|
$oVersion = new Version($aClean['iVersionId']);
|
2005-10-17 03:59:24 +00:00
|
|
|
$oTest->sQueued = "new";
|
|
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
if ($aClean['sSub'] == 'view')
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2006-08-30 22:27:07 +00:00
|
|
|
$oApp = new Application($oVersion->iAppId);
|
2005-10-17 03:59:24 +00:00
|
|
|
$sVersionInfo = $oApp->sName." ".$oVersion->sName;
|
|
|
|
|
|
|
|
|
|
switch($oTest->sQueued)
|
|
|
|
|
{
|
|
|
|
|
case "new":
|
2006-12-31 19:39:41 +00:00
|
|
|
apidb_header("Submit new test results for ".$sVersionInfo);
|
2005-10-17 03:59:24 +00:00
|
|
|
$oTest->sTestedDate = date('Y-m-d H:i:s');
|
|
|
|
|
break;
|
|
|
|
|
case "true":
|
2006-12-31 19:39:41 +00:00
|
|
|
apidb_header("Edit new test results for ".$sVersionInfo);
|
2005-10-17 03:59:24 +00:00
|
|
|
break;
|
|
|
|
|
case "rejected":
|
2006-12-31 19:39:41 +00:00
|
|
|
apidb_header("Resubmit test results for ".$sVersionInfo);
|
2005-10-17 03:59:24 +00:00
|
|
|
break;
|
|
|
|
|
case "False":
|
2006-12-31 19:39:41 +00:00
|
|
|
apidb_header("Edit test results for ".$sVersionInfo);
|
2005-10-17 03:59:24 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
2007-01-07 05:15:33 +00:00
|
|
|
util_show_error_page_and_exit('$oTest->sQueued of \''.$oTest->sQueued."'is invalid");
|
|
|
|
|
break;
|
2005-10-17 03:59:24 +00:00
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
echo '<form name="sQform" action="'.$_SERVER['PHP_SELF'].'" method="post" enctype="multipart/form-data">',"\n";
|
2005-10-17 03:59:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//help
|
2006-12-31 19:39:41 +00:00
|
|
|
echo "<p>This is the screen for inputing test information so that others looking at the database will know \n";
|
|
|
|
|
echo "what was working on a particular release of Wine.</p>\n";
|
2005-10-17 03:59:24 +00:00
|
|
|
echo "<p>Please be as detailed as you can.</p>\n";
|
2006-12-31 19:39:41 +00:00
|
|
|
echo "<p>If you cannot find your distribution in the list of existing distributions, please add it in the \n";
|
|
|
|
|
echo "provided field.</p>\n\n";
|
2005-10-17 03:59:24 +00:00
|
|
|
|
|
|
|
|
if(!empty($errors))
|
|
|
|
|
{
|
|
|
|
|
echo '<font color="red">',"\n";
|
|
|
|
|
echo '<p class="red"> We found the following errors:</p><ul>'.$errors.'</ul>Please correct them.';
|
|
|
|
|
echo '</font><br />',"\n";
|
|
|
|
|
echo '<p></p>',"\n";
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-31 19:39:41 +00:00
|
|
|
// View Test Details
|
2007-01-17 03:18:49 +00:00
|
|
|
$oTest->outputEditor($aClean['sDistribution'],true);
|
2005-10-17 03:59:24 +00:00
|
|
|
|
2006-07-06 17:27:54 +00:00
|
|
|
echo '<a href="'.BASE."appview.php?iVersionId=".$oTest->iVersionId.'">Back to Version</a>';
|
2005-10-17 03:59:24 +00:00
|
|
|
|
|
|
|
|
echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Submit Buttons
|
|
|
|
|
switch($oTest->sQueued)
|
|
|
|
|
{
|
|
|
|
|
case "new":
|
2006-07-06 17:27:54 +00:00
|
|
|
echo '<input name="sSub" type="submit" value="Submit" class="button" > ',"\n";
|
2005-10-17 03:59:24 +00:00
|
|
|
break;
|
|
|
|
|
case "true":
|
|
|
|
|
case "rejected":
|
|
|
|
|
case "False":
|
2006-07-06 17:27:54 +00:00
|
|
|
echo '<input name="sSub" type="submit" value="Resubmit" class="button" > ',"\n";
|
|
|
|
|
echo '<input name="sSub" type="submit" value="Delete" class="button" >',"\n";
|
2005-10-17 03:59:24 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
echo '</td></tr>',"\n";
|
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
|
|
echo html_frame_end(" ");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// error no sub!
|
|
|
|
|
addmsg("Internal Routine Not Found!!", "red");
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
2005-10-17 03:59:24 +00:00
|
|
|
}
|
|
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
else // if ($aClean['sSub']) is not defined, display the Testing results queue page
|
2005-10-17 03:59:24 +00:00
|
|
|
{
|
2007-03-18 22:11:28 +00:00
|
|
|
util_show_error_page_and_exit("No test id defined!");
|
2005-10-17 03:59:24 +00:00
|
|
|
}
|
2007-03-18 22:11:28 +00:00
|
|
|
apidb_footer();
|
2005-10-17 03:59:24 +00:00
|
|
|
?>
|