57 lines
1.5 KiB
JavaScript
57 lines
1.5 KiB
JavaScript
dojo.provide("fox.PrefFilterTree");
|
|
|
|
dojo.require("lib.CheckBoxTree");
|
|
|
|
dojo.declare("fox.PrefFilterTree", lib.CheckBoxTree, {
|
|
_createTreeNode: function(args) {
|
|
var tnode = this.inherited(arguments);
|
|
|
|
var enabled = this.model.store.getValue(args.item, 'enabled');
|
|
var param = this.model.store.getValue(args.item, 'param');
|
|
|
|
if (param) {
|
|
param = dojo.doc.createElement('span');
|
|
param.className = (enabled != false) ? 'labelParam' : 'labelParam Disabled';
|
|
param.innerHTML = args.item.param[0];
|
|
dojo.place(param, tnode.labelNode, 'after');
|
|
}
|
|
|
|
return tnode;
|
|
},
|
|
|
|
getLabel: function(item) {
|
|
var label = item.name;
|
|
|
|
var feed = this.model.store.getValue(item, 'feed');
|
|
var inverse = this.model.store.getValue(item, 'inverse');
|
|
|
|
if (feed)
|
|
label += " (" + __("Feed:") + " " + feed + ")";
|
|
|
|
if (inverse)
|
|
label += " (" + __("Inverse") + ")";
|
|
|
|
/* if (item.param)
|
|
label = "<span class=\"labelFixedLength\">" + label +
|
|
"</span>" + item.param[0]; */
|
|
|
|
return label;
|
|
},
|
|
getLabelClass: function (item, opened) {
|
|
var enabled = this.model.store.getValue(item, 'enabled');
|
|
return (enabled != false) ? "dijitTreeLabel labelFixedLength" : "dijitTreeLabel labelFixedLength Disabled";
|
|
},
|
|
getRowClass: function (item, opened) {
|
|
return (!item.error || item.error == '') ? "dijitTreeRow" :
|
|
"dijitTreeRow Error";
|
|
},
|
|
onClick: function (item) {
|
|
var id = String(item.id);
|
|
var bare_id = id.substr(id.indexOf(':')+1);
|
|
|
|
if (id.match('FILTER:')) {
|
|
editFilter(bare_id, event);
|
|
}
|
|
},
|
|
});
|
|
|