2010-11-18 12:49:26 +00:00
|
|
|
dojo.provide("fox.PrefFilterTree");
|
|
|
|
|
|
|
|
dojo.require("lib.CheckBoxTree");
|
2013-03-31 13:15:23 +00:00
|
|
|
dojo.require("dojo.data.ItemFileWriteStore");
|
|
|
|
|
|
|
|
dojo.declare("fox.PrefFilterStore", dojo.data.ItemFileWriteStore, {
|
|
|
|
|
|
|
|
_saveEverything: function(saveCompleteCallback, saveFailedCallback,
|
|
|
|
newFileContentString) {
|
|
|
|
|
|
|
|
dojo.xhrPost({
|
|
|
|
url: "backend.php",
|
|
|
|
content: {op: "pref-filters", method: "savefilterorder",
|
|
|
|
payload: newFileContentString},
|
|
|
|
error: saveFailedCallback,
|
|
|
|
load: saveCompleteCallback});
|
|
|
|
},
|
|
|
|
|
|
|
|
});
|
2010-11-18 12:49:26 +00:00
|
|
|
|
|
|
|
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];
|
2013-06-07 06:01:11 +00:00
|
|
|
dojo.place(param, tnode.rowNode, 'first');
|
2010-11-18 12:49:26 +00:00
|
|
|
}
|
|
|
|
|
2013-07-10 09:09:12 +00:00
|
|
|
if (this.model.store.getValue(args.item, 'id') != 'root') {
|
|
|
|
var img = dojo.doc.createElement('img');
|
|
|
|
img.src ='images/filter.png';
|
|
|
|
img.className = 'markedPic';
|
|
|
|
tnode._filterIconNode = img;
|
|
|
|
dojo.place(tnode._filterIconNode, tnode.labelNode, 'before');
|
|
|
|
}
|
|
|
|
|
2010-11-18 12:49:26 +00:00
|
|
|
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)
|
2011-12-27 08:52:33 +00:00
|
|
|
label += " (" + __("in") + " " + feed + ")";
|
2010-11-18 12:49:26 +00:00
|
|
|
|
|
|
|
if (inverse)
|
|
|
|
label += " (" + __("Inverse") + ")";
|
|
|
|
|
|
|
|
/* if (item.param)
|
2011-12-27 08:52:33 +00:00
|
|
|
label = "<span class=\"labelFixedLength\">" + label +
|
2010-11-18 12:49:26 +00:00
|
|
|
"</span>" + item.param[0]; */
|
|
|
|
|
|
|
|
return label;
|
|
|
|
},
|
2010-11-19 15:38:25 +00:00
|
|
|
getIconClass: function (item, opened) {
|
|
|
|
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
|
|
|
|
},
|
2010-11-18 12:49:26 +00:00
|
|
|
getLabelClass: function (item, opened) {
|
|
|
|
var enabled = this.model.store.getValue(item, 'enabled');
|
|
|
|
return (enabled != false) ? "dijitTreeLabel labelFixedLength" : "dijitTreeLabel labelFixedLength Disabled";
|
|
|
|
},
|
|
|
|
getRowClass: function (item, opened) {
|
2011-12-27 08:52:33 +00:00
|
|
|
return (!item.error || item.error == '') ? "dijitTreeRow" :
|
2010-11-18 12:49:26 +00:00
|
|
|
"dijitTreeRow Error";
|
|
|
|
},
|
2013-03-31 13:15:23 +00:00
|
|
|
checkItemAcceptance: function(target, source, position) {
|
|
|
|
var 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();
|
|
|
|
},
|
2010-11-18 12:49:26 +00:00
|
|
|
});
|
|
|
|
|