-require(["dojo/_base/declare", "dijit/tree/ForestStoreModel"], function (declare) {
-
- return declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
- getItemsInCategory: function (id) {
- if (!this.store._itemsByIdentity) return undefined;
-
- cat = this.store._itemsByIdentity['CAT:' + id];
-
- if (cat && cat.items)
- return cat.items;
- else
- return undefined;
-
- },
- getItemById: function (id) {
- return this.store._itemsByIdentity[id];
- },
- getFeedValue: function (feed, is_cat, key) {
- if (!this.store._itemsByIdentity) return undefined;
-
- if (is_cat)
- treeItem = this.store._itemsByIdentity['CAT:' + feed];
- else
- treeItem = this.store._itemsByIdentity['FEED:' + feed];
-
- if (treeItem)
- return this.store.getValue(treeItem, key);
- },
- getFeedName: function (feed, is_cat) {
- return this.getFeedValue(feed, is_cat, 'name');
- },
- getFeedUnread: function (feed, is_cat) {
- var unread = parseInt(this.getFeedValue(feed, is_cat, 'unread'));
- return (isNaN(unread)) ? 0 : unread;
- },
- setFeedUnread: function (feed, is_cat, unread) {
- return this.setFeedValue(feed, is_cat, 'unread', parseInt(unread));
- },
- setFeedValue: function (feed, is_cat, key, value) {
- if (!value) value = '';
- if (!this.store._itemsByIdentity) return undefined;
-
- if (is_cat)
- treeItem = this.store._itemsByIdentity['CAT:' + feed];
- else
- treeItem = this.store._itemsByIdentity['FEED:' + feed];
-
- if (treeItem)
- return this.store.setValue(treeItem, key, value);
- },
- getNextUnreadFeed: function (feed, is_cat) {
- if (!this.store._itemsByIdentity)
- return null;
-
- if (is_cat) {
- treeItem = this.store._itemsByIdentity['CAT:' + feed];
- } else {
- treeItem = this.store._itemsByIdentity['FEED:' + feed];
- }
-
- items = this.store._arrayOfAllItems;
-
- for (var i = 0; i < items.length; i++) {
- if (items[i] == treeItem) {
-
- for (var j = i + 1; j < items.length; j++) {
- var unread = this.store.getValue(items[j], 'unread');
- var id = this.store.getValue(items[j], 'id');
-
- if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) {
- if (!is_cat || !(this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed)) return items[j];
- }
- }
-
- for (var j = 0; j < i; j++) {
- var unread = this.store.getValue(items[j], 'unread');
- var id = this.store.getValue(items[j], 'id');
-
- if (unread > 0 && ((is_cat && id.match("CAT:")) || (!is_cat && id.match("FEED:")))) {
- if (!is_cat || !(this.store.hasAttribute(items[j], 'parent_id') && this.store.getValue(items[j], 'parent_id') == feed)) return items[j];
- }
- }
- }
- }
-
- return null;
- },
- hasCats: function () {
- if (this.store && this.store._itemsByIdentity)
- return this.store._itemsByIdentity['CAT:-1'] != undefined;
- else
- return false;
- },
-
- });
-});
-
-require(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct) {
+define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"], function (declare, domConstruct) {
return declare("fox.FeedTree", dijit.Tree, {
_onKeyPress: function(/* Event */ e) {
ctr = node.counterNode;
ctr.innerHTML = item.unread > 0 ? item.unread : item.auxcounter;
item.unread > 0 || item.auxcounter > 0 ?
- Effect.Appear(ctr, {duration : 0.3,
- queue: { position: 'end', scope: 'CAPPEAR-' + item.id, limit: 1 }}) :
+ item.unread > 0 ?
+ Effect.Appear(ctr, {duration : 0.3,
+ queue: { position: 'end', scope: 'CAPPEAR-' + item.id, limit: 1 }}) :
+ Element.show(ctr) :
Element.hide(ctr);
item.unread == 0 && item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux");
"dijitTreeRow Error";
if (item.unread > 0) rc += " Unread";
+ if (item.updates_disabled > 0) rc += " UpdatesDisabled";
return rc;
},
}
}
} catch (e) {
- exception_error("expandParentNodes", e);
+ exception_error(e);
}
},
findNodeParentsAndExpandThem: function(feed, is_cat, root, parents) {
}
}
} catch (e) {
- exception_error("findNodeParentsAndExpandThem", e);
+ exception_error(e);
}
},
selectFeed: function(feed, is_cat) {
treeNode = treeNode[0];
if (!is_cat) this._expandNode(treeNode);
this.set("selectedNodes", [treeNode]);
+ this.focusNode(treeNode);
+
+ // focus headlines to route key events there
+ setTimeout(function() {
+ $("headlines-frame").focus();
+ }, 0);
}
},
setFeedIcon: function(feed, is_cat, src) {