Add a detailed maintainer view
This commit is contained in:
committed by
Chris Morgan
parent
64f3219c94
commit
a084ec4991
@@ -78,6 +78,12 @@ if(!$aClean['sSubmit'])
|
||||
"=100&sOrderBy=email\">User manager</a></p>";
|
||||
}
|
||||
|
||||
if($oRecipient)
|
||||
{
|
||||
echo "<p><a href=\"".BASE."objectManager.php?sClass=maintainerView&iId=".
|
||||
"{$oRecipient->iUserId}&sTitle=Maintained+Apps\">Maintained apps</a>";
|
||||
}
|
||||
|
||||
echo "<p>E-mail $sRecipientText.</p>";
|
||||
|
||||
$oTable = new Table();
|
||||
|
||||
@@ -825,7 +825,10 @@ class maintainer
|
||||
echo "</td></tr>\n";
|
||||
|
||||
// Show which other apps the user maintains
|
||||
echo '<tr valign="top"><td class="color0" style=\'text-align:right\'><b>This user also maintains these apps:</b></td><td>',"\n";
|
||||
echo '<tr valign="top"><td class="color0" style=\'text-align:right\'><b>This user also maintains these apps:</b>';
|
||||
echo "<br /><a href=\"".BASE."objectManager.php?sClass=maintainerView".
|
||||
"&iId={$this->iUserId}&sTitle=Maintained+Apps\">Detailed view</a>";
|
||||
echo '</td><td>',"\n";
|
||||
|
||||
$oUser = new User($this->iUserId);
|
||||
$aOtherApps = Maintainer::getAppsMaintained($oUser);
|
||||
|
||||
141
include/maintainerView.php
Normal file
141
include/maintainerView.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class to show an overview of a user's maintainership, including apps maintained
|
||||
* and their ratings
|
||||
*/
|
||||
class maintainerView
|
||||
{
|
||||
var $iUserId;
|
||||
var $bViewingSelf;
|
||||
|
||||
function maintainerView($iUserId = null)
|
||||
{
|
||||
if(!$iUserId)
|
||||
$this->iUserId = $_SESSION['current']->iUserId;
|
||||
else
|
||||
$this->iUserId = $iUserId;
|
||||
|
||||
if(!$iUserId || $this->iUserId == $_SESSION['current']->iUserId)
|
||||
$this->bViewingSelf = true;
|
||||
else
|
||||
$this->bViewingSelf = false;
|
||||
}
|
||||
|
||||
function addVersionRatingInfo($oTableRow, $oVersion)
|
||||
{
|
||||
$oTableRow->AddTextCell($oVersion->objectMakeLink());
|
||||
|
||||
/* Rating info */
|
||||
$oTableCell = new TableCell($oVersion->sTestedRating);
|
||||
$oTableCell->SetClass($oVersion->sTestedRating);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
$oTableCell = new TableCell($oVersion->sTestedRelease);
|
||||
$oTableCell->SetClass($oVersion->sTestedRating);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
/* Get test reports submitted by the user */
|
||||
$aTestData = testData::getTestResultsForUser($_SESSION['current']->iUserId,
|
||||
$oVersion->iVersionId);
|
||||
|
||||
if(sizeof($aTestData))
|
||||
{
|
||||
$oTest = $aTestData[0];
|
||||
$sUserRating = $oTest->sTestedRating;
|
||||
$sUserRelease = $oTest->sTestedRelease;
|
||||
} else
|
||||
{
|
||||
$sUserRating = '';
|
||||
$sUserRelease = '';
|
||||
}
|
||||
|
||||
$oTableCell = new TableCell($sUserRating);
|
||||
$oTableCell->SetClass($sUserRating);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
$oTableCell = new TableCell($sUserRelease);
|
||||
$oTableCell->SetClass($sUserRating);
|
||||
$oTableRow->AddCell($oTableCell);
|
||||
|
||||
return $oTableRow;
|
||||
}
|
||||
|
||||
/* Shows a detailed vis of the user's maintained applications,
|
||||
including last tested release & rating */
|
||||
function display()
|
||||
{
|
||||
if(!$this->bViewingSelf)
|
||||
$oUser = new user($this->iUserId);
|
||||
|
||||
$aMaintainedApps = maintainer::getAppsMaintained($_SESSION['current']);
|
||||
if(!$aMaintainedApps || !sizeof($aMaintainedApps))
|
||||
{
|
||||
if($this->bViewingSelf)
|
||||
echo '<p>You do not maintain any apps</p>';
|
||||
else
|
||||
echo "<p>{$oUser->sRealname} does not maintain any apps</p>";
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->bViewingSelf)
|
||||
echo '<p>Viewing your maintained apps</p>';
|
||||
else
|
||||
echo "<p>Viewing {$oUser->sRealname}'s maintained apps</p>";
|
||||
|
||||
$oTable = new Table();
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->setClass('color4');
|
||||
$oTable->setCellSpacing(0);
|
||||
$oTable->setCellPadding(3);
|
||||
$oTableRow->AddTextCell('Application');
|
||||
$oTableRow->AddTextCell('Version');
|
||||
$oTableRow->AddTextCell('Current Rating');
|
||||
$oTableRow->AddTextCell('Current Version');
|
||||
$oTableRow->AddTextCell($this->bViewingSelf ? 'Your Rating' : "User's Rating");
|
||||
$oTableRow->AddTextCell($this->bViewingSelf ? 'Your Version' : "User's Version");
|
||||
$oTable->AddRow($oTableRow);
|
||||
|
||||
$i = 1;
|
||||
while(list($iIndex, list($iAppId, $iVersionId, $bSuperMaintainer)) = each($aMaintainedApps))
|
||||
{
|
||||
$oApp = new application($iAppId);
|
||||
$aVersions = array();
|
||||
|
||||
$oTableRow = new TableRow();
|
||||
$oTableRow->AddTextCell($oApp->objectMakeLink());
|
||||
|
||||
$oTableRow->SetClass(($i % 2) ? 'color0' : 'color1');
|
||||
$i++;
|
||||
|
||||
if($iVersionId)
|
||||
{
|
||||
$oVersion = new version($iVersionId);
|
||||
$oTableRow = maintainerView::addVersionRatingInfo($oTableRow, $oVersion);
|
||||
$oTable->AddRow($oTableRow);
|
||||
} else
|
||||
{
|
||||
$aVersions = $oApp->getVersions(true);
|
||||
$oTableRow->AddTextCell('*');
|
||||
$oTableRow->AddTextCell('');
|
||||
$oTableRow->AddTextCell('');
|
||||
$oTableRow->AddTextCell('');
|
||||
$oTableRow->AddTextCell('');
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
|
||||
foreach($aVersions as $oVersion)
|
||||
{
|
||||
$oTableRow = new TableRow($oTableRow);
|
||||
$oTableRow->AddTextCell('');
|
||||
$oTableRow = maintainerView::addVersionRatingInfo($oTableRow, $oVersion);
|
||||
|
||||
$oTableRow->SetClass(($i % 2) ? 'color0' : 'color1');
|
||||
$i++;
|
||||
|
||||
$oTable->AddRow($oTableRow);
|
||||
}
|
||||
}
|
||||
echo $oTable->GetString();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -23,8 +23,12 @@ function global_sidebar_login() {
|
||||
$apps_user_maintains = Maintainer::getAppsMaintained($_SESSION['current']);
|
||||
if($apps_user_maintains)
|
||||
{
|
||||
$g->add('Maintainership Overview', BASE.'objectManager.php?sClass=maintainerView&iId='.
|
||||
$_SESSION['current']->iUserId.'&sTitle=Your+Maintained+Apps');
|
||||
|
||||
$g->addmisc("");
|
||||
$g->addmisc("You maintain:\n");
|
||||
|
||||
while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains))
|
||||
{
|
||||
$oApp = new application($appId);
|
||||
|
||||
@@ -1074,6 +1074,27 @@ class testData{
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
function getTestResultsForUser($iUserId, $iVersionId)
|
||||
{
|
||||
$hResult = query_parameters("SELECT * FROM testResults WHERE
|
||||
submitterId = '?'
|
||||
AND versionId = '?'
|
||||
ORDER BY testingId DESC", $iUserId, $iVersionId);
|
||||
|
||||
if(!$hResult)
|
||||
return null;
|
||||
|
||||
$aRet = array();
|
||||
|
||||
if(!mysql_num_rows($hResult))
|
||||
return $aRet;
|
||||
|
||||
while(($oRow = mysql_fetch_object($hResult)))
|
||||
$aRet[] = new testData(0, $oRow);
|
||||
|
||||
return $aRet;
|
||||
}
|
||||
|
||||
/* List test data submitted by a given user. Ignore test results for queued applications/versions */
|
||||
function listSubmittedBy($iUserId, $bQueued = true)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,7 @@ require_once(BASE.'include/version_queue.php');
|
||||
require_once(BASE.'include/testData_queue.php');
|
||||
require_once(BASE.'include/bugs.php');
|
||||
require_once(BASE.'include/db_filter_ui.php');
|
||||
require_once(BASE.'include/maintainerView.php');
|
||||
|
||||
/* if we have no valid class name we should abort */
|
||||
if(!isset($aClean['sClass']))
|
||||
|
||||
Reference in New Issue
Block a user