diff --git a/include/objectManager.php b/include/objectManager.php index e51730c..ad71b65 100644 --- a/include/objectManager.php +++ b/include/objectManager.php @@ -305,6 +305,9 @@ class ObjectManager if(!$oObject->canEdit()) return FALSE; + if($this->bIsRejected) + $oObject->ReQueue(); + if($this->bIsQueue) $oObject->unQueue(); diff --git a/include/sidebar_admin.php b/include/sidebar_admin.php index 176e637..175aa3e 100644 --- a/include/sidebar_admin.php +++ b/include/sidebar_admin.php @@ -23,7 +23,7 @@ function global_admin_menu() { BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=". "Maintainer%20Queue"); $g->add("View Test Results Queue (".testData::objectGetEntriesCount(true, false).")", - BASE."objectManager.php?sClass=testData&bIsQueue=true&sTitle=". + BASE."objectManager.php?sClass=testData_queue&bIsQueue=true&sTitle=". "Test%20Results%20Queue"); $g->add("View Distribution Queue (".distribution::objectGetEntriesCount(true, false).")", @@ -47,12 +47,12 @@ function global_admin_menu() { BASE."objectManager.php?sClass=application&bIsQueue=true&bIsRejected=true&". "sTitle=Rejected%20Applications"); $g->add("View Rejected Versions (".version::objectGetEntriesCount(true, true).")", - BASE."objectManager.php?sClass=version&bIsQueue=true&bIsRejected=true&". - "sTitle=Rejected%20Versions"); + BASE."objectManager.php?sClass=version_queue&bIsQueue=true&". + "bIsRejected=true&sTitle=Rejected%20Versions"); $g->add("View Rejected Test Results (".testData::objectGetEntriesCount(true, true).")", - BASE."objectManager.php?sClass=testData&bIsQueue=true&bIsRejected=true&". - "sTitle=Rejected%20Test%20Results"); + BASE."objectManager.php?sClass=testData_queue&bIsQueue=true". + "&bIsRejected=true&sTitle=Rejected%20Test%20Results"); $g->addmisc(" "); diff --git a/include/sidebar_login.php b/include/sidebar_login.php index 16f6a0a..c233cee 100644 --- a/include/sidebar_login.php +++ b/include/sidebar_login.php @@ -47,6 +47,14 @@ function global_sidebar_login() { $g->add("Review Rejected Apps ($iAppsRejected)", BASE."appsubmit.php", "center"); } + /* Display the user's rejected test results */ + $iTestDataRejected = testData::objectGetEntriesCount(true, true); + if($iTestDataRejected && !$_SESSION['current']->hasPriv("admin")) + $g->add("Review Rejected Test Results ($iTestDataRejected)", + BASE."objectManager.php?sClass=testData_queue&". + "sAction=view&bIsQueue=true&bIsRejected=true&sTitle=". + "Rejected+Test+Results", "center"); + $aMonitored = Monitor::getVersionsMonitored($_SESSION['current']); if($aMonitored) { diff --git a/include/sidebar_maintainer_admin.php b/include/sidebar_maintainer_admin.php index 5d20ce9..468a294 100644 --- a/include/sidebar_maintainer_admin.php +++ b/include/sidebar_maintainer_admin.php @@ -15,7 +15,7 @@ function global_maintainer_admin_menu() { BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=". "Screenshot%20Queue"); $g->add("View Test Results Queue (".testData::objectGetEntriesCount(true, false).")", - BASE."objectManager.php?sClass=testData&bIsQueue=true&sTitle=". + BASE."objectManager.php?sClass=testData_queue&bIsQueue=true&sTitle=". "Test%20Results%20Queue"); $g->done(); } diff --git a/include/testData.php b/include/testData.php index df37d58..bb7b1bf 100644 --- a/include/testData.php +++ b/include/testData.php @@ -68,12 +68,16 @@ class testData{ "installs, runs, testedRating, comments, submitterId, queued)". " VALUES('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?',". "'?', '?')", - $this->iVersionId, $this->shWhatWorks, $this->shWhatDoesnt, - $this->shWhatNotTested, $this->sTestedDate, $this->iDistributionId, - $this->sTestedRelease, $this->sInstalls, $this->sRuns, + $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->mustBeQueued() ? "false" : "true"); + $this->mustBeQueued() ? "true" : "false"); + if($hResult) { $this->iTestingId = mysql_insert_id(); @@ -469,14 +473,16 @@ class testData{ } /* retrieve the latest test result for a given version id */ - function getNewestTestIdFromVersionId($iVersionId, $bQueued = false) + function getNewestTestIdFromVersionId($iVersionId, $sQueued = "false") { $sQuery = "SELECT testingId FROM testResults WHERE versionId = '?' AND queued = '?' ORDER BY testedDate DESC limit 1"; - $hResult = query_parameters($sQuery, $iVersionId, $bQueued ? "true" : "false"); + + $hResult = query_parameters($sQuery, $iVersionId, $sQueued); + if(!$hResult) return 0; @@ -717,9 +723,17 @@ class testData{ appMaintainers.userId = '?' AND ( - appMaintainers.appId = appVersion.appid - OR - appMaintainers.versionId = appVersion.versionId + ( + appMaintainers.superMaintainer = '1' + AND + appMaintainers.appId = appVersion.appid + ) + OR + ( + appMaintainers.superMaintainer = '0' + AND + appMaintainers.versionId = appVersion.versionId + ) ) AND testResults.queued = '?'"; @@ -775,9 +789,17 @@ class testData{ appVersion.queued = 'false' AND ( - appMaintainers.appId = appVersion.appid - OR - appMaintainers.versionId = appVersion.versionId + ( + appMaintainers.superMaintainer = '1' + AND + appMaintainers.appId = appVersion.appid + ) + OR + ( + appMaintainers.superMaintainer = '0' + AND + appMaintainers.versionId = appVersion.versionId + ) ) AND testResults.queued = '?'"; @@ -832,8 +854,10 @@ class testData{ $this->sTestedRating); if($this->canEdit() or $this->sQueued == "rejected") + { $aCells[] = "[ makeUrl("edit", $this->iTestingId)."\">$sEditLinkLabel ]"; + } echo html_tr($aCells, $this->sTestedRating); } @@ -844,6 +868,10 @@ class testData{ return TRUE; else if($this->iVersionId) { + if($this->iSubmitterId == $_SESSION['current']->iUserId && + $this->sQueued == "rejected") + return TRUE; + $oVersion = new version($this->iVersionId); if($_SESSION['current']->hasAppVersionModifyPermission($oVersion)) return TRUE; @@ -894,16 +922,16 @@ class testData{ function mustBeQueued() { if($_SESSION['current']->hasPriv("admin")) - return TRUE; + return FALSE; else if($this->iVersionId) { $oVersion = new version($this->iVersionId); if($oVersion->canEdit()) - return TRUE; - else return FALSE; + else + return TRUE; } else - return FALSE; + return TRUE; } } diff --git a/include/testData_queue.php b/include/testData_queue.php index c342019..3b6cdbf 100644 --- a/include/testData_queue.php +++ b/include/testData_queue.php @@ -18,6 +18,7 @@ class testData_queue $this->oDistribution->create(); $this->oTestData->iDistributionId = $this->oDistribution->iDistributionId; } + return $this->oTestData->create(); } @@ -26,12 +27,24 @@ class testData_queue return $this->oTestData->delete(); } + function reQueue() + { + $this->oTestData->reQueue(); + if($this->oDistribution->sQueued == "rejected") + $this->oDistribution->reQueue(); + } + function unQueue() { $this->oTestData->unQueue(); $this->oDistribution->unQueue(); } + function reject() + { + $this->oTestData->reject(); + } + function update() { $this->oTestData->update(); @@ -42,17 +55,20 @@ class testData_queue { $this->oTestData->outputEditor(); - /* If we are processing queued test results with a queued distribution, we display - some additional help here */ + /* If we are processing queued test results with a queued distribution, + we display some additional help here */ if($this->oDistribution->sQueued != "false" && $this->canEdit()) { - echo "The user submitted a new distribution, which will be un-queued together ". - "with the test data unless you select an existing one from the list above."; + echo "The user submitted a new distribution, which will be un-queued ". + "together with the test data unless you select an existing one ". + "from the list above."; } - /* 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->oDistribution->sQueued != "false") + /* 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->oDistribution->sQueued != "false") $this->oDistribution->outputEditor(); } diff --git a/include/version_queue.php b/include/version_queue.php index 7238325..389f54c 100644 --- a/include/version_queue.php +++ b/include/version_queue.php @@ -12,12 +12,8 @@ class version_queue if($iVersionId) { - if($this->oVersion->sQueued == "true") - $bQueued = TRUE; - if($this->oVersion->sQueued == "false") - $bQueued = FALSE; $iTestingId = testData::getNewestTestIdFromVersionId($iVersionId, - $bQueued); + $this->oVersion->sQueued); } $this->oTestDataQueue = new testData_queue($iTestingId); @@ -39,6 +35,12 @@ class version_queue return TRUE; } + function reQueue() + { + $this->oVersion->reQueue(); + $this->oTestDataQueue->reQueue(); + } + function reject() { $this->oVersion->reject();