Allow the user to tick a checkbox upon application submission, indication

whether he would like to become a super maintainer of the application.  The
request is processed along with the application. Also add a unit test that
tests maintainer requests submitted along with an application.
This commit is contained in:
Alexander Nicolaysen Sørnes
2006-12-09 05:07:25 +00:00
committed by WineHQ
parent cc7f3d3bc3
commit 8786673db6
3 changed files with 96 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ require_once(BASE."include/category.php");
require_once(BASE."include/url.php");
require_once(BASE."include/util.php");
require_once(BASE."include/mail.php");
require_once(BASE."include/maintainer.php");
define("PLATINUM_RATING", "Platinum");
define("GOLD_RATING", "Gold");
@@ -33,6 +34,8 @@ class Application {
var $sSubmitTime;
var $iSubmitterId;
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
var $bSuperMaintainerRequest; // Temporary variable used in application submission.
// If the user wants to become a super maintainer for the application
/**
* constructor, fetches the data.
@@ -128,6 +131,18 @@ class Application {
$this->iAppId = mysql_insert_id();
$this->application($this->iAppId);
$this->SendNotificationMail(); // Only administrators will be mailed as no supermaintainers exist for this app.
/* Submit super maintainer request if asked to */
if($this->bSuperMaintainerRequest)
{
$oMaintainer = new Maintainer();
$oMaintainer->iAppId = $this->iAppId;
$oMaintainer->iUserId = $_SESSION['current']->iUserId;
$oMaintainer->sMaintainReason = "This user submitted the application; auto-queued.";
$oMaintainer->bSuperMaintainer = 1;
$oMaintainer->create();
}
return true;
} else
{
@@ -291,6 +306,15 @@ class Application {
// we send an e-mail to intersted people
$this->mailSubmitter();
$this->SendNotificationMail();
/* Unqueue matching super maintainer request */
$hResultMaint = query_parameters("SELECT maintainerId FROM appMaintainers WHERE userId = '?' AND appId = '?'", $this->iSubmitterId, $this->iAppId);
if($hResultMaint)
{
$oMaintainerRow = mysql_fetch_object($hResultMaint);
$oMaintainer = new Maintainer($oMaintainerRow->maintainerId);
$oMaintainer->unQueue("OK");
}
}
}
@@ -336,7 +360,10 @@ class Application {
{
$aClean = array(); //array of filtered user input
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
if(isset($_REQUEST['sReplyText']))
$aClean['sReplyText'] = makeSafe($_REQUEST['sReplyText']);
else
$aClean['sReplyText'] = "";
if($this->iSubmitterId)
{
@@ -517,6 +544,15 @@ class Application {
echo $this->sDescription.'</textarea></p></td></tr>',"\n";
// Allow user to apply as super maintainer if this is a new app
if(!$this->iAppId)
{
if($this->bSuperMaintainerRequest)
$sRequestSuperMaintainerChecked = 'checked="checked"';
echo '<tr valign="top"><td class="color0"><b>Become super maintainer?</b></td>',"\n";
echo '<td><input type="checkbox" '.$sRequestSuperMaintainerChecked.' name="bSuperMaintainerRequest" /> Check this to request being a super maintainer for the application</td></tr>',"\n";
}
echo "</table>\n";
echo html_frame_end();
@@ -556,6 +592,7 @@ class Application {
$this->iVendorId = $aValues['iAppVendorId'];
$this->sWebpage = $aValues['sAppWebpage'];
$this->sKeywords = $aValues['sAppKeywords'];
$this->bSuperMaintainerRequest = $aValues['bSuperMaintainerRequest'];
}
/* display this application */

View File

@@ -185,9 +185,11 @@ class maintainer
function ObjectGetEntries($bQueued)
{
/* Excluding requests for queued apps, as these will be handled automatically */
if($bQueued)
$sQuery = "SELECT maintainerId FROM appMaintainers, user_list WHERE appMaintainers.userid = user_list.userid ".
"AND queued = '?' ORDER by submitTime";
$sQuery = "SELECT maintainerId FROM appMaintainers, user_list, appFamily WHERE appMaintainers.userid = user_list.userid ".
"AND appMaintainers.queued = '?' AND appMaintainers.appId = ".
"appFamily.appId AND appFamily.queued = 'false' ORDER by ". "appMaintainers.submitTime";
else
$sQuery = "SELECT maintainerId FROM appMaintainers, user_list WHERE appMaintainers.userid = user_list.userid ".
"AND queued = '?' ORDER by realname";
@@ -248,7 +250,8 @@ class maintainer
function getQueuedMaintainerCount()
{
$sQuery = "SELECT count(*) as queued_maintainers FROM appMaintainers where queued='true'";
/* Excluding requests for queued apps, as these are handled automatically */
$sQuery = "SELECT COUNT(*) as queued_maintainers FROM appMaintainers, appFamily WHERE appMaintainers.queued='true' AND appFamily.appId = appMaintainers.appId AND appFamily.queued = 'false'";
$hResult = query_parameters($sQuery);
$oRow = mysql_fetch_object($hResult);
return $oRow->queued_maintainers;