objectManager, add rejection support. Add support in objectManager for handling rejected
data.
This commit is contained in:
committed by
WineHQ
parent
18bb33902e
commit
c545581571
@@ -64,7 +64,8 @@ if($aClean['iPage'])
|
||||
$currentPage = $aClean['iPage'];
|
||||
|
||||
$ItemsPerPage = min($ItemsPerPage,100);
|
||||
$totalPages = ceil(appData::objectGetEntriesCount("all", "screenshot")/$ItemsPerPage);
|
||||
$totalPages = ceil(appData::objectGetEntriesCount("all", false,
|
||||
"screenshot")/$ItemsPerPage);
|
||||
$currentPage = min($currentPage,$totalPages);
|
||||
$offset = (($currentPage-1) * $ItemsPerPage);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ echo "</tr>\n\n";
|
||||
/* Display the number of images */
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td>Screenshots:</td>\n";
|
||||
echo " <td>".appData::objectGetEntriesCount("false", "screenshot")."</td>\n";
|
||||
echo " <td>".appData::objectGetEntriesCount("false", false, "screenshot")."</td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
echo "</table>\n\n";
|
||||
|
||||
@@ -104,8 +104,18 @@ class appData
|
||||
return $hResult;
|
||||
}
|
||||
|
||||
function objectGetEntriesCount($sQueued, $sType = null)
|
||||
function objectGetEntriesCount($sQueued, $bRejected, $sType = null)
|
||||
{
|
||||
/* Not implemented for appData */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
/* Compatibility with objectManager */
|
||||
if($sQueued === true)
|
||||
$sQueued = "true";
|
||||
if($sQueued === false)
|
||||
$sQueued = "false";
|
||||
|
||||
if(($sQueued == "true" || $sQueued == "all") && !appData::canEdit($sType))
|
||||
return FALSE;
|
||||
|
||||
@@ -210,8 +220,12 @@ class appData
|
||||
return $aCells;
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0, $sType)
|
||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0, $sType)
|
||||
{
|
||||
/* Not implemented for appData */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
if($bQueued && !appData::canEdit($sType))
|
||||
return FALSE;
|
||||
|
||||
@@ -268,7 +282,7 @@ class appData
|
||||
{
|
||||
if(!$iRows)
|
||||
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
|
||||
$sType);
|
||||
$bRejected, $sType);
|
||||
$sQuery .= " LIMIT ?,?";
|
||||
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||
$bQueued ? "true" : "false", $sType,
|
||||
@@ -300,7 +314,7 @@ class appData
|
||||
{
|
||||
if(!$iRows)
|
||||
$iRows = appData::objectGetEntriesCount($bQueued ? "true" : "false",
|
||||
$sType);
|
||||
$bRejected, $sType);
|
||||
$sQuery .= " LIMIT ?,?";
|
||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false", $sType,
|
||||
$iStart, $iRows);
|
||||
|
||||
@@ -838,19 +838,21 @@ class Application {
|
||||
return $sLink;
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued)
|
||||
function objectGetEntries($bQueued, $bRejected)
|
||||
{
|
||||
$sQuery = "SELECT * FROM appFamily WHERE
|
||||
appFamily.queued = '?'";
|
||||
|
||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||
|
||||
if($bQueued && !application::canEdit())
|
||||
{
|
||||
$sQuery .= "AND appFamily.submitterId = '?'";
|
||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false",
|
||||
$hResult = query_parameters($sQuery, $sQueued,
|
||||
$_SESSION['current']->iUserId);
|
||||
} else
|
||||
{
|
||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false");
|
||||
$hResult = query_parameters($sQuery, $sQueued);
|
||||
}
|
||||
|
||||
if(!$hResult)
|
||||
|
||||
@@ -367,8 +367,12 @@ class distribution {
|
||||
}
|
||||
|
||||
/* Get the total number of Distributions in the database */
|
||||
function objectGetEntriesCount($bQueued)
|
||||
function objectGetEntriesCount($bQueued, $bRejected)
|
||||
{
|
||||
/* Not implemented */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
$hResult = query_parameters("SELECT count(distributionId) as num_dists FROM
|
||||
distributions WHERE queued='?'",
|
||||
$bQueued ? "true" : "false");
|
||||
@@ -410,8 +414,12 @@ class distribution {
|
||||
return $aCells;
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
|
||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
||||
{
|
||||
/* Not implemented */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
/* Only users with edit privileges are allowed to view queued
|
||||
items, so return NULL in that case */
|
||||
if($bQueued && !distribution::canEdit())
|
||||
@@ -419,7 +427,7 @@ class distribution {
|
||||
|
||||
/* If row limit is 0 we want to fetch all rows */
|
||||
if(!$iRows)
|
||||
$iRows = distribution::objectGetEntriesCount($bQueued);
|
||||
$iRows = distribution::objectGetEntriesCount($bQueued, $bRejected);
|
||||
|
||||
$sQuery = "SELECT * FROM distributions
|
||||
WHERE queued = '?' ORDER BY name LIMIT ?,?";
|
||||
|
||||
@@ -193,8 +193,12 @@ class maintainer
|
||||
return $hResult;
|
||||
}
|
||||
|
||||
function ObjectGetEntries($bQueued)
|
||||
function ObjectGetEntries($bQueued, $bRejected)
|
||||
{
|
||||
/* Not implemented */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
/* Excluding requests for queued apps and versions, as these will be
|
||||
handled automatically */
|
||||
$sQuery = "SELECT DISTINCT maintainerId, appMaintainers.submitTime FROM
|
||||
@@ -273,8 +277,12 @@ class maintainer
|
||||
return $aAppsMaintained;
|
||||
}
|
||||
|
||||
function objectGetEntriesCount($bQueued)
|
||||
function objectGetEntriesCount($bQueued, $bRejected)
|
||||
{
|
||||
/* Not implemented */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
/* Excluding requests for queued apps and versions, as these are handled
|
||||
automatically. One SELECT for super maintainers, one for maintainers. */
|
||||
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
|
||||
|
||||
@@ -9,6 +9,7 @@ class ObjectManager
|
||||
var $bIsQueue;
|
||||
var $sTitle;
|
||||
var $iId;
|
||||
var $bIsRejected;
|
||||
|
||||
function ObjectManager($sClass, $sTitle = "list", $iId = false)
|
||||
{
|
||||
@@ -58,27 +59,23 @@ class ObjectManager
|
||||
$this->checkMethods(array("ObjectGetEntries", "ObjectGetHeader",
|
||||
"ObjectGetInstanceFromRow", "ObjectOutputTableRow", "canEdit"));
|
||||
|
||||
|
||||
$oObject = new $this->sClass();
|
||||
/* query the class for its entries */
|
||||
/* We pass in $this->bIsQueue to tell the object */
|
||||
/* if we are requesting a list of its queued objects or */
|
||||
/* all of its objects */
|
||||
$hResult = call_user_func(array($this->sClass,
|
||||
"objectGetEntries"), $this->bIsQueue);
|
||||
$hResult = $oObject->objectGetEntries($this->bIsQueue, $this->sIsRejected);
|
||||
|
||||
/* did we get any entries? */
|
||||
if(mysql_num_rows($hResult) == 0)
|
||||
{
|
||||
$sIsQueue = $this->bIsQueue ? "true" : "false";
|
||||
|
||||
if($this->bIsQueue)
|
||||
echo "<center>The queue for '$this->sClass' is empty</center>";
|
||||
else
|
||||
echo "<center>No entries of '$this->sClass' are present</center>";
|
||||
|
||||
echo "<br /><center><a href=\"".$_SERVER['PHP_SELF']."?sClass=".
|
||||
"$this->sClass&bIsQueue=$sIsQueue&sTitle=".
|
||||
urlencode($this->sTitle)."&sAction=add\">Add an entry?</a></center>";
|
||||
echo "<br /><center><a href=\"".$this->makeUrl("add", false,
|
||||
"Add $this->sClass entry")."\">Add an entry?</a></center>";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,9 +101,8 @@ class ObjectManager
|
||||
$oObject = new $this->sClass();
|
||||
if($oObject->canEdit())
|
||||
{
|
||||
echo "<br /><br /><a href=\"".$_SERVER['PHP_SELF']."?sClass=".
|
||||
"$this->sClass&sAction=add&sTitle=Add\">".
|
||||
"Add entry</a>\n";
|
||||
echo "<br /><br /><a href=\"".$this->makeUrl("add", false,
|
||||
"Add $this->sClass")."\">Add entry</a>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +123,9 @@ class ObjectManager
|
||||
echo '<input type="hidden" name="sTitle" value="'.$this->sTitle.'" />';
|
||||
echo '<input type="hidden" name="iId" value="'.$this->iId.'" />';
|
||||
echo '<input type="hidden" name="bIsQueue" '.
|
||||
'value='.($this->bIsQueue ? "true" : "false").'>';
|
||||
'value='.($this->bIsQueue ? "true" : "false").' />';
|
||||
echo '<input type="hidden" name=bIsRejected" '.
|
||||
'value='.($this->bIsRejected ? "true" : "false").' />';
|
||||
|
||||
$oObject = new $this->sClass($this->iId);
|
||||
|
||||
@@ -307,6 +305,7 @@ class ObjectManager
|
||||
$sAction = "&sAction=$sAction";
|
||||
|
||||
$sIsQueue = $this->bIsQueue ? "true" : "false";
|
||||
$sIsRejected = $this->bIsRejected ? "true" : "false";
|
||||
|
||||
if(!$sTitle)
|
||||
$sTitle = $this->sTitle;
|
||||
@@ -314,7 +313,7 @@ class ObjectManager
|
||||
$sTitle = urlencode($sTitle);
|
||||
|
||||
return APPDB_ROOT."objectManager.php?bIsQueue=$sIsQueue&sClass=$this->sClass".
|
||||
"&sTitle=$sTitle$sId$sAction";
|
||||
"&sTitle=$sTitle$sId$sAction&bIsRejected=$sIsRejected";
|
||||
}
|
||||
|
||||
/* Get id from form data */
|
||||
@@ -337,6 +336,20 @@ class ObjectManager
|
||||
|
||||
echo html_tr($aCells, $sClass);
|
||||
}
|
||||
|
||||
function getQueueString($bQueued, $bRejected)
|
||||
{
|
||||
if($bQueued)
|
||||
{
|
||||
if($bRejected)
|
||||
$sQueueString = "rejected";
|
||||
else
|
||||
$sQueueString = "true";
|
||||
} else
|
||||
$sQueueString = "false";
|
||||
|
||||
return $sQueueString;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -513,9 +513,10 @@ class Screenshot {
|
||||
return $shImg;
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
|
||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
||||
{
|
||||
return appData::objectGetEntries($bQueued, $iRows, $iStart, "screenshot");
|
||||
return appData::objectGetEntries($bQueued, $bRejected, $iRows, $iStart,
|
||||
"screenshot");
|
||||
}
|
||||
|
||||
function objectGetHeader()
|
||||
|
||||
@@ -28,7 +28,7 @@ function global_sidebar_menu()
|
||||
$g->add("Submit Application", BASE."appsubmit.php?sSub=view&sAppType=application");
|
||||
$g->add("Help & Documentation", BASE."help/");
|
||||
$g->add("AppDB Stats", BASE."appdbStats.php");
|
||||
$g->add("View Distributions (".distribution::objectGetEntriesCount(false).")", BASE."objectManager.php?sClass=distribution&bIsQueue=false&sTitle=View%20Distributions");
|
||||
$g->add("View Distributions (".distribution::objectGetEntriesCount(false, false).")", BASE."objectManager.php?sClass=distribution&bIsQueue=false&sTitle=View%20Distributions");
|
||||
$g->add("View Vendors (".getNumberOfvendors().")", BASE."objectManager.php?sClass=vendor&bIsQueue=false&sTitle=View%20Vendors");
|
||||
$g->add("Email your suggestions for improving the AppDB", "mailto:appdb@winehq.org");
|
||||
$g->done();
|
||||
|
||||
@@ -20,20 +20,21 @@ function global_admin_menu() {
|
||||
$g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")",
|
||||
BASE."admin/adminAppQueue.php");
|
||||
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||
"screenshot").")",
|
||||
false, "screenshot").")",
|
||||
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||
"Screenshot%20Queue");
|
||||
$g->add("View Maintainer Queue (".Maintainer::objectGetEntriesCount(true).")",
|
||||
$g->add("View Maintainer Queue (".Maintainer::objectGetEntriesCount(true, false).")",
|
||||
BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=".
|
||||
"Maintainer%20Queue");
|
||||
$g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")",
|
||||
BASE."admin/adminMaintainers.php");
|
||||
$g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")",
|
||||
BASE."admin/adminBugs.php");
|
||||
$g->add("View Test Results Queue (".testData::objectGetEntriesCount(true).")",
|
||||
$g->add("View Test Results Queue (".testData::objectGetEntriesCount(true, false).")",
|
||||
BASE."objectManager.php?sClass=testData&bIsQueue=true&sTitle=".
|
||||
"Test%20Results%20Queue");
|
||||
$g->add("View Distribution Queue (".distribution::objectGetEntriesCount(true).")",
|
||||
$g->add("View Distribution Queue (".distribution::objectGetEntriesCount(true,
|
||||
false).")",
|
||||
BASE."objectManager.php?sClass=distribution&bIsQueue=true&sTitle=".
|
||||
"Distribution%20Queue");
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ function global_maintainer_admin_menu() {
|
||||
$g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")",
|
||||
BASE."admin/adminAppQueue.php");
|
||||
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
|
||||
"screenshot").")",
|
||||
false, "screenshot").")",
|
||||
BASE."objectManager.php?sClass=screenshot&bIsQueue=true&sTitle=".
|
||||
"Screenshot%20Queue");
|
||||
$g->add("View Test Results Queue (".testData::objectGetEntriesCount(true).")",
|
||||
$g->add("View Test Results Queue (".testData::objectGetEntriesCount(true, false).")",
|
||||
BASE."objectManager.php?sClass=testData&bIsQueue=true&sTitle=".
|
||||
"Test%20Results%20Queue");
|
||||
$g->done();
|
||||
|
||||
@@ -754,9 +754,10 @@ class testData{
|
||||
return $sReturn;
|
||||
}
|
||||
|
||||
function objectGetEntriesCount($bQueued)
|
||||
function objectGetEntriesCount($bQueued, $bRejected)
|
||||
{
|
||||
$oTest = new testData();
|
||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||
if($bQueued && !$oTest->canEdit())
|
||||
{
|
||||
if($oTest->canEditSome())
|
||||
@@ -777,7 +778,7 @@ class testData{
|
||||
AND
|
||||
testResults.queued = '?'";
|
||||
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||
$bQueued ? "true": "false");
|
||||
$sQueued);
|
||||
}
|
||||
} else
|
||||
{
|
||||
@@ -788,7 +789,7 @@ class testData{
|
||||
appVersion.queued = 'false'
|
||||
AND
|
||||
testResults.queued = '?'";
|
||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false");
|
||||
$hResult = query_parameters($sQuery, $sQueued);
|
||||
}
|
||||
|
||||
if(!$hResult)
|
||||
@@ -800,9 +801,10 @@ class testData{
|
||||
return $oRow->count;
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued)
|
||||
function objectGetEntries($bQueued, $bRejected)
|
||||
{
|
||||
$oTest = new testData();
|
||||
$sQueued = objectManager::getQueueString($bQueued, $bRejected);
|
||||
if($bQueued && !$oTest->canEdit())
|
||||
{
|
||||
if($oTest->canEditSome())
|
||||
@@ -823,7 +825,7 @@ class testData{
|
||||
AND
|
||||
testResults.queued = '?'";
|
||||
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
|
||||
$bQueued ? "true": "false");
|
||||
$sQueued);
|
||||
}
|
||||
} else
|
||||
{
|
||||
@@ -833,7 +835,7 @@ class testData{
|
||||
appVersion.queued = 'false'
|
||||
AND
|
||||
testResults.queued = '?' ORDER by testingId";
|
||||
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false");
|
||||
$hResult = query_parameters($sQuery, $sQueued);
|
||||
}
|
||||
|
||||
if(!$hResult)
|
||||
|
||||
@@ -148,11 +148,15 @@ class Vendor {
|
||||
echo "</table>\n";
|
||||
}
|
||||
|
||||
function objectGetEntries($bQueued, $iRows = 0, $iStart = 0)
|
||||
function objectGetEntries($bQueued, $bRejected, $iRows = 0, $iStart = 0)
|
||||
{
|
||||
/* Vendor queueing is not implemented yet */
|
||||
if($bQueued)
|
||||
return NULL;
|
||||
return FALSE;
|
||||
|
||||
/* Not implemented */
|
||||
if($bRejected)
|
||||
return FALSE;
|
||||
|
||||
if(!$iRows)
|
||||
$iRows = getNumberOfVendors();
|
||||
|
||||
@@ -25,9 +25,18 @@ if(!class_exists($aClean['sClass']))
|
||||
|
||||
$oObject = new objectManager($aClean['sClass'], $aClean['sTitle'], $aClean['iId']);
|
||||
|
||||
if($aClean['bIsQueue'] == 'true') $oObject->bIsQueue = true;
|
||||
else $oObject->bIsQueue = false;
|
||||
if($aClean['bIsQueue'] == 'true')
|
||||
$oObject->bIsQueue = true;
|
||||
else
|
||||
$oObject->bIsQueue = false;
|
||||
|
||||
/* If it is rejected it is defined as queued */
|
||||
if($aClean['bIsRejected'] == 'true')
|
||||
{
|
||||
$oObject->bIsRejected = true;
|
||||
$oObject->bIsQueue = true;
|
||||
} else
|
||||
$oObject->bIsRejected = false;
|
||||
|
||||
$oOtherObject = new $oObject->sClass($oObject->iId);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ function test_class($sClassName, $aTestMethods)
|
||||
|
||||
/* Should return 1 or more, since there may be entries present already */
|
||||
$iExpected = 1;
|
||||
$hResult = $oTestObject->objectGetEntries(false);
|
||||
$hResult = $oTestObject->objectGetEntries(false, false);
|
||||
$iReceived = mysql_num_rows($hResult);
|
||||
$oTestObject->delete();
|
||||
if($iExpected > $iReceived)
|
||||
|
||||
@@ -22,7 +22,8 @@ if($aClean['iPage'])
|
||||
$currentPage = $aClean['iPage'];
|
||||
|
||||
$ItemsPerPage = min($ItemsPerPage,100);
|
||||
$totalPages = ceil(appData::objectGetEntriesCount("false", "screenshot")/$ItemsPerPage);
|
||||
$totalPages = ceil(appData::objectGetEntriesCount("false", false,
|
||||
"screenshot")/$ItemsPerPage);
|
||||
$currentPage = min($currentPage,$totalPages);
|
||||
$offset = (($currentPage-1) * $ItemsPerPage);
|
||||
|
||||
@@ -57,7 +58,7 @@ echo "</form>";
|
||||
echo "</center>";
|
||||
|
||||
/* query for all of the Screenshots in assending order */
|
||||
$Ids = appData::objectGetEntries(false, $ItemsPerPage, $offset, "screenshot");
|
||||
$Ids = appData::objectGetEntries(false, false, $ItemsPerPage, $offset, "screenshot");
|
||||
$c = 1;
|
||||
echo "<div align=center><table><tr>\n";
|
||||
while ($oRow = mysql_fetch_object($Ids))
|
||||
|
||||
Reference in New Issue
Block a user