]> git.wh0rd.org - tt-rss.git/blob - PrefFeedTree.js
assorted DnD and pref layout fixes
[tt-rss.git] / PrefFeedTree.js
1 dojo.provide("fox.PrefFeedTree");
2
3 dojo.require("lib.CheckBoxTree");
4
5 dojo.declare("fox.PrefFeedTree", lib.CheckBoxTree, {
6 checkItemAcceptance: function(target, source, position) {
7 var item = dijit.getEnclosingWidget(target).item;
8
9 // disable copying items
10 source.copyState = function() { return false; }
11
12 var source_item = false;
13
14 source.forInSelectedItems(function(node) {
15 source_item = node.data.item;
16 });
17
18 if (!source_item || !item) return false;
19
20 var id = String(item.id);
21 var source_id = String(source_item.id);
22
23 var id = this.tree.model.store.getValue(item, 'id');
24 var source_id = source.tree.model.store.getValue(source_item, 'id');
25
26 //console.log(id + " " + position + " " + source_id);
27
28 if (source_id.match("FEED:")) {
29 return ((id.match("CAT:") && position == "over") ||
30 (id.match("FEED:") && position != "over"));
31 } else if (source_id.match("CAT:")) {
32 return ((id.match("CAT:") && position != "over") ||
33 (id.match("root") && position == "over"));
34 }
35 },
36 });
37