]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix label row backgrounds only used when cached data is available
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 27 Oct 2012 07:25:26 +0000 (11:25 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sat, 27 Oct 2012 07:25:26 +0000 (11:25 +0400)
classes/feeds.php

index 113e2768eca614fc6456b2fd1e2087ca817ad998..72abc41e2cdfa49a1fd2d1d14ea9dc293516f18e 100644 (file)
@@ -283,25 +283,29 @@ class Feeds extends Handler_Protected {
                                        if ($label_cache) {\r
                                                if ($label_cache["no-labels"] == 1)\r
                                                        $labels = array();\r
-                                               else {\r
+                                               else\r
                                                        $labels = $label_cache;\r
-                                                       if (count($labels) > 0) {\r
-                                                               $bg = rgb2hsl(_color_unpack($labels[0][3]));\r
-                                                               if ($bg && $bg[1] > 0) {\r
+                                       }\r
+                               }\r
 \r
-                                                                       $bg[1] = 0.1;\r
-                                                                       $bg[2] = 1;\r
+                               if (!is_array($labels)) $labels = get_article_labels($this->link, $id);\r
 \r
-                                                                       $bg = _color_pack(hsl2rgb($bg));\r
-                                                                       $label_row_style = $this->make_gradient($bg, $class);;\r
-                                                               }\r
-                                                       }\r
+                               if (count($labels) > 0) {\r
+                                       for ($i = 0; $i < min(4, count($labels)); $i++) {\r
+                                               $bg = rgb2hsl(_color_unpack($labels[$i][3]));\r
+\r
+                                               if ($bg && $bg[1] > 0) {\r
+                                                       $bg[1] = 0.1;\r
+                                                       $bg[2] = 1;\r
+\r
+                                                       $bg = _color_pack(hsl2rgb($bg));\r
+                                                       $label_row_style = $this->make_gradient($bg, $class);;\r
+\r
+                                                       break;\r
                                                }\r
                                        }\r
                                }\r
 \r
-                               if (!is_array($labels)) $labels = get_article_labels($this->link, $id);\r
-\r
                                $labels_str = "<span id=\"HLLCTR-$id\">";\r
                                $labels_str .= format_article_labels($labels, $id);\r
                                $labels_str .= "</span>";\r