Use sState for objectGetEntries[Count]()
This commit is contained in:
committed by
Chris Morgan
parent
4297db9786
commit
9b92c2221c
@@ -49,7 +49,7 @@ class appData
|
|||||||
$this->iVersionId = $oRow->versionId;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->iId = $iId;
|
$this->iId = $iId;
|
||||||
$this->bQueued = ($oRow->sQueued == "false") ? false : true;
|
$this->bQueued = ($oRow->sState == 'accepted') ? false : true;
|
||||||
$this->sDescription = $oRow->description;
|
$this->sDescription = $oRow->description;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,8 +79,8 @@ class appData
|
|||||||
if(!$this->canEdit())
|
if(!$this->canEdit())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$sQuery = "UPDATE appData SET queued = '?' WHERE id = '?'";
|
$sQuery = "UPDATE appData SET state = '?' WHERE id = '?'";
|
||||||
$hResult = query_parameters($sQuery, "true", $this->iId);
|
$hResult = query_parameters($sQuery, 'queued', $this->iId);
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -93,8 +93,8 @@ class appData
|
|||||||
if(!$this->canEdit())
|
if(!$this->canEdit())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$sQuery = "UPDATE appData SET queued = '?' WHERE id = '?'";
|
$sQuery = "UPDATE appData SET state = '?' WHERE id = '?'";
|
||||||
$hResult = query_parameters($sQuery, "rejected", $this->iId);
|
$hResult = query_parameters($sQuery, 'rejected', $this->iId);
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -123,9 +123,9 @@ class appData
|
|||||||
$hResult = query_parameters("SELECT * FROM appData WHERE
|
$hResult = query_parameters("SELECT * FROM appData WHERE
|
||||||
appData.submitterId = '?'
|
appData.submitterId = '?'
|
||||||
AND
|
AND
|
||||||
appData.queued = '?'
|
appData.state = '?'
|
||||||
ORDER BY appData.id",
|
ORDER BY appData.id",
|
||||||
$iUserId, $bQueued ? "true" : "false");
|
$iUserId, $bQueued ? 'queued' : 'accepted');
|
||||||
|
|
||||||
if(!$hResult || !query_num_rows($hResult))
|
if(!$hResult || !query_num_rows($hResult))
|
||||||
return false;
|
return false;
|
||||||
@@ -194,11 +194,11 @@ class appData
|
|||||||
else
|
else
|
||||||
$iAppId = $iId;
|
$iAppId = $iId;
|
||||||
|
|
||||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
$sState = objectManager::getStateString($bQueued, $bRejected);
|
||||||
|
|
||||||
$hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND
|
$hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND
|
||||||
versionId = '?' AND TYPE = '?' AND queued = '?'",
|
versionId = '?' AND TYPE = '?' AND state = '?'",
|
||||||
$iAppId, $iVersionId, $sType, $sQueued);
|
$iAppId, $iVersionId, $sType, $sState);
|
||||||
|
|
||||||
if(!$hResult || !query_num_rows($hResult))
|
if(!$hResult || !query_num_rows($hResult))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -206,27 +206,23 @@ class appData
|
|||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($sQueued, $bRejected, $sType = null)
|
function objectGetEntriesCount($sState, $sType = null)
|
||||||
{
|
{
|
||||||
/* Not implemented for appData */
|
/* Not implemented for appData */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Compatibility with objectManager */
|
|
||||||
if($sQueued === true)
|
|
||||||
$sQueued = "true";
|
|
||||||
if($sQueued === false)
|
|
||||||
$sQueued = "false";
|
|
||||||
|
|
||||||
$sSelectType = "";
|
$sSelectType = "";
|
||||||
|
|
||||||
if(($sQueued == "true" || $sQueued == "all") &&
|
if(($sState != 'accepted') &&
|
||||||
!$_SESSION['current']->hasPriv("admin"))
|
!$_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT COUNT(DISTINCT appData.id) as count FROM appData,
|
$sQuery = "SELECT COUNT(DISTINCT appData.id) as count FROM appData,
|
||||||
appMaintainers, appVersion, appFamily WHERE
|
appMaintainers, appVersion, appFamily WHERE
|
||||||
appFamily.appId = appVersion.appId
|
appFamily.appId = appVersion.appId
|
||||||
AND
|
AND
|
||||||
|
appMaintainers.state = 'accepted'
|
||||||
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
(
|
(
|
||||||
@@ -261,8 +257,8 @@ class appData
|
|||||||
AND
|
AND
|
||||||
appFamily.state = 'accepted'";
|
appFamily.state = 'accepted'";
|
||||||
|
|
||||||
if($sQueued == "true")
|
if($sState != 'all')
|
||||||
$sQuery .= " AND appData.queued = 'true'";
|
$sQuery .= " AND appData.state = 'true'";
|
||||||
|
|
||||||
if($sType)
|
if($sType)
|
||||||
{
|
{
|
||||||
@@ -275,8 +271,8 @@ class appData
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if($sQueued == "true" || $sQueued == "false")
|
if($sState != 'all')
|
||||||
$sAppDataQueued = " AND appData.queued = '$sQueued'";
|
$sAppDataQueued = " AND appData.state = '$sState'";
|
||||||
else
|
else
|
||||||
$sAppDataQueued = '';
|
$sAppDataQueued = '';
|
||||||
|
|
||||||
@@ -330,21 +326,24 @@ class appData
|
|||||||
return $oTableRow;
|
return $oTableRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sType)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sType)
|
||||||
{
|
{
|
||||||
/* Not implemented for appData */
|
/* Not implemented for appData */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$sSelectType = "";
|
$sSelectType = "";
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
|
|
||||||
if($bQueued && !$_SESSION['current']->hasPriv("admin"))
|
if($sState != 'accepted' && !$_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT DISTINCT appData.* FROM appData, appMaintainers,
|
$sQuery = "SELECT DISTINCT appData.* FROM appData, appMaintainers,
|
||||||
appVersion, appFamily WHERE
|
appVersion, appFamily WHERE
|
||||||
appFamily.appId = appVersion.appId
|
appFamily.appId = appVersion.appId
|
||||||
AND
|
AND
|
||||||
|
AND
|
||||||
|
appMaintainers.state = 'accepted'
|
||||||
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
(
|
(
|
||||||
@@ -381,22 +380,21 @@ class appData
|
|||||||
AND
|
AND
|
||||||
appFamily.state = 'accepted'
|
appFamily.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
appData.queued = '?'
|
appData.state = '?'
|
||||||
AND
|
AND
|
||||||
appData.type = '?'
|
appData.type = '?'
|
||||||
ORDER BY appFamily.appName";
|
ORDER BY appFamily.appName";
|
||||||
if(!$iRows && !$iStart)
|
if(!$iRows && !$iStart)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||||
$bQueued ? "true" : "false", $sType);
|
$sState, $sType);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
|
$iRows = appData::objectGetEntriesCount($sState, $sType);
|
||||||
$bRejected, $sType);
|
|
||||||
$sQuery .= " LIMIT ?,?";
|
$sQuery .= " LIMIT ?,?";
|
||||||
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||||
$bQueued ? "true" : "false", $sType,
|
$sState, $sType,
|
||||||
$iStart, $iRows);
|
$iStart, $iRows);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -416,7 +414,7 @@ class appData
|
|||||||
AND
|
AND
|
||||||
appFamily.state = 'accepted'
|
appFamily.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
appData.queued = '?'
|
appData.state = '?'
|
||||||
AND
|
AND
|
||||||
appData.type = '?' ORDER BY appFamily.appName $sLimit
|
appData.type = '?' ORDER BY appFamily.appName $sLimit
|
||||||
)
|
)
|
||||||
@@ -434,22 +432,21 @@ class appData
|
|||||||
AND
|
AND
|
||||||
appFamily.state = 'accepted'
|
appFamily.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
appData.queued = '?'
|
appData.state = '?'
|
||||||
AND
|
AND
|
||||||
appData.type = '?' ORDER BY appFamily.appName $sLimit
|
appData.type = '?' ORDER BY appFamily.appName $sLimit
|
||||||
)";
|
)";
|
||||||
if(!$iRows && !$iStart)
|
if(!$iRows && !$iStart)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
|
$hResult = query_parameters($sQuery, $sState, $sType,
|
||||||
$bQueued ? "true" : "false", $sType);
|
$sState, $sType);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
|
$iRows = appData::objectGetEntriesCount($sState, $sType);
|
||||||
$bRejected, $sType);
|
$hResult = query_parameters($sQuery, $sState, $sType,
|
||||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
|
|
||||||
$iStart, $iRows,
|
$iStart, $iRows,
|
||||||
$bQueued ? "true" : "false", $sType,
|
$sState, $sType,
|
||||||
$iStart, $iRows);
|
$iStart, $iRows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -931,7 +931,7 @@ class Application {
|
|||||||
return $sLink;
|
return $sLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE)
|
public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE)
|
||||||
{
|
{
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
$sOrdering = $bAscending ? "ASC" : "DESC";
|
$sOrdering = $bAscending ? "ASC" : "DESC";
|
||||||
@@ -944,7 +944,7 @@ class Application {
|
|||||||
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
||||||
after an offset given by iStart */
|
after an offset given by iStart */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = maintainer::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = application::objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sQuery = "SELECT appFamily.*, vendor.vendorName AS vendorName FROM appFamily, vendor WHERE
|
$sQuery = "SELECT appFamily.*, vendor.vendorName AS vendorName FROM appFamily, vendor WHERE
|
||||||
@@ -952,12 +952,10 @@ class Application {
|
|||||||
AND
|
AND
|
||||||
appFamily.state = '?'";
|
appFamily.state = '?'";
|
||||||
|
|
||||||
$sState = objectManager::getStateString($bQueued, $bRejected);
|
if($sState != 'accepted' && !application::canEdit())
|
||||||
|
|
||||||
if($bQueued && !application::canEdit())
|
|
||||||
{
|
{
|
||||||
/* Without global edit rights a user can only view his rejected apps */
|
/* Without global edit rights a user can only view his rejected apps */
|
||||||
if(!$bRejected)
|
if($sState != 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$sQuery .= " AND appFamily.submitterId = '?' ORDER BY ? ?$sLimit";
|
$sQuery .= " AND appFamily.submitterId = '?' ORDER BY ? ?$sLimit";
|
||||||
@@ -1106,11 +1104,9 @@ class Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function objectGetEntriesCount($bQueued, $bRejected)
|
public static function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
$sState = objectManager::getStateString($bQueued, $bRejected);
|
if($sState != 'accepted' && !application::canEdit())
|
||||||
|
|
||||||
if($bQueued && !application::canEdit())
|
|
||||||
{
|
{
|
||||||
/* Without edit rights users can only resubmit their rejected entries */
|
/* Without edit rights users can only resubmit their rejected entries */
|
||||||
if(!$bRejected)
|
if(!$bRejected)
|
||||||
|
|||||||
@@ -378,14 +378,14 @@ class application_queue
|
|||||||
return $this->oApp->objectGetItemsPerPage($sState);
|
return $this->oApp->objectGetItemsPerPage($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
return $this->oApp->objectGetEntriesCount($bQueued, $bRejected);
|
return $this->oApp->objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "appId", $bAscending = TRUE)
|
||||||
{
|
{
|
||||||
return $this->oApp->objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
|
return $this->oApp->objectGetEntries($sState, $iRows, $iStart,
|
||||||
$sOrderBy, $bAscending);
|
$sOrderBy, $bAscending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class Bug
|
|||||||
$this->iLinkId = $oRow->linkId;
|
$this->iLinkId = $oRow->linkId;
|
||||||
$this->iBug_id = $oRow->bug_id;
|
$this->iBug_id = $oRow->bug_id;
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->bQueued = ($oRow->queued=="true") ? true : false;
|
$this->bQueued = ($oRow->state=='queued') ? true : false;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
/* lets fill in some blanks */
|
/* lets fill in some blanks */
|
||||||
@@ -125,12 +125,12 @@ class Bug
|
|||||||
|
|
||||||
/* passed the checks so lets insert the puppy! */
|
/* passed the checks so lets insert the puppy! */
|
||||||
$hResult = query_parameters("INSERT INTO buglinks (versionId, bug_id, ".
|
$hResult = query_parameters("INSERT INTO buglinks (versionId, bug_id, ".
|
||||||
"submitTime, submitterId, queued) ".
|
"submitTime, submitterId, state) ".
|
||||||
"VALUES('?', '?', ?, '?', '?')",
|
"VALUES('?', '?', ?, '?', '?')",
|
||||||
$this->iVersionId, $this->iBug_id,
|
$this->iVersionId, $this->iBug_id,
|
||||||
"NOW()",
|
"NOW()",
|
||||||
$_SESSION['current']->iUserId,
|
$_SESSION['current']->iUserId,
|
||||||
$this->bQueued ? "true":"false");
|
$this->bQueued ? 'queued' : 'accepted');
|
||||||
if($hResult)
|
if($hResult)
|
||||||
{
|
{
|
||||||
$this->iLinkId = query_appdb_insert_id();
|
$this->iLinkId = query_appdb_insert_id();
|
||||||
@@ -286,7 +286,7 @@ class Bug
|
|||||||
/* Get a list of bugs submitted by a given user */
|
/* Get a list of bugs submitted by a given user */
|
||||||
function listSubmittedBy($iUserId, $bQueued = true)
|
function listSubmittedBy($iUserId, $bQueued = true)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT appFamily.appName, buglinks.versionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id, buglinks.linkId FROM buglinks, appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND buglinks.versionId = appVersion.versionId AND buglinks.queued = '?' AND buglinks.submitterId = '?' ORDER BY buglinks.versionId", $bQueued ? "true" : "false", $iUserId);
|
$hResult = query_parameters("SELECT appFamily.appName, buglinks.versionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id, buglinks.linkId FROM buglinks, appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND buglinks.versionId = appVersion.versionId AND buglinks.state = '?' AND buglinks.submitterId = '?' ORDER BY buglinks.versionId", $bQueued ? 'queued' : 'accepted', $iUserId);
|
||||||
|
|
||||||
if(!$hResult || !query_num_rows($hResult))
|
if(!$hResult || !query_num_rows($hResult))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -365,7 +365,7 @@ class Bug
|
|||||||
return $this->iLinkId;
|
return $this->iLinkId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0)
|
||||||
{
|
{
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
|
|
||||||
@@ -373,19 +373,17 @@ class Bug
|
|||||||
wants to select all of them
|
wants to select all of them
|
||||||
after an offset given by iStart */
|
after an offset given by iStart */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = bug::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = bug::objectGetEntriesCount($sState);
|
||||||
|
|
||||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
$sQuery = "select * from buglinks where state = '?' LIMIT ?, ?";
|
||||||
$sQuery = "select * from buglinks where queued = '?' LIMIT ?, ?";
|
$hResult = query_parameters($sQuery, $sState, $iStart, $iRows);
|
||||||
$hResult = query_parameters($sQuery, $sQueued, $iStart, $iRows);
|
|
||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
$sQuery = "select count(*) as cnt from buglinks where state = '?'";
|
||||||
$sQuery = "select count(*) as cnt from buglinks where queued = '?'";
|
$hResult = query_parameters($sQuery, $sState);
|
||||||
$hResult = query_parameters($sQuery, $sQueued);
|
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
return $oRow->cnt;
|
return $oRow->cnt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ class Comment {
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
echo "<li><a href=\"commentview.php?iAppId={$oRow->appId}&iVersionId=".
|
echo "<li><a href=\"commentview.php?iAppId={$oRow->appId}&iVersionId=".
|
||||||
"{$oRow->versionId}&iThreadId={$oRow->parentId}\" ".
|
"{$oRow->versionId}&iThreadId={$oRow->parentId}\" ".
|
||||||
"name=\"Comment-{$oRow->commentId}\"> ".
|
"name=\"Comment-{$oRow->commentId}\"> ".
|
||||||
$oRow->subject.' </a> by '.forum_lookup_user($oRow->userId).' on '.$oRow->time.' </li>'."\n";
|
$oRow->subject.' </a> by '.forum_lookup_user($oRow->userId).' on '.$oRow->time.' </li>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -496,15 +496,15 @@ class distribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the total number of Distributions in the database */
|
/* Get the total number of Distributions in the database */
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$hResult = query_parameters("SELECT count(distributionId) as num_dists FROM
|
$hResult = query_parameters("SELECT count(distributionId) as num_dists FROM
|
||||||
distributions WHERE state='?'",
|
distributions WHERE state='?'",
|
||||||
$bQueued ? 'queued' : 'accepted');
|
$sState);
|
||||||
|
|
||||||
if($hResult)
|
if($hResult)
|
||||||
{
|
{
|
||||||
@@ -555,27 +555,27 @@ class distribution {
|
|||||||
return array('name');
|
return array('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "name", $bAscending = TRUE)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "name", $bAscending = TRUE)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Only users with edit privileges are allowed to view queued
|
/* Only users with edit privileges are allowed to view queued
|
||||||
items, so return NULL in that case */
|
items, so return NULL in that case */
|
||||||
if($bQueued && !distribution::canEdit())
|
if($sState != 'accepted' && !distribution::canEdit())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
$sOrder = $bAscending ? "ASC" : "DESC";
|
$sOrder = $bAscending ? "ASC" : "DESC";
|
||||||
|
|
||||||
/* If row limit is 0 we want to fetch all rows */
|
/* If row limit is 0 we want to fetch all rows */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = distribution::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = distribution::objectGetEntriesCount($sState);
|
||||||
|
|
||||||
$sQuery = "SELECT * FROM distributions
|
$sQuery = "SELECT * FROM distributions
|
||||||
WHERE state = '?' ORDER BY $sOrderBy $sOrder LIMIT ?,?";
|
WHERE state = '?' ORDER BY $sOrderBy $sOrder LIMIT ?,?";
|
||||||
|
|
||||||
return query_parameters($sQuery, $bQueued ? 'queued' : 'accepted',
|
return query_parameters($sQuery, $sState,
|
||||||
$iStart, $iRows);
|
$iStart, $iRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class downloadurl
|
|||||||
if(!$oRow)
|
if(!$oRow)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT id, versionId, description, url,
|
$hResult = query_parameters("SELECT id, versionId, description, url,
|
||||||
submitTime, submitterId, queued FROM appData WHERE id = '?'",
|
submitTime, submitterId, state FROM appData WHERE id = '?'",
|
||||||
$iId);
|
$iId);
|
||||||
|
|
||||||
if($hResult && query_num_rows($hResult))
|
if($hResult && query_num_rows($hResult))
|
||||||
@@ -40,7 +40,7 @@ class downloadurl
|
|||||||
$this->sUrl = $oRow->url;
|
$this->sUrl = $oRow->url;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
$this->bQueued = ($oRow->queued == "true") ? TRUE : FALSE;
|
$this->bQueued = ($oRow->state == 'queued') ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,11 +321,11 @@ class downloadurl
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$hResult = query_parameters("INSERT INTO appData (versionId, type,
|
$hResult = query_parameters("INSERT INTO appData (versionId, type,
|
||||||
description, url, queued, submitTime, submitterId)
|
description, url, state, submitTime, submitterId)
|
||||||
VALUES('?', '?', '?', '?', '?', ?, '?')",
|
VALUES('?', '?', '?', '?', '?', ?, '?')",
|
||||||
$this->iVersionId, "downloadurl", $this->sDescription,
|
$this->iVersionId, "downloadurl", $this->sDescription,
|
||||||
$this->sUrl,
|
$this->sUrl,
|
||||||
downloadurl::canEdit($this->iVersionId) ? "false" : "true",
|
downloadurl::canEdit($this->iVersionId) ? 'accepted' : 'queued',
|
||||||
"NOW()",
|
"NOW()",
|
||||||
$_SESSION['current']->iUserId);
|
$_SESSION['current']->iUserId);
|
||||||
|
|
||||||
@@ -427,10 +427,9 @@ class downloadurl
|
|||||||
return $oAppData->reject();
|
return $oAppData->reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0)
|
||||||
{
|
{
|
||||||
return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
|
return appData::objectGetEntries($sState, $iRows, $iStart, 'downloadurl');
|
||||||
"downloadurl");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetHeader()
|
function objectGetHeader()
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ class queuedEntries
|
|||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// queued screenshots
|
// queued screenshots
|
||||||
$sQuery = "select * from appData where type = 'screenshot' and versionId = '?' and queued = '?'";
|
$sQuery = "select * from appData where type = 'screenshot' and versionId = '?' and state = '?'";
|
||||||
$hResult = query_parameters($sQuery, $iVersionId, "true");
|
$hResult = query_parameters($sQuery, $iVersionId, 'queued');
|
||||||
while($oScreenshotRow = query_fetch_object($hResult))
|
while($oScreenshotRow = query_fetch_object($hResult))
|
||||||
{
|
{
|
||||||
$oScreenshot = new Screenshot(null, $oScreenshotRow);
|
$oScreenshot = new Screenshot(null, $oScreenshotRow);
|
||||||
@@ -157,7 +157,7 @@ class maintainer
|
|||||||
var $sMaintainReason;
|
var $sMaintainReason;
|
||||||
var $bSuperMaintainer;
|
var $bSuperMaintainer;
|
||||||
var $aSubmitTime; //FIXME: should be 'sSubmitTime'
|
var $aSubmitTime; //FIXME: should be 'sSubmitTime'
|
||||||
var $bQueued; //FIXME: Should be sQueued
|
var $sState;
|
||||||
var $sReplyText;
|
var $sReplyText;
|
||||||
|
|
||||||
// parameters used in the queued data notification system
|
// parameters used in the queued data notification system
|
||||||
@@ -191,7 +191,7 @@ class maintainer
|
|||||||
$this->sMaintainReason = $oRow->maintainReason;
|
$this->sMaintainReason = $oRow->maintainReason;
|
||||||
$this->bSuperMaintainer = $oRow->superMaintainer;
|
$this->bSuperMaintainer = $oRow->superMaintainer;
|
||||||
$this->aSubmitTime = $oRow->submitTime;
|
$this->aSubmitTime = $oRow->submitTime;
|
||||||
$this->bQueued = $oRow->queued;
|
$this->sState = $oRow->state;
|
||||||
|
|
||||||
$this->iNotificationLevel = $oRow->notificationLevel;
|
$this->iNotificationLevel = $oRow->notificationLevel;
|
||||||
$this->sNotificationTime = $oRow->notificationTime;
|
$this->sNotificationTime = $oRow->notificationTime;
|
||||||
@@ -215,16 +215,16 @@ class maintainer
|
|||||||
|
|
||||||
if($oApp->objectGetState() != 'accepted' ||
|
if($oApp->objectGetState() != 'accepted' ||
|
||||||
(!$this->bSuperMaintainer && $oVersion->objectGetState() != 'accepted'))
|
(!$this->bSuperMaintainer && $oVersion->objectGetState() != 'accepted'))
|
||||||
$this->sQueued = "pending";
|
$this->sState = "pending";
|
||||||
else
|
else
|
||||||
$this->sQueued = $this->mustBeQueued() ? "true" : "false";
|
$this->sState = $this->mustBeQueued() ? 'queued' : 'accepted';
|
||||||
|
|
||||||
$hResult = query_parameters("INSERT INTO appMaintainers (appId, versionId, ".
|
$hResult = query_parameters("INSERT INTO appMaintainers (appId, versionId, ".
|
||||||
"userId, maintainReason, superMaintainer, submitTime, queued) ".
|
"userId, maintainReason, superMaintainer, submitTime, state) ".
|
||||||
"VALUES ('?', '?', '?', '?', '?', ?, '?')",
|
"VALUES ('?', '?', '?', '?', '?', ?, '?')",
|
||||||
$this->iAppId, $this->iVersionId,
|
$this->iAppId, $this->iVersionId,
|
||||||
$this->iUserId, $this->sMaintainReason,
|
$this->iUserId, $this->sMaintainReason,
|
||||||
$this->bSuperMaintainer, "NOW()", $this->sQueued);
|
$this->bSuperMaintainer, "NOW()", $this->sState);
|
||||||
|
|
||||||
/* this objects id is the insert id returned by the database */
|
/* this objects id is the insert id returned by the database */
|
||||||
$this->iMaintainerId = query_appdb_insert_id();
|
$this->iMaintainerId = query_appdb_insert_id();
|
||||||
@@ -250,7 +250,7 @@ class maintainer
|
|||||||
((!$this->bSuperMaintainer && !$oUser->isMaintainer($this->iVersionId)) || $this->bSuperMaintainer))
|
((!$this->bSuperMaintainer && !$oUser->isMaintainer($this->iVersionId)) || $this->bSuperMaintainer))
|
||||||
{
|
{
|
||||||
/* unqueue the maintainer entry */
|
/* unqueue the maintainer entry */
|
||||||
$hResult = query_parameters("UPDATE appMaintainers SET queued='false' WHERE userId = '?' AND maintainerId = '?'",
|
$hResult = query_parameters("UPDATE appMaintainers SET state='accepted' WHERE userId = '?' AND maintainerId = '?'",
|
||||||
$this->iUserId, $this->iMaintainerId);
|
$this->iUserId, $this->iMaintainerId);
|
||||||
|
|
||||||
if($hResult)
|
if($hResult)
|
||||||
@@ -285,7 +285,7 @@ class maintainer
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
/* Delete entry, but only if queued */
|
/* Delete entry, but only if queued */
|
||||||
query_parameters("DELETE from appMaintainers WHERE userId = '?' AND maintainerId = '?' AND queued = 'true'", $this->iUserId, $this->iMaintainerId);
|
query_parameters("DELETE from appMaintainers WHERE userId = '?' AND maintainerId = '?' AND state = 'queued'", $this->iUserId, $this->iMaintainerId);
|
||||||
|
|
||||||
if($oUser->isSuperMaintainer($this->iAppId) && !$this->bSuperMaintainer)
|
if($oUser->isSuperMaintainer($this->iAppId) && !$this->bSuperMaintainer)
|
||||||
$sStatusMessage = "<p>User is already a super maintainer of this application</p>\n";
|
$sStatusMessage = "<p>User is already a super maintainer of this application</p>\n";
|
||||||
@@ -394,10 +394,10 @@ class maintainer
|
|||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ObjectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
function ObjectGetEntries($sState, $iRows = 0, $iStart = 0)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
@@ -410,24 +410,24 @@ class maintainer
|
|||||||
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
||||||
after an offset given by iStart */
|
after an offset given by iStart */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = maintainer::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = maintainer::objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Excluding requests for queued apps and versions, as these will be
|
/* Excluding requests for queued apps and versions, as these will be
|
||||||
handled automatically */
|
handled automatically */
|
||||||
$sQuery = "SELECT * FROM appMaintainers WHERE
|
$sQuery = "SELECT * FROM appMaintainers WHERE
|
||||||
appMaintainers.queued = '?'$sLimit";
|
appMaintainers.state = '?'$sLimit";
|
||||||
|
|
||||||
if($bQueued)
|
if($sState != 'accepted')
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
if($sLimit)
|
if($sLimit)
|
||||||
{
|
{
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false", $iStart, $iRows);
|
return query_parameters($sQuery, $sState, $iStart, $iRows);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false");
|
return query_parameters($sQuery, $sState);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
@@ -437,10 +437,10 @@ class maintainer
|
|||||||
{
|
{
|
||||||
if($sLimit)
|
if($sLimit)
|
||||||
{
|
{
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false", $iStart, $iRows);
|
return query_parameters($sQuery, $sState, $iStart, $iRows);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false");
|
return query_parameters($sQuery, $sState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -456,8 +456,8 @@ class maintainer
|
|||||||
function getMaintainerCountForUser($oUser, $bSuperMaintainer)
|
function getMaintainerCountForUser($oUser, $bSuperMaintainer)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT count(*) as cnt from appMaintainers WHERE userid = '?' AND superMaintainer = '?'".
|
$sQuery = "SELECT count(*) as cnt from appMaintainers WHERE userid = '?' AND superMaintainer = '?'".
|
||||||
" AND queued ='?'";
|
" AND state ='?'";
|
||||||
$hResult = query_parameters($sQuery, $oUser->iUserId, $bSuperMaintainer ? "1" : "0", "false");
|
$hResult = query_parameters($sQuery, $oUser->iUserId, $bSuperMaintainer ? "1" : "0", 'accepted');
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
return 0;
|
return 0;
|
||||||
$oRow = query_fetch_object($hResult);
|
$oRow = query_fetch_object($hResult);
|
||||||
@@ -472,8 +472,8 @@ class maintainer
|
|||||||
/* retrieve the list of application and order them by application name */
|
/* retrieve the list of application and order them by application name */
|
||||||
$hResult = query_parameters("SELECT appMaintainers.appId, versionId, superMaintainer, appName FROM ".
|
$hResult = query_parameters("SELECT appMaintainers.appId, versionId, superMaintainer, appName FROM ".
|
||||||
"appFamily, appMaintainers WHERE appFamily.appId = appMaintainers.appId ".
|
"appFamily, appMaintainers WHERE appFamily.appId = appMaintainers.appId ".
|
||||||
"AND userId = '?' AND appMaintainers.queued = '?' ORDER BY appName",
|
"AND userId = '?' AND appMaintainers.state = '?' ORDER BY appName",
|
||||||
$oUser->iUserId, "false");
|
$oUser->iUserId, 'accepted');
|
||||||
if(!$hResult || query_num_rows($hResult) == 0)
|
if(!$hResult || query_num_rows($hResult) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -488,18 +488,18 @@ class maintainer
|
|||||||
return $aAppsMaintained;
|
return $aAppsMaintained;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Excluding requests for queued apps and versions, as these are handled
|
/* Excluding requests for queued apps and versions, as these are handled
|
||||||
automatically. One SELECT for super maintainers, one for maintainers. */
|
automatically. One SELECT for super maintainers, one for maintainers. */
|
||||||
$sQuery = "SELECT COUNT(maintainerId) as count FROM appMaintainers WHERE
|
$sQuery = "SELECT COUNT(maintainerId) as count FROM appMaintainers WHERE
|
||||||
appMaintainers.queued = '?'";
|
appMaintainers.state = '?'";
|
||||||
|
|
||||||
if(!($hResult = query_parameters($sQuery, $bQueued ? "true" : "false")))
|
if(!($hResult = query_parameters($sQuery, $sState)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if($oRow = query_fetch_object($hResult))
|
if($oRow = query_fetch_object($hResult))
|
||||||
@@ -510,15 +510,6 @@ class maintainer
|
|||||||
return $iCount;
|
return $iCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see how many maintainer entries we have in the database */
|
|
||||||
function getMaintainerCount()
|
|
||||||
{
|
|
||||||
$sQuery = "SELECT count(*) as maintainers FROM appMaintainers where queued='false'";
|
|
||||||
$hResult = query_parameters($sQuery);
|
|
||||||
$oRow = query_fetch_object($hResult);
|
|
||||||
return $oRow->maintainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* see how many unique maintainers we actually have */
|
/* see how many unique maintainers we actually have */
|
||||||
function getNumberOfMaintainers()
|
function getNumberOfMaintainers()
|
||||||
{
|
{
|
||||||
@@ -536,12 +527,12 @@ class maintainer
|
|||||||
/* otherwise check if we maintain this specific version */
|
/* otherwise check if we maintain this specific version */
|
||||||
if($iVersionId)
|
if($iVersionId)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT * FROM appMaintainers WHERE userId = '?' AND versionId = '?' AND queued = '?'";
|
$sQuery = "SELECT * FROM appMaintainers WHERE userId = '?' AND versionId = '?' AND state = '?'";
|
||||||
$hResult = query_parameters($sQuery, $oUser->iUserId, $iVersionId, "false");
|
$hResult = query_parameters($sQuery, $oUser->iUserId, $iVersionId, 'accepted');
|
||||||
} else // are we maintaining any version ?
|
} else // are we maintaining any version ?
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT * FROM appMaintainers WHERE userId = '?' AND queued = '?'";
|
$sQuery = "SELECT * FROM appMaintainers WHERE userId = '?' AND state = '?'";
|
||||||
$hResult = query_parameters($sQuery, $oUser->iUserId, "false");
|
$hResult = query_parameters($sQuery, $oUser->iUserId, 'accepted');
|
||||||
}
|
}
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
return false;
|
return false;
|
||||||
@@ -553,12 +544,12 @@ class maintainer
|
|||||||
{
|
{
|
||||||
if($iAppId)
|
if($iAppId)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT * FROM appMaintainers WHERE userid = '?' AND appId = '?' AND superMaintainer = '1' AND queued = '?'";
|
$sQuery = "SELECT * FROM appMaintainers WHERE userid = '?' AND appId = '?' AND superMaintainer = '1' AND state = '?'";
|
||||||
$hResult = query_parameters($sQuery, $oUser->iUserId, $iAppId, "false");
|
$hResult = query_parameters($sQuery, $oUser->iUserId, $iAppId, 'accepted');
|
||||||
} else /* are we super maintainer of any applications? */
|
} else /* are we super maintainer of any applications? */
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT * FROM appMaintainers WHERE userid = '?' AND superMaintainer = '1' AND queued = '?'";
|
$sQuery = "SELECT * FROM appMaintainers WHERE userid = '?' AND superMaintainer = '1' AND state'?'";
|
||||||
$hResult = query_parameters($sQuery, $oUser->iUserId, "false");
|
$hResult = query_parameters($sQuery, $oUser->iUserId, 'accepted');
|
||||||
}
|
}
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
return false;
|
return false;
|
||||||
@@ -575,7 +566,7 @@ class maintainer
|
|||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT userId from appMaintainers, appVersion
|
$hResult = query_parameters("SELECT userId from appMaintainers, appVersion
|
||||||
WHERE
|
WHERE
|
||||||
appMaintainers.queued = 'false'
|
appMaintainers.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
appVersion.versionId = '?'
|
appVersion.versionId = '?'
|
||||||
AND
|
AND
|
||||||
@@ -595,7 +586,7 @@ class maintainer
|
|||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT userId
|
$hResult = query_parameters("SELECT userId
|
||||||
FROM appMaintainers
|
FROM appMaintainers
|
||||||
WHERE appId = '?' AND queued = 'false'",
|
WHERE appId = '?' AND state = 'accepted'",
|
||||||
$iAppId);
|
$iAppId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,8 +600,8 @@ class maintainer
|
|||||||
{
|
{
|
||||||
$sQuery = "SELECT userId FROM ".
|
$sQuery = "SELECT userId FROM ".
|
||||||
"appMaintainers WHERE appId = '?' " .
|
"appMaintainers WHERE appId = '?' " .
|
||||||
"AND superMaintainer = '1' AND queued='?';";
|
"AND superMaintainer = '1' AND state='?';";
|
||||||
$hResult = query_parameters($sQuery, $iAppId, "false");
|
$hResult = query_parameters($sQuery, $iAppId, 'accepted');
|
||||||
$aUserIds = array();
|
$aUserIds = array();
|
||||||
$c = 0;
|
$c = 0;
|
||||||
while($oRow = query_fetch_object($hResult))
|
while($oRow = query_fetch_object($hResult))
|
||||||
@@ -909,7 +900,7 @@ class maintainer
|
|||||||
{
|
{
|
||||||
$oSubmitter = new user($this->iSubmitterId);
|
$oSubmitter = new user($this->iSubmitterId);
|
||||||
|
|
||||||
$sVerb = $this->sQueued == "true" ? "rejected" : "removed";
|
$sVerb = $this->sState == 'queued' ? 'rejected' : 'removed';
|
||||||
|
|
||||||
if($this->bSuperMaintainer)
|
if($this->bSuperMaintainer)
|
||||||
{
|
{
|
||||||
@@ -929,7 +920,7 @@ class maintainer
|
|||||||
{
|
{
|
||||||
case "delete":
|
case "delete":
|
||||||
$sSubject = "Maintainership for $sFor $sVerb";
|
$sSubject = "Maintainership for $sFor $sVerb";
|
||||||
if($this->sQueued == "true")
|
if($this->sState == 'queued')
|
||||||
{
|
{
|
||||||
$sMsg = "Your request to be a maintainer of '$sFor'".
|
$sMsg = "Your request to be a maintainer of '$sFor'".
|
||||||
" has been denied.";
|
" has been denied.";
|
||||||
@@ -949,7 +940,7 @@ class maintainer
|
|||||||
if(!$bParentAction)
|
if(!$bParentAction)
|
||||||
{
|
{
|
||||||
$sSubject = "Maintainership for $sFor $sVerb";
|
$sSubject = "Maintainership for $sFor $sVerb";
|
||||||
if($this->bQueued == "false")
|
if($this->sState == 'accepted')
|
||||||
{
|
{
|
||||||
$sMsg = $oSubmitter->sRealName." has been removed as a ".
|
$sMsg = $oSubmitter->sRealName." has been removed as a ".
|
||||||
"maintainer of $sFor.";
|
"maintainer of $sFor.";
|
||||||
@@ -1340,7 +1331,7 @@ class maintainer
|
|||||||
function notifyMaintainersOfQueuedData()
|
function notifyMaintainersOfQueuedData()
|
||||||
{
|
{
|
||||||
// retrieve all of the maintainers
|
// retrieve all of the maintainers
|
||||||
$hResult = maintainer::objectGetEntries(false, false);
|
$hResult = maintainer::objectGetEntries('accepted');
|
||||||
|
|
||||||
// echo "Processing ".query_num_rows($hResult)." maintainers\n";
|
// echo "Processing ".query_num_rows($hResult)." maintainers\n";
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ class Monitor {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected)
|
function objectGetEntries($sState)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT * FROM appMonitors");
|
$hResult = query_parameters("SELECT * FROM appMonitors");
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ class Monitor {
|
|||||||
return $hResult;
|
return $hResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT COUNT(DISTINCT monitorId) as count
|
$hResult = query_parameters("SELECT COUNT(DISTINCT monitorId) as count
|
||||||
FROM appMonitors");
|
FROM appMonitors");
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ class Note {
|
|||||||
// do not support queuing at this point
|
// do not support queuing at this point
|
||||||
// TODO: we have no permissions scope on retrieving entries
|
// TODO: we have no permissions scope on retrieving entries
|
||||||
// as notes are typically only added to unqueued versions
|
// as notes are typically only added to unqueued versions
|
||||||
function objectGetEntries($bQueued, $bRejected)
|
function objectGetEntries($sState)
|
||||||
{
|
{
|
||||||
$sQuery = "select * from appNotes";
|
$sQuery = "select * from appNotes";
|
||||||
$hResult = query_parameters($sQuery);
|
$hResult = query_parameters($sQuery);
|
||||||
|
|||||||
@@ -283,14 +283,14 @@ class ObjectManager
|
|||||||
/* Has the user chosen a particular field to sort by? If not we want to use the default */
|
/* Has the user chosen a particular field to sort by? If not we want to use the default */
|
||||||
if($this->oSortInfo->sCurrentSort)
|
if($this->oSortInfo->sCurrentSort)
|
||||||
{
|
{
|
||||||
$hResult = $oObject->objectGetEntries($this->getIsQueue(), $this->sState == 'rejected',
|
$hResult = $oObject->objectGetEntries($this->sState,
|
||||||
$this->oMultiPage->iItemsPerPage,
|
$this->oMultiPage->iItemsPerPage,
|
||||||
$this->oMultiPage->iLowerLimit,
|
$this->oMultiPage->iLowerLimit,
|
||||||
$this->oSortInfo->sCurrentSort,
|
$this->oSortInfo->sCurrentSort,
|
||||||
$this->oSortInfo->bAscending);
|
$this->oSortInfo->bAscending);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$hResult = $oObject->objectGetEntries($this->getIsQueue(), $this->sState == 'rejected',
|
$hResult = $oObject->objectGetEntries($this->sState,
|
||||||
$this->oMultiPage->iItemsPerPage,
|
$this->oMultiPage->iItemsPerPage,
|
||||||
$this->oMultiPage->iLowerLimit);
|
$this->oMultiPage->iLowerLimit);
|
||||||
}
|
}
|
||||||
@@ -299,12 +299,12 @@ class ObjectManager
|
|||||||
/* Has the user chosen a particular field to sort by? If not we want to use the default */
|
/* Has the user chosen a particular field to sort by? If not we want to use the default */
|
||||||
if($this->oSortInfo->sCurrentSort)
|
if($this->oSortInfo->sCurrentSort)
|
||||||
{
|
{
|
||||||
$hResult = $oObject->objectGetEntries($this->getIsQueue(), $this->sState == 'rejected',
|
$hResult = $oObject->objectGetEntries($this->sState,
|
||||||
$this->oSortInfo->sCurrentSort,
|
$this->oSortInfo->sCurrentSort,
|
||||||
$this->oSortInfo->bAscending);
|
$this->oSortInfo->bAscending);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$hResult = $oObject->objectGetEntries($this->getIsQueue(), $this->sState == 'rejected');
|
$hResult = $oObject->objectGetEntries($this->sState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -783,7 +783,7 @@ class ObjectManager
|
|||||||
|
|
||||||
$oObject = $this->getObject();
|
$oObject = $this->getObject();
|
||||||
|
|
||||||
$hResult = $oObject->objectGetEntries(true, true);
|
$hResult = $oObject->objectGetEntries('rejected');
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
{
|
{
|
||||||
@@ -899,7 +899,7 @@ class ObjectManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We only allow moving to non-queued objects */
|
/* We only allow moving to non-queued objects */
|
||||||
if(!$hResult = $oObject->objectGetEntries(false, false))
|
if(!$hResult = $oObject->objectGetEntries('accepted'))
|
||||||
{
|
{
|
||||||
echo "Failed to get list of objects.<br />\n";
|
echo "Failed to get list of objects.<br />\n";
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1381,7 +1381,7 @@ class ObjectManager
|
|||||||
$sControls .= "</form></p>";
|
$sControls .= "</form></p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$iTotalEntries = $oObject->objectGetEntriesCount($this->getIsQueue(), $this->sState == 'rejected');
|
$iTotalEntries = $oObject->objectGetEntriesCount($this->sState);
|
||||||
$iNumPages = ceil($iTotalEntries / $iItemsPerPage);
|
$iNumPages = ceil($iTotalEntries / $iItemsPerPage);
|
||||||
if($iNumPages == 0)
|
if($iNumPages == 0)
|
||||||
$iNumPages = 1;
|
$iNumPages = 1;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class screenshot
|
|||||||
$this->iAppId = $oRow->appId;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->sUrl = $oRow->url;
|
$this->sUrl = $oRow->url;
|
||||||
$this->bQueued = ($oRow->queued=="true")?true:false;
|
$this->bQueued = ($oRow->state=='queued')?true:false;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
$this->hFile = null;
|
$this->hFile = null;
|
||||||
@@ -71,11 +71,11 @@ class screenshot
|
|||||||
function create()
|
function create()
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("INSERT INTO appData
|
$hResult = query_parameters("INSERT INTO appData
|
||||||
(versionId, type, description, queued, submitTime, submitterId)
|
(versionId, type, description, state, submitTime, submitterId)
|
||||||
VALUES('?', '?', '?', '?', ?, '?')",
|
VALUES('?', '?', '?', '?', ?, '?')",
|
||||||
$this->iVersionId, "screenshot",
|
$this->iVersionId, "screenshot",
|
||||||
$this->sDescription,
|
$this->sDescription,
|
||||||
$this->mustBeQueued() ? "true" : "false",
|
$this->mustBeQueued() ? 'queued' : 'accepted',
|
||||||
"NOW()",
|
"NOW()",
|
||||||
$_SESSION['current']->iUserId);
|
$_SESSION['current']->iUserId);
|
||||||
if($hResult)
|
if($hResult)
|
||||||
@@ -173,8 +173,8 @@ class screenshot
|
|||||||
if(!$this->bQueued)
|
if(!$this->bQueued)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(query_parameters("UPDATE appData SET queued = '?' WHERE id='?'",
|
if(query_parameters("UPDATE appData SET state = '?' WHERE id='?'",
|
||||||
"false", $this->iScreenshotId))
|
'accepted', $this->iScreenshotId))
|
||||||
{
|
{
|
||||||
$this->bQueued = false;
|
$this->bQueued = false;
|
||||||
// we send an e-mail to interested people
|
// we send an e-mail to interested people
|
||||||
@@ -479,7 +479,7 @@ class screenshot
|
|||||||
WHERE appData.versionId = appVersion.versionId
|
WHERE appData.versionId = appVersion.versionId
|
||||||
AND appVersion.appId = '?'
|
AND appVersion.appId = '?'
|
||||||
AND type = 'screenshot'
|
AND type = 'screenshot'
|
||||||
AND appData.queued = 'false'
|
AND appData.state = 'accepted'
|
||||||
ORDER BY rand", $iAppId);
|
ORDER BY rand", $iAppId);
|
||||||
} else if ($iVersionId) // we want a random screenshot for this version
|
} else if ($iVersionId) // we want a random screenshot for this version
|
||||||
{
|
{
|
||||||
@@ -487,7 +487,7 @@ class screenshot
|
|||||||
FROM appData
|
FROM appData
|
||||||
WHERE versionId = '?'
|
WHERE versionId = '?'
|
||||||
AND type = 'screenshot'
|
AND type = 'screenshot'
|
||||||
AND queued = 'false'
|
AND state = 'accepted'
|
||||||
ORDER BY rand", $iVersionId);
|
ORDER BY rand", $iVersionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ class screenshot
|
|||||||
WHERE appVersion.versionId = appData.versionId
|
WHERE appVersion.versionId = appData.versionId
|
||||||
AND type = 'screenshot'
|
AND type = 'screenshot'
|
||||||
AND appVersion.appId = '?'
|
AND appVersion.appId = '?'
|
||||||
AND appData.queued = '?'", $iAppId, $bQueued);
|
AND appData.state = '?'", $iAppId, ($bQueued == 'false') ? 'accepted' : 'queued');
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We want all screenshots for this version.
|
* We want all screenshots for this version.
|
||||||
@@ -557,7 +557,7 @@ class screenshot
|
|||||||
WHERE appVersion.versionId = appData.versionId
|
WHERE appVersion.versionId = appData.versionId
|
||||||
AND type = 'screenshot'
|
AND type = 'screenshot'
|
||||||
AND appData.versionId = '?'
|
AND appData.versionId = '?'
|
||||||
AND appData.queued = '?'", $iVersionId, $bQueued);
|
AND appData.state = '?'", $iVersionId, ($bQueued == 'false') ? 'accepted' : 'queued');
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -649,16 +649,15 @@ class screenshot
|
|||||||
echo "</tr></table></div><br />\n";
|
echo "</tr></table></div><br />\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0)
|
||||||
{
|
{
|
||||||
return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
|
return appData::objectGetEntries($sState, $iRows, $iStart,
|
||||||
"screenshot");
|
"screenshot");
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
function objectGetEntriesCount($sState, $iRows = 0, $iStart = 0)
|
||||||
{
|
{
|
||||||
return appData::objectGetEntriesCount($bQueued, $bRejected,
|
return appData::objectGetEntriesCount($sState, 'screenshot');
|
||||||
'screenshot');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetHeader()
|
function objectGetHeader()
|
||||||
|
|||||||
@@ -9,34 +9,33 @@ function global_admin_menu() {
|
|||||||
|
|
||||||
$g = new htmlmenu("Global Admin");
|
$g = new htmlmenu("Global Admin");
|
||||||
|
|
||||||
$g->add("App Queue (".application::objectGetEntriesCount(true, false).")",
|
$g->add("App Queue (".application::objectGetEntriesCount('queued').")",
|
||||||
BASE.'objectManager.php?sClass=application_queue&sState=queued&sTitle='.
|
BASE.'objectManager.php?sClass=application_queue&sState=queued&sTitle='.
|
||||||
'Application%20Queue');
|
'Application%20Queue');
|
||||||
$g->add("Version Queue (".version::objectGetEntriesCount(true, false).")",
|
$g->add("Version Queue (".version::objectGetEntriesCount('queued').")",
|
||||||
BASE.'objectManager.php?sClass=version_queue&sState=queued&sTitle='.
|
BASE.'objectManager.php?sClass=version_queue&sState=queued&sTitle='.
|
||||||
'Version%20Queue');
|
'Version%20Queue');
|
||||||
$g->add("Screenshot Queue (".appData::objectGetEntriesCount("true",
|
$g->add("Screenshot Queue (".appData::objectGetEntriesCount('queued', "screenshot").")",
|
||||||
false, "screenshot").")",
|
|
||||||
BASE.'objectManager.php?sClass=screenshot&sState=queued&sTitle='.
|
BASE.'objectManager.php?sClass=screenshot&sState=queued&sTitle='.
|
||||||
'Screenshot%20Queue');
|
'Screenshot%20Queue');
|
||||||
$g->add("Maintainer Queue (".Maintainer::objectGetEntriesCount(true, false).")",
|
$g->add("Maintainer Queue (".Maintainer::objectGetEntriesCount('queued').")",
|
||||||
BASE.'objectManager.php?sClass=maintainer&sState=queued&sTitle='.
|
BASE.'objectManager.php?sClass=maintainer&sState=queued&sTitle='.
|
||||||
'Maintainer%20Queue');
|
'Maintainer%20Queue');
|
||||||
$g->add("Test Results Queue (".testData::objectGetEntriesCount(true, false).")",
|
$g->add("Test Results Queue (".testData::objectGetEntriesCount('queued').")",
|
||||||
BASE.'objectManager.php?sClass=testData_queue&sState=queued&sTitle='.
|
BASE.'objectManager.php?sClass=testData_queue&sState=queued&sTitle='.
|
||||||
'Test%20Results%20Queue');
|
'Test%20Results%20Queue');
|
||||||
$g->add("Bug Link Queue (".bug::objectGetEntriesCount(true, false).")",
|
$g->add("Bug Link Queue (".bug::objectGetEntriesCount('queued').")",
|
||||||
BASE.'objectManager.php?sClass=bug&sState=queued&sTitle='.
|
BASE.'objectManager.php?sClass=bug&sState=queued&sTitle='.
|
||||||
'Bug%20Link%20Queue');
|
'Bug%20Link%20Queue');
|
||||||
|
|
||||||
$g->addmisc(" ");
|
$g->addmisc(" ");
|
||||||
|
|
||||||
$g->add("Maintainer Entries (".Maintainer::getMaintainerCount().")",
|
$g->add("Maintainer Entries (".Maintainer::objectGetEntriesCount('accepted').")",
|
||||||
BASE."admin/adminMaintainers.php");
|
BASE."admin/adminMaintainers.php");
|
||||||
$g->add("Bug Links (".bug::objectGetEntriesCount(false, false).")",
|
$g->add("Bug Links (".bug::objectGetEntriesCount('accepted').")",
|
||||||
BASE."objectManager.php?sClass=bug&sTitle=".
|
BASE."objectManager.php?sClass=bug&sTitle=".
|
||||||
"Bug%20Links");
|
"Bug%20Links");
|
||||||
$g->add("Test Results (".testData::objectGetEntriesCount(false, false).")",
|
$g->add("Test Results (".testData::objectGetEntriesCount('accepted').")",
|
||||||
BASE."objectManager.php?sClass=testData&sTitle=".
|
BASE."objectManager.php?sClass=testData&sTitle=".
|
||||||
"View%20Test%20Results");
|
"View%20Test%20Results");
|
||||||
$g->add("Users Management", BASE."admin/adminUsers.php");
|
$g->add("Users Management", BASE."admin/adminUsers.php");
|
||||||
@@ -45,15 +44,13 @@ function global_admin_menu() {
|
|||||||
|
|
||||||
$g->addmisc(" ");
|
$g->addmisc(" ");
|
||||||
|
|
||||||
$g->add("Rejected Applications (".application::objectGetEntriesCount(true,
|
$g->add("Rejected Applications (".application::objectGetEntriesCount('rejected').")",
|
||||||
true).")",
|
|
||||||
BASE.'objectManager.php?sClass=application_queue&sState=rejected&'.
|
BASE.'objectManager.php?sClass=application_queue&sState=rejected&'.
|
||||||
'sTitle=Rejected%20Applications');
|
'sTitle=Rejected%20Applications');
|
||||||
$g->add("Rejected Versions (".version::objectGetEntriesCount(true, true).")",
|
$g->add("Rejected Versions (".version::objectGetEntriesCount('rejected').")",
|
||||||
BASE.'objectManager.php?sClass=version_queue&sState=rejected&'.
|
BASE.'objectManager.php?sClass=version_queue&sState=rejected&'.
|
||||||
'sTitle=Rejected%20Versions');
|
'sTitle=Rejected%20Versions');
|
||||||
$g->add("Rejected Test Results (".testData::objectGetEntriesCount(true,
|
$g->add("Rejected Test Results (".testData::objectGetEntriesCount('rejected').")",
|
||||||
true).")",
|
|
||||||
BASE.'objectManager.php?sClass=testData_queue&sState=rejected&'.
|
BASE.'objectManager.php?sClass=testData_queue&sState=rejected&'.
|
||||||
'sTitle=Rejected%20Test%20Results');
|
'sTitle=Rejected%20Test%20Results');
|
||||||
|
|
||||||
|
|||||||
@@ -1139,13 +1139,13 @@ class testData{
|
|||||||
return $oRow->cnt;
|
return $oRow->cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
$oTest = new testData();
|
$oTest = new testData();
|
||||||
$sState = objectManager::getStateString($bQueued, $bRejected);
|
|
||||||
if($bQueued && !$oTest->canEdit())
|
if($bQueued && !$oTest->canEdit())
|
||||||
{
|
{
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT COUNT(testingId) AS count FROM
|
$sQuery = "SELECT COUNT(testingId) AS count FROM
|
||||||
testResults WHERE
|
testResults WHERE
|
||||||
@@ -1160,7 +1160,7 @@ class testData{
|
|||||||
AND
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
appMaintainers.queued = 'false'
|
appMaintainers.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
@@ -1197,10 +1197,9 @@ class testData{
|
|||||||
return $oRow->count;
|
return $oRow->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "testingId")
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId")
|
||||||
{
|
{
|
||||||
$oTest = new testData();
|
$oTest = new testData();
|
||||||
$sState = objectManager::getStateString($bQueued, $bRejected);
|
|
||||||
|
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
|
|
||||||
@@ -1212,12 +1211,12 @@ class testData{
|
|||||||
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
||||||
after an offset given by iStart */
|
after an offset given by iStart */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = testData::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = testData::objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bQueued && !$oTest->canEdit())
|
if($sState != 'accepted' && !$oTest->canEdit())
|
||||||
{
|
{
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT testResults.* FROM testResults WHERE
|
$sQuery = "SELECT testResults.* FROM testResults WHERE
|
||||||
testResults.submitterId = '?'
|
testResults.submitterId = '?'
|
||||||
@@ -1245,7 +1244,7 @@ class testData{
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
AND
|
AND
|
||||||
appMaintainers.queued = 'false'
|
appMaintainers.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
testResults.state = '?' ORDER BY ?$sLimit";
|
testResults.state = '?' ORDER BY ?$sLimit";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,14 +137,14 @@ class testData_queue
|
|||||||
$this->oTestData->objectDisplayAddItemHelp();
|
$this->oTestData->objectDisplayAddItemHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "testingId")
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "testingId")
|
||||||
{
|
{
|
||||||
return $this->oTestData->objectGetEntries($bQueued, $bRejected, $iRows, $iStart, $sOrderBy);
|
return $this->oTestData->objectGetEntries($sState, $iRows, $iStart, $sOrderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
return testData::objectGetEntriesCount($bQueued, $bRejected);
|
return testData::objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetHeader()
|
function objectGetHeader()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Url {
|
|||||||
$this->iAppId = $oRow->appId;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->iVersionId = $oRow->versionId;
|
$this->iVersionId = $oRow->versionId;
|
||||||
$this->sUrl = Url::normalize($oRow->url);
|
$this->sUrl = Url::normalize($oRow->url);
|
||||||
$this->bQueued = $oRow->queued;
|
$this->bQueued = ($oRow->state == 'accepted') ? false : true;
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
}
|
}
|
||||||
@@ -65,10 +65,10 @@ class Url {
|
|||||||
$this->bQueued = true;
|
$this->bQueued = true;
|
||||||
|
|
||||||
$hResult = query_parameters("INSERT INTO appData (appId, versionId, type,
|
$hResult = query_parameters("INSERT INTO appData (appId, versionId, type,
|
||||||
description, queued, submitTime, submitterId, url)
|
description, state, submitTime, submitterId, url)
|
||||||
VALUES ('?', '?', '?', '?', '?', ?, '?', '?')",
|
VALUES ('?', '?', '?', '?', '?', ?, '?', '?')",
|
||||||
$iAppId, $iVersionId, "url", $sDescription,
|
$iAppId, $iVersionId, "url", $sDescription,
|
||||||
$this->bQueued ? "true" : "false",
|
$this->bQueued ? 'queued' : 'accepted',
|
||||||
"NOW()", $_SESSION['current']->iUserId, $sUrl);
|
"NOW()", $_SESSION['current']->iUserId, $sUrl);
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
@@ -117,8 +117,8 @@ class Url {
|
|||||||
if(!$this->bQueued)
|
if(!$this->bQueued)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(query_parameters("UPDATE appData SET queued = '?' WHERE id='?'",
|
if(query_parameters("UPDATE appData SET state '?' WHERE id='?'",
|
||||||
"false", $this->iUrlId))
|
'accepted', $this->iUrlId))
|
||||||
{
|
{
|
||||||
// we send an e-mail to interested people
|
// we send an e-mail to interested people
|
||||||
$this->mailSubmitter();
|
$this->mailSubmitter();
|
||||||
|
|||||||
@@ -240,20 +240,16 @@ class Vendor {
|
|||||||
return array('vendorName');
|
return array('vendorName');
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = 'vendorName', $bAscending = TRUE)
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = 'vendorName', $bAscending = TRUE)
|
||||||
{
|
{
|
||||||
/* Vendor queueing is not implemented yet */
|
|
||||||
if($bQueued)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$sOrder = $bAscending ? 'ASC' : 'DESC';
|
$sOrder = $bAscending ? 'ASC' : 'DESC';
|
||||||
|
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = Vendor::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = Vendor::objectGetEntriesCount($sState);
|
||||||
|
|
||||||
$hResult = query_parameters("SELECT * FROM vendor
|
$hResult = query_parameters("SELECT * FROM vendor
|
||||||
ORDER BY $sOrderBy $sOrder LIMIT ?,?",
|
ORDER BY $sOrderBy $sOrder LIMIT ?,?",
|
||||||
@@ -398,14 +394,10 @@ class Vendor {
|
|||||||
return "<a href=\"".$this->objectMakeUrl()."\">$this->sName</a>";
|
return "<a href=\"".$this->objectMakeUrl()."\">$this->sName</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
/* Not implemented */
|
||||||
if($bQueued)
|
if($sState == 'rejected')
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Not implemented */
|
|
||||||
if($bRejected)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
$hResult = query_parameters("SELECT COUNT(vendorId) as count FROM vendor");
|
$hResult = query_parameters("SELECT COUNT(vendorId) as count FROM vendor");
|
||||||
|
|||||||
@@ -1421,16 +1421,14 @@ class version {
|
|||||||
return $sLink;
|
return $sLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function objectGetEntriesCount($bQueued, $bRejected)
|
public static function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
$sState = objectManager::getStateString($bQueued, $bRejected);
|
|
||||||
|
|
||||||
$oVersion = new version();
|
$oVersion = new version();
|
||||||
if($bQueued && !$oVersion->canEdit())
|
if($sState != 'accepted' && !$oVersion->canEdit())
|
||||||
{
|
{
|
||||||
/* Users should see their own rejected entries, but maintainers should
|
/* Users should see their own rejected entries, but maintainers should
|
||||||
not be able to see rejected entries for versions they maintain */
|
not be able to see rejected entries for versions they maintain */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
||||||
appVersion WHERE
|
appVersion WHERE
|
||||||
appVersion.submitterId = '?'
|
appVersion.submitterId = '?'
|
||||||
@@ -1445,7 +1443,7 @@ class version {
|
|||||||
AND
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
appMaintainers.queued = 'false'
|
appMaintainers.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
appVersion.state = '?'";
|
appVersion.state = '?'";
|
||||||
|
|
||||||
@@ -1546,10 +1544,8 @@ class version {
|
|||||||
return array($aItemsPerPage, $iDefaultPerPage);
|
return array($aItemsPerPage, $iDefaultPerPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
|
public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
|
||||||
{
|
{
|
||||||
$sState = objectManager::getStateString($bQueued, $bRejected);
|
|
||||||
|
|
||||||
$sLimit = "";
|
$sLimit = "";
|
||||||
|
|
||||||
/* Should we add a limit clause to the query? */
|
/* Should we add a limit clause to the query? */
|
||||||
@@ -1560,14 +1556,14 @@ class version {
|
|||||||
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
/* Selecting 0 rows makes no sense, so we assume the user wants to select all of them
|
||||||
after an offset given by iStart */
|
after an offset given by iStart */
|
||||||
if(!$iRows)
|
if(!$iRows)
|
||||||
$iRows = maintainer::objectGetEntriesCount($bQueued, $bRejected);
|
$iRows = version::objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bQueued && !version::canEdit())
|
if($sState != 'accepted' && !version::canEdit())
|
||||||
{
|
{
|
||||||
/* Users should see their own rejected entries, but maintainers should
|
/* Users should see their own rejected entries, but maintainers should
|
||||||
not be able to see rejected entries for versions they maintain */
|
not be able to see rejected entries for versions they maintain */
|
||||||
if($bRejected)
|
if($sState == 'rejected')
|
||||||
$sQuery = "SELECT * FROM appVersion WHERE
|
$sQuery = "SELECT * FROM appVersion WHERE
|
||||||
appVersion.submitterId = '?'
|
appVersion.submitterId = '?'
|
||||||
AND
|
AND
|
||||||
@@ -1581,7 +1577,7 @@ class version {
|
|||||||
AND
|
AND
|
||||||
appMaintainers.userId = '?'
|
appMaintainers.userId = '?'
|
||||||
AND
|
AND
|
||||||
appMaintainers.queued = 'false'
|
appMaintainers.state = 'accepted'
|
||||||
AND
|
AND
|
||||||
appVersion.state = '?' ORDER BY ?$sLimit";
|
appVersion.state = '?' ORDER BY ?$sLimit";
|
||||||
|
|
||||||
|
|||||||
@@ -225,14 +225,14 @@ class version_queue
|
|||||||
return $this->oVersion->objectGetItemsPerPage($sState);
|
return $this->oVersion->objectGetItemsPerPage($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntriesCount($bQueued, $bRejected)
|
function objectGetEntriesCount($sState)
|
||||||
{
|
{
|
||||||
return $this->oVersion->objectGetEntriesCount($bQueued, $bRejected);
|
return $this->oVersion->objectGetEntriesCount($sState);
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
|
function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId")
|
||||||
{
|
{
|
||||||
return $this->oVersion->objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
|
return $this->oVersion->objectGetEntries($sState, $iRows, $iStart,
|
||||||
$sOrderBy);
|
$sOrderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ function test_class($sClassName, $aTestMethods)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Should return 1 or more, since there may be entries present already */
|
/* Should return 1 or more, since there may be entries present already */
|
||||||
$hResult = $oTestObject->objectGetEntries(false, false);
|
$hResult = $oTestObject->objectGetEntries('accepted');
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
{
|
{
|
||||||
@@ -105,7 +105,7 @@ function test_class($sClassName, $aTestMethods)
|
|||||||
|
|
||||||
/* Should return 1 or more, since there may be entries present already */
|
/* Should return 1 or more, since there may be entries present already */
|
||||||
$iExpected = 1;
|
$iExpected = 1;
|
||||||
$hResult = $oTestObject->objectGetEntries(false, false);
|
$hResult = $oTestObject->objectGetEntries('accepted');
|
||||||
$iReceived = query_num_rows($hResult);
|
$iReceived = query_num_rows($hResult);
|
||||||
if($iExpected > $iReceived)
|
if($iExpected > $iReceived)
|
||||||
{
|
{
|
||||||
@@ -230,9 +230,9 @@ function create_object($sClassName, $oUser)
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$sQuery = "INSERT INTO appData
|
$sQuery = "INSERT INTO appData
|
||||||
(versionId, type, description, queued, submitterId)
|
(versionId, type, description, state, submitterId)
|
||||||
VALUES('?','?','?','?','?')";
|
VALUES('?','?','?','?','?')";
|
||||||
$hResult = query_parameters($sQuery, $oTestObject->iVersionId, "screenshot", "", "false",
|
$hResult = query_parameters($sQuery, $oTestObject->iVersionId, 'screenshot', '', 'accepted',
|
||||||
$oUser->iUserId);
|
$oUser->iUserId);
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user