Use objectmanager to list queued/rejected versions
This commit is contained in:
committed by
WineHQ
parent
ec0cb3dbbb
commit
ff476b1b13
@@ -145,8 +145,7 @@ if ($aClean['sSub'])
|
|||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
//error no Id!
|
//error no Id!
|
||||||
addmsg("Application Not Found!", "red");
|
util_show_error_page_and_exit("Application Not Found!");
|
||||||
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Testing results if they exist
|
// Get the Testing results if they exist
|
||||||
@@ -191,7 +190,14 @@ if ($aClean['sSub'])
|
|||||||
|
|
||||||
downloadurl::processFormSingle($oVersion->iVersionId, $aClean, TRUE);
|
downloadurl::processFormSingle($oVersion->iVersionId, $aClean, TRUE);
|
||||||
|
|
||||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
if($oVersion->sQueued == "rejected")
|
||||||
|
$sIsRejected = "true";
|
||||||
|
else
|
||||||
|
$sIsRejected = "false";
|
||||||
|
|
||||||
|
util_redirect_and_exit(BASE."objectManager.php?sClass=".$aClean['sAppType'].
|
||||||
|
"&bIsQueue=true&bIsRejected=$sIsRejected&sTitle=".
|
||||||
|
$aClean['sAppType']."%20Queue");
|
||||||
}
|
}
|
||||||
else if ($aClean['sSub'] == 'duplicate')
|
else if ($aClean['sSub'] == 'duplicate')
|
||||||
{
|
{
|
||||||
@@ -208,7 +214,8 @@ if ($aClean['sSub'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* redirect back to the main page */
|
/* redirect back to the main page */
|
||||||
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
|
util_redirect_and_exit(BASE."objectManager.php?sClass=application&".
|
||||||
|
"bIsQueue=true&sTitle=Application%20Queue");
|
||||||
}
|
}
|
||||||
else if ($aClean['sSub'] == 'movetest')
|
else if ($aClean['sSub'] == 'movetest')
|
||||||
{
|
{
|
||||||
@@ -225,7 +232,8 @@ if ($aClean['sSub'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// redirect back to the main page
|
// redirect back to the main page
|
||||||
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
|
util_redirect_and_exit(BASE."objectManager.php?sClass=version&".
|
||||||
|
"bIsQueue=true&sTitle=Version%20Queue");
|
||||||
}
|
}
|
||||||
else if ($aClean['sSub'] == 'Delete')
|
else if ($aClean['sSub'] == 'Delete')
|
||||||
{
|
{
|
||||||
@@ -244,7 +252,8 @@ if ($aClean['sSub'])
|
|||||||
$oVersion->delete();
|
$oVersion->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
|
util_redirect_and_exit(BASE."objectManager.php?sClass=".$aClean['sAppType'].
|
||||||
|
"&bIsQueue=true&sTitle=".$aClean['sAppType']."%20Queue");
|
||||||
}
|
}
|
||||||
else if ($aClean['sSub'] == 'Reject')
|
else if ($aClean['sSub'] == 'Reject')
|
||||||
{
|
{
|
||||||
@@ -263,7 +272,8 @@ if ($aClean['sSub'])
|
|||||||
$oVersion->reject();
|
$oVersion->reject();
|
||||||
$oTest->update(true);
|
$oTest->update(true);
|
||||||
$oTest->reject();
|
$oTest->reject();
|
||||||
util_redirect_and_exit($_SERVER['PHP_SELF']);
|
util_redirect_and_exit(BASE."objectManager.php?sClass=".$aClean['sAppType'].
|
||||||
|
"&bIsQueue=true&sTitle=".$aClean['sAppType']."%20Queue");
|
||||||
}
|
}
|
||||||
|
|
||||||
//process according to sub flag
|
//process according to sub flag
|
||||||
@@ -275,7 +285,13 @@ if ($aClean['sSub'])
|
|||||||
echo '<form name="sQform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
|
echo '<form name="sQform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
|
||||||
echo '<input type="hidden" name="sSub" value="add">',"\n";
|
echo '<input type="hidden" name="sSub" value="add">',"\n";
|
||||||
|
|
||||||
echo html_back_link(1,'adminAppQueue.php');
|
if($oVersion->sQueued == "rejected")
|
||||||
|
$sIsRejected = "true";
|
||||||
|
else
|
||||||
|
$sIsRejected = "false";
|
||||||
|
|
||||||
|
echo html_back_link(1,BASE."objectManager.php?sClass=".$aClean['sAppType']."&bIsQueue=true&".
|
||||||
|
"bIsRejected=$sIsRejected&sTitle=".$aClean['sAppType']."%20Queue");
|
||||||
|
|
||||||
if (!$oApp) //app version
|
if (!$oApp) //app version
|
||||||
{
|
{
|
||||||
@@ -401,44 +417,15 @@ if ($aClean['sSub'])
|
|||||||
echo '</table>',"\n";
|
echo '</table>',"\n";
|
||||||
echo '</form>',"\n";
|
echo '</form>',"\n";
|
||||||
echo html_frame_end();
|
echo html_frame_end();
|
||||||
echo html_back_link(1,'adminAppQueue.php');
|
echo html_back_link(1,BASE."objectManager.php?sClass=".$aClean['sAppType']."&bIsQueue=true&".
|
||||||
|
"bIsRejected=$sIsRejected&sTitle=".$aClean['sAppType']."%20Queue");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//error no sub!
|
//error no sub!
|
||||||
addmsg("Internal Routine Not Found!!", "red");
|
util_show_error_page_and_exit("Internal Routine Not Found!!");
|
||||||
util_redirect_and_exit(apidb_fullurl("admin/adminAppQueue.php"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* if ($aClean['sSub']) is not defined, display the main app queue page */
|
|
||||||
{
|
|
||||||
apidb_header("Admin App Queue");
|
|
||||||
|
|
||||||
// get queued versions (only versions where application are not queued already)
|
|
||||||
$hResult = $_SESSION['current']->getAppQueueQuery(false); /* query for the app version */
|
|
||||||
|
|
||||||
if(!$hResult || !mysql_num_rows($hResult))
|
|
||||||
{
|
|
||||||
//no apps in queue
|
|
||||||
echo html_frame_start("Version Queue","90%");
|
|
||||||
echo '<p><b>The Version Queue is empty.</b></p>',"\n";
|
|
||||||
echo html_frame_end(" ");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//help
|
|
||||||
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
|
|
||||||
echo "<p>This is the list of versions waiting for your approval, or to be rejected.</p>\n";
|
|
||||||
echo "<p>To view a submission, click on its name. From that page you can edit, delete or approve it into \n";
|
|
||||||
echo "the AppDB .<br>\n";
|
|
||||||
echo "<p>Note that versions linked to application that have not been yet approved are not displayed in this list.</p>\n";
|
|
||||||
echo "the AppDB.<br>\n";
|
|
||||||
echo "</td></tr></table></div>\n\n";
|
|
||||||
|
|
||||||
//show version list
|
|
||||||
Version::showList($hResult);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
apidb_footer();
|
apidb_footer();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ function global_admin_menu() {
|
|||||||
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 (".version::objectGetEntriesCount(true, false).")",
|
$g->add("View Version Queue (".version::objectGetEntriesCount(true, false).")",
|
||||||
BASE."admin/adminAppQueue.php");
|
BASE."objectManager.php?sClass=version&bIsQueue=true&sTitle=".
|
||||||
|
"Version%20Queue");
|
||||||
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||||
false, "screenshot").")",
|
false, "screenshot").")",
|
||||||
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||||
@@ -46,7 +47,8 @@ function global_admin_menu() {
|
|||||||
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).")",
|
$g->add("View Rejected Versions (".version::objectGetEntriesCount(true, true).")",
|
||||||
BASE."appsubmit.php");
|
BASE."objectManager.php?sClass=version&bIsQueue=true&bIsRejected=true&".
|
||||||
|
"sTitle=Rejected%20Versions");
|
||||||
$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&".
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ function global_maintainer_admin_menu() {
|
|||||||
$g = new htmlmenu("Maintainer Admin");
|
$g = new htmlmenu("Maintainer Admin");
|
||||||
|
|
||||||
$g->add("View Version Queue (".version::objectGetEntriesCount(true, false).")",
|
$g->add("View Version Queue (".version::objectGetEntriesCount(true, false).")",
|
||||||
BASE."admin/adminAppQueue.php");
|
BASE."objectManager.php?sClass=version&bIsQueue=true&sTitle=".
|
||||||
|
"Version%20Queue");
|
||||||
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||||
false, "screenshot").")",
|
false, "screenshot").")",
|
||||||
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||||
|
|||||||
@@ -389,48 +389,6 @@ class User {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the list of applications in the app queue that this user can see
|
|
||||||
*/
|
|
||||||
function getAppQueueQuery($queryAppFamily)
|
|
||||||
{
|
|
||||||
/* escape input as we can't easily use query_parameters() */
|
|
||||||
$queryAppFamily = mysql_real_escape_string($queryAppFamily);
|
|
||||||
|
|
||||||
if($this->hasPriv("admin"))
|
|
||||||
{
|
|
||||||
if($queryAppFamily)
|
|
||||||
{
|
|
||||||
$sQuery = "SELECT appFamily.appId FROM appFamily WHERE queued = 'true' ORDER BY appId";
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
|
|
||||||
WHERE appFamily.appId = appVersion.appId
|
|
||||||
AND appFamily.queued = 'false' AND appVersion.queued = 'true' ORDER BY versionId";
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if($queryAppFamily)
|
|
||||||
{
|
|
||||||
$sQuery = "SELECT appFamily.appId FROM appFamily, appMaintainers
|
|
||||||
WHERE appFamily.queued = 'true'
|
|
||||||
AND appFamily.appId = appMaintainers.appId
|
|
||||||
AND appMaintainers.superMaintainer = '1'
|
|
||||||
AND appMaintainers.userId = '".mysql_real_escape_string($this->iUserId)."';";
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
$sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily, appMaintainers
|
|
||||||
WHERE appFamily.appId = appVersion.appId
|
|
||||||
AND appFamily.queued = 'false' AND appVersion.queued = 'true'
|
|
||||||
AND appFamily.appId = appMaintainers.appId
|
|
||||||
AND appMaintainers.superMaintainer = '1'
|
|
||||||
AND appMaintainers.userId = '".mysql_real_escape_string($this->iUserId)."';";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return query_appdb($sQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAppRejectQueueQuery($queryAppFamily)
|
function getAppRejectQueueQuery($queryAppFamily)
|
||||||
{
|
{
|
||||||
/* escape input as we can't easily use query_parameters() */
|
/* escape input as we can't easily use query_parameters() */
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Version {
|
|||||||
/**
|
/**
|
||||||
* constructor, fetches the data.
|
* constructor, fetches the data.
|
||||||
*/
|
*/
|
||||||
function Version($iVersionId = null)
|
function Version($iVersionId = null, $oRow = null)
|
||||||
{
|
{
|
||||||
// we are working on an existing version
|
// we are working on an existing version
|
||||||
if(is_numeric($iVersionId))
|
if(is_numeric($iVersionId))
|
||||||
@@ -51,26 +51,28 @@ class Version {
|
|||||||
*/
|
*/
|
||||||
if(!$this->iVersionId)
|
if(!$this->iVersionId)
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT *
|
if(!$oRow)
|
||||||
FROM appVersion
|
|
||||||
WHERE versionId = '?'";
|
|
||||||
if($hResult = query_parameters($sQuery, $iVersionId))
|
|
||||||
{
|
{
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$sQuery = "SELECT *
|
||||||
if($oRow)
|
FROM appVersion
|
||||||
{
|
WHERE versionId = '?'";
|
||||||
$this->iVersionId = $iVersionId;
|
if($hResult = query_parameters($sQuery, $iVersionId))
|
||||||
$this->iAppId = $oRow->appId;
|
$oRow = mysql_fetch_object($hResult);
|
||||||
$this->iSubmitterId = $oRow->submitterId;
|
}
|
||||||
$this->sSubmitTime = $oRow->submitTime;
|
|
||||||
$this->sDate = $oRow->submitTime;
|
if($oRow)
|
||||||
$this->sName = $oRow->versionName;
|
{
|
||||||
$this->sDescription = $oRow->description;
|
$this->iVersionId = $iVersionId;
|
||||||
$this->sTestedRelease = $oRow->maintainer_release;
|
$this->iAppId = $oRow->appId;
|
||||||
$this->sTestedRating = $oRow->maintainer_rating;
|
$this->iSubmitterId = $oRow->submitterId;
|
||||||
$this->sQueued = $oRow->queued;
|
$this->sSubmitTime = $oRow->submitTime;
|
||||||
$this->sLicense = $oRow->license;
|
$this->sDate = $oRow->submitTime;
|
||||||
}
|
$this->sName = $oRow->versionName;
|
||||||
|
$this->sDescription = $oRow->description;
|
||||||
|
$this->sTestedRelease = $oRow->maintainer_release;
|
||||||
|
$this->sTestedRating = $oRow->maintainer_rating;
|
||||||
|
$this->sQueued = $oRow->queued;
|
||||||
|
$this->sLicense = $oRow->license;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1157,7 +1159,8 @@ class Version {
|
|||||||
{
|
{
|
||||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||||
|
|
||||||
if($bQueued && !version::canEdit())
|
$oVersion = new version();
|
||||||
|
if($bQueued && !$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 */
|
||||||
@@ -1222,7 +1225,120 @@ class Version {
|
|||||||
|
|
||||||
function canEdit()
|
function canEdit()
|
||||||
{
|
{
|
||||||
return $_SESSION['current']->hasPriv("admin");
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
|
return TRUE;
|
||||||
|
else if($this->iVersionId &&
|
||||||
|
maintainer::isUserMaintainer($_SESSION['current'], $this->iVersionId))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetHeader()
|
||||||
|
{
|
||||||
|
$aCells = array(
|
||||||
|
"Submission Date",
|
||||||
|
"Submitter",
|
||||||
|
"Vendor",
|
||||||
|
"Application",
|
||||||
|
"Version");
|
||||||
|
return $aCells;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetEntries($bQueued, $bRejected)
|
||||||
|
{
|
||||||
|
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||||
|
|
||||||
|
if($bQueued && !$this->canEdit())
|
||||||
|
{
|
||||||
|
/* Users should see their own rejected entries, but maintainers should
|
||||||
|
not be able to see rejected entries for versions they maintain */
|
||||||
|
if($bRejected)
|
||||||
|
$sQuery = "SELECT appVersion.* FROM
|
||||||
|
appVersion, appFamily WHERE
|
||||||
|
appFamily.appId = appVersion.appId
|
||||||
|
AND
|
||||||
|
appFamily.queued = 'false'
|
||||||
|
AND
|
||||||
|
appVersion.submitterId = '?'
|
||||||
|
AND
|
||||||
|
appVersion.queued = '?'";
|
||||||
|
else
|
||||||
|
$sQuery = "SELECT appVersion.* 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'
|
||||||
|
AND
|
||||||
|
appVersion.queued = '?'";
|
||||||
|
|
||||||
|
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $sQueued);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sQuery = "SELECT appVersion.*
|
||||||
|
FROM appVersion, appFamily WHERE
|
||||||
|
appFamily.appId = appVersion.appId
|
||||||
|
AND
|
||||||
|
appFamily.queued = 'false'
|
||||||
|
AND
|
||||||
|
appVersion.queued = '?'";
|
||||||
|
$hResult = query_parameters($sQuery, $sQueued);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return $hResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
|
||||||
|
{
|
||||||
|
$oUser = new user($this->iSubmitterId);
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
$oVendor = new vendor($oApp->iVendorId);
|
||||||
|
$aCells = array(
|
||||||
|
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)),
|
||||||
|
$oUser->objectMakeLink(),
|
||||||
|
$oVendor->objectMakeLink(),
|
||||||
|
$oApp->objectMakeLink(),
|
||||||
|
$this->sName);
|
||||||
|
|
||||||
|
if($this->canEdit())
|
||||||
|
$aCells[] = "[ <a href=\"".BASE."admin/adminAppQueue.php?sAppType=".
|
||||||
|
"version&sSub=view&iVersionId=$this->iVersionId\">$sEditLinkLabel</a> ]";
|
||||||
|
|
||||||
|
echo html_tr($aCells, $sClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetInstanceFromRow($oRow)
|
||||||
|
{
|
||||||
|
return new version($oRow->versionId, $oRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectDisplayQueueProcessingHelp()
|
||||||
|
{
|
||||||
|
echo "<p>This is the list of versions waiting for your approval, ".
|
||||||
|
"or to be rejected.</p>\n";
|
||||||
|
echo "<p>To view a submission, click on its name. ".
|
||||||
|
"From that page you can edit, delete or approve it into the AppDB.</p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user