version: Rename 'queued' to 'state'

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-12-12 20:56:04 +01:00
committed by Chris Morgan
parent 06f693859f
commit aee69c1735
12 changed files with 77 additions and 60 deletions

View File

@@ -252,7 +252,7 @@ class appData
)
)
AND
appVersion.queued = 'false'
appVersion.state = 'accepted'
AND
appFamily.queued = 'false'";
@@ -296,7 +296,7 @@ class appData
appData.versionId = appVersion.versionId
)
AND
appVersion.queued = 'false'
appVersion.state = 'accepted'
AND
appFamily.queued = 'false'$sAppDataQueued$sSelectType)";
@@ -372,7 +372,7 @@ class appData
)
)
AND
appVersion.queued = 'false'
appVersion.state = 'accepted'
AND
appFamily.queued = 'false'
AND
@@ -425,7 +425,7 @@ class appData
appData.versionId = appVersion.versionId
)
AND
appVersion.queued = 'false'
appVersion.state = 'accepted'
AND
appFamily.queued = 'false'
AND
@@ -492,7 +492,7 @@ class appData
if($this->iVersionId)
{
$oVersion = new version($this->iVersionId);
if($oVersion->canEdit() && $oVersion->sQueued == "false")
if($oVersion->canEdit() && $oVersion->objectGetState() == 'accepted')
return FALSE;
else
return TRUE;

View File

@@ -116,7 +116,7 @@ class Application {
private function _internal_retrieve_unqueued_versions()
{
$sQuery = "SELECT versionId FROM appVersion WHERE
queued = 'false' AND
state = 'accepted' AND
appId = '?'";
$hResult = query_parameters($sQuery, $this->iAppId);
return $hResult;
@@ -1108,7 +1108,7 @@ class Application {
$sMsg = "<select name=\"$sVarName\">\n";
foreach($this->getVersions() as $oVersion)
{
if($oVersion->sQueued != "false" || $oVersion->iVersionId == $iExclude ||
if($oVersion->objectGetState() != 'accepted' || $oVersion->iVersionId == $iExclude ||
(!$bIncludeObsolete && $oVersion->iObsoleteBy))
continue;

View File

@@ -63,7 +63,7 @@ class distribution {
testResults.versionId = appVersion.versionId AND
appFamily.appId = appVersion.appId AND
appFamily.queued = 'false' AND
appVersion.queued = 'false' AND
appVersion.state = 'accepted' AND
distributionId = '?'
ORDER BY testedRating;";
}

View File

@@ -70,7 +70,7 @@ class queuedEntries
print_r($oVersion);
}
if($oVersion->sQueued == "true")
if($oVersion->objectGetState() == 'queued')
{
$this->aVersions[] = $oVersion->objectGetId();
} else // version isn't queued
@@ -214,7 +214,7 @@ class maintainer
$oVersion = new version($this->iVersionId);
if($oApp->sQueued != "false" ||
(!$this->bSuperMaintainer && $oVersion->sQueued != "false"))
(!$this->bSuperMaintainer && $oVersion->objectGetState() != 'accepted'))
$this->sQueued = "pending";
else
$this->sQueued = $this->mustBeQueued() ? "true" : "false";

View File

@@ -64,7 +64,7 @@ class testData{
function create()
{
$oVersion = new version($this->iVersionId);
if($oVersion->sQueued != "false")
if($oVersion->objectGetState() != 'accepted')
$this->sState = 'pending';
else
$this->sState = $this->mustBeQueued() ? 'queued' : 'accepted';
@@ -876,7 +876,7 @@ class testData{
/* List test data submitted by a given user. Ignore test results for queued applications/versions */
function listSubmittedBy($iUserId, $bQueued = true)
{
$hResult = query_parameters("SELECT testResults.versionId, testResults.testedDate, testResults.testedRelease, testResults.testedRating, testResults.submitTime, appFamily.appName, appVersion.versionName from testResults, appFamily, appVersion WHERE testResults.versionId = appVersion.versionId AND appVersion.appId = appFamily.appId AND (appFamily.queued = '?' OR appVersion.queued = '?') AND testResults.submitterId = '?' AND testResults.state = '?' ORDER BY testResults.testingId", "false", "false", $iUserId, $bQueued ? 'queued' : 'accepted');
$hResult = query_parameters("SELECT testResults.versionId, testResults.testedDate, testResults.testedRelease, testResults.testedRating, testResults.submitTime, appFamily.appName, appVersion.versionName from testResults, appFamily, appVersion WHERE testResults.versionId = appVersion.versionId AND appVersion.appId = appFamily.appId AND (appFamily.queued = '?' OR appVersion.state = '?') AND testResults.submitterId = '?' AND testResults.state = '?' ORDER BY testResults.testingId", "false", 'accepted', $iUserId, $bQueued ? 'queued' : 'accepted');
if(!$hResult || !query_num_rows($hResult))
return false;
@@ -1188,7 +1188,7 @@ class testData{
// 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")
if($oVersion->canEdit() && $oVersion->objectGetState() == 'accepted')
return FALSE;
else
return TRUE;

View File

@@ -722,7 +722,7 @@ class User {
function canViewVersion($oVersion)
{
/* if the version isn't queued */
if($oVersion->sQueued == 'false')
if($oVersion->objectGetState() == 'accepted')
return true;
if($this->hasPriv("admin"))
@@ -730,7 +730,7 @@ class User {
/* if the user is the submitter and the version is still queued */
if(($this->iUserId == $oVersion->iSubmitterId) &&
($oVersion->sQueued != 'false'))
($oVersion->objectGetState() != 'accepted'))
return true;
/* if this user supermaintains the application this version belongs to */
@@ -758,7 +758,7 @@ class User {
return true;
/* the version is queued and the user is the submitter */
if(($oVersion->sQueued != 'false') && ($this->iUserId == $oVersion->iSubmitterId))
if(($oVersion->objectGetState() != 'accepted') && ($this->iUserId == $oVersion->iSubmitterId))
return true;
return false;
@@ -783,7 +783,7 @@ class User {
/* if the app is anything other than not queued and if the user is the submitter */
/* then allow the user to delete the app */
if(($oVersion->sQueued != 'false') && ($oVersion->iSubmitterId == $this->iUserId))
if(($oVersion->objectGetState() != 'accepted') && ($oVersion->iSubmitterId == $this->iUserId))
return true;
/* is this user a supermaintainer of the application this version is under? */
@@ -833,7 +833,7 @@ class User {
return true;
if(($this->iUserId == $oVersion->iSubmitterId) &&
($oVersion->sQueued != 'false'))
($oVersion->objectGetState() != 'accepted'))
return true;
return false;

View File

@@ -524,7 +524,7 @@ function outputSearchTableForhResult($search_words, $hResult)
$bgcolor = ($c % 2) ? 'color0' : 'color1';
//count versions
$hResult2 = query_parameters("SELECT count(*) as versions FROM appVersion WHERE appId = '?' AND versionName != 'NONAME' and queued = 'false'",
$hResult2 = query_parameters("SELECT count(*) as versions FROM appVersion WHERE appId = '?' AND versionName != 'NONAME' and state = 'accepted'",
$oRow->appId);
$y = query_fetch_object($hResult2);

View File

@@ -33,7 +33,7 @@ class version {
var $sTestedRating;
var $sSubmitTime;
var $iSubmitterId;
var $sQueued;
private $sState;
var $sLicense;
var $aTestResults; /* Array of test result objects. Especially useful when
we want to preview a version before submitting it;
@@ -77,7 +77,7 @@ class version {
$this->sDescription = $oRow->description;
$this->sTestedRelease = $oRow->maintainer_release;
$this->sTestedRating = $oRow->maintainer_rating;
$this->sQueued = $oRow->queued;
$this->sState = $oRow->state;
$this->sLicense = $oRow->license;
$this->iObsoleteBy = $oRow->obsoleteBy;
}
@@ -94,18 +94,18 @@ class version {
$oApp = new application($this->iAppId);
if($oApp->sQueued != "false")
$this->sQueued = "pending";
$this->sState = 'pending';
else
$this->sQueued = $this->mustBeQueued() ? "true" : "false";
$this->sState = $this->mustBeQueued() ? 'queued' : 'accepted';
$hResult = query_parameters("INSERT INTO appVersion
(versionName, description, maintainer_release,
maintainer_rating, appId, submitTime, submitterId,
queued, license)
state, license)
VALUES ('?', '?', '?', '?', '?', ?, '?', '?', '?')",
$this->sName, $this->sDescription, $this->sTestedRelease,
$this->sTestedRating, $this->iAppId, "NOW()",
$_SESSION['current']->iUserId, $this->sQueued,
$_SESSION['current']->iUserId, $this->sState,
$this->sLicense);
if($hResult)
@@ -288,13 +288,13 @@ class version {
return;
// If we are not in the queue, we can't move the version out of the queue.
if($this->sQueued == 'false')
if($this->sState == 'accepted')
return false;
if(query_parameters("UPDATE appVersion SET queued = '?' WHERE versionId = '?'",
"false", $this->iVersionId))
if(query_parameters("UPDATE appVersion SET state = '?' WHERE versionId = '?'",
'accepted', $this->iVersionId))
{
$this->sQueued = 'false';
$this->sState = 'accepted';
// we send an e-mail to interested people
$this->mailSubmitter("add");
$this->SendNotificationMail();
@@ -319,13 +319,13 @@ class version {
return;
// If we are not in the queue, we can't move the version out of the queue.
if(!$this->sQueued == 'true')
if($this->sState != 'queued')
return false;
if(query_parameters("UPDATE appVersion SET queued = '?' WHERE versionId = '?'",
"rejected", $this->iVersionId))
if(query_parameters("UPDATE appVersion SET state = '?' WHERE versionId = '?'",
'rejected', $this->iVersionId))
{
$this->sQueued = 'rejected';
$this->sState = 'rejected';
// we send an e-mail to interested people
if(!$bSilent)
{
@@ -342,10 +342,10 @@ class version {
if(!$_SESSION['current']->canRequeueVersion($this))
return;
if(query_parameters("UPDATE appVersion SET queued = '?' WHERE versionId = '?'",
"true", $this->iVersionId))
if(query_parameters("UPDATE appVersion SET state = '?' WHERE versionId = '?'",
'queued', $this->iVersionId))
{
$this->sQueued = 'true';
$this->sState = 'queued';
// we send an e-mail to interested people
$this->SendNotificationMail();
@@ -443,7 +443,7 @@ class version {
switch($sAction)
{
case "add":
if($this->sQueued == "false")
if($this->sState == 'accepted')
{
$sSubject = "Version ".$this->sName." of ".$oApp->sName." added by ".$_SESSION['current']->sRealname;
$sMsg = $this->objectMakeUrl()."\n";
@@ -569,7 +569,7 @@ class version {
if(!$this->iAppId)
$this->iAppId = $aClean['iAppId'];
if($this->sQueued == "false" && $this->iVersionId)
if($this->sState == 'accepted' && $this->iVersionId)
{
// app parent
$x = new TableVE("view");
@@ -636,7 +636,7 @@ class version {
echo html_frame_end();
if($this->sQueued == "false" && $this->iVersionId)
if($this->sState == 'accepted' && $this->iVersionId)
{
echo html_frame_start("Info", "90%", "", 0);
@@ -1188,7 +1188,14 @@ class version {
foreach($aVersions as $oVersion)
{
$oApp = new application($oVersion->iAppId);
if ($oVersion->sQueued == $oApp->sQueued)
/* Temporary workaround */
$sAppState = $oApp->sQueued;
if($sAppState == 'true')
$sAppState = 'queued';
else if($sAppState == 'false')
$sAppState = 'accepted';
if ($oVersion->sState == $sAppState)
{
// set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
@@ -1277,7 +1284,7 @@ class version {
/* List the versions submitted by a user. Ignore versions for queued applications */
public static function listSubmittedBy($iUserId, $bQueued = true)
{
$hResult = query_parameters("SELECT appFamily.appName, appVersion.versionName, appVersion.description, appVersion.versionId, appVersion.submitTime FROM appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND appVersion.submitterId = '?' AND appVersion.queued = '?' AND appFamily.queued = '?'", $iUserId, $bQueued ? "true" : "false", "false");
$hResult = query_parameters("SELECT appFamily.appName, appVersion.versionName, appVersion.description, appVersion.versionId, appVersion.submitTime FROM appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND appVersion.submitterId = '?' AND appVersion.state = '?' AND appFamily.queued = '?'", $iUserId, $bQueued ? 'queued' : 'accepted', 'false');
if(!$hResult || !query_num_rows($hResult))
return false;
@@ -1365,7 +1372,7 @@ class version {
public static function objectGetEntriesCount($bQueued, $bRejected)
{
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
$sState = objectManager::getStateString($bQueued, $bRejected);
$oVersion = new version();
if($bQueued && !$oVersion->canEdit())
@@ -1377,7 +1384,7 @@ class version {
appVersion WHERE
appVersion.submitterId = '?'
AND
appVersion.queued = '?'";
appVersion.state = '?'";
else
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
appVersion, appMaintainers WHERE
@@ -1389,15 +1396,15 @@ class version {
AND
appMaintainers.queued = 'false'
AND
appVersion.queued = '?'";
appVersion.state = '?'";
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $sQueued);
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $sState);
} else
{
$sQuery = "SELECT COUNT(DISTINCT versionId) as count
FROM appVersion WHERE
appVersion.queued = '?'";
$hResult = query_parameters($sQuery, $sQueued);
appVersion.state = '?'";
$hResult = query_parameters($sQuery, $sState);
}
if(!$hResult)
@@ -1409,6 +1416,16 @@ class version {
return $oRow->count;
}
public function objectGetState()
{
return $this->sState;
}
public function objectSetState($sState)
{
$this->sState = $sState;
}
public function canEdit()
{
if($_SESSION['current']->hasPriv("admin"))
@@ -1480,7 +1497,7 @@ class version {
public static function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
{
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
$sState = objectManager::getStateString($bQueued, $bRejected);
$sLimit = "";
@@ -1503,7 +1520,7 @@ class version {
$sQuery = "SELECT * FROM appVersion WHERE
appVersion.submitterId = '?'
AND
appVersion.queued = '?' ORDER BY ?$sLimit";
appVersion.state = '?' ORDER BY ?$sLimit";
else
$sQuery = "SELECT appVersion.* FROM
appVersion, appMaintainers WHERE
@@ -1515,29 +1532,29 @@ class version {
AND
appMaintainers.queued = 'false'
AND
appVersion.queued = '?' ORDER BY ?$sLimit";
appVersion.state = '?' ORDER BY ?$sLimit";
if($sLimit)
{
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$sQueued, $sOrderBy, $iStart, $iRows);
$sState, $sOrderBy, $iStart, $iRows);
} else
{
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$sQueued, $sOrderBy);
$sState, $sOrderBy);
}
} else
{
$sQuery = "SELECT * FROM appVersion WHERE
appVersion.queued = '?' ORDER BY ?$sLimit";
appVersion.state = '?' ORDER BY ?$sLimit";
if($sLimit)
{
$hResult = query_parameters($sQuery, $sQueued, $sOrderBy,
$hResult = query_parameters($sQuery, $sState, $sOrderBy,
$iStart, $iRows);
} else
{
$hResult = query_parameters($sQuery, $sQueued, $sOrderBy);
$hResult = query_parameters($sQuery, $sState, $sOrderBy);
}
}

View File

@@ -268,7 +268,7 @@ class version_queue
foreach($oApp->aVersionsIds as $iVersionId)
{
$oVersion = new Version($iVersionId);
if ($oVersion->sQueued == 'false')
if ($oVersion->objectGetState() == 'accepted')
{
//display row
echo html_tr(array(