Let ObjectManager handle maintainer requests
This commit is contained in:
committed by
WineHQ
parent
47a4d3cf84
commit
bf7daaa789
@@ -16,6 +16,7 @@ class maintainer
|
||||
var $bSuperMaintainer;
|
||||
var $aSubmitTime;
|
||||
var $bQueued;
|
||||
var $sReplyText;
|
||||
|
||||
function maintainer($iMaintainerId = "")
|
||||
{
|
||||
@@ -57,7 +58,7 @@ class maintainer
|
||||
return $hResult;
|
||||
}
|
||||
|
||||
function unQueue($sReplyText)
|
||||
function unQueue()
|
||||
{
|
||||
/* if the user isn't already a supermaintainer of the application and */
|
||||
/* if they are trying to become a maintainer and aren't already a maintainer of */
|
||||
@@ -90,7 +91,7 @@ class maintainer
|
||||
$sSubject = "Application Maintainer Request Report";
|
||||
$sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." has been accepted.\n";
|
||||
$sMsg .= "$sURL\n";
|
||||
$sMsg .= "$sReplyText\n";
|
||||
$sMsg .= "$this->sReplyText\n";
|
||||
$sMsg .= "We appreciate your help in making the Application Database better for all users.\n\n";
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
@@ -110,7 +111,7 @@ class maintainer
|
||||
return $sStatusMessage;
|
||||
}
|
||||
|
||||
function reject($sReplyText)
|
||||
function reject()
|
||||
{
|
||||
$oUser = new User($this->iUserId);
|
||||
$sEmail = $oUser->sEmail;
|
||||
@@ -120,10 +121,10 @@ class maintainer
|
||||
$oVersion = new Version($oRow->versionId);
|
||||
$sSubject = "Application Maintainer Request Report";
|
||||
$sMsg = "Your application to be the maintainer of ".$oApp->sName." ".$oVersion->sName." was rejected. ";
|
||||
$sMsg .= $sReplyText;
|
||||
$sMsg .= $this->sReplyText;
|
||||
$sMsg .= "";
|
||||
$sMsg .= "-The AppDB admins\n";
|
||||
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
|
||||
@@ -389,34 +390,40 @@ class maintainer
|
||||
return $aUserIds;
|
||||
}
|
||||
|
||||
function ObjectOutputHeader()
|
||||
function ObjectOutputHeader($sClass)
|
||||
{
|
||||
echo " <td>Submission Date</td>\n";
|
||||
echo " <td>Application Name</td>\n";
|
||||
echo " <td>Version</td>\n";
|
||||
echo " <td>Super maintainer?</td>\n";
|
||||
echo " <td>Submitter</td>\n";
|
||||
$aCells = array(
|
||||
"Submission Date",
|
||||
"Application Name",
|
||||
"Version",
|
||||
"Super maintainer?",
|
||||
"Submitter");
|
||||
|
||||
if(maintainer::canEdit())
|
||||
$aCells[sizeof($aCells)] = "Action";
|
||||
|
||||
echo html_tr($aCells, $sClass);
|
||||
}
|
||||
|
||||
function ObjectOutputTableRow()
|
||||
function ObjectOutputTableRow($oObject, $sClass)
|
||||
{
|
||||
$oUser = new User($this->iUserId);
|
||||
$oApp = new Application($this->iAppId);
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
echo "<td>".print_date(mysqldatetime_to_unixtimestamp($this->aSubmitTime))." </td>\n";
|
||||
echo "<td>".$oApp->sName."</td>\n";
|
||||
|
||||
if($this->bSuperMaintainer)
|
||||
{
|
||||
echo "<td>N/A</td>\n";
|
||||
echo "<td>Yes</td>\n";
|
||||
} else
|
||||
{
|
||||
echo "<td>".$oVersion->sName." </td>\n";
|
||||
echo "<td>No</td>\n";
|
||||
}
|
||||
$aCells = array(
|
||||
print_date(mysqldatetime_to_unixtimestamp($this->aSubmitTime)),
|
||||
$oApp->sName,
|
||||
($this->bSuperMaintainer) ? "N/A" : $oVersion->sName,
|
||||
($this->bSuperMaintainer) ? "Yes" : "No",
|
||||
"<a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a>");
|
||||
|
||||
echo "<td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
|
||||
if(maintainer::canEdit())
|
||||
$aCells[sizeof($aCells)] = "<a href=\"".$oObject->makeUrl("edit",
|
||||
$this->iMaintainerId)."\">answer</a>";
|
||||
|
||||
echo html_tr($aCells,
|
||||
$sClass);
|
||||
}
|
||||
|
||||
function ObjectDisplayQueueProcessingHelp()
|
||||
@@ -427,12 +434,26 @@ class maintainer
|
||||
echo "</td></tr></table></div>\n\n";
|
||||
}
|
||||
|
||||
function objectGetInstanceFromRow($oRow)
|
||||
{
|
||||
return new maintainer($oRow->maintainerId, $oRow);
|
||||
}
|
||||
|
||||
function canEdit()
|
||||
{
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function outputEditor()
|
||||
{
|
||||
//view application details
|
||||
echo html_frame_start("New Maintainer Form",600,"",0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
|
||||
echo "<input type=\"hidden\" name=\"iMaintainerId\" ".
|
||||
"value=\"$this->iMaintainerId\" />";
|
||||
/**
|
||||
* Show the other maintainers of this application, if there are any
|
||||
*/
|
||||
@@ -536,6 +557,37 @@ class maintainer
|
||||
|
||||
echo html_frame_end(" ");
|
||||
}
|
||||
};
|
||||
|
||||
function ObjectGetId()
|
||||
{
|
||||
return $this->iMaintainerId;
|
||||
}
|
||||
|
||||
function getOutputEditorValues($aClean)
|
||||
{
|
||||
$this->sReplyText = $aClean['sReplyText'];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function update()
|
||||
{
|
||||
/* STUB: No updating possible at the moment */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function getDefaultReply()
|
||||
{
|
||||
$sReplyTextHelp = "Enter a personalized reason for accepting or rejecting the ".
|
||||
"user's maintainer request here";
|
||||
|
||||
return $sReplyTextHelp;
|
||||
}
|
||||
|
||||
function objectHideDelete()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -56,7 +56,7 @@ class ObjectManager
|
||||
function display_table()
|
||||
{
|
||||
$this->checkMethods(array("ObjectGetEntries", "ObjectOutputHeader",
|
||||
"ObjectGetInstanceFromRow", "ObjectOutputTableRow"));
|
||||
"ObjectGetInstanceFromRow", "ObjectOutputTableRow", "canEdit"));
|
||||
|
||||
|
||||
/* query the class for its entries */
|
||||
@@ -137,21 +137,28 @@ class ObjectManager
|
||||
queued entry */
|
||||
if($this->bIsQueue)
|
||||
{
|
||||
/* If it isn't implemented, that means there is no default text */
|
||||
if(method_exists(new $this->sClass, "getDefaultReply"))
|
||||
$sDefaultReply = $oObject->getDefaultReply();
|
||||
|
||||
echo html_frame_start("Reply text", "90%", "", 0);
|
||||
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
||||
echo '<tr valign=top><td class="color0"><b>email Text</b></td>',"\n";
|
||||
echo '<td><textarea name="sReplyText" style="width: 100%" cols="80" '.
|
||||
'rows="10"></textarea></td></tr>',"\n";
|
||||
'rows="10">'.$sDefaultReply.'</textarea></td></tr>',"\n";
|
||||
|
||||
/* buttons for operations we can perform on this entry */
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
|
||||
echo '<input name="sSub" type="submit" value="Submit" class="button" '.
|
||||
echo '<input name="sSubmit" type="submit" value="Submit" class="button" '.
|
||||
'/>',"\n";
|
||||
echo '<input name="sSub" type="submit" value="Delete" class="button" '.
|
||||
if(!method_exists(new $this->sClass, "objectHideDelete"))
|
||||
{
|
||||
echo '<input name="sSubmit" type="submit" value="Delete" '.
|
||||
'class="button" />',"\n";
|
||||
}
|
||||
echo '<input name="sSubmit" type="submit" value="Reject" class="button" '.
|
||||
'/>',"\n";
|
||||
echo '<input name="sSub" type="submit" value="Reject" class="button" '.
|
||||
'/>',"\n";
|
||||
echo '<input name="sSub" type="submit" value="Cancel" class="button" '.
|
||||
echo '<input name="sSubmit" type="submit" value="Cancel" class="button" '.
|
||||
'/>',"\n";
|
||||
echo '</td></tr>',"\n";
|
||||
echo '</table>';
|
||||
@@ -159,7 +166,7 @@ class ObjectManager
|
||||
} else
|
||||
{
|
||||
echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
|
||||
echo '<input name="sSubmit" type="submit" value="Save" class="button">'.
|
||||
echo '<input name="sSubmit" type="submit" value="Submit" class="button">'.
|
||||
' ',"\n";
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
@@ -243,21 +250,51 @@ class ObjectManager
|
||||
|
||||
$oObject = new $this->sClass($this->iId);
|
||||
|
||||
/* If it isn't implemented, that means there is no default text */
|
||||
if(method_exists(new $this->sClass, "getDefaultReply"))
|
||||
{
|
||||
/* Don't send the default reply text */
|
||||
if($oObject->getDefaultReply() == $aClean['sReplyText'])
|
||||
$aClean['sReplyText'] = "";
|
||||
}
|
||||
|
||||
$oObject->getOutputEditorValues($aClean);
|
||||
|
||||
if($this->iId)
|
||||
switch($aClean['sSubmit'])
|
||||
{
|
||||
if(!$oObject->canEdit())
|
||||
return FALSE;
|
||||
case "Submit":
|
||||
if($this->iId)
|
||||
{
|
||||
if(!$oObject->canEdit())
|
||||
return FALSE;
|
||||
|
||||
$oObject->update();
|
||||
if($this->bIsQueue)
|
||||
$oObject->unQueue();
|
||||
|
||||
$oObject->update();
|
||||
}
|
||||
else
|
||||
$oObject->create();
|
||||
break;
|
||||
|
||||
case "Reject":
|
||||
if(!$oObject->canEdit())
|
||||
return FALSE;
|
||||
|
||||
$oObject->reject();
|
||||
break;
|
||||
case "Delete":
|
||||
$this->delete_entry();
|
||||
}
|
||||
else
|
||||
$oObject->create();
|
||||
|
||||
$sIsQueue = $tihs->bIsQueue ? "true" : "false";
|
||||
|
||||
util_redirect_and_exit($this->makeUrl("view", false, "$this->sClass list"));
|
||||
if(!$this->bIsQueue)
|
||||
$sAction = "view";
|
||||
else
|
||||
$sAction = false;
|
||||
|
||||
util_redirect_and_exit($this->makeUrl($sAction, false, "$this->sClass list"));
|
||||
}
|
||||
|
||||
/* Make an objectManager URL based on the object and optional parameters */
|
||||
|
||||
@@ -15,11 +15,15 @@ function global_admin_menu() {
|
||||
|
||||
$g->addmisc(" ");
|
||||
$g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/".$_SESSION['current']->getQueuedVersionCount().")", BASE."admin/adminAppQueue.php");
|
||||
$g->add("View App Data Queue (".$_SESSION['current']->getQueuedAppDataCount().")", BASE."admin/adminAppDataQueue.php");
|
||||
$g->add("View Maintainer Queue (".Maintainer::getQueuedMaintainerCount().")", BASE."admin/adminMaintainerQueue.php");
|
||||
$g->add("View App Data Queue (".$_SESSION['current']->getQueuedAppDataCount().")",
|
||||
BASE."admin/adminAppDataQueue.php");
|
||||
$g->add("View Maintainer Queue (".Maintainer::getQueuedMaintainerCount().")",
|
||||
BASE."objectManager.php?sClass=maintainer&bIsQueue=true&sTitle=Maintainer%20Queue");
|
||||
$g->add("View Maintainer Entries (".Maintainer::getMaintainerCount().")", BASE."admin/adminMaintainers.php");
|
||||
$g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")", BASE."admin/adminBugs.php");
|
||||
$g->add("View Test Results Queue (".testData::getNumberOfQueuedTests().")", BASE."admin/adminTestResults.php");
|
||||
$g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")",
|
||||
BASE."admin/adminBugs.php");
|
||||
$g->add("View Test Results Queue (".testData::getNumberOfQueuedTests().")",
|
||||
BASE."admin/adminTestResults.php");
|
||||
|
||||
$g->addmisc(" ");
|
||||
$g->add("Users Management", BASE."admin/adminUsers.php");
|
||||
|
||||
Reference in New Issue
Block a user