website/appdb: fixed Highlighting of Top10 on Mainpage

André Hentschel nerv at dawncrow.de
Sat Jan 17 08:01:05 CST 2009


see Bug #16442
it just was missing to check the Rating, and so all highlights were white like platinum
---
 include/util.php |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/include/util.php b/include/util.php
index bf6f8df..8e2bf8e 100644
--- a/include/util.php
+++ b/include/util.php
@@ -279,7 +279,7 @@ function getNumberOfComments()
 }
 
 /* used by outputTopXRowAppsFromRating() to reduce duplicated code */
-function outputTopXRow($oRow)
+function outputTopXRow($oRow, $sRating)
 {
     $oVersion = new Version($oRow->versionId);
     $oApp = new Application($oVersion->iAppId);
@@ -287,21 +287,22 @@ function outputTopXRow($oRow)
 
     // create the table row
     $oTableRow = new TableRow();
-    $oTableRow->SetClass("white");
 
     // create the cells that represent the row
     $oTableCell = new TableCell(version::fullNameLink($oVersion->iVersionId));
     $oTableCell->SetClass("app_name");
     $oTableRow->AddCell($oTableCell);
-    $oTableRow->AddTextCell(util_trim_description($oApp->sDescription));
+    $oTableRow->AddTextCell($sRating);
     $oTableCell = new TableCell($img);
     $oTableCell->SetStyle("text-align:center;");
     $oTableRow->AddCell($oTableCell);
 
     // create a new TableRowHighlight instance
-    $oHighlightColor = new color(0xf0, 0xf6, 0xff);
     $oInactiveColor = new color();
-    $oInactiveColor->SetColorByName("White");
+	$oHighlightColor = new color();
+    $oInactiveColor->SetColorByName($sRating);
+	if(strtolower($sRating)=="platinum") $oHighlightColor->color(0xF0,0xF6,0xFF);
+	else $oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
     $oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
 
     // create a new TableRowclick
@@ -341,7 +342,7 @@ function outputTopXRowAppsFromRating($sRating, $iNumApps)
     {
         /* keep track of the apps we've already output */
         $aVersionId[] = $oRow->versionId;
-        outputTopXRow($oRow);
+        outputTopXRow($oRow, $sRating);
     }
 
     /* if we have no more app entries we should stop now and save ourselves a query */
@@ -365,7 +366,7 @@ function outputTopXRowAppsFromRating($sRating, $iNumApps)
     /* get the list that will fill the empty spots */
     $hResult = query_appdb($sQuery);
     while($oRow = query_fetch_object($hResult))
-        outputTopXRow($oRow);
+        outputTopXRow($oRow, $sRating);
 }
 
 /* return true if this word is in the list of words to ignore */
@@ -988,14 +989,14 @@ class color
     switch(strtolower($sColorName))
     {
     case "platinum":
-      $this->iRed = 0xEC;
-      $this->iGreen = 0xEC;
-      $this->iBlue = 0xEC;
+      $this->iRed = 0xFF;
+      $this->iGreen = 0xFF;
+      $this->iBlue = 0xFF;
       break;
     case "gold":
-      $this->iRed = 0xFF;
-      $this->iGreen = 0xF6;
-      $this->iBlue = 0x00;
+      $this->iRed = 0xDA;
+      $this->iGreen = 0xA5;
+      $this->iBlue = 0x20;
       break;
     case "silver":
       $this->iRed = 0xC0;
-- 
1.6.0.4


--------------030508070002030606040902--



More information about the wine-patches mailing list