Add distribution queue.

Queued distributions are still treated like un-queued ones, since currently
only 8 distributions are un-queued.  'View Distributions', however, will only
show un-queued distributions.

If an admin tries to remove a distribution with associated test results, an
error is printed and no action is performed.  This could be improved in the
future by showing a 'move test data' link.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-03-13 16:59:35 +00:00
committed by WineHQ
parent b628b3af0e
commit f782c10317
3 changed files with 23 additions and 37 deletions

View File

@@ -145,9 +145,15 @@ class distribution {
// is the current user allowed to delete this Distribution?
if(!$_SESSION['current']->hasPriv("admin") &&
!($_SESSION['current']->iUserId == $this->iSubmitterId))
{
return;
/* Check for associated test results */
if(sizeof($this->aTestingIds))
{
addmsg("This distribution still has associated test results", "red");
return FALSE;
}
// now delete the Distribution
$sQuery = "DELETE FROM distributions
WHERE distributionId = '?'
@@ -179,7 +185,7 @@ class distribution {
if(!$this->sQueued == 'true')
return false;
if(query_parameters("UPDATE distribution SET queued = '?' WHERE distributionId = '?'",
if(query_parameters("UPDATE distributions SET queued = '?' WHERE distributionId = '?'",
"false", $this->iDistributionId))
{
$this->sQueued = 'false';
@@ -206,23 +212,7 @@ class distribution {
if(!$this->sQueued == 'true')
return false;
if(query_parameters("UPDATE distribution SET queued = '?' WHERE distributionId = '?'",
"rejected", $this->iDistributionId))
{
$this->sQueued = 'rejected';
// we send an e-mail to interested people
if(!$bSilent)
{
$this->mailSubmitter("reject");
$this->SendNotificationMail("reject");
}
// the Distribution data has been rejected
return true;
} else
{
addmsg("Error while rejecting Distribution", "red");
return false;
}
return $this->delete();
}
function ReQueue()
@@ -271,16 +261,6 @@ class distribution {
$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?sSub=view&iVersionId=".$this->iVersionId."\n";
$sMsg .= "Reason given:\n";
$sMsg .= $aClean['sReplyText']."\n"; // append the reply text, if there is any
}
break;
case "delete":
{
$sSubject = "Submitted Distribution deleted";
@@ -387,14 +367,12 @@ class distribution {
}
/* Get the total number of Distributions in the database */
function getNumberOfDistributions($bQueued)
function objectGetEntriesCount($bQueued)
{
if($bQueued)
$hResult = query_parameters("SELECT count(*) as num_dists FROM
distributions WHERE queued='true';");
else
$hResult = query_parameters("SELECT count(*) as num_dists FROM
distributions");
$hResult = query_parameters("SELECT count(distributionId) as num_dists FROM
distributions WHERE queued='?'",
$bQueued ? "true" : "false");
if($hResult)
{
$oRow = mysql_fetch_object($hResult);
@@ -490,6 +468,11 @@ class distribution {
return FALSE;
}
function objectHideDelete()
{
return TRUE;
}
function display()
{
echo "Distribution Name:";

View File

@@ -28,7 +28,7 @@ function global_sidebar_menu()
$g->add("Submit Application", BASE."appsubmit.php?sSub=view&sAppType=application");
$g->add("Help & Documentation", BASE."help/");
$g->add("AppDB Stats", BASE."appdbStats.php");
$g->add("View Distributions (".distribution::getNumberOfDistributions(false).")", BASE."objectManager.php?sClass=distribution&bIsQueue=false&sTitle=View%20Distributions");
$g->add("View Distributions (".distribution::objectGetEntriesCount(false).")", BASE."objectManager.php?sClass=distribution&bIsQueue=false&sTitle=View%20Distributions");
$g->add("View Vendors (".getNumberOfvendors().")", BASE."objectManager.php?sClass=vendor&bIsQueue=false&sTitle=View%20Vendors");
$g->add("Email your suggestions for improving the AppDB", "mailto:appdb@winehq.org");
$g->done();

View File

@@ -30,6 +30,9 @@ function global_admin_menu() {
BASE."admin/adminBugs.php");
$g->add("View Test Results Queue (".testData::getNumberOfQueuedTests().")",
BASE."admin/adminTestResults.php");
$g->add("View Distribution Queue (".distribution::objectGetEntriesCount(true).")",
BASE."objectManager.php?sClass=distribution&bIsQueue=true&sTitle=".
"Distribution%20Queue");
$g->addmisc(" ");
$g->add("Users Management", BASE."admin/adminUsers.php");