Let objectManager show the application queue

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-03-17 23:45:54 +00:00
committed by WineHQ
parent 3757716b1a
commit f4c5077094
4 changed files with 108 additions and 61 deletions

View File

@@ -9,13 +9,6 @@ require_once(BASE."include/tableve.php");
require_once(BASE."include/application.php");
require_once(BASE."include/testData.php");
function get_vendor_from_keywords($sKeywords)
{
$aKeywords = explode(" *** ",$sKeywords);
$iLastElt = (sizeOf($aKeywords)-1);
return($aKeywords[$iLastElt]);
}
/* allows the admin to click on a row and mark the current application as a duplicate */
/* of the selected application */
function outputSearchTableForDuplicateFlagging($currentAppId, $hResult)
@@ -421,30 +414,6 @@ else /* if ($aClean['sSub']) is not defined, display the main app queue page */
{
apidb_header("Admin App Queue");
// get queued apps that the current user should see
$hResult = $_SESSION['current']->getAppQueueQuery(true); /* query for the app family */
if(!$hResult || !mysql_num_rows($hResult))
{
//no apps in queue
echo html_frame_start("Application Queue","90%");
echo '<p><b>The Application Queue is empty.</b></p>',"\n";
echo html_frame_end("&nbsp;");
}
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 applications 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 "</td></tr></table></div>\n\n";
//show applist
Application::showList($hResult);
}
// get queued versions (only versions where application are not queued already)
$hResult = $_SESSION['current']->getAppQueueQuery(false); /* query for the app version */

View File

@@ -33,13 +33,6 @@ require_once(BASE."include/tableve.php");
require_once(BASE."include/application.php");
require_once(BASE."include/testData.php");
function get_vendor_from_keywords($sKeywords)
{
$aKeywords = explode(" *** ",$sKeywords);
$iLastElt = (sizeOf($aKeywords)-1);
return($aKeywords[$iLastElt]);
}
function newSubmission($errors)
{
global $aClean;

View File

@@ -42,18 +42,21 @@ class Application {
/**
* constructor, fetches the data.
*/
function Application($iAppId = null)
function Application($iAppId = null, $oRow = null)
{
// we are working on an existing application
if(is_numeric($iAppId))
{
if(!$oRow)
{
/* fetch this applications information */
$sQuery = "SELECT *
FROM appFamily
WHERE appId = '?'";
if($hResult = query_parameters($sQuery, $iAppId))
{
$oRow = mysql_fetch_object($hResult);
}
if($oRow)
{
$this->iAppId = $iAppId;
@@ -68,7 +71,6 @@ class Application {
$this->sWebpage = $oRow->webPage;
$this->sQueued = $oRow->queued;
}
}
/* fetch versions of this application, if there are any */
$this->aVersionsIds = array();
@@ -829,6 +831,87 @@ class Application {
$this->sName."</a>";
return $sLink;
}
function objectGetEntries($bQueued)
{
$sQuery = "SELECT * FROM appFamily WHERE
appFamily.queued = '?'";
if($bQueued && !application::canEdit())
{
$sQuery .= "AND appFamily.submitterId = '?'";
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false",
$_SESSION['current']->iUserId);
} else
{
$hResult = query_parameters($sQuery, $bQueued ? "true" : "false");
}
if(!$hResult)
return FALSE;
return $hResult;
}
function objectGetHeader()
{
$aCells = array(
"Submission Date",
"Submitter",
"Vendor",
"Application");
return $aCells;
}
function objectGetInstanceFromRow($oRow)
{
return new application($oRow->appId, $oRow);
}
function objectOutputTableRow($oObject, $sClass, $sEditLinkLabel)
{
$oUser = new user($this->iSubmitterId);
$oVendor = new vendor($this->iVendorId);
if(!$oVendor->sName)
$oVendor->sName = get_vendor_from_keywords($this->sKeywords);
$aCells = array(
print_date(mysqltimestamp_to_unixtimestamp($this->sSubmitTime)),
$oUser->sRealname,
$oVendor->sName,
$this->sName);
if($this->canEdit() || $oObject->bQueued)
$aCells[] = "[ <a href=\"".BASE."admin/adminAppQueue.php?sAppType=".
"application&sSub=view&iAppId=$this->iAppId\">".
"$sEditLinkLabel</a> ]";
echo html_tr($aCells, $sClass);
}
function canEdit()
{
if($_SESSION['current']->hasPriv("admin"))
return TRUE;
else
return FALSE;
}
function objectDisplayQueueProcessingHelp()
{
echo "<p>This is the list of applications 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";
}
}
function get_vendor_from_keywords($sKeywords)
{
$aKeywords = explode(" *** ",$sKeywords);
$iLastElt = (sizeOf($aKeywords)-1);
return($aKeywords[$iLastElt]);
}
?>

View File

@@ -14,8 +14,10 @@ function global_admin_menu() {
"false&sAction=add&sTitle=Add%20Vendor");
$g->addmisc("&nbsp;");
$g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/".
$_SESSION['current']->getQueuedVersionCount().")",
$g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount().")",
BASE."objectManager.php?sClass=application&bIsQueue=true&sTitle=".
"Application%20Queue");
$g->add("View Version Queue (".$_SESSION['current']->getQueuedVersionCount().")",
BASE."admin/adminAppQueue.php");
$g->add("View Screenshot Queue (".appData::objectGetEntriesCount("true",
"screenshot").")",