Alexander Nicolaysen Sørnes : browse apps: Add support for filtering by license

Chris Morgan cmorgan at winehq.org
Sat Jun 14 16:16:51 CDT 2008


Module: appdb
Branch: master
Commit: 0a305197fd2f4ee0e7cf35525f8f9ab9c232edc2
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=0a305197fd2f4ee0e7cf35525f8f9ab9c232edc2

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Fri Jun 13 21:28:08 2008 +0200

browse apps: Add support for filtering by license

---

 include/application.php |    5 ++++-
 include/version.php     |   10 ++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/application.php b/include/application.php
index aa49a9f..64f3cc6 100644
--- a/include/application.php
+++ b/include/application.php
@@ -1020,8 +1020,11 @@ class Application {
             $aCatIds[] = $oCategory->objectGetId();
         }
 
+        $aLicenses = version::getLicenses();
+
         $oFilter->AddFilterInfo('appVersion.rating', 'Rating', array(FILTER_EQUALS, FILTER_LESS_THAN, FILTER_GREATER_THAN), FILTER_VALUES_ENUM, array('Platinum', 'Gold', 'Silver', 'Bronze', 'Garbage'));
         $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);
         return $oFilter;
     }
 
@@ -1044,7 +1047,7 @@ class Application {
             $oTableRow->AddSortableTextCell('Submission Date', 'submitTime');
 
             /* Only show submitter when processing queued entries */
-                $oTableRow->AddTextCell('Submitter');
+            $oTableRow->AddTextCell('Submitter');
             $oTableRow->AddSortableTextCell('Vendor', 'vendorName');
             $oTableRow->AddSortableTextCell('Application', 'appName');
         }
diff --git a/include/version.php b/include/version.php
index 04affed..be905e2 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1368,6 +1368,13 @@ class version {
         return $oTable->GetString();
     }
 
+    /* Returns an array containg the different software licences */
+    public function getLicenses()
+    {
+        return array(LICENSE_RETAIL, LICENSE_OPENSOURCE, LICENSE_FREETOUSE,
+                     LICENSE_FREETOSHARE, LICENSE_DEMO, LICENSE_SHAREWARE);
+    }
+
     // returns a string containing the html for a selection list
     public function makeLicenseList($sLicense = NULL)
     {
@@ -1376,8 +1383,7 @@ class version {
 
         $sReturn = "<select name=\"sLicense\">\n";
         $sReturn .= "<option value=\"\">Choose . . .</option>\n";
-        $aLicense = array(LICENSE_RETAIL, LICENSE_OPENSOURCE, LICENSE_FREETOUSE,
-                          LICENSE_FREETOSHARE, LICENSE_DEMO, LICENSE_SHAREWARE);
+        $aLicense = version::getLicences();
         $iMax = count($aLicense);
 
         for($i = 0; $i < $iMax; $i++)




More information about the wine-cvs mailing list