show icons in feedlist

master
Andrew Dolgov 14 years ago
parent 4a28ab4444
commit 2ef5c21f61

@ -506,6 +506,15 @@ function parse_counters(reply, scheduled_call) {
if (kind != "cat") { if (kind != "cat") {
//setFeedValue(id, false, 'error', error); //setFeedValue(id, false, 'error', error);
setFeedValue(id, false, 'updated', updated); 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); 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);
}
}

@ -7215,6 +7215,7 @@
$obj['type'] = 'feed'; $obj['type'] = 'feed';
$obj['error'] = $error; $obj['error'] = $error;
$obj['updated'] = $updated; $obj['updated'] = $updated;
$obj['icon'] = getFeedIcon($feed_id);
return $obj; return $obj;
} }

@ -1514,3 +1514,8 @@ div.fatalError textarea {
.dijitTreeRow.Hidden { .dijitTreeRow.Hidden {
display : none; display : none;
} }
img.feedIcon {
max-width : 16px;
max-height : 16px;
}

@ -270,9 +270,16 @@ function init() {
model: treeModel, model: treeModel,
_createTreeNode: function(args) { _createTreeNode: function(args) {
var tnode = new dijit._TreeNode(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; return tnode;
}, },
getIconClass: function (item, opened) {
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feedIcon";
},
getLabelClass: function (item, opened) { getLabelClass: function (item, opened) {
return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread"; return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
}, },

Loading…
Cancel
Save