browse apps: Allow filtering by Wine version

This commit is contained in:
Alexander Nicolaysen Sørnes
2008-06-16 10:53:49 +02:00
committed by Chris Morgan
parent 250296e237
commit d98e38e305
2 changed files with 24 additions and 12 deletions

View File

@@ -1031,8 +1031,10 @@ class Application {
} }
$aLicenses = version::getLicenses(); $aLicenses = version::getLicenses();
$aWineVersions = get_bugzilla_versions();
$oFilter->AddFilterInfo('appVersion.rating', 'Rating', array(FILTER_EQUALS), FILTER_VALUES_ENUM, array('Platinum', 'Gold', 'Silver', 'Bronze', 'Garbage')); $oFilter->AddFilterInfo('appVersion.rating', 'Rating', array(FILTER_EQUALS), FILTER_VALUES_ENUM, array('Platinum', 'Gold', 'Silver', 'Bronze', 'Garbage'));
$oFilter->AddFilterInfo('appVersion.ratingRelease', 'Tested Wine version', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aWineVersions);
$oFilter->AddFilterInfo('appFamily.catId', 'Category', array(FILTER_EQUALS), FILTER_VALUES_ENUM, $aCatIds, $aCatNames); $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('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); $oFilter->AddFilterInfo('appFamily.appName', 'Name', array(FILTER_CONTAINS, FILTER_STARTS_WITH, FILTER_ENDS_WITH), FILTER_VALUES_NORMAL);

View File

@@ -163,6 +163,27 @@ function get_xml_tag ($file, $mode = null)
} }
/* bugzilla functions */ /* bugzilla functions */
// Returns an array containg the Wine versions stored in our Bugzilla DB
function get_bugzilla_versions()
{
$aVersions = array();
$sTable = BUGZILLA_DB.".versions";
$sWhere = "WHERE product_id=".BUGZILLA_PRODUCT_ID;
$sQuery = "SELECT value FROM $sTable $sWhere ORDER BY id desc limit 6";
$hResult = query_bugzilladb($sQuery);
if(!$hResult) return $aVersions; // empty
// build the list of versions
while(list($sValue) = query_fetch_row($hResult))
{
$aVersions[] = $sValue;
}
return $aVersions;
}
// $sVarname - name of the selection array that this function will output // $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 // this is the name to use to retrieve the selection on the form postback
// $sSelectedValue - the currently selected entry // $sSelectedValue - the currently selected entry
@@ -171,19 +192,8 @@ function make_bugzilla_version_list($sVarname, $sSelectedValue)
{ {
$sStr = ""; $sStr = "";
$sTable = BUGZILLA_DB.".versions";
$sWhere = "WHERE product_id=".BUGZILLA_PRODUCT_ID;
$sQuery = "SELECT value FROM $sTable $sWhere ORDER BY id desc limit 6";
$hResult = query_bugzilladb($sQuery);
if(!$hResult) return;
// build the list of versions // build the list of versions
$aVersions = array(); $aVersions = get_bugzilla_versions();
while(list($sValue) = query_fetch_row($hResult))
{
$aVersions[] = $sValue;
}
// build the selection array // build the selection array
$sStr.= "<select name='$sVarname'>\n"; $sStr.= "<select name='$sVarname'>\n";