Module: appdb Branch: master Commit: a084ec499165433375f52a573c67add2ba7cbf3e URL: http://source.winehq.org/git/appdb.git/?a=commit;h=a084ec499165433375f52a573...
Author: Alexander Nicolaysen Sørnes alex@thehandofagony.com Date: Fri Jul 18 16:07:14 2008 +0200
Add a detailed maintainer view
---
contact.php | 6 ++ include/maintainer.php | 5 +- include/maintainerView.php | 141 ++++++++++++++++++++++++++++++++++++++++++++ include/sidebar_login.php | 4 + include/testData.php | 21 +++++++ objectManager.php | 1 + 6 files changed, 177 insertions(+), 1 deletions(-)
diff --git a/contact.php b/contact.php index f1a2b0c..06757c6 100644 --- a/contact.php +++ b/contact.php @@ -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(); diff --git a/include/maintainer.php b/include/maintainer.php index 66e1f6b..1851f91 100644 --- a/include/maintainer.php +++ b/include/maintainer.php @@ -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); diff --git a/include/maintainerView.php b/include/maintainerView.php new file mode 100644 index 0000000..b3241f3 --- /dev/null +++ b/include/maintainerView.php @@ -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(); + } +} + +?> diff --git a/include/sidebar_login.php b/include/sidebar_login.php index 536ad71..719647a 100644 --- a/include/sidebar_login.php +++ b/include/sidebar_login.php @@ -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); diff --git a/include/testData.php b/include/testData.php index c749c53..0183040 100644 --- a/include/testData.php +++ b/include/testData.php @@ -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) { diff --git a/objectManager.php b/objectManager.php index 30ad2f3..7cf3180 100644 --- a/objectManager.php +++ b/objectManager.php @@ -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']))