Allow maintainers/administrators to reject an application submission instead of just deleting it
This commit is contained in:
@@ -19,7 +19,7 @@ class Application {
|
||||
var $sKeywords;
|
||||
var $sDescription;
|
||||
var $sWebpage;
|
||||
var $bQueued;
|
||||
var $sQueued;
|
||||
var $sSubmitTime;
|
||||
var $iSubmitterId;
|
||||
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
|
||||
@@ -58,7 +58,7 @@ class Application {
|
||||
$this->sKeywords = $oRow->keywords;
|
||||
$this->sDescription = $oRow->description;
|
||||
$this->sWebpage = $oRow->webPage;
|
||||
$this->bQueued = ($oRow->queued=="true")?true:false;
|
||||
$this->sQueued = $oRow->queued;
|
||||
}
|
||||
$this->aVersionsIds[] = $oRow->versionId;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class Application {
|
||||
$this->sKeywords = $oRow->keywords;
|
||||
$this->sDescription = $oRow->description;
|
||||
$this->sWebpage = $oRow->webPage;
|
||||
$this->bQueued = ($oRow->queued=="true")?true:false;
|
||||
$this->sQueued = $oRow->queued;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ class Application {
|
||||
{
|
||||
// Security, if we are not an administrator the application must be queued.
|
||||
if(!($_SESSION['current']->hasPriv("admin")))
|
||||
$this->bQueued = true;
|
||||
$this->sQueued = 'true';
|
||||
else
|
||||
$this->bQueued = false;
|
||||
$this->sQueued = 'false';
|
||||
|
||||
$aInsert = compile_insert_string(array( 'appName' => $sName,
|
||||
'description'=> $sDescription,
|
||||
@@ -128,7 +128,7 @@ class Application {
|
||||
'vendorId' => $iVendorId,
|
||||
'catId' => $iCatId,
|
||||
'submitterId'=> $_SESSION['current']->iUserId,
|
||||
'queued' => $this->bQueued?"true":"false" ));
|
||||
'queued' => $this->sQueued));
|
||||
$sFields = "({$aInsert['FIELDS']})";
|
||||
$sValues = "({$aInsert['VALUES']})";
|
||||
|
||||
@@ -262,14 +262,14 @@ class Application {
|
||||
function unQueue()
|
||||
{
|
||||
// If we are not in the queue, we can't move the application out of the queue.
|
||||
if(!$this->bQueued)
|
||||
if(!$this->sQueued == 'true')
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_update_string(array('queued' => "false",
|
||||
'keywords'=> str_replace(" *** ","",$this->sKeywords) ));
|
||||
if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
|
||||
{
|
||||
$this->bQueued = false;
|
||||
$this->sQueued = 'false';
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter();
|
||||
$this->mailSupermaintainers();
|
||||
@@ -279,24 +279,77 @@ class Application {
|
||||
}
|
||||
}
|
||||
|
||||
function Reject()
|
||||
{
|
||||
// If we are not in the queue, we can't move the application out of the queue.
|
||||
if(!$this->sQueued == 'true')
|
||||
return false;
|
||||
|
||||
function mailSubmitter($bRejected=false)
|
||||
$sUpdate = compile_update_string(array('queued' => "rejected"));
|
||||
if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
|
||||
{
|
||||
$this->sQueued = 'rejected';
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter("reject");
|
||||
$this->mailSupermaintainers("reject");
|
||||
|
||||
// the application has been rejectedd
|
||||
addmsg("The application has been rejected.", "green");
|
||||
}
|
||||
}
|
||||
function ReQueue()
|
||||
{
|
||||
// If we are not in the rejected, we can't move the application into the queue.
|
||||
if(!$this->sQueued == 'rejected')
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_update_string(array('queued' => "true"));
|
||||
if(query_appdb("UPDATE appFamily SET ".$sUpdate." WHERE appId = ".$this->iAppId))
|
||||
{
|
||||
$this->sQueued = 'true';
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSupermaintainers();
|
||||
|
||||
// the application has been re-queued
|
||||
addmsg("The application has been re-queued.", "green");
|
||||
}
|
||||
}
|
||||
|
||||
function mailSubmitter($sAction="add")
|
||||
{
|
||||
if($this->iSubmitterId)
|
||||
{
|
||||
$oSubmitter = new User($this->iSubmitterId);
|
||||
if(!$bRejected)
|
||||
switch($sAction)
|
||||
{
|
||||
$sSubject = "Submitted application accepted";
|
||||
$sMsg = "The application you submitted (".$this->sName.") has been accepted.";
|
||||
} else
|
||||
{
|
||||
$sSubject = "Submitted application rejected";
|
||||
$sMsg = "The application you submitted (".$this->sName.") has been rejected.";
|
||||
}
|
||||
case "add":
|
||||
{
|
||||
$sSubject = "Submitted application accepted";
|
||||
$sMsg = "The application you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
|
||||
}
|
||||
break;
|
||||
case "reject":
|
||||
{
|
||||
$sSubject = "Submitted application rejected";
|
||||
$sMsg = "The application you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
|
||||
$sMsg .= APPDB_ROOT."admin/resubmitRejectedApps.php?sub=view&appId=".$this->iAppId."\n";
|
||||
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
||||
}
|
||||
break;
|
||||
case "delete":
|
||||
{
|
||||
$sSubject = "Submitted application deleted";
|
||||
$sMsg = "The application you submitted (".$oApp->sName." ".$this->sName.") has been deleted.";
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
||||
}
|
||||
break;
|
||||
|
||||
$sMsg .= $_REQUEST['replyText']."\n";
|
||||
$sMsg .= "We appreciate your help in making the Application Database better for all users.";
|
||||
|
||||
}
|
||||
mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
}
|
||||
@@ -307,7 +360,7 @@ class Application {
|
||||
switch($sAction)
|
||||
{
|
||||
case "add":
|
||||
if(!$this->bQueued)
|
||||
if(!$this->sQueued == 'true')
|
||||
{
|
||||
$sSubject = $this->sName." has been added by ".$_SESSION['current']->sRealname;
|
||||
$sMsg = APPDB_ROOT."appview.php?appId=".$this->iAppId."\n";
|
||||
@@ -323,7 +376,7 @@ class Application {
|
||||
$sSubject = $this->sName." has been submitted by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= "This application has been queued.";
|
||||
$sMsg .= "\n";
|
||||
addmsg("The application you submitted will be added to the database database after being reviewed.", "green");
|
||||
addmsg("The application you submitted will be added to the database after being reviewed.", "green");
|
||||
}
|
||||
break;
|
||||
case "edit":
|
||||
@@ -343,6 +396,18 @@ class Application {
|
||||
|
||||
addmsg("Application deleted.", "green");
|
||||
break;
|
||||
case "reject":
|
||||
$sSubject = $this->sName." has been rejected by ".$_SESSION['current']->sRealname;
|
||||
|
||||
/* if replyText is set we should report the reason the application was rejected */
|
||||
if($_REQUEST['replyText'])
|
||||
{
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
||||
}
|
||||
|
||||
addmsg("Application rejected.", "green");
|
||||
break;
|
||||
}
|
||||
$sEmail = get_notify_email_address_list($this->iAppId);
|
||||
if($sEmail)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
require_once(BASE."include/maintainer.php");
|
||||
require_once(BASE."include/application.php");
|
||||
|
||||
require_once(BASE."include/user.php");
|
||||
|
||||
function global_sidebar_login() {
|
||||
|
||||
@@ -32,6 +32,10 @@ function global_sidebar_login() {
|
||||
$g->addmisc("<a href='".BASE."appview.php?versionId=$versionId'>".lookup_app_name($appId)." ".lookup_version_name($versionId)."</a>", "center");
|
||||
}
|
||||
}
|
||||
$appsRejected = $_SESSION['current']->getAllRejectedApps();
|
||||
if($appsRejected)
|
||||
$g->addmisc("<a href='".BASE."admin/resubmitRejectedApps.php?'>Review Rejected Apps</a>", "center");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -533,6 +533,60 @@ class User {
|
||||
return query_appdb($sQuery);
|
||||
}
|
||||
|
||||
function getAppRejectQueueQuery($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 = '".$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 = '".$this->iUserId."';";
|
||||
}
|
||||
}
|
||||
|
||||
return query_appdb($sQuery);
|
||||
}
|
||||
|
||||
function getAllRejectedApps()
|
||||
{
|
||||
$result = query_appdb("SELECT appVersion.versionId, appFamily.appId
|
||||
FROM appVersion, appFamily
|
||||
WHERE appFamily.appId = appVersion.appId
|
||||
AND (appFamily.queued = 'rejected' OR appVersion.queued = 'rejected')
|
||||
AND appVersion.submitterId = '".$this->iUserId."';");
|
||||
|
||||
if(!$result || mysql_num_rows($result) == 0)
|
||||
return;
|
||||
|
||||
$retval = array();
|
||||
$c = 0;
|
||||
while($row = mysql_fetch_object($result))
|
||||
{
|
||||
$retval[$c] = array($row->appId, $row->versionId);
|
||||
$c++;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the user have permission to modify on this version?
|
||||
*/
|
||||
@@ -553,6 +607,30 @@ class User {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function isAppSubmitter($iAppId)
|
||||
{
|
||||
$sQuery = "SELECT appId FROM appFamily
|
||||
WHERE submitterId = '".$this->iUserId."'
|
||||
AND appId = '".$iAppId."';";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if(mysql_num_rows($hResult))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
function isVersionSubmitter($iVersionId)
|
||||
{
|
||||
$sQuery = "SELECT appVersion.versionId FROM appVersion, appFamily
|
||||
WHERE appFamily.appId = appVersion.appId
|
||||
AND appVersion.submitterId = '".$this->iUserId."'
|
||||
AND appVersion.versionId = '".$iVersionId."';";
|
||||
$hResult = query_appdb($sQuery);
|
||||
if(mysql_num_rows($hResult))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ class Version {
|
||||
var $sSubmitTime;
|
||||
var $iSubmitterId;
|
||||
var $sDate;
|
||||
var $sQueued;
|
||||
var $aNotesIds; // an array that contains the noteId of every note linked to this version
|
||||
var $aCommentsIds; // an array that contains the commentId of every comment linked to this version
|
||||
var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot linked to this version
|
||||
@@ -59,7 +60,7 @@ class Version {
|
||||
$this->sTestedRelease = $oRow->maintainer_release;
|
||||
$this->sTestedRating = $oRow->maintainer_rating;
|
||||
$this->sWebpage = $oRow->webPage;
|
||||
$this->bQueued = ($oRow->queued=="true")?true:false;
|
||||
$this->sQueued = $oRow->queued;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,9 +141,9 @@ class Version {
|
||||
{
|
||||
// Security, if we are not an administrator or an appmaintainer the version must be queued.
|
||||
if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSupermaintainer($iAppId)))
|
||||
$this->bQueued = true;
|
||||
$this->sQueued = 'true';
|
||||
else
|
||||
$this->bQueued = false;
|
||||
$this->sQueued = 'false';
|
||||
|
||||
$aInsert = compile_insert_string(array( 'versionName' => $sName,
|
||||
'description' => $sDescription,
|
||||
@@ -150,7 +151,7 @@ class Version {
|
||||
'maintainer_rating' => $sTestedRating,
|
||||
'appId' => $iAppId,
|
||||
'submitterId' => $_SESSION['current']->iUserId,
|
||||
'queued' => $this->bQueued?"true":"false" ));
|
||||
'queued' => $this->sQueued ));
|
||||
$sFields = "({$aInsert['FIELDS']})";
|
||||
$sValues = "({$aInsert['VALUES']})";
|
||||
|
||||
@@ -249,7 +250,9 @@ class Version {
|
||||
function delete($bSilent=false)
|
||||
{
|
||||
/* is the current user allowed to delete this version? */
|
||||
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($iVersionId))
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($iVersionId) &&
|
||||
!(($_SESSION['current']->iUserId == $this->iSubmitterId) && ($this->sQueued == 'rejected')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -300,7 +303,7 @@ class Version {
|
||||
if(!$bSilent)
|
||||
$this->mailMaintainers("delete");
|
||||
|
||||
$this->mailSubmitter(true);
|
||||
$this->mailSubmitter("delete");
|
||||
}
|
||||
|
||||
|
||||
@@ -316,15 +319,15 @@ class Version {
|
||||
}
|
||||
|
||||
// If we are not in the queue, we can't move the version out of the queue.
|
||||
if(!$this->bQueued)
|
||||
if(!$this->sQueued == 'true')
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_update_string(array('queued' => "false"));
|
||||
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
||||
{
|
||||
$this->bQueued = false;
|
||||
$this->sQueued = 'false';
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailSubmitter();
|
||||
$this->mailSubmitter("unQueue");
|
||||
$this->mailMaintainers();
|
||||
|
||||
// the version has been unqueued
|
||||
@@ -332,25 +335,91 @@ class Version {
|
||||
}
|
||||
}
|
||||
|
||||
function Reject($bSilent=false)
|
||||
{
|
||||
/* is the current user allowed to delete this version? */
|
||||
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($iVersionId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
function mailSubmitter($bRejected=false)
|
||||
// If we are not in the queue, we can't move the version out of the queue.
|
||||
if(!$this->sQueued == 'true')
|
||||
return false;
|
||||
|
||||
$sUpdate = compile_update_string(array('queued' => "rejected"));
|
||||
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
||||
{
|
||||
$this->sQueued = 'rejected';
|
||||
// we send an e-mail to intersted people
|
||||
if(!$bSilent)
|
||||
{
|
||||
$this->mailSubmitter("reject");
|
||||
$this->mailMaintainers("reject");
|
||||
}
|
||||
// the version has been unqueued
|
||||
addmsg("The version has been rejected.", "green");
|
||||
}
|
||||
}
|
||||
|
||||
function ReQueue()
|
||||
{
|
||||
/* is the current user allowed to delete this version? */
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($iVersionId) &&
|
||||
!$_SESSION['current']->iUserId == $this->iSubmitterId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$sUpdate = compile_update_string(array('queued' => "true"));
|
||||
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
||||
{
|
||||
$this->sQueued = 'true';
|
||||
// we send an e-mail to intersted people
|
||||
$this->mailMaintainers();
|
||||
|
||||
// the version has been unqueued
|
||||
addmsg("The version has been re-submitted", "green");
|
||||
}
|
||||
}
|
||||
|
||||
function mailSubmitter($sAction="add")
|
||||
{
|
||||
if($this->iSubmitterId)
|
||||
{
|
||||
$oApp = new Application($this->appId);
|
||||
$oSubmitter = new User($this->iSubmitterId);
|
||||
if(!$bRejected)
|
||||
switch($sAction)
|
||||
{
|
||||
$sSubject = "Submitted version accepted";
|
||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
|
||||
} else
|
||||
{
|
||||
$sSubject = "Submitted version rejected";
|
||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
|
||||
case "add":
|
||||
{
|
||||
$sSubject = "Submitted version accepted";
|
||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
|
||||
}
|
||||
break;
|
||||
case "reject":
|
||||
{
|
||||
$sSubject = "Submitted version rejected";
|
||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected.";
|
||||
$sMsg .= APPDB_ROOT."admin/resubmitRejectedApps.php?sub=view&versionId=".$this->iVersionId."\n";
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
||||
}
|
||||
|
||||
break;
|
||||
case "delete":
|
||||
{
|
||||
$sSubject = "Submitted version deleted";
|
||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been deleted.";
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
||||
}
|
||||
break;
|
||||
}
|
||||
$sMsg .= $_REQUEST['replyText']."\n";
|
||||
$sMsg .= "We appreciate your help in making the Version Database better for all users.";
|
||||
|
||||
|
||||
mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
}
|
||||
@@ -362,7 +431,7 @@ class Version {
|
||||
switch($sAction)
|
||||
{
|
||||
case "add":
|
||||
if(!$this->bQueued)
|
||||
if($this->sQueued == "false")
|
||||
{
|
||||
$sSubject = "Version ".$this->sName." of ".$oApp->sName." added by ".$_SESSION['current']->sRealname;
|
||||
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
|
||||
@@ -380,7 +449,7 @@ class Version {
|
||||
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' submitted by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= "This version has been queued.";
|
||||
$sMsg .= "\n";
|
||||
addmsg("The version you submitted will be added to the database database after being reviewed.", "green");
|
||||
addmsg("The version you submitted will be added to the database after being reviewed.", "green");
|
||||
}
|
||||
break;
|
||||
case "edit":
|
||||
@@ -400,6 +469,20 @@ class Version {
|
||||
|
||||
addmsg("Version deleted.", "green");
|
||||
break;
|
||||
case "reject":
|
||||
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' has been rejected by ".$_SESSION['current']->sRealname;
|
||||
|
||||
/* if replyText is set we should report the reason the application was rejected */
|
||||
if($_REQUEST['replyText'])
|
||||
{
|
||||
$sMsg = APPDB_ROOT."admin/resubmitRejectedApps.php?versionId=".$this->iVersionId."\n";
|
||||
|
||||
$sMsg .= "Reason given:\n";
|
||||
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
||||
}
|
||||
|
||||
addmsg("Version rejected.", "green");
|
||||
break;
|
||||
}
|
||||
$sEmail = get_notify_email_address_list(null, $this->iVersionId);
|
||||
if($sEmail)
|
||||
|
||||
Reference in New Issue
Block a user