show icons in feedlist

This commit is contained in:
Andrew Dolgov 2010-11-16 09:49:00 +03:00
parent 4a28ab4444
commit 2ef5c21f61
4 changed files with 42 additions and 1 deletions

View 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);
}
}

View file

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

View file

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

View file

@ -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";
},