Use objectManager to list a user's rejected apps

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-22 00:02:30 +00:00
committed by WineHQ
parent b292a84bcf
commit 3dc453112a
4 changed files with 36 additions and 112 deletions

View File

@@ -424,32 +424,9 @@ if ($aClean['sSub'])
}
else // if ($aClean['sSub']) is not defined, display the main app queue page
{
apidb_header("Resubmit application");
// get queued apps that the current user should see
$hResult = $_SESSION['current']->getAppRejectQueueQuery(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 Resubmit 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 re-submission, or to be deleted.</p>\n";
echo "<p>To view a submission, click on its name. From that page you can delete or edit and\n";
echo "re-submit it into the AppDB .<br>\n";
echo "</td></tr></table></div>\n\n";
//show applist
Application::showList($hResult);
}
apidb_footer();
/* Displaying of the app queue is now done by objectManager, so redirect to the
front page instead */
util_redirect_and_exit(BASE);
}
?>

View File

@@ -739,50 +739,6 @@ class Application {
return $ob->appName;
}
function showList($hResult)
{
//show applist
echo html_frame_start("","90%","",0);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">
<tr class=color4>
<td>Submission Date</td>
<td>Submitter</td>
<td>Vendor</td>
<td>Application</td>
<td align=\"center\">Action</td>
</tr>";
$c = 1;
while($oRow = mysql_fetch_object($hResult))
{
$oApp = new Application($oRow->appId);
$oSubmitter = new User($oApp->iSubmitterId);
if($oApp->iVendorId)
{
$oVendor = new Vendor($oApp->iVendorId);
$sVendor = $oVendor->sName;
} else
{
$sVendor = get_vendor_from_keywords($oApp->sKeywords);
}
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=\"$bgcolor\">\n";
echo " <td>".print_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
echo " <td>\n";
echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
echo $oSubmitter->sRealname;
echo $oSubmitter->sEmail ? "</a>":"";
echo " </td>\n";
echo " <td>".$sVendor."</td>\n";
echo " <td>".$oApp->sName."</td>\n";
echo " <td align=\"center\">[<a href=".$_SERVER['PHP_SELF']."?sAppType=application&sSub=view&iAppId=".$oApp->iAppId.">process</a>]</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");
}
/* List applications submitted by a given user */
function listSubmittedBy($iUserId, $bQueued = true)
{
@@ -844,7 +800,11 @@ class Application {
if($bQueued && !application::canEdit())
{
$sQuery .= "AND appFamily.submitterId = '?'";
/* Without global edit rights a user can only view his rejected apps */
if(!$bRejected)
return FALSE;
$sQuery .= " AND appFamily.submitterId = '?'";
$hResult = query_parameters($sQuery, $sQueued,
$_SESSION['current']->iUserId);
} else
@@ -889,10 +849,21 @@ class Application {
$sVendor,
$this->sName);
if($this->canEdit() || $oObject->bQueued)
/* If the user has global edit rights canEdit() will return true even if
the appId is not defined, in which case he should use adminAppQueue.
This will soon be replaced by a unified objectManager link */
$oApp = new application();
if($oApp->canEdit())
{
$aCells[] = "[ <a href=\"".BASE."admin/adminAppQueue.php?sAppType=".
"application&sSub=view&iAppId=$this->iAppId\">".
"$sEditLinkLabel</a> ]";
} else if($this->canEdit())
{
$aCells[] = "[ <a href=\"".BASE."appsubmit.php?sAppType=".
"application&sSub=view&iAppId=$this->iAppId\">".
"$sEditLinkLabel</a> ]";
}
echo html_tr($aCells, $sClass);
}
@@ -901,9 +872,19 @@ class Application {
{
if($_SESSION['current']->hasPriv("admin"))
return TRUE;
else if($this)
return maintainer::isUserSuperMaintainer($_SESSION['current'],
$this->iAppId);
if(is_object($this) && $this->iAppId)
{
if(maintainer::isUserSuperMaintainer($_SESSION['current'],
$this->iAppId))
return TRUE;
if($this->sQueued != "true" && $this->iSubmitterId =
$_SESSION['current']->iUserId)
return TRUE;
return FALSE;
}
else
return FALSE;
}

View File

@@ -43,8 +43,9 @@ function global_sidebar_login() {
$iAppsRejected = application::objectGetEntriesCount(true, true);
if($iAppsRejected && !$_SESSION['current']->hasPriv("admin"))
{
$g->add("Review Rejected Apps ($iAppsRejected)", BASE."appsubmit.php",
"center");
$g->add("Review Rejected Apps ($iAppsRejected)", BASE."objectManager.php?".
"sClass=application&bIsQueue=true&bIsRejected=true&sTitle=".
"Rejected+Applications", "center");
}
/* Display the user's rejected versions */

View File

@@ -316,41 +316,6 @@ class User {
return ($this->isLoggedIn() && $this->getPref("send_email","yes")=="yes");
}
function getAppRejectQueueQuery($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 = 'rejected'";
} else
{
$sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
WHERE appFamily.appId = appVersion.appId
AND appFamily.queued = 'false' AND appVersion.queued = 'rejected'";
}
} else
{
if($queryAppFamily)
{
$sQuery = "SELECT appFamily.appId FROM appFamily
WHERE queued = 'rejected'
AND appFamily.submitterId = '".mysql_real_escape_string($this->iUserId)."';";
} else
{
$sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
WHERE appFamily.appId = appVersion.appId
AND appFamily.queued = 'false' AND appVersion.queued = 'rejected'
AND appVersion.submitterId = '".mysql_real_escape_string($this->iUserId)."';";
}
}
return query_appdb($sQuery);
}
function isAppSubmitter($iAppId)
{
$hResult = query_parameters("SELECT appId FROM appFamily