]> git.wh0rd.org Git - tt-rss.git/commitdiff
show icons in feedlist
authorAndrew Dolgov <fox@fakecake.org>
Tue, 16 Nov 2010 06:49:00 +0000 (09:49 +0300)
committerAndrew Dolgov <fox@fakecake.org>
Tue, 16 Nov 2010 06:49:00 +0000 (09:49 +0300)
feedlist.js
functions.php
tt-rss.css
tt-rss.js

index f906c37ed367f8a34f548589cc52f5621830e142..c3860da55a5ab37184131876eff149a49f6f0930 100644 (file)
@@ -506,6 +506,15 @@ function parse_counters(reply, scheduled_call) {
                        if (kind != "cat") {
                                //setFeedValue(id, false, 'error', error);
                                setFeedValue(id, false, 'updated', updated);
+
+                               if (id > 0) {
+                                       if (has_img) {
+                                               setFeedIcon(id, false, 
+                                                       getInitParam("icons_url") + "/" + id + ".ico");
+                                       } else {
+                                               setFeedIcon(id, false, 'images/blank_icon.gif');
+                                       }
+                               }
                        }
                }
        
@@ -915,3 +924,22 @@ function selectFeed(feed, is_cat) {
                exception_error("selectFeed", e);
        }
 }
+
+function setFeedIcon(feed, is_cat, src) {
+       try {
+               var tree = dijit.byId("feedTree");
+
+               if (is_cat) 
+                       treeNode = tree._itemNodesMap['CAT:' + feed];
+               else
+                       treeNode = tree._itemNodesMap['FEED:' + feed];
+
+               if (treeNode) {
+                       treeNode = treeNode[0];
+                       treeNode.iconNode.src = src;
+               }
+
+       } catch (e) {
+               exception_error("setFeedIcon", e);
+       }
+}
index 94cb9ced90f4650916206cfade4220e18e287384..82f06e718cad1784bd925b218ae82c1a12ebe161 100644 (file)
                $obj['type'] = 'feed';
                $obj['error'] = $error;
                $obj['updated'] = $updated;
+               $obj['icon'] = getFeedIcon($feed_id);
 
                return $obj;
        }
index 017ce6f624501cec05e8182c7023844f68d38764..35d1095d3a07950fcdc819cfde6c1ea753499664 100644 (file)
@@ -1514,3 +1514,8 @@ div.fatalError textarea {
 .dijitTreeRow.Hidden {
        display : none;
 }
+
+img.feedIcon {
+       max-width : 16px;
+       max-height : 16px;
+}
index 5a7fc3ee3495c8bd91c1ebd937fd02a526dce187..f7beba47409056a656bd2dc51b91b04e67efe2aa 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -270,9 +270,16 @@ function init() {
                                model: treeModel,
                                _createTreeNode: function(args) {
                                        var tnode = new dijit._TreeNode(args);
-                                       tnode.labelNode.innerHTML = args.label;
+
+                                       if (args.item.icon) 
+                                               tnode.iconNode.src = args.item.icon[0];
+
+                                       //tnode.labelNode.innerHTML = args.label;
                                        return tnode;
                                        },
+                               getIconClass: function (item, opened) {
+                                       return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon";
+                               },
                                getLabelClass: function (item, opened) {
                                        return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
                                },