1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/* global dijit,lib */
define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], function (declare, domConstruct) {
return declare("fox.PrefFilterTree", lib.CheckBoxTree, {
_createTreeNode: function(args) {
const tnode = this.inherited(arguments);
const enabled = this.model.store.getValue(args.item, 'enabled');
let param = this.model.store.getValue(args.item, 'param');
const rules = this.model.store.getValue(args.item, 'rules');
if (param) {
param = dojo.doc.createElement('span');
param.className = (enabled != false) ? 'labelParam' : 'labelParam filterDisabled';
param.innerHTML = args.item.param[0];
domConstruct.place(param, tnode.rowNode, 'first');
}
if (rules) {
param = dojo.doc.createElement('span');
param.className = 'filterRules';
param.innerHTML = rules;
domConstruct.place(param, tnode.rowNode, 'next');
}
if (this.model.store.getValue(args.item, 'id') != 'root') {
const img = dojo.doc.createElement('img');
img.src ='images/filter.png';
img.className = 'markedPic';
tnode._filterIconNode = img;
domConstruct.place(tnode._filterIconNode, tnode.labelNode, 'before');
}
return tnode;
},
getLabel: function(item) {
let label = item.name;
const feed = this.model.store.getValue(item, 'feed');
const inverse = this.model.store.getValue(item, 'inverse');
if (feed)
label += " (" + __("in") + " " + feed + ")";
if (inverse)
label += " (" + __("Inverse") + ")";
/* if (item.param)
label = "<span class=\"labelFixedLength\">" + label +
"</span>" + item.param[0]; */
return label;
},
getIconClass: function (item, opened) {
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
},
getLabelClass: function (item, opened) {
const enabled = this.model.store.getValue(item, 'enabled');
return (enabled != false) ? "dijitTreeLabel labelFixedLength" : "dijitTreeLabel labelFixedLength filterDisabled";
},
getRowClass: function (item, opened) {
return (!item.error || item.error == '') ? "dijitTreeRow" :
"dijitTreeRow Error";
},
checkItemAcceptance: function(target, source, position) {
const item = dijit.getEnclosingWidget(target).item;
// disable copying items
source.copyState = function() { return false; };
return position != 'over';
},
onDndDrop: function() {
this.inherited(arguments);
this.tree.model.store.save();
},
});
});
|