Allow maintainer requests on version submission
This commit is contained in:
committed by
WineHQ
parent
6a92f95a6d
commit
a81ce02877
@@ -17,6 +17,8 @@ define("SILVER_RATING", "Silver");
|
|||||||
define("BRONZE_RATING", "Bronze");
|
define("BRONZE_RATING", "Bronze");
|
||||||
define("GARBAGE_RATING", "Garbage");
|
define("GARBAGE_RATING", "Garbage");
|
||||||
|
|
||||||
|
define("MAINTAINER_REQUEST", 1);
|
||||||
|
define("SUPERMAINTAINER_REQUEST", 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application class for handling applications.
|
* Application class for handling applications.
|
||||||
@@ -34,8 +36,8 @@ class Application {
|
|||||||
var $sSubmitTime;
|
var $sSubmitTime;
|
||||||
var $iSubmitterId;
|
var $iSubmitterId;
|
||||||
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
|
var $aVersionsIds; // an array that contains the versionId of every version linked to this app.
|
||||||
var $bSuperMaintainerRequest; // Temporary variable used in application submission.
|
var $iMaintainerRequest; /* Temporary variable for tracking maintainer
|
||||||
// If the user wants to become a super maintainer for the application
|
requests on app submission. Value denotes type of request */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor, fetches the data.
|
* constructor, fetches the data.
|
||||||
@@ -133,7 +135,7 @@ class Application {
|
|||||||
$this->SendNotificationMail(); // Only administrators will be mailed as no supermaintainers exist for this app.
|
$this->SendNotificationMail(); // Only administrators will be mailed as no supermaintainers exist for this app.
|
||||||
|
|
||||||
/* Submit super maintainer request if asked to */
|
/* Submit super maintainer request if asked to */
|
||||||
if($this->bSuperMaintainerRequest)
|
if($this->iMaintainerRequest == SUPERMAINTAINER_REQUEST)
|
||||||
{
|
{
|
||||||
$oMaintainer = new Maintainer();
|
$oMaintainer = new Maintainer();
|
||||||
$oMaintainer->iAppId = $this->iAppId;
|
$oMaintainer->iAppId = $this->iAppId;
|
||||||
@@ -309,7 +311,7 @@ class Application {
|
|||||||
|
|
||||||
/* Unqueue matching super maintainer request */
|
/* Unqueue matching super maintainer request */
|
||||||
$hResultMaint = query_parameters("SELECT maintainerId FROM appMaintainers WHERE userId = '?' AND appId = '?'", $this->iSubmitterId, $this->iAppId);
|
$hResultMaint = query_parameters("SELECT maintainerId FROM appMaintainers WHERE userId = '?' AND appId = '?'", $this->iSubmitterId, $this->iAppId);
|
||||||
if($hResultMaint)
|
if($hResultMaint && mysql_num_rows($hResultMaint))
|
||||||
{
|
{
|
||||||
$oMaintainerRow = mysql_fetch_object($hResultMaint);
|
$oMaintainerRow = mysql_fetch_object($hResultMaint);
|
||||||
$oMaintainer = new Maintainer($oMaintainerRow->maintainerId);
|
$oMaintainer = new Maintainer($oMaintainerRow->maintainerId);
|
||||||
@@ -541,10 +543,25 @@ class Application {
|
|||||||
// Allow user to apply as super maintainer if this is a new app
|
// Allow user to apply as super maintainer if this is a new app
|
||||||
if(!$this->iAppId)
|
if(!$this->iAppId)
|
||||||
{
|
{
|
||||||
if($this->bSuperMaintainerRequest)
|
$sMaintainerOptions =
|
||||||
$sRequestSuperMaintainerChecked = 'checked="checked"';
|
"<input type=\"radio\" name=\"iMaintainerRequest\" value=\"0\" />".
|
||||||
echo '<tr valign="top"><td class="color0"><b>Become super maintainer?</b></td>',"\n";
|
"I would not like to become a maintainer<br />\n".
|
||||||
echo '<td><input type="checkbox" '.$sRequestSuperMaintainerChecked.' name="bSuperMaintainerRequest" /> Check this to request being a super maintainer for the application</td></tr>',"\n";
|
"<input type=\"radio\" name=\"iMaintainerRequest\" ".
|
||||||
|
"value=\"".MAINTAINER_REQUEST."\" />".
|
||||||
|
"I would like to be a maintainer of the new version only<br />\n".
|
||||||
|
"<input type=\"radio\" name=\"iMaintainerRequest\" ".
|
||||||
|
"value=\"".SUPERMAINTAINER_REQUEST."\" />".
|
||||||
|
"I would like to be a maintainer of the entire application<br />\n";
|
||||||
|
|
||||||
|
$sMaintainerOptionsSelected = str_replace(
|
||||||
|
"value=\"$this->iMaintainerRequest\"",
|
||||||
|
"value=\"$this->iMaintainerRequest\" checked=\"checked\"",
|
||||||
|
$sMaintainerOptions);
|
||||||
|
|
||||||
|
echo html_tr(array(
|
||||||
|
array("<b>Maintainer options</b>", "class=\"color0\""),
|
||||||
|
$sMaintainerOptionsSelected),
|
||||||
|
"", "valign=\"top\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
@@ -586,7 +603,7 @@ class Application {
|
|||||||
$this->iVendorId = $aValues['iAppVendorId'];
|
$this->iVendorId = $aValues['iAppVendorId'];
|
||||||
$this->sWebpage = $aValues['sAppWebpage'];
|
$this->sWebpage = $aValues['sAppWebpage'];
|
||||||
$this->sKeywords = $aValues['sAppKeywords'];
|
$this->sKeywords = $aValues['sAppKeywords'];
|
||||||
$this->bSuperMaintainerRequest = $aValues['bSuperMaintainerRequest'];
|
$this->iMaintainerRequest = $aValues['iMaintainerRequest'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* display this application */
|
/* display this application */
|
||||||
|
|||||||
@@ -191,19 +191,31 @@ class maintainer
|
|||||||
|
|
||||||
function ObjectGetEntries($bQueued)
|
function ObjectGetEntries($bQueued)
|
||||||
{
|
{
|
||||||
/* Excluding requests for queued apps, as these will be handled automatically */
|
/* Excluding requests for queued apps and versions, as these will be
|
||||||
|
handled automatically */
|
||||||
if($bQueued)
|
if($bQueued)
|
||||||
$sQuery = "SELECT maintainerId FROM appMaintainers, user_list, appFamily WHERE appMaintainers.userid = user_list.userid ".
|
$sQuery = "SELECT appMaintainers.submitTime, maintainerId FROM
|
||||||
"AND appMaintainers.queued = '?' AND appMaintainers.appId = ".
|
appMaintainers, user_list, appFamily
|
||||||
"appFamily.appId AND appFamily.queued = 'false' ORDER by ". "appMaintainers.submitTime";
|
WHERE appMaintainers.userid = user_list.userid AND
|
||||||
|
appMaintainers.queued = '?' AND appMaintainers.appId =
|
||||||
|
appFamily.appId AND appMaintainers.versionId = '' AND
|
||||||
|
appFamily.queued = 'false' UNION SELECT
|
||||||
|
appMaintainers.submitTime, maintainerId FROM
|
||||||
|
appMaintainers, user_list, appVersion WHERE
|
||||||
|
user_list.userid = appMaintainers.userid AND
|
||||||
|
appMaintainers.versionId = appVersion.versionId AND
|
||||||
|
appVersion.queued = 'false' AND appMaintainers.queued = '?'
|
||||||
|
ORDER by submitTime";
|
||||||
else
|
else
|
||||||
$sQuery = "SELECT maintainerId FROM appMaintainers, user_list WHERE appMaintainers.userid = user_list.userid ".
|
$sQuery = "SELECT maintainerId FROM appMaintainers, user_list
|
||||||
|
WHERE appMaintainers.userid = user_list.userid ".
|
||||||
"AND queued = '?' ORDER by realname";
|
"AND queued = '?' ORDER by realname";
|
||||||
|
|
||||||
if($bQueued)
|
if($bQueued)
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
return query_parameters($sQuery, $bQueued ? "true" : "false");
|
return query_parameters($sQuery, $bQueued ? "true" : "false",
|
||||||
|
$bQueued ? "true" : "false");
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} else
|
||||||
@@ -256,10 +268,21 @@ class maintainer
|
|||||||
|
|
||||||
function getQueuedMaintainerCount()
|
function getQueuedMaintainerCount()
|
||||||
{
|
{
|
||||||
/* Excluding requests for queued apps, as these are handled automatically */
|
/* Excluding requests for queued apps and versions, as these are handled
|
||||||
$sQuery = "SELECT COUNT(*) as queued_maintainers FROM appMaintainers, appFamily WHERE appMaintainers.queued='true' AND appFamily.appId = appMaintainers.appId AND appFamily.queued = 'false'";
|
automatically. One SELECT for super maintainers, one for maintainers. */
|
||||||
$hResult = query_parameters($sQuery);
|
$sQuery = "SELECT COUNT(DISTINCT maintainerId) as queued_maintainers FROM
|
||||||
|
appMaintainers, appFamily, appVersion
|
||||||
|
WHERE appMaintainers.queued='true' AND ((appFamily.appId =
|
||||||
|
appMaintainers.appId AND appFamily.queued = 'false' AND
|
||||||
|
appMaintainers.versionId = '') OR (
|
||||||
|
appVersion.versionId = appMaintainers.versionId
|
||||||
|
AND appVersion.queued = 'false'))";
|
||||||
|
|
||||||
|
if(!($hResult = query_parameters($sQuery)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
$oRow = mysql_fetch_object($hResult);
|
$oRow = mysql_fetch_object($hResult);
|
||||||
|
|
||||||
return $oRow->queued_maintainers;
|
return $oRow->queued_maintainers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ class Version {
|
|||||||
var $iSubmitterId;
|
var $iSubmitterId;
|
||||||
var $sDate;
|
var $sDate;
|
||||||
var $sQueued;
|
var $sQueued;
|
||||||
|
var $iMaintainerRequest; /* Temporary variable for version submisson.
|
||||||
|
Indicates whether the user wants to become a
|
||||||
|
maintainer of the version being submitted.
|
||||||
|
Value denotes type of request. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor, fetches the data.
|
* constructor, fetches the data.
|
||||||
@@ -90,6 +94,19 @@ class Version {
|
|||||||
$this->iVersionId = mysql_insert_id();
|
$this->iVersionId = mysql_insert_id();
|
||||||
$this->Version($this->iVersionId);
|
$this->Version($this->iVersionId);
|
||||||
$this->SendNotificationMail();
|
$this->SendNotificationMail();
|
||||||
|
|
||||||
|
/* Submit maintainer request if asked to */
|
||||||
|
if($this->iMaintainerRequest == MAINTAINER_REQUEST)
|
||||||
|
{
|
||||||
|
$oMaintainer = new Maintainer();
|
||||||
|
$oMaintainer->iAppId = $this->iAppId;
|
||||||
|
$oMaintainer->iVersionId = $this->iVersionId;
|
||||||
|
$oMaintainer->iUserId = $_SESSION['current']->iUserId;
|
||||||
|
$oMaintainer->sMaintainReason = "This user submitted the version;".
|
||||||
|
"auto-queued.";
|
||||||
|
$oMaintainer->bSuperMaintainer = 0;
|
||||||
|
$oMaintainer->create();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -348,6 +365,18 @@ class Version {
|
|||||||
// we send an e-mail to interested people
|
// we send an e-mail to interested people
|
||||||
$this->mailSubmitter("unQueue");
|
$this->mailSubmitter("unQueue");
|
||||||
$this->SendNotificationMail();
|
$this->SendNotificationMail();
|
||||||
|
|
||||||
|
/* Unqueue matching maintainer request */
|
||||||
|
$hResultMaint = query_parameters("SELECT maintainerId FROM
|
||||||
|
appMaintainers WHERE userId = '?' AND versionId = '?'",
|
||||||
|
$this->iSubmitterId, $this->iVersionId);
|
||||||
|
|
||||||
|
if($hResultMaint && mysql_num_rows($hResultMaint))
|
||||||
|
{
|
||||||
|
$oMaintainerRow = mysql_fetch_object($hResultMaint);
|
||||||
|
$oMaintainer = new Maintainer($oMaintainerRow->maintainerId);
|
||||||
|
$oMaintainer->unQueue("OK");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,6 +591,21 @@ class Version {
|
|||||||
|
|
||||||
echo $this->sDescription.'</textarea></p></td></tr>',"\n";
|
echo $this->sDescription.'</textarea></p></td></tr>',"\n";
|
||||||
|
|
||||||
|
/* Allow the user to apply as maintainer if this is a new version.
|
||||||
|
If it is a new application as well, radio boxes will be displayed
|
||||||
|
by the application class instead. */
|
||||||
|
if(!$this->iVersionId && $_REQUEST['iAppId'])
|
||||||
|
{
|
||||||
|
if($this->iMaintainerRequest == MAINTAINER_REQUEST)
|
||||||
|
$sRequestMaintainerChecked = 'checked="checked"';
|
||||||
|
echo html_tr(array(
|
||||||
|
array("<b>Become maintainer?</b>", "class=\"color0\""),
|
||||||
|
"<input type=\"checkbox\" $sRequestMaintainerChecked".
|
||||||
|
"name=\"iMaintainerRequest\" value=\"".MAINTAINER_REQUEST."\" /> ".
|
||||||
|
"Check this box to request being a maintainer for this version"),
|
||||||
|
"","valign=\"top\"");
|
||||||
|
}
|
||||||
|
|
||||||
echo '</table>',"\n";
|
echo '</table>',"\n";
|
||||||
|
|
||||||
echo html_frame_end();
|
echo html_frame_end();
|
||||||
@@ -608,6 +652,7 @@ class Version {
|
|||||||
$this->sDescription = $aValues['shVersionDescription'];
|
$this->sDescription = $aValues['shVersionDescription'];
|
||||||
$this->sTestedRating = $aValues['sMaintainerRating'];
|
$this->sTestedRating = $aValues['sMaintainerRating'];
|
||||||
$this->sTestedRelease = $aValues['sMaintainerRelease'];
|
$this->sTestedRelease = $aValues['sMaintainerRelease'];
|
||||||
|
$this->iMaintainerRequest = $aValues['iMaintainerRequest'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function display($iTestingId)
|
function display($iTestingId)
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ function test_superMaintainerOnAppSubmit()
|
|||||||
$oApp = new Application($iAppId);
|
$oApp = new Application($iAppId);
|
||||||
|
|
||||||
/* The user wants to be a super maintainer */
|
/* The user wants to be a super maintainer */
|
||||||
$oApp->bSuperMaintainerRequest = 1;
|
$oApp->iMaintainerRequest = SUPERMAINTAINER_REQUEST;
|
||||||
|
|
||||||
/* Make sure the user is not an admin, so the app will be queued */
|
/* Make sure the user is not an admin, so the app will be queued */
|
||||||
$oUser->delPriv("admin");
|
$oUser->delPriv("admin");
|
||||||
|
|||||||
Reference in New Issue
Block a user