diff --git a/admin/adminDistributions.php b/admin/adminDistributions.php new file mode 100644 index 0000000..5a4e222 --- /dev/null +++ b/admin/adminDistributions.php @@ -0,0 +1,69 @@ +hasPriv("admin")) +{ + errorpage("Insufficient privileges."); + exit; +} +if ($_REQUEST['sub']) +{ + if($_REQUEST['sub'] == 'delete') + { + $oDistribution = new distribution($_REQUEST['iDistributionId']); + $oDistribution->delete(); + redirect(apidb_fullurl("admin/adminDistributions.php")); + } +} else +{ + apidb_header("Admin Distributions"); + + //get available Distributions + $sQuery = "SELECT distributionId FROM distributions ORDER BY name, distributionId;"; + $hResult = query_appdb($sQuery); + + // show Distribution list + echo html_frame_start("","90%","",0); + echo "\n\n"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + + $c = 1; + while($ob = mysql_fetch_object($hResult)) + { + if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } + $oDistribution = new distribution($ob->distributionId); + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + $c++; + } + echo "
Distribution nameDistribution urlLinked TestsAction
iDistributionId."\">","\n"; + echo $oDistribution->sName."sUrl."\">".$oDistribution->sUrl."".sizeof($oDistribution->aTestingIds).""; + echo "[edit]"; + if(!sizeof($oDistribution->aTestingIds)) + echo "   [delete]"; + echo "
\n\n"; + echo html_frame_end(" "); + +} + +apidb_footer(); +?> diff --git a/admin/adminTestResults.php b/admin/adminTestResults.php new file mode 100644 index 0000000..186029c --- /dev/null +++ b/admin/adminTestResults.php @@ -0,0 +1,172 @@ +hasPriv("admin")) && + !($_SESSION['current']->hasAppVersionModifyPermission($_REQUEST['iVersionId']))) + { + errorpage("Insufficient privileges."); + exit; + } + + if(($_REQUEST['sub'] == 'Submit') || ($_REQUEST['sub'] == 'Save') || + ($_REQUEST['sub'] == 'Reject') || ($_REQUEST['sub'] == 'Delete')) + { + if(is_numeric($_REQUEST['iTestingId'])) + { + $oTest = new testData($_REQUEST['iTestingId']); + $oTest->GetOutputEditorValues(); + + if($_REQUEST['sub'] == 'Submit') // submit the testing results + { + $oTest->update(true); + $oTest->unQueue(); + } else if($_REQUEST['sub'] == 'Save') // save the testing results + { + $oTest->update(); + } else if($_REQUEST['sub'] == 'Reject') // reject testing results + { + $oTest->update(true); + $oTest->Reject(); + } else if($_REQUEST['sub'] == 'Delete') // delete testing results + { + $oTest->delete(); + } + + redirect($_SERVER['PHP_SELF']); + } + } + + if(is_numeric($_REQUEST['iTestingId'])) + { + $oTest = new testData($_REQUEST['iTestingId']); + } + + if ($_REQUEST['sub'] == 'view') + { + switch($oTest->sQueued) + { + case "new": + apidb_header("Submit new testing results"); + $_REQUEST['sTestedDate'] = date('Y-m-d H:i:s'); + break; + case "true": + case "rejected": + apidb_header("Edit new testing results"); + break; + case "False": + apidb_header("Edit testing results"); + break; + } + echo '
',"\n"; + // View Testing Details + echo "\n"; +/* + //help + echo "
\n\n"; + echo "

This is the full view of the rejected application. \n"; + echo "You need to pick a category before submitting \n"; + echo "it into the database.\n"; + echo "

Click delete to remove the selected item from the queue. An email will automatically be sent to the\n"; + echo "submitter to let them know the item was deleted.

\n\n"; + echo "
\n\n"; +*/ + $oTest->OutputEditor(); + + echo 'Back'; + + echo '' ,"\n"; + + // Submit Buttons + switch($oTest->sQueued) + { + case "false": + echo ' ',"\n"; + echo '',"\n"; + break; + case "true": + echo ' ',"\n"; + echo ' ',"\n"; + echo '',"\n"; + break; + case "rejected": + echo ' ',"\n"; + echo ' ',"\n"; + echo '',"\n"; + break; + } + echo '',"\n"; + echo '
',"\n"; + + echo html_frame_end(" "); + } + else + { + // error no sub! + addmsg("Internal Routine Not Found!!", "red"); + redirect($_SERVER['PHP_SELF']); + } +} +else // if ($_REQUEST['sub']) is not defined, display the Testing results queue page +{ + $oTest = new TestData(); + apidb_header("Testing Results"); + + // Get queued testing results. + + $hResult = $oTest->getTestingQueue("true"); + if(!$hResult) + { + //no apps in queue + echo html_frame_start("Submitted Testing Results","90%"); + echo '

The Submitted Testng Results Queue is empty.

',"\n"; + echo html_frame_end(" "); + } + else + { + //help + echo "
\n\n"; + echo "

This is the list of test results waiting for submition, rejection or deletion.

\n"; + echo "

To view a submission, click on its name. From that page you can Submit it into \n"; + echo "the AppDB reject it or delete it.
\n"; + echo "

\n\n"; + + $oTest->ShowListofTests($hResult,"Submitted Testing Results"); + } + + // Get rejected testing results. + $hResult = $oTest->getTestingQueue("rejected"); + if(!$hResult || !mysql_num_rows($hResult)) + { + //no rejected test results in queue + echo html_frame_start("Rejected Testing Results","90%"); + echo '

The Rejected Testng Results Queue is empty.

',"\n"; + echo html_frame_end(" "); + } + else + { + //help + echo "
\n\n"; + echo "

This is the list of test results that have been rejected for some reason.

\n"; + echo "

To view a submission, click on its name. From that page you can Submit it into \n"; + echo "the AppDB, edit and save it or delete it.
\n"; + echo "

\n\n"; + + $oTest->ShowListofTests($hResult,"Rejected Testing Results"); + } +} +apidb_footer(); +?> diff --git a/admin/editDistribution.php b/admin/editDistribution.php new file mode 100644 index 0000000..8a05007 --- /dev/null +++ b/admin/editDistribution.php @@ -0,0 +1,47 @@ +hasPriv("admin")) +{ + errorpage(); + exit; +} + + +$oDistribution = new distribution($_REQUEST['iDistributionId']); +if($_REQUEST['Submit']) +{ + $oDistribution->GetOutputEditorValues(); + + if($oDistribution->iDistributionId) + $oDistribution->update(); + else + { + $oDistribution->create(); + } + + redirect(apidb_fullurl("admin/adminDistributions.php")); + exit; +} +else +{ + if ($oDistribution->iDistributionId) + apidb_header("Edit Distribution"); + else + apidb_header("Add Distribution"); + + echo '
',"\n"; + + $oDistribution->OutputEditor(); + + echo '',"\n"; + echo ' ',"\n"; + echo '',"\n"; + + echo "
"; + echo html_frame_end(" "); + apidb_footer(); +} +?> diff --git a/application.css b/application.css index 603daef..a36cbeb 100644 --- a/application.css +++ b/application.css @@ -21,5 +21,9 @@ table.historyTable { border: 1px; td.gold { background-color: #fff600; } td.silver { background-color: silver; } td.bronze { background-color: #fcba0a; } -td.garbage { background-color: #5c4f2a; } +td.garbage { background-color: #999966; } +tr.gold { background-color: #fff600; } +tr.silver { background-color: silver; } +tr.bronze { background-color: #fcba0a; } +tr.garbage { background-color: #999966; } diff --git a/appview.php b/appview.php index 30612f1..e1cfc62 100644 --- a/appview.php +++ b/appview.php @@ -15,6 +15,7 @@ require(BASE."include/category.php"); require(BASE."include/maintainer.php"); require(BASE."include/mail.php"); require(BASE."include/monitor.php"); +require_once(BASE."include/testResults.php"); $oApp = new Application($_REQUEST['appId']); @@ -503,8 +504,19 @@ else if($_REQUEST['versionId']) // description echo ""; + // Show testing data + $oTest = new TestData($_REQUEST['iTestingId']); + $iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId,$oVersion->iVersionId); + if($iCurrentTest) + $oTest->ShowVersionsTestingTable($oVersion->iVersionId,$iCurrentTest,$_SERVER['PHP_SELF']."?versionId=".$oVersion->iVersionId."&iTestingId="); + echo 'iVersionId.'>'; + echo ''; + echo ''; + + + echo ""; + /* close the table */ echo "
Description
\n"; echo $oVersion->sDescription; - echo "
\n"; diff --git a/distributionView.php b/distributionView.php new file mode 100644 index 0000000..34c1a76 --- /dev/null +++ b/distributionView.php @@ -0,0 +1,83 @@ +iDistributionId) +{ + errorpage("No Distribution ID specified!"); + exit; +} +else +{ + //display page + apidb_header("View Distribution"); + echo html_frame_start("Distribution Information",500); + + echo "Distribution Name:"; + + if($oDistribution->sUrl) + echo ""; + + echo $oDistribution->sName; + + if ($oDistribution->sUrl) + echo " (".$oDistribution->sUrl.")"; + echo "
\n"; + + echo "
\n"; + + if($oDistribution->aTestingIds) + { + echo "
Testing results for ".$oDistribution->sName."
    \n"; + echo '

    Testing Results
    ',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + foreach($oDistribution->aTestingIds as $iTestingId) + { + $oTest = new testData($iTestingId); + $oVersion = new version($oTest->iVersionId); + $oApp = new application($oVersion->iAppId); + $oSubmitter = new User($oTest->iSubmitterId); + $bgcolor = $oTest->sTestedRating; + echo '',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo '',"\n"; + } + echo '
    SubmitterDate SubmittedWine versionInstalls?Runs?Rating
    ',"\n"; + echo $oSubmitter->sEmail ? "sEmail."\">":""; + echo $oSubmitter->sRealname; + echo $oSubmitter->sEmail ? "":""; + echo ' '.date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sSubmitTime)).''.$oTest->sTestedRelease.' '.$oTest->sInstalls.' '.$oTest->sRuns.' '.$oTest->sTestedRating.' 
    ',"\n"; + } + + echo html_frame_end(); + echo html_back_link(1); + apidb_footer(); +} + +?> diff --git a/include/distributions.php b/include/distributions.php new file mode 100644 index 0000000..f749844 --- /dev/null +++ b/include/distributions.php @@ -0,0 +1,396 @@ +$iDistributionId) + { + $sQuery = "SELECT * + FROM distributions + WHERE distributionId = ".$iDistributionId; + if($hResult = query_appdb($sQuery)) + { + $oRow = mysql_fetch_object($hResult); + $this->iDistributionId = $iDistributionId; + $this->sName = $oRow->name; + $this->sDescription = $oRow->description; + $this->sUrl = $oRow->url; + $this->sSubmitTime = $oRow->submitTime; + $this->iSubmitterId = $oRow->submitterId; + $this->sQueued = $oRow->queued; + } + } + + /* + * We fetch Test Result Ids. + */ + $sQuery = "SELECT testingId + FROM testResults + WHERE distributionId = ".$iDistributionId; + if($hResult = query_appdb($sQuery)) + { + while($oRow = mysql_fetch_object($hResult)) + { + $this->aTestingIds[] = $oRow->testingId; + } + } + } + } + + // Creates a new distribution. + function create() + { + //Let's not create a duplicate + $sQuery = "SELECT * + FROM distributions + WHERE name LIKE '".$this->sName."'"; + $hDuplicate = query_appdb($sQuery, "checking distributions"); + if(!mysql_num_rows($hDuplicate) == 0) + { + addmsg("There was an existing Distribution called ".$this->sName.".", "red"); + $oRow = mysql_fetch_object($hDuplicate); + $this->iDistributionId = $oRow->distributionId; + return false; + } + + // Security, if we are not an administrator the Distributions must be queued. + if(!$_SESSION['current']->hasPriv("admin")) + $this->sQueued = 'true'; + else + $this->sQueued = 'false'; + + $aInsert = compile_insert_string(array( 'name' => $this->sName, + 'url' => $this->sUrl, + 'submitterId' => $_SESSION['current']->iUserId, + 'queued' => $this->sQueued )); + $sFields = "({$aInsert['FIELDS']})"; + $sValues = "({$aInsert['VALUES']})"; + + if(query_appdb("INSERT INTO distributions $sFields VALUES $sValues", "Error while creating Distribution.")) + { + $this->iDistributionId = mysql_insert_id(); + $this->distribution($this->iDistributionId); + $this->SendNotificationMail(); + return true; + } + else + return false; + } + + // Update Distribution. + function update() + { + // is the current user allowed to update this Distribution? + if(!$_SESSION['current']->hasPriv("admin") && + !($_SESSION['current']->iUserId == $this->iSubmitterId)) + { + return; + } + $sUpdate = compile_update_string(array( 'name' => $this->sName, + 'url' => $this->sUrl )); + if(query_appdb("UPDATE distributions SET ".$sUpdate." WHERE distributionId = ".$this->iDistributionId, "Error while updating Distribution.")) + { + $this->SendNotificationMail("edit"); + return true; + } + else + return false; + } + + // Delete Distributution. + function delete($bSilent=false) + { + // is the current user allowed to delete this Distribution? + if(!$_SESSION['current']->hasPriv("admin") && + !($_SESSION['current']->iUserId == $this->iSubmitterId)) + { + return; + } + // now delete the Distribution + $sQuery = "DELETE FROM distributions + WHERE distributionId = ".$this->iDistributionId." + LIMIT 1"; + if(!($hResult = query_appdb($sQuery))) + { + addmsg("Error removing the Distribution!", "red"); + } + + if(!$bSilent) + $this->SendNotificationMail("delete"); + + $this->mailSubmitter("delete"); + } + + + // Move Distribution out of the queue. + function unQueue() + { + // is the current user allowed to move this Distribution? + if(!$_SESSION['current']->hasPriv("admin")) + { + return; + } + + // If we are not in the queue, we can't move the Distribution out of the queue. + if(!$this->sQueued == 'true') + return false; + + $sUpdate = compile_update_string(array('queued' => "false")); + if(query_appdb("UPDATE distribution SET ".$sUpdate." WHERE distributionId = ".$this->iDistributionId, "Error while unqueuing Distribution.")) + { + $this->sQueued = 'false'; + // we send an e-mail to intersted people + $this->mailSubmitter("unQueue"); + $this->SendNotificationMail(); + } + } + + function Reject($bSilent=false) + { + // is the current user allowed to reject this Distribution? + if(!$_SESSION['current']->hasPriv("admin")) + { + return; + } + + // If we are not in the queue, we can't move the Distribution out of the queue. + if(!$this->sQueued == 'true') + return false; + + $sUpdate = compile_update_string(array('queued' => "rejected")); + if(query_appdb("UPDATE distribution SET ".$sUpdate." WHERE distributionId = ".$this->iDistributionId, "Error while rejecting Distribution.")) + { + $this->sQueued = 'rejected'; + // we send an e-mail to intersted people + if(!$bSilent) + { + $this->mailSubmitter("reject"); + $this->SendNotificationMail("reject"); + } + // the Distribution data has been rejected + } + } + + function ReQueue() + { + // is the current user allowed to requeue this data + if(!$_SESSION['current']->hasPriv("admin") && + !($_SESSION['current']->iUserId == $this->iSubmitterId)) + { + return; + } + + $sUpdate = compile_update_string(array('queued' => "true")); + if(query_appdb("UPDATE testResults SET ".$sUpdate." WHERE testingId = ".$this->iTestingId)) + if(query_appdb("UPDATE distribution SET ".$sUpdate." WHERE distributionId = ".$this->iDistributionId, "Error while requeueing Distribution.")) + { + $this->sQueued = 'true'; + // we send an e-mail to intersted people + $this->SendNotificationMail(); + + // the testing data has been resubmitted + addmsg("The Distribution has been resubmitted", "green"); + } + } + + function mailSubmitter($sAction="add") + { + if($this->iSubmitterId) + { + $oSubmitter = new User($this->iSubmitterId); + switch($sAction) + { + case "add": + { + $sSubject = "Submitted Distribution accepted"; + $sMsg = "The Distribution you submitted (".$this->sName.") has been accepted."; + } + break; + case "reject": + { + $sSubject = "Distribution rejected"; + $sMsg = "The Distribution you submitted (".$this->sName.") has been rejected."; + $sMsg .= APPDB_ROOT."testingData.php?sub=view&versionId=".$this->iVersionId."\n"; + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + + break; + case "delete": + { + $sSubject = "Submitted Distribution deleted"; + $sMsg = "The Distribution you submitted (".$this->sName.") has been deleted."; + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + break; + } + $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) + { + switch($sAction) + { + case "add": + if($this->sQueued == "false") + { + $sSubject = "Distribution ".$this->sName." added by ".$_SESSION['current']->sRealname; + $sMsg = APPDB_ROOT."distributionView.php?iDistributionId=".$this->iDistributionId."\n"; + if($this->iSubmitterId) + { + $oSubmitter = new User($this->iSubmitterId); + $sMsg .= "This Distribution has been submitted by ".$oSubmitter->sRealname."."; + $sMsg .= "\n"; + $sMsg .= "Appdb admin reply text:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + addmsg("The Distribution was successfully added into the database.", "green"); + } else // testing data queued. + { + $sSubject = "Distribution ".$this->sName." submitted by ".$_SESSION['current']->sRealname; + $sMsg .= "This testing data has been queued."; + $sMsg .= "\n"; + addmsg("The Distribution you submitted will be added to the database after being reviewed.", "green"); + } + break; + case "edit": + $sSubject = "Distribution ".$this->sName." has been modified by ".$_SESSION['current']->sRealname; + $sMsg = APPDB_ROOT."distributionView.php?iDistributionId=".$this->iDistributionId."\n"; + addmsg("Distribution modified.", "green"); + break; + case "delete": + $sSubject = "Distribution ".$this->sName." has been deleted by ".$_SESSION['current']->sRealname; + + // if replyText is set we should report the reason the data was deleted + if($_REQUEST['replyText']) + { + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + + addmsg("Distribution deleted.", "green"); + break; + case "reject": + $sSubject = "Distribution '".$this->sName." has been rejected by ".$_SESSION['current']->sRealname; + $sMsg = APPDB_ROOT."distributionView.php?iDistributionId=".$this->iDistributionId."\n"; + + // if replyText is set we should report the reason the data was rejected + if($_REQUEST['replyText']) + { + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + + addmsg("Distribution rejected.", "green"); + break; + } + $sEmail = get_notify_email_address_list(null, null); + if($sEmail) + mail_appdb($sEmail, $sSubject ,$sMsg); + } + + function OutputEditor() + { + echo html_frame_start("Distribution Form", "90%", "", 0); + echo "\n"; + + // Name + echo '',"\n"; + echo '',"\n"; + // Url + echo '',"\n"; + echo '',"\n"; + + echo '',"\n"; + + echo "
    Distribution Name
    Distribution Url
    \n"; + echo html_frame_end(); + } + + /* retrieves values from $_REQUEST that were output by OutputEditor() */ + function GetOutputEditorValues() + { + if(get_magic_quotes_gpc()) + { + $this->iDistributionId = stripslashes($_REQUEST['iDistributionId']); + $this->sName = stripslashes($_REQUEST['sName']); + $this->sUrl = stripslashes($_REQUEST['sUrl']); + } else + { + $this->iDistributionId = $_REQUEST['iDistributionId']; + $this->sName = $_REQUEST['sName']; + $this->sUrl = $_REQUEST['sUrl']; + } + } + +} + +/* Make a dropdown list of distributions */ +function make_distribution_list($varname, $cvalue) +{ + $query = "SELECT name, distributionId FROM distributions ORDER BY name"; + + $result = query_appdb($query); + if(!$result) return; + + echo "\n"; +} +/* Get the total number of Distributions in the database */ +function getNumberOfDistributions() +{ + $hResult = query_appdb("SELECT count(*) as num_dists FROM distributions"); + if($hResult) + { + $row = mysql_fetch_object($hResult); + return $row->num_dists; + } + return 0; +} + +/* Get the number of Queued Distributions in the database */ +function getNumberOfQueuedDistributions() +{ + $hResult = query_appdb("SELECT count(*) as num_dists FROM distributions WHERE queued='true';"); + if($hResult) + { + $row = mysql_fetch_object($hResult); + return $row->num_dists; + } + return 0; +} + +?> diff --git a/include/sidebar_admin.php b/include/sidebar_admin.php index 940f5df..93b87da 100644 --- a/include/sidebar_admin.php +++ b/include/sidebar_admin.php @@ -2,6 +2,8 @@ /*****************/ /* sidebar_admin */ /*****************/ +require_once(BASE."include/testResults.php"); +require_once(BASE."include/distributions.php"); function global_admin_menu() { @@ -9,6 +11,7 @@ function global_admin_menu() { $g->add("Add Category", BASE."admin/addCategory.php"); $g->add("Add Vendor", BASE."admin/addVendor.php"); + $g->add("Add Distribution", BASE."admin/editDistribution.php"); $g->addmisc(" "); $g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/".$_SESSION['current']->getQueuedVersionCount().")", BASE."admin/adminAppQueue.php"); @@ -17,11 +20,14 @@ function global_admin_menu() { $g->add("View Maintainer Entries (".getMaintainerCount().")", BASE."admin/adminMaintainers.php"); $g->add("View Vendors (".getVendorCount().")", BASE."admin/adminVendors.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 Distributions (".getNumberOfDistributions().")", BASE."admin/adminDistributions.php"); $g->addmisc(" "); $g->add("Users Management", BASE."admin/adminUsers.php"); $g->add("Comments Management", BASE."admin/adminCommentView.php"); $g->add("Screenshots Management", BASE."admin/adminScreenshots.php"); + $g->done(); } diff --git a/include/testResults.php b/include/testResults.php new file mode 100644 index 0000000..612d249 --- /dev/null +++ b/include/testResults.php @@ -0,0 +1,643 @@ +iTestingId) + { + $sQuery = "SELECT * + FROM testResults + WHERE testingId = ".$iTestingId; + if($hResult = query_appdb($sQuery)) + { + $oRow = mysql_fetch_object($hResult); + $this->iTestingId = $iTestingId; + $this->iVersionId = $oRow->versionId; + $this->sWhatWorks = $oRow->whatWorks; + $this->sWhatDoesnt = $oRow->whatDoesnt; + $this->sWhatNotTested = $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() + { + // Security, if we are not an administrator or an maintainer the test result must be queued. + if(!$_SESSION['current']->hasPriv("admin") && + !$_SESSION['current']->hasAppVersionModifyPermission($oTest->iVersionId)) + $this->sQueued = 'true'; + else + $this->sQueued = 'false'; + + $aInsert = compile_insert_string(array( 'versionId' => $this->iVersionId, + 'whatWorks' => $this->sWhatWorks, + 'whatDoesnt' => $this->sWhatDoesnt, + 'whatNotTested' => $this->sWhatNotTested, + 'testedDate' => $this->sTestedDate, + 'distributionId' => $this->iDistributionId, + 'testedRelease' => $this->sTestedRelease, + 'installs' => $this->sInstalls, + 'runs' => $this->sRuns, + 'testedRating' => $this->sTestedRating, + 'comments' => $this->sComments, + 'submitterId' => $_SESSION['current']->iUserId, + 'queued' => $this->sQueued )); + $sFields = "({$aInsert['FIELDS']})"; + $sValues = "({$aInsert['VALUES']})"; + + if(query_appdb("INSERT INTO testResults $sFields VALUES $sValues", "Error while creating test results.")) + { + $this->iTestingId = mysql_insert_id(); + $this->testData($this->iTestingId); + $this->SendNotificationMail(); + return true; + } + else + return false; + } + + // Update Test Results. + function update($bSilent=false) + { + // is the current user allowed to update this testing result? + if(!$_SESSION['current']->hasPriv("admin") && + !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId) && + !(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sQueued == 'false'))) + { + return; + } + + $sUpdate = compile_update_string(array( 'versionId' => $this->iVersionId, + 'whatWorks' => $this->sWhatWorks, + 'whatDoesnt' => $this->sWhatDoesnt, + 'whatNotTested' => $this->sWhatNotTested, + 'testedDate' => $this->sTestedDate, + 'distributionId' => $this->iDistributionId, + 'testedRelease' => $this->sTestedRelease, + 'installs' => $this->sInstalls, + 'runs' => $this->sRuns, + 'testedRating' => $this->sTestedRating, + 'comments' => $this->sComments)); + + if(query_appdb("UPDATE testResults SET ".$sUpdate." WHERE testingId = ".$this->iTestingId, "Error while updating test results.")) + { + if(!$bSilent) + $this->SendNotificationMail(); + return true; + } + else + return false; + } + + // Delete testing results. + function delete($bSilent=false) + { + // is the current user allowed to delete this testing result? + if(!$_SESSION['current']->hasPriv("admin") && + !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId) && + !(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sQueued == 'false'))) + { + return; + } + // now delete the testing data + $sQuery = "DELETE FROM testResults + WHERE testingId = ".$this->iTestingId." + LIMIT 1"; + if(!($hResult = query_appdb($sQuery))) + { + addmsg("Error removing the deleted testing data!", "red"); + } + + if(!$bSilent) + $this->SendNotificationMail("delete"); + + $this->mailSubmitter("delete"); + } + + + // Move Testing Data out of the queue. + function unQueue() + { + // is the current user allowed to delete this testing data? + if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId)) + { + return; + } + + // If we are not in the queue, we can't move the testing data out of the queue. + if(!$this->sQueued == 'true') + return false; + + $sUpdate = compile_update_string(array('queued' => "false")); + if(query_appdb("UPDATE testResults SET ".$sUpdate." WHERE testingId = ".$this->iTestingId)) + { + $this->sQueued = 'false'; + // we send an e-mail to intersted people + $this->mailSubmitter("unQueue"); + $this->SendNotificationMail(); + } + } + + function Reject() + { + // is the current user allowed to delete this testing data? + if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId)) + { + return; + } + + // If we are not in the queue, we can't move the version out of the queue. + if(!$this->sQueued == 'true') + return false; + + $sUpdate = compile_update_string(array('queued' => "rejected")); + if(query_appdb("UPDATE testResults SET ".$sUpdate." WHERE testingId = ".$this->iTestingId)) + { + $this->sQueued = 'rejected'; + // we send an e-mail to intersted people + $this->mailSubmitter("reject"); + $this->SendNotificationMail("reject"); + } + } + + function ReQueue() + { + // is the current user allowed to requeue this data + if(!$_SESSION['current']->hasPriv("admin") && + !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId) && + !$_SESSION['current']->iUserId == $this->iSubmitterId) + { + return; + } + + $sUpdate = compile_update_string(array('queued' => "true")); + if(query_appdb("UPDATE testResults SET ".$sUpdate." WHERE testingId = ".$this->iTestingId)) + { + $this->sQueued = 'true'; + // we send an e-mail to intersted people + $this->SendNotificationMail(); + } + } + + function mailSubmitter($sAction="add") + { + if($this->iSubmitterId) + { + $oSubmitter = new User($this->iSubmitterId); + switch($sAction) + { + case "add": + $sSubject = "Submitted testing data accepted"; + $sMsg = "The testing data you submitted (".$oApp->sName." ".$this->sName.") has been accepted."; + $sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."&iTestingId=".$this->iTestingId."\n"; + break; + case "reject": + $sSubject = "Submitted testing data rejected"; + $sMsg = "The testing data you submitted (".$oApp->sName." ".$this->sName.") has been rejected."; + $sMsg .= APPDB_ROOT."testResults.php?sub=view&iTestingId=".$this->iTestingId."\n"; + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + break; + case "delete": + $sSubject = "Submitted testing data deleted"; + $sMsg = "The testing data you submitted (".$oApp->sName." ".$this->sName.") has been deleted."; + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + break; + } + $sMsg .= $_REQUEST['replyText']."\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) + { + $oVersion = new Version($this->iVersionId); + $oApp = new Application($oVersion->iAppId); + switch($sAction) + { + case "add": + if($this->sQueued == "false") + { + $sSubject = "Test Results added to version ".$oVersion->sName." of ".$oApp->sName." submitted by ".$_SESSION['current']->sRealname; + $sMsg = $sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."&iTestingId=".$this->iTestingId."\n"; + if($this->iSubmitterId) + { + $oSubmitter = new User($this->iSubmitterId); + $sMsg .= "This Testing data has been submitted by ".$oSubmitter->sRealname."."; + $sMsg .= "\n"; + $sMsg .= "Appdb admin reply text:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + addmsg("The testing data was successfully added into the database.", "green"); + } else // testing data queued. + { + $sSubject = "Test Results submitted for version ".$oVersion->sName." of ".$oApp->sName." submitted by ".$_SESSION['current']->sRealname; + $sMsg .= APPDB_ROOT."admin/adminTestResults.php?sub=view&iTestingId=".$this->iTestingId."\n"; + $sMsg .= "This testing data has been queued."; + $sMsg .= "\n"; + addmsg("The testing 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." submitted by ".$_SESSION['current']->sRealname; + $sMsg .= APPDB_ROOT."admin/adminTestResults.php?sub=view&iTestingId=".$this->iTestingId."\n"; + addmsg("testing data modified.", "green"); + break; + case "delete": + $sSubject = "Test Results deleted for version ".$oVersion->sName." of ".$oApp->sName." submitted by ".$_SESSION['current']->sRealname; + // if replyText is set we should report the reason the data was deleted + if($_REQUEST['replyText']) + { + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + + addmsg("testing data deleted.", "green"); + break; + case "reject": + $sSubject = "Test Results rejected for version ".$oVersion->sName." of ".$oApp->sName." submitted by ".$_SESSION['current']->sRealname; + $sMsg .= APPDB_ROOT."admin/adminTestResults.php?sub=view&iTestingId=".$this->iTestingId."\n"; + // if replyText is set we should report the reason the data was rejected + if($_REQUEST['replyText']) + { + $sMsg .= "Reason given:\n"; + $sMsg .= $_REQUEST['replyText']."\n"; // append the reply text, if there is any + } + addmsg("testing data rejected.", "green"); + break; + } + $sEmail = get_notify_email_address_list(null, $this->iVersionId); + if($sEmail) + mail_appdb($sEmail, $sSubject ,$sMsg); + } + + function ShowTestResult($iCurrentTest,$iVersionId) + { + $hResult = query_appdb("SELECT * + FROM testResults + WHERE testingId = '".$iCurrentTest."';"); + if(!$hResult || mysql_num_rows($hResult) == 0) + { + echo '

    over hers
    ',"\n"; + + $hResult = query_appdb("SELECT * + FROM testResults + WHERE versionId = '".$iVersionId."' + ORDER BY testedRelease DESC ;"); + if(!$hResult || mysql_num_rows($hResult) == 0) + return false; + } + $oRow = mysql_fetch_object($hResult); + echo '

    What works
    ',"\n"; + echo $oRow->whatWorks; + echo '

    What Doesn\'t
    ',"\n"; + echo $oRow->whatDoesnt; + echo '

    What wasn\'t tested
    ',"\n"; + echo $oRow->whatNotTested; + return $oRow->testingId; + } + + // Show the Test results for a application version + function ShowVersionsTestingTable($iVersionId, $iCurrentTest, $link) + { + $hResult = query_appdb("SELECT * + FROM testResults + WHERE versionId = '".$iVersionId."' + ORDER BY testedRelease DESC;"); + if(!$hResult || mysql_num_rows($hResult) == 0) + return; + echo '

    Testing Results
    ',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + while($oRow = mysql_fetch_object($hResult)) + { + $oTest = new testData($oRow->testingId); + $oVersion = new version($oTest->iVersionId); + $oApp = new application($oVersion->iAppId); + $oSubmitter = new User($oTest->iSubmitterId); + $oDistribution = new distribution($oTest->iDistributionId); + $bgcolor = $oTest->sTestedRating; + echo '',"\n"; + if ($oTest->iTestingId == $iCurrentTest) + echo ' ',"\n"; + else + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo '',"\n"; + } + + echo '
    DistributionDate SubmittedWine versionInstalls?Runs?Rating
    Current[Show]',"\n"; + echo '',"\n"; + echo $oDistribution->sName.'',"\n"; + echo ' '.date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sSubmitTime)).''.$oTest->sTestedRelease.' '.$oTest->sInstalls.' '.$oTest->sRuns.' '.$oTest->sTestedRating.' 
    ',"\n"; + + + } + // show the fields for editing + function OutputEditor($sDistribution, $bNewDist=false) + { + HtmlAreaLoaderScript(array("Test1", "Test2", "Test3")); + + echo html_frame_start("Testing Form", "90%", "", 0); + echo "\n"; + + // What works + echo '',"\n"; + echo '',"\n"; + // What Does not work + echo '',"\n"; + echo '',"\n"; + // What was not tested + echo '',"\n"; + echo '',"\n"; + // Date Tested + echo '',"\n"; + echo '',"\n"; + echo '',"\n"; + // Distribution + echo '',"\n"; + if ($bNewDist) + { + echo '',"\n"; + echo '',"\n"; + } + echo '',"\n"; + // Version List + echo '',"\n"; + // Installs + echo '',"\n"; + // Runs + echo '',"\n"; + // Rating + echo '',"\n"; + // extra comments + echo '',"\n"; + echo '',"\n"; + + echo ''; + echo ''; + + echo "
    What Works

    What Does not work

    What was not tested

    Date Tested

    YYYY-MM-DD HH:MM:SS

    Distribution
    ',"\n"; + make_distribution_list("iDistributionId", $this->iDistributionId); + echo '
    Tested Release',"\n"; + make_bugzilla_version_list("sTestedRelease", $this->sTestedRelease); + echo '
    Installs?',"\n"; + make_Installs_list("sInstalls", $this->sInstalls); + echo '
    Runs?',"\n"; + make_Runs_list("sRuns", $this->sRuns); + echo '
    Rating',"\n"; + make_maintainer_rating_list("sTestedRating", $this->sTestedRating); + echo '
    Extra Comments
    \n"; + + echo html_frame_end(); + } + function CheckOutputEditorInput($sDistribution="") + { + + $errors = ""; + $sWhatWorks = trim($_REQUEST['sWhatWorks']); + $sWhatDoesnt = trim($_REQUEST['sWhatDoesnt']); + $sWhatNotTested = trim($_REQUEST['sWhatNotTested']); + $sDistribution = trim($_REQUEST['sDistribution']); + + if (empty($sWhatWorks)) + $errors .= "

  1. Please enter what worked.
  2. \n"; + + if (empty($sWhatDoesnt)) + $errors .= "
  3. Please enter what did not work.
  4. \n"; + + if (empty($sWhatNotTested)) + $errors .= "
  5. Please enter what was not tested.
  6. \n"; + + if (empty($_REQUEST['sTestedDate'])) + $errors .= "
  7. Please enter the Date and Time that you tested.
  8. \n"; + + if (empty($_REQUEST['sTestedRelease'])) + $errors .= "
  9. Please enter the version of Wine that you tested with.
  10. \n"; + + // No Distribution entered, and nothing in the list is selected + if (empty($sDistribution) && !$_REQUEST['iDistributionId']) + $errors .= "
  11. Please enter a Distribution.
  12. \n"; + + if (empty($_REQUEST['sInstalls'])) + $errors .= "
  13. Please enter whether this application installs or not.
  14. \n"; + + if (empty($_REQUEST['sRuns'])) + $errors .= "
  15. Please enter whether this application runs or not.
  16. \n"; + + if (empty($_REQUEST['sTestedRating'])) + $errors .= "
  17. Please enter a Rating based on how well this application runs.
  18. \n"; + + return $errors; + + } + + /* retrieves values from $_REQUEST that were output by OutputEditor() */ + function GetOutputEditorValues() + { + if(get_magic_quotes_gpc()) + { + $this->iTestingId = stripslashes($_REQUEST['iTestingId']); + $this->iVersionId = stripslashes($_REQUEST['iVersionId']); + $this->sWhatWorks = stripslashes($_REQUEST['sWhatWorks']); + $this->sWhatDoesnt = stripslashes($_REQUEST['sWhatDoesnt']); + $this->sWhatNotTested = stripslashes($_REQUEST['sWhatNotTested']); + $this->sTestedDate = stripslashes($_REQUEST['sTestedDate']); + $this->iDistributionId = stripslashes($_REQUEST['iDistributionId']); + $this->sTestedRelease = stripslashes($_REQUEST['sTestedRelease']); + $this->sInstalls = stripslashes($_REQUEST['sInstalls']); + $this->sRuns = stripslashes($_REQUEST['sRuns']); + $this->sTestedRating = stripslashes($_REQUEST['sTestedRating']); + $this->sComments = stripslashes($_REQUEST['sComments']); + } else + { + $this->iTestingId = $_REQUEST['iTestingId']; + $this->iVersionId = $_REQUEST['iVersionId']; + $this->sWhatWorks = $_REQUEST['sWhatWorks']; + $this->sWhatDoesnt = $_REQUEST['sWhatDoesnt']; + $this->sWhatNotTested = $_REQUEST['sWhatNotTested']; + $this->sTestedDate = $_REQUEST['sTestedDate']; + $this->iDistributionId = $_REQUEST['iDistributionId']; + $this->sTestedRelease = $_REQUEST['sTestedRelease']; + $this->sInstalls = $_REQUEST['sInstalls']; + $this->sRuns = $_REQUEST['sRuns']; + $this->sTestedRating = $_REQUEST['sTestedRating']; + $this->sComments = $_REQUEST['sComments']; + } + } + + + function getTestingQueue($sQueued='true') + { + if($_SESSION['current']->hasPriv("admin")) + { + $hResult = query_appdb("SELECT * + FROM testResults + WHERE queued = '".$sQueued."';"); + if(!$hResult || mysql_num_rows($hResult) == 0) + return; + } else + { + $hResult = query_appdb("SELECT * + FROM testResults + WHERE queued = '".$sQueued."' + AND submitterId = ".$_SESSION['current']->iUserId.";"); + if(!$hResult || mysql_num_rows($hResult) == 0) + return; + } + return $hResult; + } + + function ShowListofTests($hResult, $heading="") + { + //show applist + echo html_frame_start($heading,"90%","",0); + echo " + + + + + + + + "; + + $c = 1; + while($oRow = mysql_fetch_object($hResult)) + { + $oTest = new testData($oRow->testingId); + $oVersion = new version($oTest->iVersionId); + $oApp = new application($oVersion->iAppId); + $oSubmitter = new User($oTest->iSubmitterId); + if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + $c++; + } + echo html_frame_end(); + + } +} + +/* Get the number of TestResults in the database */ +function getNumberOfQueuedTests() +{ + $hResult = query_appdb("SELECT count(*) as num_tests FROM testResults WHERE queued='true';"); + if($hResult) + { + $row = mysql_fetch_object($hResult); + return $row->num_tests; + } + return 0; +} + +function make_Installs_list($varname, $cvalue) +{ + + echo "\n"; +} + +function make_Runs_list($varname, $cvalue) +{ + + echo "\n"; +} + + +?> diff --git a/include/util.php b/include/util.php index 8f112c4..6ea7641 100644 --- a/include/util.php +++ b/include/util.php @@ -117,7 +117,7 @@ function make_bugzilla_version_list($varname, $cvalue) if(!$result) return; echo "\n"; - echo "\n"; + echo "\n"; $aRating = array("Gold", "Silver", "Bronze", "Garbage"); $iMax = count($aRating); diff --git a/tables/distributions.sql b/tables/distributions.sql new file mode 100644 index 0000000..f21453a --- /dev/null +++ b/tables/distributions.sql @@ -0,0 +1,18 @@ +use apidb; + +drop table if exists distributions; + +/* + * Distributions table. + */ +create table distributions ( + distributionId int not null auto_increment, + name varchar(255) default NULL, + url varchar(255) default NULL, + submitTime timestamp(14) NOT NULL, + submitterId int(11) NOT NULL default '0', + queued enum('true','false','rejected') NOT NULL default 'false', + key(distributionId), + index(name) +); + diff --git a/tables/testResults.sql b/tables/testResults.sql new file mode 100644 index 0000000..a71cf17 --- /dev/null +++ b/tables/testResults.sql @@ -0,0 +1,26 @@ +use apidb; + +drop table if exists testResults; +drop table if exists TestResults; + +/* + * Version Testing results + */ +create table testResults ( + testingId int not null auto_increment, + versionId int not null, + whatWorks text, + whatDoesnt text, + whatNotTested text, + testedDate datetime not null, + distributionId int not null, + testedRelease tinytext, + installs enum('Yes','No') NOT NULL default 'Yes', + runs enum('Yes','No','???') NOT NULL default 'Yes', + testedRating tinytext, + comments text, + submitTime timestamp(14) NOT NULL, + submitterId int(11) NOT NULL default '0', + queued enum('true','false','rejected') NOT NULL default 'false', + key(testingId) +); diff --git a/testResults.php b/testResults.php new file mode 100644 index 0000000..2e6dafe --- /dev/null +++ b/testResults.php @@ -0,0 +1,206 @@ +iVersionId = $_REQUEST['iVersionId']; + $errors = ""; + + // Submit or Resubmit the new testing results + if (($_REQUEST['sub'] == 'Submit') || ($_REQUEST['sub'] == 'Resubmit')) + { + $errors = $oTest->CheckOutputEditorInput(); + $oTest->GetOutputEditorValues(); // retrieve the values from the current $_REQUEST + if(empty($errors)) + { + $sDistribution = trim($_REQUEST['sDistribution']); + if(!empty($sDistribution)) + { + $oDistribution = new distribution(); + $oDistribution->sName = $sDistribution; + $oDistribution->create(); + $oTest->iDistributionId = $oDistribution->iDistributionId; + } + if($_REQUEST['sub'] == 'Submit') + { + $oTest->create(); + } else if($_REQUEST['sub'] == 'Resubmit') + { + $oTest->update(true); + $oTest->ReQueue(); + } + redirect($_SERVER['PHP_SELF']); + } else + { + $_REQUEST['sub'] = 'view'; + } + } + + // Delete testing results + if ($_REQUEST['sub'] == 'Delete') + { + if(is_numeric($_REQUEST['iTestingId'])) + { + $oTest = new testData($_REQUEST['iTestingId']); + $oTest->delete(); + } + + redirect($_SERVER['PHP_SELF']); + } + + // is this an old test? + if(is_numeric($_REQUEST['iTestingId'])) + { + // make sure the user has permission to view this testing result + if(!$_SESSION['current']->hasPriv("admin") && + !$_SESSION['current']->hasAppVersionModifyPermission($oTest->iVersionId)&& + !(($_SESSION['current']->iUserId == $oTest->iSubmitterId) && !($oTest->sQueued == 'false'))) + { + errorpage("Insufficient privileges."); + exit; + } else + $oVersion = new version($oTest->iVersionId); + } else + { + $oTest->iVersionId = $_REQUEST['iVersionId']; + $oVersion = new version($_REQUEST['iVersionId']); + $oTest->sQueued = "new"; + } + if ($_REQUEST['sub'] == 'view') + { + $oApp = new application($oVersion->iAppId); + $sVersionInfo = $oApp->sName." ".$oVersion->sName; + + switch($oTest->sQueued) + { + case "new": + apidb_header("Submit new testing results for ".$sVersionInfo); + $oTest->sTestedDate = date('Y-m-d H:i:s'); + break; + case "true": + apidb_header("Edit new testing results for ".$sVersionInfo); + break; + case "rejected": + apidb_header("Resubmit testing results for ".$sVersionInfo); + break; + case "False": + apidb_header("Edit testing results for ".$sVersionInfo); + break; + default: + apidb_header("Edit testing results for "); + } + echo '',"\n"; + + + //help + echo "

    This is the Screen for imputting testing information so that others looking at the database will know \n"; + echo "what was working or a particular release of Wine.

    \n"; + echo "

    Please be as detailed as you can.

    \n"; + echo "

    If you can not find your distribution on the list of existing Distributions please add it add it in the \n"; + echo "field provided.

    \n\n"; + + if(!empty($errors)) + { + echo '',"\n"; + echo '

    We found the following errors:

    Please correct them.'; + echo '

    ',"\n"; + echo '

    ',"\n"; + } + + // View Testing Details + $oTest->OutputEditor($_REQUEST['sDistribution'],true); + + echo 'Back to Version'; + + echo '',"\n"; + echo ""; + + echo html_frame_end(" "); + } + else + { + // error no sub! + addmsg("Internal Routine Not Found!!", "red"); + redirect($_SERVER['PHP_SELF']); + } +} +else // if ($_REQUEST['sub']) is not defined, display the Testing results queue page +{ + apidb_header("Testing Results"); + + // Get queued testing results. + $oTest = new TestData(); + $hResult = $oTest->getTestingQueue("true"); + + if(!$hResult) + { + // no Tests in queue + echo html_frame_start("Submitted Testing Results","90%"); + echo '

    The Submitted Testng Results Queue is empty.

    ',"\n"; + echo html_frame_end(" "); + } + else + { + // help + echo "
    Submission DateSubmitterApplicationVersionReleaseAction
    ".print_date(mysqltimestamp_to_unixtimestamp($oTest->sSubmitTime))."\n"; + echo $oSubmitter->sEmail ? "sEmail."\">":""; + echo $oSubmitter->sRealname; + echo $oSubmitter->sEmail ? "":""; + echo " ".$oApp->sName."".$oVersion->sName."".$oTest->sTestedRelease."[iTestingId.">process]
    ',"\n"; + + + // Submit Buttons + switch($oTest->sQueued) + { + case "new": + echo ' ',"\n"; + break; + case "true": + case "rejected": + case "False": + echo ' ',"\n"; + echo '',"\n"; + break; + } + echo '
    \n\n"; + echo "

    This is the list of Test Results waiting for submition, or to be deleted.

    \n"; + echo "

    To view a submission, click on its name. From that page you can delete or edit and\n"; + echo "re-submit it into the AppDB .
    \n"; + echo "

    \n\n"; + + $oTest->ShowListofTests($hResult,"Submitted Testing Results"); + } + // Get rejected testing results. + $hResult = $oTest->getTestingQueue("rejected"); + + if(!$hResult || !mysql_num_rows($hResult)) + { + //no Test Results in queue + echo html_frame_start("Rejected Testing Results","90%"); + echo '

    The Rejected Testng Results Queue is empty.

    ',"\n"; + echo html_frame_end(" "); + } + else + { + //help + echo "
    \n\n"; + echo "

    This is the list of Rejected Test Results waiting for re-submition or deletion.

    \n"; + echo "

    To view a submission, click on its name. From that page you can delete or edit and re-submit it into \n"; + echo "the AppDB .
    \n"; + echo "

    \n\n"; + + $oTest->ShowListofTests($hResult,"Rejected Testing Results"); + } +} +apidb_footer(); +?>