2010-11-18 13:49:26 +01:00
|
|
|
dojo.provide("fox.PrefFilterTree");
|
|
|
|
|
|
|
|
dojo.require("lib.CheckBoxTree");
|
2013-03-31 15:15:23 +02: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 13:49:26 +01: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 08:01:11 +02:00
|
|
|
dojo.place(param, tnode.rowNode, 'first');
|
2010-11-18 13:49:26 +01: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 09:52:33 +01:00
|
|
|
label += " (" + __("in") + " " + feed + ")";
|
2010-11-18 13:49:26 +01:00
|
|
|
|
|
|
|
if (inverse)
|
|
|
|
label += " (" + __("Inverse") + ")";
|
|
|
|
|
|
|
|
/* if (item.param)
|
2011-12-27 09:52:33 +01:00
|
|
|
label = "<span class=\"labelFixedLength\">" + label +
|
2010-11-18 13:49:26 +01:00
|
|
|
"</span>" + item.param[0]; */
|
|
|
|
|
|
|
|
return label;
|
|
|
|
},
|
2010-11-19 16:38:25 +01:00
|
|
|
getIconClass: function (item, opened) {
|
|
|
|
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "invisible";
|
|
|
|
},
|
2010-11-18 13:49:26 +01: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 09:52:33 +01:00
|
|
|
return (!item.error || item.error == '') ? "dijitTreeRow" :
|
2010-11-18 13:49:26 +01:00
|
|
|
"dijitTreeRow Error";
|
|
|
|
},
|
2013-03-31 15:15:23 +02: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 13:49:26 +01:00
|
|
|
});
|
|
|
|
|