browse apps: More options for Wine version filter

This commit is contained in:
Alexander Nicolaysen Sørnes
2008-08-05 17:16:22 +02:00
committed by Chris Morgan
parent 1ab8145d02
commit 63ef4f4e95
2 changed files with 49 additions and 4 deletions

View File

@@ -953,10 +953,24 @@ class Application {
if($sWhereFilter || $aOptions['onlyDownloadable'] == 'true')
{
$sExtraTables = ',appVersion';
$sExtraTables = ",appVersion";
$sBugzillaQuery = '';
/* We only query the bugzilla table when necessary; these queries
will hide apps without test results */
if(strstr($sWhereFilter, 'versions.id'))
{
$sExtraTables .= ','.BUGZILLA_DB.'.versions';
$sBugzillaQuery = ' AND versions.value = appVersion.ratingRelease
AND versions.product_id = '.BUGZILLA_PRODUCT_ID.' ';
}
if($sWhereFilter)
$sWhereFilter = " AND $sWhereFilter";
$sWhereFilter = " AND appVersion.state = 'accepted' AND appVersion.appId = appFamily.appId $sWhereFilter";
$sWhereFilter = " AND appVersion.state = 'accepted'
AND appVersion.appId = appFamily.appId
$sBugzillaQuery
$sWhereFilter";
}
if($aOptions['onlyDownloadable'] == 'true')
@@ -1032,9 +1046,10 @@ class Application {
$aLicenses = version::getLicenses();
$aWineVersions = get_bugzilla_versions();
$aWineVersionIds = get_bugzilla_version_ids();
$oFilter->AddFilterInfo('appVersion.rating', 'Rating', array(FILTER_EQUALS), FILTER_VALUES_ENUM, array('Platinum', 'Gold', 'Silver', 'Bronze', 'Garbage'));
$oFilter->AddFilterInfo('appVersion.ratingRelease', 'Wine version', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aWineVersions);
$oFilter->AddFilterInfo('versions.id', 'Wine version', array(FILTER_EQUALS,FILTER_LESS_THAN,FILTER_GREATER_THAN), FILTER_VALUES_ENUM, $aWineVersionIds, $aWineVersions);
$oFilter->AddFilterInfo('appFamily.catId', 'Category', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aCatIds, $aCatNames);
$oFilter->AddFilterInfo('appVersion.license', 'License', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aLicenses);
$oFilter->AddFilterInfo('appFamily.appName', 'Name', array(FILTER_CONTAINS, FILTER_STARTS_WITH, FILTER_ENDS_WITH), FILTER_VALUES_NORMAL);
@@ -1186,9 +1201,22 @@ class Application {
if($sWhereFilter || $aOptions['onlyDownloadable'] == 'true')
{
$sExtraTables = ',appVersion';
$sBugzillaQuery = '';
/* We only query the bugzilla table when necessary; these queries
will hide apps without test results */
if(strstr($sWhereFilter, 'versions.id'))
{
$sExtraTables .= ','.BUGZILLA_DB.'.versions';
$sBugzillaQuery = ' AND versions.value = appVersion.ratingRelease
AND versions.product_id = '.BUGZILLA_PRODUCT_ID.' ';
}
if($sWhereFilter)
$sWhereFilter = " AND $sWhereFilter";
$sWhereFilter = " AND appVersion.appId = appFamily.appId $sWhereFilter";
$sWhereFilter = " AND appVersion.appId = appFamily.appId
$sBugzillaQuery
$sWhereFilter";
}
if($aOptions['onlyDownloadable'] == 'true')

View File

@@ -184,6 +184,23 @@ function get_bugzilla_versions()
return $aVersions;
}
// Returns an array containing the IDs of the Wine versions stored in Bugzilla
function get_bugzilla_version_ids()
{
$aIds = array();
$hResult = query_bugzilladb("SELECT id FROM ".BUGZILLA_DB.".versions WHERE
product_id = '".BUGZILLA_PRODUCT_ID."'
ORDER BY id DESC LIMIT 6");
if(!$hResult)
return $aIds;
while(list($sId) = mysql_fetch_row($hResult))
$aIds[] = $sId;
return $aIds;
}
// $sVarname - name of the selection array that this function will output
// this is the name to use to retrieve the selection on the form postback
// $sSelectedValue - the currently selected entry