forked from extern/egroupware
Add multiple marking (multiselection) to folder widget, and dhtmlxtree:
- Attribute name: multimarking, default value: false
This commit is contained in:
parent
a9a246c727
commit
ae95e934a8
@ -101,7 +101,13 @@ var et2_tree = et2_inputWidget.extend(
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"description": "comma-separated names of icons for a leaf, closed and opend folder (default: leaf.gif,folderClosed.gif,folderOpen.gif), images with extension get loaded from image_path, just 'image' or 'appname/image' are allowed too"
|
||||
}
|
||||
},
|
||||
"multimarking": {
|
||||
"name": "multimarking",
|
||||
"type": "any",
|
||||
"default": false,
|
||||
"description": "Allow marking multiple nodes, default is false which means disabled multiselection, true or 'strict' activates it and 'strict' makes it strick to only same level marking"
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
@ -218,6 +224,11 @@ var et2_tree = et2_inputWidget.extend(
|
||||
widget.input.setXMLAutoLoading(egw.link(url));
|
||||
widget.input.setDataMode('JSON');
|
||||
}
|
||||
|
||||
if (widget.options.multimarking)
|
||||
{
|
||||
widget.input.enableMultiselection(!!widget.options.multimarking, widget.options.multimarking === 'strict');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1240,9 +1240,31 @@ SELECTION
|
||||
if (typeof mode == 'undefined') mode=false;
|
||||
if (!mode && this.checkEvent("onSelect")) this._onSSCFold=this.getSelectedItemId();
|
||||
|
||||
this._unselectItems();
|
||||
|
||||
this._markItem(node);
|
||||
if ((!this._amsel) || (!e) || ((!e.ctrlKey) && (!e.metaKey) && (!e.shiftKey))) {
|
||||
this._unselectItems()
|
||||
}
|
||||
if ((node.i_sel) && (this._amsel) && (e) && (e.ctrlKey || e.metaKey)) {
|
||||
this._unselectItem(node)
|
||||
} else {
|
||||
if ((!node.i_sel) && ((!this._amselS) || (this._selected.length == 0) || (this._selected[0].parentObject == node.parentObject))) {
|
||||
if ((this._amsel) && (e) && (e.shiftKey) && (this._selected.length != 0) && (this._selected[this._selected.length - 1].parentObject == node.parentObject)) {
|
||||
var f = this._getIndex(this._selected[this._selected.length - 1]);
|
||||
var d = this._getIndex(node);
|
||||
if (d < f) {
|
||||
var l = f;
|
||||
f = d;
|
||||
d = l
|
||||
}
|
||||
for (var g = f; g <= d; g++) {
|
||||
if (!node.parentObject.childNodes[g].i_sel) {
|
||||
this._markItem(node.parentObject.childNodes[g])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this._markItem(node)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!mode && this.checkEvent("onSelect")) {
|
||||
var z=this.getSelectedItemId();
|
||||
if (z!=this._onSSCFold)
|
||||
@ -2263,6 +2285,16 @@ dhtmlXTreeObject.prototype._recreateBranch=function(itemObject,targetObject,befo
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableCheckBoxes=function(mode, hidden){ this.checkBoxOff=convertStringToBoolean(mode); this.cBROf=(!(this.checkBoxOff||convertStringToBoolean(hidden)));
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: enable/disable multiple selection
|
||||
* @param: mode - true/false
|
||||
* @param: strict - true/false
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableMultiselection = function(mode, strict) {
|
||||
this._amsel = convertStringToBoolean(mode);
|
||||
this._amselS = convertStringToBoolean(strict);
|
||||
};
|
||||
/**
|
||||
* @desc: set default images for nodes (must be called before XML loading)
|
||||
* @type: public
|
||||
|
Loading…
Reference in New Issue
Block a user