Alexander Nicolaysen Sørnes : version: Allow only showing unmaintained versions in version queue
Alexander Nicolaysen Sørnes
asornes at winehq.org
Thu Nov 12 03:55:16 CST 2009
Module: appdb
Branch: master
Commit: fd98a49ba4746dadca89372f0dd470db629040d0
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=fd98a49ba4746dadca89372f0dd470db629040d0
Author: Alexander Nicolaysen Sørnes <alexander at linux-xqqm.(none)>
Date: Wed Nov 11 23:26:49 2009 +0100
version: Allow only showing unmaintained versions in version queue
---
include/version.php | 50 ++++++++++++++++++++++++++++++++------------
include/version_queue.php | 16 ++++++++++---
2 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/include/version.php b/include/version.php
index bc42f22..70a5b37 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1467,8 +1467,19 @@ class version {
return $sLink;
}
- public static function objectGetEntriesCount($sState)
+ public static function objectGetEntriesCount($sState, $oFilters = null)
{
+ $sExtraTables = '';
+ $aOptions = $oFilters ? $oFilters->getOptions() : array('onlyWithoutMaintainers' => 'false');
+ $sWhereFilter = '';
+
+ if($aOptions['onlyWithoutMaintainers'] == 'true')
+ {
+ $sExtraTables = ',appFamily';
+
+ $sWhereFilter .= " AND appFamily.hasMaintainer = 'false' AND appFamily.appId = appVersion.appId";
+ }
+
$oVersion = new version();
if($sState != 'accepted' && !$oVersion->canEdit())
{
@@ -1476,13 +1487,13 @@ class version {
not be able to see rejected entries for versions they maintain */
if($sState == 'rejected')
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
- appVersion WHERE
+ appVersion$sExtraTables WHERE
appVersion.submitterId = '?'
AND
- appVersion.state = '?'";
+ appVersion.state = '?'$sWhereFilter";
else
$sQuery = "SELECT COUNT(DISTINCT appVersion.versionId) as count FROM
- appVersion, appMaintainers WHERE
+ appVersion, appMaintainers$sExtraTables WHERE
appMaintainers.appId = appVersion.appId
AND
superMaintainer = '1'
@@ -1491,14 +1502,14 @@ class version {
AND
appMaintainers.state = 'accepted'
AND
- appVersion.state = '?'";
+ appVersion.state = '?'$sWhereFilter";
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $sState);
} else
{
$sQuery = "SELECT COUNT(DISTINCT versionId) as count
- FROM appVersion WHERE
- appVersion.state = '?'";
+ FROM appVersion$sExtraTables WHERE
+ appVersion.state = '?'$sWhereFilter";
$hResult = query_parameters($sQuery, $sState);
}
@@ -1595,8 +1606,19 @@ class version {
return 'versionId';
}
- public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true)
+ public static function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true, $oFilters = null)
{
+ $sExtraTables = '';
+ $aOptions = $oFilters ? $oFilters->getOptions() : array('onlyWithoutMaintainers' => 'false');
+ $sWhereFilter = '';
+
+ if($aOptions['onlyWithoutMaintainers'] == 'true')
+ {
+ $sExtraTables = ',appFamily';
+
+ $sWhereFilter .= " AND appFamily.hasMaintainer = 'false' AND appFamily.appId = appVersion.appId";
+ }
+
$sLimit = "";
/* Should we add a limit clause to the query? */
@@ -1615,13 +1637,13 @@ class version {
/* Users should see their own rejected entries, but maintainers should
not be able to see rejected entries for versions they maintain */
if($sState == 'rejected')
- $sQuery = "SELECT * FROM appVersion WHERE
+ $sQuery = "SELECT * FROM appVersion$sExtraTables WHERE
appVersion.submitterId = '?'
AND
- appVersion.state = '?' ORDER BY ?$sLimit";
+ appVersion.state = '?'$sWhereFilter ORDER BY ?$sLimit";
else
$sQuery = "SELECT appVersion.* FROM
- appVersion, appMaintainers WHERE
+ appVersion, appMaintainers$sExtraTables WHERE
appMaintainers.appId = appVersion.appId
and
superMaintainer = '1'
@@ -1630,7 +1652,7 @@ class version {
AND
appMaintainers.state = 'accepted'
AND
- appVersion.state = '?' ORDER BY ?$sLimit";
+ appVersion.state = '?'$sWhereFilter ORDER BY ?$sLimit";
if($sLimit)
{
@@ -1643,8 +1665,8 @@ class version {
}
} else
{
- $sQuery = "SELECT * FROM appVersion WHERE
- appVersion.state = '?' ORDER BY ?$sLimit";
+ $sQuery = "SELECT * FROM appVersion$sExtraTables WHERE
+ appVersion.state = '?'$sWhereFilter ORDER BY ?$sLimit";
if($sLimit)
{
diff --git a/include/version_queue.php b/include/version_queue.php
index 6dd5fe5..0be7ba4 100644
--- a/include/version_queue.php
+++ b/include/version_queue.php
@@ -240,9 +240,9 @@ class version_queue
return $this->oVersion->objectGetItemsPerPage($sState);
}
- function objectGetEntriesCount($sState)
+ function objectGetEntriesCount($sState, $oFilters = null)
{
- return $this->oVersion->objectGetEntriesCount($sState);
+ return $this->oVersion->objectGetEntriesCount($sState, $oFilters);
}
public static function objectGetDefaultSort()
@@ -250,10 +250,11 @@ class version_queue
return version::objectGetDefaultSort();
}
- function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true)
+ function objectGetEntries($sState, $iRows = 0, $iStart = 0, $sOrderBy = "versionId", $bAscending = true, $oFilters = null)
{
return $this->oVersion->objectGetEntries($sState, $iRows, $iStart,
- $sOrderBy, $bAscending);
+ $sOrderBy, $bAscending,
+ $oFilters);
}
function objectGetHeader()
@@ -261,6 +262,13 @@ class version_queue
return $this->oVersion->objectGetHeader();
}
+ public function objectGetFilterInfo()
+ {
+ $oFilter = new FilterInterface();
+ $oFilter->AddFilterInfo('onlyWithoutMaintainers', 'Only show versions without maintainers', array(FILTER_OPTION_BOOL), FILTER_VALUES_OPTION_BOOL, array('false','true'));
+ return $oFilter;
+ }
+
function objectGetTableRow()
{
return $this->oVersion->objectGetTableRow();
More information about the wine-cvs
mailing list