Use objectManager to list a user's rejected apps
This commit is contained in:
committed by
WineHQ
parent
b292a84bcf
commit
3dc453112a
@@ -424,32 +424,9 @@ if ($aClean['sSub'])
|
|||||||
}
|
}
|
||||||
else // if ($aClean['sSub']) is not defined, display the main app queue page
|
else // if ($aClean['sSub']) is not defined, display the main app queue page
|
||||||
{
|
{
|
||||||
apidb_header("Resubmit application");
|
/* Displaying of the app queue is now done by objectManager, so redirect to the
|
||||||
|
front page instead */
|
||||||
// get queued apps that the current user should see
|
util_redirect_and_exit(BASE);
|
||||||
$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(" ");
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -739,50 +739,6 @@ class Application {
|
|||||||
return $ob->appName;
|
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(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* List applications submitted by a given user */
|
/* List applications submitted by a given user */
|
||||||
function listSubmittedBy($iUserId, $bQueued = true)
|
function listSubmittedBy($iUserId, $bQueued = true)
|
||||||
{
|
{
|
||||||
@@ -844,6 +800,10 @@ class Application {
|
|||||||
|
|
||||||
if($bQueued && !application::canEdit())
|
if($bQueued && !application::canEdit())
|
||||||
{
|
{
|
||||||
|
/* Without global edit rights a user can only view his rejected apps */
|
||||||
|
if(!$bRejected)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
$sQuery .= " AND appFamily.submitterId = '?'";
|
$sQuery .= " AND appFamily.submitterId = '?'";
|
||||||
$hResult = query_parameters($sQuery, $sQueued,
|
$hResult = query_parameters($sQuery, $sQueued,
|
||||||
$_SESSION['current']->iUserId);
|
$_SESSION['current']->iUserId);
|
||||||
@@ -889,10 +849,21 @@ class Application {
|
|||||||
$sVendor,
|
$sVendor,
|
||||||
$this->sName);
|
$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=".
|
$aCells[] = "[ <a href=\"".BASE."admin/adminAppQueue.php?sAppType=".
|
||||||
"application&sSub=view&iAppId=$this->iAppId\">".
|
"application&sSub=view&iAppId=$this->iAppId\">".
|
||||||
"$sEditLinkLabel</a> ]";
|
"$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);
|
echo html_tr($aCells, $sClass);
|
||||||
}
|
}
|
||||||
@@ -901,9 +872,19 @@ class Application {
|
|||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else if($this)
|
|
||||||
return maintainer::isUserSuperMaintainer($_SESSION['current'],
|
if(is_object($this) && $this->iAppId)
|
||||||
$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
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ function global_sidebar_login() {
|
|||||||
$iAppsRejected = application::objectGetEntriesCount(true, true);
|
$iAppsRejected = application::objectGetEntriesCount(true, true);
|
||||||
if($iAppsRejected && !$_SESSION['current']->hasPriv("admin"))
|
if($iAppsRejected && !$_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
$g->add("Review Rejected Apps ($iAppsRejected)", BASE."appsubmit.php",
|
$g->add("Review Rejected Apps ($iAppsRejected)", BASE."objectManager.php?".
|
||||||
"center");
|
"sClass=application&bIsQueue=true&bIsRejected=true&sTitle=".
|
||||||
|
"Rejected+Applications", "center");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display the user's rejected versions */
|
/* Display the user's rejected versions */
|
||||||
|
|||||||
@@ -316,41 +316,6 @@ class User {
|
|||||||
return ($this->isLoggedIn() && $this->getPref("send_email","yes")=="yes");
|
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)
|
function isAppSubmitter($iAppId)
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("SELECT appId FROM appFamily
|
$hResult = query_parameters("SELECT appId FROM appFamily
|
||||||
|
|||||||
Reference in New Issue
Block a user