Add and use version::objectGetEntriesCount(). Only display the user menu's 'view rejected
apps' link for non-admins
This commit is contained in:
committed by
WineHQ
parent
89535dbe01
commit
970cbca7f3
@@ -12,7 +12,7 @@ function global_admin_menu() {
|
|||||||
$g->add("View App Queue (".application::objectGetEntriesCount(true, false).")",
|
$g->add("View App Queue (".application::objectGetEntriesCount(true, false).")",
|
||||||
BASE."objectManager.php?sClass=application&bIsQueue=true&sTitle=".
|
BASE."objectManager.php?sClass=application&bIsQueue=true&sTitle=".
|
||||||
"Application%20Queue");
|
"Application%20Queue");
|
||||||
$g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")",
|
$g->add("View Version Queue (".version::objectGetEntriesCount(true, false).")",
|
||||||
BASE."admin/adminAppQueue.php");
|
BASE."admin/adminAppQueue.php");
|
||||||
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||||
false, "screenshot").")",
|
false, "screenshot").")",
|
||||||
@@ -45,6 +45,8 @@ function global_admin_menu() {
|
|||||||
true).")",
|
true).")",
|
||||||
BASE."objectManager.php?sClass=application&bIsQueue=true&bIsRejected=true&".
|
BASE."objectManager.php?sClass=application&bIsQueue=true&bIsRejected=true&".
|
||||||
"sTitle=Rejected%20Applications");
|
"sTitle=Rejected%20Applications");
|
||||||
|
$g->add("View Rejected Versions (".version::objectGetEntriesCount(true, true).")",
|
||||||
|
BASE."appsubmit.php");
|
||||||
$g->add("View Rejected Test Results (".testData::objectGetEntriesCount(true,
|
$g->add("View Rejected Test Results (".testData::objectGetEntriesCount(true,
|
||||||
true).")",
|
true).")",
|
||||||
BASE."objectManager.php?sClass=testData&bIsQueue=true&bIsRejected=true&".
|
BASE."objectManager.php?sClass=testData&bIsQueue=true&bIsRejected=true&".
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ function global_sidebar_login() {
|
|||||||
$g->addmisc(version::fullNameLink($versionId), "center");
|
$g->addmisc(version::fullNameLink($versionId), "center");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$appsRejected = $_SESSION['current']->getAllRejectedApps();
|
$iAppsRejected = application::objectGetEntriesCount(true, true) +
|
||||||
if($appsRejected)
|
version::objectGetEntriesCount(true, true);
|
||||||
$g->addmisc("<a href='".BASE."appsubmit.php?'>Review Rejected Apps</a>", "center");
|
if($iAppsRejected && !$_SESSION['current']->hasPriv("admin"))
|
||||||
|
$g->addmisc("<a href='".BASE."appsubmit.php?'>Review Rejected Apps ".
|
||||||
|
"($iAppsRejected)</a>", "center");
|
||||||
|
|
||||||
$aMonitored = Monitor::getVersionsMonitored($_SESSION['current']);
|
$aMonitored = Monitor::getVersionsMonitored($_SESSION['current']);
|
||||||
if($aMonitored)
|
if($aMonitored)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function global_maintainer_admin_menu() {
|
|||||||
|
|
||||||
$g = new htmlmenu("Maintainer Admin");
|
$g = new htmlmenu("Maintainer Admin");
|
||||||
|
|
||||||
$g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")",
|
$g->add("View Version Queue (".version::objectGetEntriesCount(true, false).")",
|
||||||
BASE."admin/adminAppQueue.php");
|
BASE."admin/adminAppQueue.php");
|
||||||
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||||
false, "screenshot").")",
|
false, "screenshot").")",
|
||||||
|
|||||||
@@ -265,40 +265,6 @@ class User {
|
|||||||
return Maintainer::isUserSuperMaintainer($this, $iAppId);
|
return Maintainer::isUserSuperMaintainer($this, $iAppId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get the number of queued applications */
|
|
||||||
function getQueuedAppCount()
|
|
||||||
{
|
|
||||||
/* return 0 because non-admins have no way to process new apps */
|
|
||||||
if(!$this->hasPriv("admin"))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
$sQuery = "SELECT count(*) as queued_apps FROM appFamily WHERE queued='true'";
|
|
||||||
$hResult = query_parameters($sQuery);
|
|
||||||
$oRow = mysql_fetch_object($hResult);
|
|
||||||
return $oRow->queued_apps;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getQueuedVersionCount()
|
|
||||||
{
|
|
||||||
if($this->hasPriv("admin"))
|
|
||||||
{
|
|
||||||
$hResult = query_parameters("SELECT count(*) as queued_versions FROM appVersion WHERE queued='true'");
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
/* find all queued versions of applications that the user is a super maintainer of */
|
|
||||||
$hResult = query_parameters("SELECT count(*) as queued_versions FROM appVersion, appMaintainers
|
|
||||||
WHERE appVersion.queued='true' AND appMaintainers.superMaintainer ='1'
|
|
||||||
AND appVersion.appId = appMaintainers.appId
|
|
||||||
AND appMaintainers.userId ='?'", $this->iUserId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oRow = mysql_fetch_object($hResult);
|
|
||||||
|
|
||||||
/* we don't want to count the versions that are implicit in the applications */
|
|
||||||
/* that are in the queue */
|
|
||||||
return $oRow->queued_versions - $this->getQueuedAppCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
function addPriv($sPriv)
|
function addPriv($sPriv)
|
||||||
{
|
{
|
||||||
if(!$this->isLoggedIn() || !$sPriv)
|
if(!$this->isLoggedIn() || !$sPriv)
|
||||||
@@ -500,29 +466,6 @@ class User {
|
|||||||
return query_appdb($sQuery);
|
return query_appdb($sQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllRejectedApps()
|
|
||||||
{
|
|
||||||
$hResult = query_parameters("SELECT appVersion.versionId, appFamily.appId
|
|
||||||
FROM appVersion, appFamily
|
|
||||||
WHERE appFamily.appId = appVersion.appId
|
|
||||||
AND (appFamily.queued = 'rejected' OR appVersion.queued = 'rejected')
|
|
||||||
AND appVersion.submitterId = '?'",
|
|
||||||
$this->iUserId);
|
|
||||||
|
|
||||||
if(!$hResult || mysql_num_rows($hResult) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
$retval = array();
|
|
||||||
$c = 0;
|
|
||||||
while($oRow = mysql_fetch_object($hResult))
|
|
||||||
{
|
|
||||||
$retval[$c] = array($oRow->appId, $oRow->versionId);
|
|
||||||
$c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isAppSubmitter($iAppId)
|
function isAppSubmitter($iAppId)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT appId FROM appFamily
|
$hResult = query_parameters("SELECT appId FROM appFamily
|
||||||
|
|||||||
@@ -1152,6 +1152,74 @@ class Version {
|
|||||||
$this->sName."</a>";
|
$this->sName."</a>";
|
||||||
return $sLink;
|
return $sLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetEntriesCount($bQueued, $bRejected)
|
||||||
|
{
|
||||||
|
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||||
|
|
||||||
|
if($bQueued && !version::canEdit())
|
||||||
|
{
|
||||||
|
/* Users should see their own rejected entries */
|
||||||
|
if($bRejected)
|
||||||
|
$sIncludeUserSubmissions = "OR appVersion.submitterId = '".
|
||||||
|
$_SESSION['current']->iUserId."'";
|
||||||
|
|
||||||
|
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
|
||||||
|
appVersion, appMaintainers, appFamily WHERE
|
||||||
|
appFamily.appId = appVersion.appId
|
||||||
|
AND
|
||||||
|
appFamily.queued = 'false'
|
||||||
|
AND
|
||||||
|
(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
appMaintainers.appId = appVersion.appId
|
||||||
|
AND
|
||||||
|
superMaintainer = '1'
|
||||||
|
)
|
||||||
|
OR
|
||||||
|
(
|
||||||
|
appMaintainers.versionId = appVersion.versionId
|
||||||
|
AND
|
||||||
|
superMaintainer = '0'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
AND
|
||||||
|
appMaintainers.userId = '?'
|
||||||
|
AND
|
||||||
|
appMaintainers.queued = 'false'
|
||||||
|
)
|
||||||
|
$sIncludeUserSubmissions
|
||||||
|
)
|
||||||
|
AND
|
||||||
|
appVersion.queued = '?'";
|
||||||
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $sQueued);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sQuery = "SELECT COUNT(DISTINCT versionId) as count
|
||||||
|
FROM appVersion, appFamily WHERE
|
||||||
|
appFamily.appId = appVersion.appId
|
||||||
|
AND
|
||||||
|
appFamily.queued = 'false'
|
||||||
|
AND
|
||||||
|
appVersion.queued = '?'";
|
||||||
|
$hResult = query_parameters($sQuery, $sQueued);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if(!$oRow = mysql_fetch_object($hResult))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return $oRow->count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function canEdit()
|
||||||
|
{
|
||||||
|
return $_SESSION['current']->hasPriv("admin");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user