iTestingId = $oRow->testingId; $this->iVersionId = $oRow->versionId; $this->shWhatWorks = $oRow->whatWorks; $this->shWhatDoesnt = $oRow->whatDoesnt; $this->shWhatNotTested = $oRow->whatNotTested; $this->sTestedDate = $oRow->testedDate; $this->iDistributionId = $oRow->distributionId; $this->sTestedRelease = $oRow->testedRelease; $this->sInstalls = $oRow->installs; $this->sRuns = $oRow->runs; $this->sTestedRating = $oRow->testedRating; $this->sComments = $oRow->comments; $this->sSubmitTime = $oRow->submitTime; $this->iSubmitterId = $oRow->submitterId; $this->sQueued = $oRow->queued; } } // Creates a new Test Results. function create() { $hResult = query_parameters("INSERT INTO testResults (versionId, whatWorks, whatDoesnt,". "whatNotTested, testedDate, distributionId, testedRelease,". "installs, runs, testedRating, comments,". "submitTime, submitterId, queued)". "VALUES('?', '?', '?', '?', '?', '?', '?',". "'?', '?', '?', '?',". "?, '?', '?')", $this->iVersionId, $this->shWhatWorks, $this->shWhatDoesnt, $this->shWhatNotTested, $this->sTestedDate, $this->iDistributionId, $this->sTestedRelease, $this->sInstalls, $this->sRuns, $this->sTestedRating, $this->sComments, "NOW()", $_SESSION['current']->iUserId, $this->mustBeQueued() ? "true" : "false"); if($hResult) { $this->iTestingId = query_appdb_insert_id(); $this->testData($this->iTestingId); $this->SendNotificationMail(); return true; } else { addmsg("Error while creating test results.", "red"); return false; } } // Update Test Results. function update($bSilent=false) { // is the current user allowed to update this test result? $oVersion = new Version($this->iVersionId); if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($oVersion) && !(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sQueued == 'false'))) { return; } $oOldTest = new testData($this->iTestingId); /* Nothing changed */ if($this == $oOldTest) return TRUE; /* Provide some feedback as to what was changed. Not all fields are interesting */ $sWhatChanged = ""; if($this->shWhatWorks != $oOldTest->shWhatWorks) { $sWhatChanged .= "What works was changed from\n'$oOldTest->shWhatWorks'\n". "to\n'$this->shWhatWorks'.\n"; } if($this->shWhatDoesnt != $oOldTest->shWhatDoesnt) { $sWhatChanged .= "What does not work was changed from\n'" .$oOldTest->shWhatDoesnt."'\n to\n'$this->shWhatDoesnt'.\n"; } if($this->shWhatNotTested != $oOldTest->shWhatNotTested) { $sWhatChanged .= "What was not tested was changed from\n'". $oOldTest->shWhatNotTested."'\nto\n'$this->shWhatNotTested'.\n"; } if($this->sComments != $oOldTest->sComments) { $sWhatChanged .= "Extra comments was changed from\n'". $oOldTest->sComments."'\nto\n'$this->sComments'.\n"; } if($this->iDistributionId != $oOldTest->iDistributionId) { $oNewDist = new distribution($this->iDistributionId); $oOldDist = new distribution($oOldTest->iDistributionId); $sWhatChanged .= "Distribution was changed from $oOldDist->sName ". "to $oNewDist->sName.\n"; } if($this->sInstalls != $oOldTest->sInstalls) { $sWhatChanged .= "Installs? was changed from $oOldTest->sInstalls to ". "$this->sInstalls.\n"; } if($this->sRuns != $oOldTest->sRuns) { $sWhatChanged .= "Runs? was changed from $oOldTest->sRuns to ". "$this->sRuns.\n"; } if($this->sTestedRating != $oOldTest->sTestedRating) { $sWhatChanged .= "Rating was changed from $oOldTest->sTestedRating ". "to $this->sTestedRating.\n"; } if($this->sTestedRelease != $oOldTest->sTestedRelease) { $sWhatChanged .= "Tested release was changed from ". $oOldTest->sTestedRelease." to $this->sTestedRelease.\n"; } if(query_parameters("UPDATE testResults SET versionId = '?', whatWorks = '?', whatDoesnt = '?', whatNotTested = '?', testedDate = '?', distributionId = '?', testedRelease = '?', installs = '?', runs = '?', testedRating = '?', comments = '?' WHERE testingId = '?'", $this->iVersionId, $this->shWhatWorks, $this->shWhatDoesnt, $this->shWhatNotTested, $this->sTestedDate, $this->iDistributionId, $this->sTestedRelease, $this->sInstalls, $this->sRuns, $this->sTestedRating, $this->sComments, $this->iTestingId)) { if(!$bSilent) $this->SendNotificationMail("edit", $sWhatChanged); return true; } else { addmsg("Error while updating test results", "red"); return false; } } // Delete test results. function delete() { // is the current user allowed to delete this test result? $oVersion = new Version($this->iVersionId); if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($oVersion) && !(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sQueued == 'false'))) { return false; } // now delete the test data $sQuery = "DELETE FROM testResults WHERE testingId = '?' LIMIT 1"; if(!($hResult = query_parameters($sQuery, $this->iTestingId))) { addmsg("Error removing the deleted test data!", "red"); return false; } return true; } // Move Test Data out of the queue. function unQueue() { // is the current user allowed to delete this test data? $oVersion = new Version($this->iVersionId); if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($oVersion)) { return false; } // If we are not in the queue, we can't move the test data out of the queue. if(!$this->sQueued == 'true') return false; if(query_parameters("UPDATE testResults SET queued = '?' WHERE testingId = '?'", "false", $this->iTestingId)) { $this->sQueued = 'false'; // we send an e-mail to interested people $this->mailSubmitter("add"); $this->SendNotificationMail(); } else { return false; } return true; } function Reject() { // is the current user allowed to delete this test data? $oVersion = new Version($this->iVersionId); if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($oVersion)) { return; } // If we are not in the queue, we can't move the version out of the queue. if(!$this->sQueued == 'true') return false; if(query_parameters("UPDATE testResults SET queued = '?' WHERE testingId = '?'", "rejected", $this->iTestingId)) { $this->sQueued = 'rejected'; // we send an e-mail to interested people $this->mailSubmitter("reject"); $this->SendNotificationMail("reject"); } } function ReQueue() { // is the current user allowed to requeue this data $oVersion = new Version($this->iVersionId); if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($oVersion) && !$_SESSION['current']->iUserId == $this->iSubmitterId) { return; } if(query_parameters("UPDATE testResults SET queued = '?' WHERE testingId = '?'", "true", $this->iTestingId)) { $this->sQueued = 'true'; // we send an e-mail to interested people $this->SendNotificationMail(); } } function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction) { $oOptions = new mailOptions(); if($sAction == "delete" && $bParentAction) $oOptions->bMailOnce = TRUE; return $oOptions; } function objectGetMail($sAction, $bMailSubmitter, $bParentAction) { $oSubmitter = new User($this->iSubmitterId); $sName = version::fullName($this->iVersionId); $sMsg = null; $sSubject = null; if($bMailSubmitter) { switch($sAction) { case "delete": $sSubject = "Submitted test data deleted"; if($bParentAction) { $sMsg = "All test data you submitted for '$sName' has ". "been deleted because '$sName' was deleted."; } else { $sMsg = "The test report you submitted for '$sName' has ". "been deleted."; } break; } $aMailTo = nulL; } else { switch($sAction) { case "delete": if(!$bParentAction) { $sSubject = "Test Results deleted for $sName by ". $_SESSION['current']->sRealname; $sMsg = ""; } break; } $aMailTo = User::get_notify_email_address_list(null, $this->iVersionId); } return array($sSubject, $sMsg, $aMailTo); } function mailSubmitter($sAction="add") { global $aClean; if($this->iSubmitterId) { $oSubmitter = new User($this->iSubmitterId); /* Get the full app/version name to display */ $sName = version::fullName($this->iVersionId); $oVersion = new version($this->iVersionId); switch($sAction) { case "add": $sSubject = "Submitted testing data accepted"; $sMsg = "The testing data you submitted for '$sName' has been ". "accepted by ".$_SESSION['current']->sRealname."."; $sMsg .= $oVersion->objectMakeUrl()."&iTestingId=".$this->iTestingId."\n"; $sMsg .= "Administrators Responce:\n"; break; case "reject": $sSubject = "Submitted testing data rejected"; $sMsg = "The testing data you submitted for '$sName' has ". "been rejected by ".$_SESSION['current']->sRealname."."; $sMsg .= $this->objectMakeUrl()."\n"; $sMsg .= "Reason given:\n"; break; } $sMsg .= $aClean['sReplyText']."\n"; $sMsg .= "We appreciate your help in making the Application ". "Database better for all users."; mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg); } } function SendNotificationMail($sAction="add",$sMsg=null) { global $aClean; $oVersion = new Version($this->iVersionId); $oApp = new Application($oVersion->iAppId); $sBacklink = $oVersion->objectMakeUrl()."&iTestingId=".$this->iTestingId."\n"; switch($sAction) { case "add": if($this->sQueued == "false") { $sSubject = "Test Results added to version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname; $sMsg .= $sBacklink; if($this->iSubmitterId) { $oSubmitter = new User($this->iSubmitterId); $sMsg .= "This Test data has been submitted by ".$oSubmitter->sRealname."."; $sMsg .= "\n"; } if($aClean['sReplyText']) { $sMsg .= "Appdb admin reply text:\n"; $sMsg .= $aClean['sReplyText']."\n"; // append the reply text, if there is any } addmsg("The test data was successfully added into the database.", "green"); } else // test data queued. { $sSubject = "Test Results submitted for version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname; $sMsg .= $sBacklink; $sMsg .= "This test data has been queued."; $sMsg .= "\n"; addmsg("The test data you submitted will be added to the database after being reviewed.", "green"); } break; case "edit": $sSubject = "Test Results modified for version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname; $sMsg .= $sBacklink; addmsg("test data modified.", "green"); break; case "reject": $sSubject = "Test Results rejected for version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname; $sMsg .= $sBacklink; // if replyText is set we should report the reason the data was rejected if($aClean['sReplyText']) { $sMsg .= "Reason given:\n"; $sMsg .= $aClean['sReplyText']."\n"; // append the reply text, if there is any } addmsg("test data rejected.", "green"); break; } $sEmail = User::get_notify_email_address_list(null, $this->iVersionId); if($sEmail) mail_appdb($sEmail, $sSubject ,$sMsg); } function ShowTestResult() { echo '
What works
',"\n";
echo $this->shWhatWorks,"\n";
echo '
What does not
',"\n";
echo $this->shWhatDoesnt,"\n";
echo '
What was not tested
',"\n";
echo $this->shWhatNotTested,"\n";
echo '
Additional Comments
',"\n";
echo $this->sComments,"\n";
}
// Show the Test results for a application version
function ShowVersionsTestingTable($sLink, $iDisplayLimit)
{
global $aClean;
/* escape input parameters */
$link = query_escape_string($link);
$iDisplayLimit = query_escape_string($iDisplayLimit);
$sShowAll = isset($aClean['sShowAll']) ? $aClean['sShowAll'] : false;
$sQuery = "SELECT *
FROM testResults
WHERE versionId = '?'
AND
queued = '?'
ORDER BY testedDate DESC";
if(!$sShowAll)
$sQuery.=" LIMIT 0,".$iDisplayLimit;
$hResult = query_parameters($sQuery, $this->iVersionId, "false");
if(!$hResult)
return;
$rowsUsed = query_num_rows($hResult);
if($rowsUsed == 0)
return;
echo '
| What works | ',"\n"; echo '|
| What does not work | ',"\n"; echo '|
| What was not tested | ',"\n"; echo '|
| Date tested | ',"\n"; echo '|
| YYYY-MM-DD HH:MM:SS | |
| Distribution | ',"\n"; echo '',"\n"; echo $sDistributionHelp; distribution::make_distribution_list("iDistributionId", $this->iDistributionId); echo ' |
| Tested release | ',"\n";
echo make_bugzilla_version_list("sTestedRelease", $this->sTestedRelease);
// Give the user some information about our available versions
echo "
|
| Installs? | ',"\n"; testData::make_Installs_list("sInstalls", $this->sInstalls); echo ' |
| Runs? | ',"\n"; testData::make_Runs_list("sRuns", $this->sRuns); echo ' |
| Rating | ',"\n"; echo make_maintainer_rating_list("sTestedRating", $this->sTestedRating); echo 'Rating definitions |
| Extra comments | ',"\n"; echo '
This is the list of test results waiting for submission, ". "rejection or deletion.
\n"; echo "To view a submission, click on its name. From that page ". "you can submit it into the AppDB, reject it or delete it.
\n"; } function display() { /* STUB */ return TRUE; } function objectMakeUrl() { $oObject = new objectManager("testData", "Edit Test Results", $this->iTestingId); return $oObject->makeUrl("edit", $this->iTestingId); } function objectMakeLink() { /* STUB */ return TRUE; } function objectGetChildren() { /* We have none */ return array(); } function objectDisplayAddItemHelp() { echo "This is the screen for inputing test information so that others "; echo "looking at the database will know \n"; echo "what was working on a particular release of Wine.
\n"; echo "Please DO NOT include crash or Wine debug output.\n"; echo " Instead report the crash as a bug in the Wine bugzilla at \n"; echo "http://bugs.winehq.org.\n"; echo "We ask that you use bugzilla because developers do not monitor the AppDB \n"; echo "for bugs.
\n"; echo "Please be as detailed as you can but do not paste large \n"; echo "chunks of output from the terminal. Type out your report \n"; echo "clearly and in proper English so that it is easily readable.
\n"; echo "If you cannot find your distribution in the list of existing "; echo "distributions, please add it in the \n"; echo "provided field.
\n\n"; } function mustBeQueued() { if($_SESSION['current']->hasPriv("admin")) { return FALSE; } else if($this->iVersionId) { // if the user can edit the version and the version isn't queued then // they can also submit test results without them being queued // this is the case where they maintain the version and the version isn't queued $oVersion = new version($this->iVersionId); if($oVersion->canEdit() && $oVersion->sQueued == "false") return FALSE; else return TRUE; } else { return TRUE; } } function allowAnonymousSubmissions() { return FALSE; } function objectGetItemsPerPage($bQueued = false) { $aItemsPerPage = array(25, 50, 100, 200); $iDefaultPerPage = 25; return array($aItemsPerPage, $iDefaultPerPage); } function objectGetId() { return $this->iTestingId; } function objectGetSubmitterId() { return $this->iSubmitterId; } } ?>