Refactor code structure for improved readability and maintainability
5345
themes/sources/dhtmlxTree/codebase/dhtmlxtree.js
Normal file
26
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_attrs.js
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
dhtmlXTreeObject.prototype.parserExtension={
|
||||
_parseExtension:function(p,a,pid) {
|
||||
this._idpull[a.id]._attrs=a;
|
||||
}
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype.getAttribute=function(id,name){
|
||||
this._globalIdStorageFind(id)
|
||||
var t=this._idpull[id]._attrs;
|
||||
return t?t[name]:window.undefined;
|
||||
}
|
||||
dhtmlXTreeObject.prototype.setAttribute=function(id,name,value){
|
||||
this._globalIdStorageFind(id)
|
||||
var t=(this._idpull[id]._attrs)||{};
|
||||
t[name]=value;
|
||||
this._idpull[id]._attrs=t;
|
||||
}
|
||||
|
||||
76
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_dragin.js
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* @desc: adds drag-n-drop capabilities (with possibility to drop into dhtmlxTree) to HTML object.
|
||||
* @param: obj - HTML object, or HTML object ID
|
||||
* @param: func - custom drag processor function, optional
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.makeDraggable=function(obj,func){
|
||||
if (typeof(obj)!="object")
|
||||
obj=document.getElementById(obj);
|
||||
|
||||
dragger=new dhtmlDragAndDropObject();
|
||||
dropper=new dhx_dragSomethingInTree();
|
||||
|
||||
dragger.addDraggableItem(obj,dropper);
|
||||
obj.dragLanding=null;
|
||||
obj.ondragstart=dropper._preventNsDrag;
|
||||
obj.onselectstart=new Function("return false;");
|
||||
|
||||
obj.parentObject=new Object;
|
||||
obj.parentObject.img=obj;
|
||||
obj.parentObject.treeNod=dropper;
|
||||
dropper._customDrop=func;
|
||||
}
|
||||
dhtmlXTreeObject.prototype.makeDragable=dhtmlXTreeObject.prototype.makeDraggable;
|
||||
/**
|
||||
* @desc: adds drag-n-drop capabilities (with possibility to drop into dhtmlxTree) to all HTML items with dragInDhtmlXTree attribute
|
||||
* @param: func - custom drag processor function, optional
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.makeAllDraggable=function(func){
|
||||
var z=document.getElementsByTagName("div");
|
||||
for (var i=0; i<z.length; i++)
|
||||
if (z[i].getAttribute("dragInDhtmlXTree"))
|
||||
this.makeDragable(z[i],func);
|
||||
}
|
||||
|
||||
function dhx_dragSomethingInTree(){
|
||||
this.lWin=window;
|
||||
//this function creates a HTML object which will be used while drag-n-drop
|
||||
this._createDragNode=function(node){
|
||||
var dragSpan=document.createElement('div');
|
||||
dragSpan.style.position="absolute";
|
||||
dragSpan.innerHTML=(node.innerHTML||node.value);
|
||||
dragSpan.className="dragSpanDiv";
|
||||
return dragSpan;
|
||||
};
|
||||
//this function necessary for correct browser support
|
||||
//doesn't change anything in it
|
||||
this._preventNsDrag=function(e){
|
||||
(e||window.event).cancelBubble=true;
|
||||
if ((e)&&(e.preventDefault)) { e.preventDefault(); return false; }
|
||||
return false;
|
||||
}
|
||||
//this function contains a reaction on drop operation
|
||||
//the tree don't know what to do with custom item
|
||||
//so you must define this reaction
|
||||
this._nonTrivialNode=function(tree,item,bitem,source){
|
||||
if (this._customDrop) return this._customDrop(tree,source.img.id,item.id,bitem?bitem.id:null);
|
||||
|
||||
var image=(source.img.getAttribute("image")||"");
|
||||
var id=source.img.id||"new";
|
||||
var text=(source.img.getAttribute("text")||(_isIE?source.img.innerText:source.img.textContent));
|
||||
tree[bitem?"insertNewNext":"insertNewItem"](bitem?bitem.id:item.id,id,text,"",image,image,image);
|
||||
}
|
||||
}
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
202
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_ed.js
Normal file
@ -0,0 +1,202 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Purpose: item edit extension
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @desc: enable editing of item text
|
||||
* @param: mode - true/false
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableItemEditor=function(mode){
|
||||
this._eItEd=dhx4.s2b(mode);
|
||||
if (!this._eItEdFlag){
|
||||
|
||||
this._edn_click_IE=true;
|
||||
this._edn_dblclick=true;
|
||||
this._ie_aFunc=this.aFunc;
|
||||
this._ie_dblclickFuncHandler=this.dblclickFuncHandler;
|
||||
|
||||
this.setOnDblClickHandler(function (a,b) {
|
||||
if (this._edn_dblclick) this._editItem(a,b);
|
||||
return true;
|
||||
});
|
||||
|
||||
this.setOnClickHandler(function (a,b) {
|
||||
this._stopEditItem(a,b);
|
||||
if ((this.ed_hist_clcik==a)&&(this._edn_click_IE))
|
||||
this._editItem(a,b);
|
||||
this.ed_hist_clcik=a;
|
||||
return true;
|
||||
});
|
||||
|
||||
this._eItEdFlag=true;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: set onEdit handler ( multi handler event)
|
||||
* @param: func - function which will be called on edit related events
|
||||
* @type: depricated
|
||||
* @event: onEdit
|
||||
* @depricated: use grid.attachEvent("onEdit",func); instead
|
||||
* @eventdesc: Event occurs on 4 different stages of edit process: before editing started (cancelable), after editing started, before closing (cancelable), after closed
|
||||
* @eventparam: state - 0 before editing started , 1 after editing started, 2 before closing, 3 after closed
|
||||
* @eventparam: id - id of edited items
|
||||
* @eventparam: tree - tree object
|
||||
* @eventparam: value - for stage 0 and 2, value of editor
|
||||
* @eventreturn: for stages 0 and 2; true - confirm opening/closing, false - deny opening/closing; text - edit value
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.setOnEditHandler=function(func){
|
||||
this.attachEvent("onEdit",func);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @desc: define which events must start editing
|
||||
* @param: click_IE - click on already selected item - true/false [true by default]
|
||||
* @param: dblclick - on double click
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.setEditStartAction=function(click_IE, dblclick){
|
||||
this._edn_click_IE=dhx4.s2b(click_IE);
|
||||
this._edn_dblclick=dhx4.s2b(dblclick);
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._stopEdit=function(a,mode){
|
||||
if (this._editCell){
|
||||
this.dADTempOff=this.dADTempOffEd;
|
||||
if (this._editCell.id!=a){
|
||||
|
||||
var editText=true;
|
||||
if(!mode){
|
||||
editText=this.callEvent("onEdit",[2,this._editCell.id,this,this._editCell.span.childNodes[0].value]);
|
||||
}
|
||||
else{
|
||||
editText = false;
|
||||
this.callEvent("onEditCancel",[this._editCell.id,this._editCell._oldValue]);
|
||||
}
|
||||
if (editText===true)
|
||||
editText=this._editCell.span.childNodes[0].value;
|
||||
else if (editText===false) editText=this._editCell._oldValue;
|
||||
|
||||
var changed = (editText!=this._editCell._oldValue);
|
||||
this._editCell.span.innerHTML=editText;
|
||||
this._editCell.label=this._editCell.span.innerHTML;
|
||||
var cSS=this._editCell.i_sel?"selectedTreeRow":"standartTreeRow";
|
||||
this._editCell.span.className=cSS;
|
||||
this._editCell.span.parentNode.className="standartTreeRow";
|
||||
this._editCell.span.style.paddingRight=this._editCell.span.style.paddingLeft='5px';
|
||||
this._editCell.span.onclick=this._editCell.span.ondblclick=function(){};
|
||||
|
||||
var id=this._editCell.id;
|
||||
if (this.childCalc) this._fixChildCountLabel(this._editCell);
|
||||
this._editCell=null;
|
||||
|
||||
if(!mode)
|
||||
this.callEvent("onEdit",[3,id,this,changed]);
|
||||
|
||||
if (this._enblkbrd){
|
||||
this.parentObject.lastChild.focus();
|
||||
this.parentObject.lastChild.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._stopEditItem=function(id,tree){
|
||||
this._stopEdit(id);
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: switch currently edited item back to normal view
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
|
||||
dhtmlXTreeObject.prototype.stopEdit=function(mode){
|
||||
if (this._editCell)
|
||||
this._stopEdit(this._editCell.id+"_non",mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: open editor for specified item
|
||||
* @param: id - item ID
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.editItem=function(id){
|
||||
this._editItem(id,this);
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._editItem=function(id,tree){
|
||||
if (this._eItEd){
|
||||
this._stopEdit();
|
||||
var temp=this._globalIdStorageFind(id);
|
||||
if (!temp) return;
|
||||
|
||||
var editText = this.callEvent("onEdit",[0,id,this,temp.span.innerHTML]);
|
||||
if (editText===true)
|
||||
editText = (typeof temp.span.innerText!="undefined"?temp.span.innerText:temp.span.textContent);
|
||||
else if (editText===false) return;
|
||||
this.dADTempOffEd=this.dADTempOff;
|
||||
this.dADTempOff=false;
|
||||
|
||||
|
||||
this._editCell=temp;
|
||||
temp._oldValue=editText;
|
||||
temp.span.innerHTML="<input type='text' class='intreeeditRow' />";
|
||||
temp.span.style.paddingRight=temp.span.style.paddingLeft='0px';
|
||||
temp.span.onclick = temp.span.ondblclick= function(e){
|
||||
(e||event).cancelBubble = true;
|
||||
}
|
||||
|
||||
temp.span.childNodes[0].value=editText;
|
||||
|
||||
temp.span.childNodes[0].onselectstart=function(e){
|
||||
(e||event).cancelBubble=true;
|
||||
return true;
|
||||
}
|
||||
temp.span.childNodes[0].onmousedown=function(e){
|
||||
(e||event).cancelBubble=true;
|
||||
return true;
|
||||
}
|
||||
|
||||
temp.span.childNodes[0].focus();
|
||||
temp.span.childNodes[0].focus();
|
||||
// temp.span.childNodes[0].select();
|
||||
temp.span.onclick=function (e){ (e||event).cancelBubble=true; return false; };
|
||||
temp.span.className="";
|
||||
temp.span.parentNode.className="";
|
||||
|
||||
var self=this;
|
||||
|
||||
temp.span.childNodes[0].onkeydown=function(e){
|
||||
if (!e) e=window.event;
|
||||
if (e.keyCode==13){
|
||||
e.cancelBubble=true;
|
||||
self._stopEdit(window.undefined);
|
||||
}
|
||||
else if (e.keyCode==27){
|
||||
self._stopEdit(window.undefined, true);
|
||||
}
|
||||
(e||event).cancelBubble=true;
|
||||
}
|
||||
this.callEvent("onEdit",[1,id,this]);
|
||||
}
|
||||
};
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
264
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_json.js
Normal file
@ -0,0 +1,264 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
function jsonPointer(data,parent){
|
||||
this.d=data;
|
||||
this.dp=parent;
|
||||
}
|
||||
jsonPointer.prototype={
|
||||
text:function(){ var afff=function(n){ var p=[]; for(var i=0; i<n.length; i++) p.push("{"+sfff(n[i])+"}"); return p.join(","); }; var sfff=function(n){ var p=[]; for (var a in n) if (typeof(n[a])=="object"){ if (a.length) p.push('"'+a+'":['+afff(n[a])+"]"); else p.push('"'+a+'":{'+sfff(n[a])+"}"); }else p.push('"'+a+'":"'+n[a]+'"'); return p.join(","); }; return "{"+sfff(this.d)+"}"; },
|
||||
get:function(name){return this.d[name]; },
|
||||
exists:function(){return !!this.d },
|
||||
content:function(){return this.d.content; },
|
||||
each:function(name,f,t){ var a=this.d[name]; var c=new jsonPointer(); if (a) for (var i=0; i<a.length; i++) { c.d=a[i]; f.apply(t,[c,i]); } },
|
||||
get_all:function(){ return this.d; },
|
||||
sub:function(name){ return new jsonPointer(this.d[name],this.d) },
|
||||
sub_exists:function(name){ return !!this.d[name]; },
|
||||
each_x:function(name,rule,f,t,i){ var a=this.d[name]; var c=new jsonPointer(0,this.d); if (a) for (i=i||0; i<a.length; i++) if (a[i][rule]) { c.d=a[i]; if(f.apply(t,[c,i])==-1) return; } },
|
||||
up:function(name){ return new jsonPointer(this.dp,this.d); },
|
||||
set:function(name,val){ this.d[name]=val; },
|
||||
clone:function(name){ return new jsonPointer(this.d,this.dp); },
|
||||
through:function(name,rule,v,f,t){ var a=this.d[name]; if (a.length) for (var i=0; i<a.length; i++) { if (a[i][rule]!=null && a[i][rule]!="" && (!v || a[i][rule]==v )) {
|
||||
var c=new jsonPointer(a[i],this.d); f.apply(t,[c,i]); } var w=this.d; this.d=a[i];
|
||||
if (this.sub_exists(name)) this.through(name,rule,v,f,t); this.d=w; } }
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: load tree from js array file|stream
|
||||
* @type: public
|
||||
* @param: file - link to JSArray file
|
||||
* @param: afterCall - function which will be called after xml loading
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadJSArrayFile=function(file,callback){
|
||||
if (window.console && window.console.info)
|
||||
window.console.info("loadJSArrayFile was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44");
|
||||
return this._loadJSArrayFile(file, callback);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._loadJSArrayFile=function(file,callback){
|
||||
if (!this.parsCount) this.callEvent("onXLS",[this,this._ld_id]); this._ld_id=null; this.xmlstate=1;
|
||||
var that=this;
|
||||
|
||||
this.XMLLoader=function(xml, callback){
|
||||
eval("var z="+xml.responseText);
|
||||
this._loadJSArray(z);
|
||||
if (callback) callback.call(this, xml);
|
||||
};
|
||||
|
||||
dhx4.ajax.get(file, function(obj){
|
||||
that.XMLLoader(obj.xmlDoc, callback);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: load tree from csv file|stream
|
||||
* @type: public
|
||||
* @param: file - link to CSV file
|
||||
* @param: afterCall - function which will be called after xml loading
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadCSV=function(file,callback){
|
||||
if (window.console && window.console.info)
|
||||
window.console.info("loadCSV was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44");
|
||||
return this._loadCSV(file, callback);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._loadCSV=function(file,callback){
|
||||
if (!this.parsCount) this.callEvent("onXLS",[this,this._ld_id]); this._ld_id=null; this.xmlstate=1;
|
||||
var that=this;
|
||||
this.XMLLoader=function(xml, callback){
|
||||
this._loadCSVString(xml.responseText);
|
||||
if (callback) callback.call(this, xml);
|
||||
};
|
||||
|
||||
dhx4.ajax.get(file, function(obj){
|
||||
that.XMLLoader(obj.xmlDoc, callback);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: load tree from js array object
|
||||
* @type: public
|
||||
* @param: ar - js array
|
||||
* @param: afterCall - function which will be called after xml loading
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadJSArray=function(file,callback){
|
||||
if (window.console && window.console.info)
|
||||
window.console.info("loadJSArray was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44");
|
||||
return this._loadJSArray(file, callback);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._loadJSArray=function(ar,afterCall){
|
||||
|
||||
//array id,parentid,text
|
||||
var z=[];
|
||||
for (var i=0; i<ar.length; i++){
|
||||
if (!z[ar[i][1]]) z[ar[i][1]]=[];
|
||||
z[ar[i][1]].push({id:ar[i][0],text:ar[i][2]});
|
||||
}
|
||||
|
||||
var top={id: this.rootId};
|
||||
var f=function(top,f){
|
||||
if (z[top.id]){
|
||||
top.item=z[top.id];
|
||||
for (var j=0; j<top.item.length; j++)
|
||||
f(top.item[j],f);
|
||||
}
|
||||
}
|
||||
f(top,f);
|
||||
this._loadJSONObject(top,afterCall);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc: load tree from csv string
|
||||
* @type: public
|
||||
* @param: csv - csv string
|
||||
* @param: afterCall - function which will be called after xml loading
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadCSVString=function(file,callback){
|
||||
if (window.console && window.console.info)
|
||||
window.console.info("loadCSVString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44");
|
||||
return this._loadCSVString(file, callback);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._loadCSVString=function(csv,afterCall){
|
||||
//array id,parentid,text
|
||||
var z=[];
|
||||
var ar=csv.split("\n");
|
||||
for (var i=0; i<ar.length; i++){
|
||||
var t=ar[i].split(",");
|
||||
if (!z[t[1]]) z[t[1]]=[];
|
||||
z[t[1]].push({id:t[0],text:t[2]});
|
||||
}
|
||||
|
||||
var top={id: this.rootId};
|
||||
var f=function(top,f){
|
||||
if (z[top.id]){
|
||||
top.item=z[top.id];
|
||||
for (var j=0; j<top.item.length; j++)
|
||||
f(top.item[j],f);
|
||||
}
|
||||
}
|
||||
f(top,f);
|
||||
this._loadJSONObject(top,afterCall);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc: load tree from json object
|
||||
* @type: public
|
||||
* @param: json - json object
|
||||
* @param: afterCall - function which will be called after xml loading
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadJSONObject=function(file,callback){
|
||||
if (window.console && window.console.info)
|
||||
window.console.info("loadJSONObject was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44");
|
||||
return this._loadJSONObject(file, callback);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._loadJSONObject=function(json,afterCall){
|
||||
if (!this.parsCount) this.callEvent("onXLS",[this,null]);this.xmlstate=1;
|
||||
var p=new jsonPointer(json);
|
||||
this._parse(p);
|
||||
this._p=p;
|
||||
if (afterCall) afterCall();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @desc: load tree from json file
|
||||
* @type: public
|
||||
* @param: file - link to JSON file
|
||||
* @param: afterCall - function which will be called after xml loading
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadJSON=function(file,callback){
|
||||
if (window.console && window.console.info)
|
||||
window.console.info("loadJSON was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44");
|
||||
return this._loadJSON(file, callback);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._loadJSON=function(file,callback){
|
||||
if (!this.parsCount) this.callEvent("onXLS",[this,this._ld_id]); this._ld_id=null; this.xmlstate=1;
|
||||
var that=this;
|
||||
|
||||
this.XMLLoader=function(xml, callback){
|
||||
try {
|
||||
eval("var t="+xml.responseText);
|
||||
} catch(e){
|
||||
dhx4.callEvent("onLoadXMLerror",["Incorrect JSON",
|
||||
(xml),
|
||||
this
|
||||
]);
|
||||
return;
|
||||
}
|
||||
var p=new jsonPointer(t);
|
||||
this._parse(p);
|
||||
this._p=p;
|
||||
if (callback) callback.call(this, xml);
|
||||
};
|
||||
|
||||
dhx4.ajax.get(file, function(obj){
|
||||
that.XMLLoader(obj.xmlDoc, callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @desc: return tree as json string
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.serializeTreeToJSON=function(){
|
||||
var out=['{"id":"'+this.rootId+'", "item":['];
|
||||
var p=[];
|
||||
for (var i=0; i<this.htmlNode.childsCount; i++)
|
||||
p.push(this._serializeItemJSON(this.htmlNode.childNodes[i]));
|
||||
out.push(p.join(","));
|
||||
out.push("]}");
|
||||
return out.join("");
|
||||
};
|
||||
dhtmlXTreeObject.prototype._serializeItemJSON=function(itemNode){
|
||||
var out=[];
|
||||
if (itemNode.unParsed)
|
||||
return (itemNode.unParsed.text());
|
||||
|
||||
if (this._selected.length)
|
||||
var lid=this._selected[0].id;
|
||||
else lid="";
|
||||
var text=itemNode.span.innerHTML;
|
||||
|
||||
text=text.replace(/\"/g, "\\\"", text);
|
||||
|
||||
if (!this._xfullXML)
|
||||
out.push('{ "id":"'+itemNode.id+'", '+(this._getOpenState(itemNode)==1?' "open":"1", ':'')+(lid==itemNode.id?' "select":"1",':'')+' "text":"'+text+'"'+( ((this.XMLsource)&&(itemNode.XMLload==0))?', "child":"1" ':''));
|
||||
else
|
||||
out.push('{ "id":"'+itemNode.id+'", '+(this._getOpenState(itemNode)==1?' "open":"1", ':'')+(lid==itemNode.id?' "select":"1",':'')+' "text":"'+text+'", "im0":"'+itemNode.images[0]+'", "im1":"'+itemNode.images[1]+'", "im2":"'+itemNode.images[2]+'" '+(itemNode.acolor?(', "aCol":"'+itemNode.acolor+'" '):'')+(itemNode.scolor?(', "sCol":"'+itemNode.scolor+'" '):'')+(itemNode.checkstate==1?', "checked":"1" ':(itemNode.checkstate==2?', "checked":"-1"':''))+(itemNode.closeable?', "closeable":"1" ':'')+( ((this.XMLsource)&&(itemNode.XMLload==0))?', "child":"1" ':''));
|
||||
|
||||
if ((this._xuserData)&&(itemNode._userdatalist))
|
||||
{
|
||||
out.push(', "userdata":[');
|
||||
var names=itemNode._userdatalist.split(",");
|
||||
var p=[];
|
||||
for (var i=0; i<names.length; i++)
|
||||
p.push('{ "name":"'+names[i]+'" , "content":"'+itemNode.userData["t_"+names[i]]+'" }');
|
||||
out.push(p.join(",")); out.push("]");
|
||||
}
|
||||
|
||||
if (itemNode.childsCount){
|
||||
out.push(', "item":[');
|
||||
var p=[];
|
||||
for (var i=0; i<itemNode.childsCount; i++)
|
||||
p.push(this._serializeItemJSON(itemNode.childNodes[i]));
|
||||
out.push(p.join(","));
|
||||
out.push("]\n");
|
||||
}
|
||||
|
||||
out.push("}\n")
|
||||
return out.join("");
|
||||
}
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
188
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_kn.js
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Purpose: keyboard navigation extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @desc: enable keyboard navigation in tree
|
||||
* @param: mode - true/false
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableKeyboardNavigation=function(mode){
|
||||
this._enblkbrd=dhx4.s2b(mode);
|
||||
if (this._enblkbrd){
|
||||
if (_isFF){
|
||||
var z=window.getComputedStyle(this.parentObject,null)["position"];
|
||||
if ((z!="absolute")&&(z!="relative"))
|
||||
this.parentObject.style.position="relative";
|
||||
}
|
||||
this._navKeys=[["up",38],["down",40],["open",39],["close",37],["call",13],["edit",113]];
|
||||
var self=this;
|
||||
var z=document.createElement("INPUT");
|
||||
z.className="a_dhx_hidden_input";
|
||||
z.autocomplete="off";
|
||||
if (window._KHTMLrv) z.style.color="white";
|
||||
this.parentObject.appendChild(z);
|
||||
this.parentObject[_isOpera?"onkeypress":"onkeydown"]=function(e){
|
||||
if (self.callEvent("onKeyPress",[(e||window.event).keyCode,(e||window.event)]))
|
||||
return self._onKeyDown(e||window.event)
|
||||
|
||||
}
|
||||
this.parentObject.onclick=function(e){
|
||||
if (_isFF || _isIE)
|
||||
z.select();
|
||||
if (window._KHTMLrv || _isOpera)
|
||||
z.focus();
|
||||
}
|
||||
}
|
||||
else
|
||||
this.parentObject.onkeydown=null;
|
||||
}
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._onKeyDown=function(e){
|
||||
if (window.globalActiveDHTMLGridObject && globalActiveDHTMLGridObject.isActive)
|
||||
return true;
|
||||
var self=this;
|
||||
for (var i=0; i<this._navKeys.length; i++)
|
||||
if (this._navKeys[i][1]==e.keyCode){
|
||||
|
||||
this["_onkey_"+this._navKeys[i][0]].apply(this,[this.getSelectedItemId()]);
|
||||
if (e.preventDefault) e.preventDefault();
|
||||
(e||event).cancelBubble=true;
|
||||
return false;
|
||||
}
|
||||
if (this._textSearch) {
|
||||
return this._searchItemByKey(e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._onkey_up=function(id){
|
||||
var temp=this._globalIdStorageFind(id);
|
||||
if (!temp) return;
|
||||
var next=this._getPrevVisibleNode(temp);
|
||||
if (next.id==this.rootId) return;
|
||||
this.focusItem(next.id);
|
||||
this.selectItem(next.id,false);
|
||||
}
|
||||
dhtmlXTreeObject.prototype._onkey_down=function(id){
|
||||
var temp=this._globalIdStorageFind(id);
|
||||
if (!temp) return;
|
||||
var next=this._getNextVisibleNode(temp);
|
||||
if (next.id==this.rootId) return;
|
||||
this.focusItem(next.id);
|
||||
this.selectItem(next.id,false);
|
||||
}
|
||||
dhtmlXTreeObject.prototype._onkey_open=function(id){
|
||||
this.openItem(id);
|
||||
}
|
||||
dhtmlXTreeObject.prototype._onkey_close=function(id){
|
||||
this.closeItem(id);
|
||||
}
|
||||
dhtmlXTreeObject.prototype._onkey_call=function(id){
|
||||
if (this.stopEdit){
|
||||
this.stopEdit();
|
||||
this.parentObject.lastChild.focus();
|
||||
this.parentObject.lastChild.focus();
|
||||
this.selectItem(id,true);
|
||||
}
|
||||
else
|
||||
this.selectItem(this.getSelectedItemId(),true);
|
||||
}
|
||||
dhtmlXTreeObject.prototype._onkey_edit=function(id){
|
||||
if (this.editItem)
|
||||
this.editItem(id);
|
||||
}
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._getNextVisibleNode=function(item,mode){
|
||||
if ((!mode)&&(this._getOpenState(item)>0)) return item.childNodes[0];
|
||||
if ((item.tr)&&(item.tr.nextSibling)&&(item.tr.nextSibling.nodem))
|
||||
return item.tr.nextSibling.nodem;
|
||||
|
||||
if (item.parentObject) return this._getNextVisibleNode(item.parentObject,1);
|
||||
return item;
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._getPrevVisibleNode=function(item){
|
||||
if ((item.tr)&&(item.tr.previousSibling)&&(item.tr.previousSibling.nodem))
|
||||
return this._lastVisibleChild(item.tr.previousSibling.nodem);
|
||||
|
||||
if (item.parentObject)
|
||||
return item.parentObject;
|
||||
else return item;
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._lastVisibleChild=function(item){
|
||||
if (this._getOpenState(item)>0)
|
||||
return this._lastVisibleChild(item.childNodes[item.childsCount-1]);
|
||||
else return item;
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._searchItemByKey=function(e){
|
||||
if (e.keyCode==8) {
|
||||
this._textSearchString='';
|
||||
return true;
|
||||
}
|
||||
var key = String.fromCharCode(e.keyCode).toUpperCase();
|
||||
if (key.match(/[A-Z,a-z,0-9\ ]/)) {
|
||||
this._textSearchString += key;
|
||||
this._textSearchInProgress = true;
|
||||
if (!(this.getSelectedItemText()||"").match(RegExp('^'+this._textSearchString,"i"))){
|
||||
this.findItem(this._textSearchString, 0);
|
||||
}
|
||||
this._textSearchInProgress = false;
|
||||
if (e.preventDefault) e.preventDefault();
|
||||
(e||event).cancelBubble=true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @desc: configure keys used for keyboard navigation
|
||||
* @param: keys - configuration array, please check pro_key_nav.html in samples for more details
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.assignKeys=function(keys){
|
||||
this._navKeys=keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: enable search items by pressing keys (any item in tree should be focused/selected to make search work)
|
||||
* @param: mode - true/false
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableKeySearch=function(mode){
|
||||
this._textSearch = dhx4.s2b(mode);
|
||||
if (!this._textSearch) return;
|
||||
this._textSearchString = '';
|
||||
var self = this;
|
||||
this._markItem2 = this._markItem;
|
||||
this._markItem = function(node)
|
||||
{
|
||||
if (!self._textSearchInProgress)
|
||||
self._textSearchString = '';
|
||||
self._markItem2(node);
|
||||
}
|
||||
|
||||
}
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
41
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_lf.js
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Purpose: temporary loading XML item
|
||||
Warining - this extension is an experimental and not fully compatible
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @desc: enable/disable "Loading..." item
|
||||
* @param: text - text of temporary item (default is "Loading...")
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableLoadingItem=function(text) {
|
||||
this.attachEvent("onXLS",this._showFakeItem);
|
||||
this.attachEvent("onXLE",this._hideFakeItem);
|
||||
|
||||
this._tfi_text=text||"Loading...";
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._showFakeItem=function(tree,id) {
|
||||
if ((id===null)||(this._globalIdStorageFind("fake_load_xml_"+id))) return;
|
||||
var temp = this.XMLsource; this.XMLsource=null;
|
||||
this.insertNewItem(id,"fake_load_xml_"+id,this._tfi_text);
|
||||
this.XMLsource=temp;
|
||||
}
|
||||
dhtmlXTreeObject.prototype._hideFakeItem=function(tree,id) {
|
||||
if (id===null) return;
|
||||
this.deleteItem("fake_load_xml_"+id);
|
||||
}
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
193
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_li.js
Normal file
@ -0,0 +1,193 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Purpose: locked item extension for dhtmlxTree
|
||||
Last updated: 11.01.2006
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @desc: get locked state of item
|
||||
* @param: itemId - id of item
|
||||
* @returns: true/false - locked/unlocked
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.isLocked=function(itemId)
|
||||
{
|
||||
if (!this._locker) this._init_lock();
|
||||
return (this._locker[itemId]==true);
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._lockItem=function(sNode,state,skipdraw){
|
||||
if (!this._locker) this._init_lock();
|
||||
if (state){
|
||||
|
||||
if (this._locker[sNode.id]==true) return;
|
||||
this._locker[sNode.id]=true;
|
||||
|
||||
sNode.bIm0=sNode.images[0];
|
||||
sNode.bIm1=sNode.images[1];
|
||||
sNode.bIm2=sNode.images[2];
|
||||
|
||||
sNode.images[0]=this.lico0;
|
||||
sNode.images[1]=this.lico1;
|
||||
sNode.images[2]=this.lico2;
|
||||
|
||||
var z1=sNode.span.parentNode;
|
||||
var z2=z1.previousSibling;
|
||||
|
||||
this.dragger.removeDraggableItem(z1);
|
||||
this.dragger.removeDraggableItem(z2);
|
||||
}
|
||||
else{
|
||||
if (this._locker[sNode.id]!=true) return;
|
||||
this._locker[sNode.id]=false;
|
||||
|
||||
sNode.images[0]=sNode.bIm0;
|
||||
sNode.images[1]=sNode.bIm1;
|
||||
sNode.images[2]=sNode.bIm2;
|
||||
|
||||
var z1=sNode.span.parentNode;
|
||||
var z2=z1.previousSibling;
|
||||
|
||||
this.dragger.addDraggableItem(z1,this);
|
||||
this.dragger.addDraggableItem(z2,this);
|
||||
}
|
||||
|
||||
if (!skipdraw) this._correctPlus(sNode);
|
||||
}
|
||||
/**
|
||||
* @desc: lock/unlock item
|
||||
* @param: itemId - id of item
|
||||
* @param: state - true/false - lock/unlock item
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.lockItem=function(itemId,state)
|
||||
{
|
||||
if (!this._locker) this._init_lock();
|
||||
this._lockOn=false;
|
||||
var sNode=this._globalIdStorageFind(itemId);
|
||||
this._lockOn=true;
|
||||
this._lockItem(sNode,dhx4.s2b(state));
|
||||
}
|
||||
/**
|
||||
* @desc: set icon for locked items
|
||||
* @param: im0 - icon for locked leaf
|
||||
* @param: im1 - icon for closed branch
|
||||
* @param: im2 - icon for opened branch
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.setLockedIcons=function(im0,im1,im2)
|
||||
{
|
||||
if (!this._locker) this._init_lock();
|
||||
this.lico0=im0;
|
||||
this.lico1=im1;
|
||||
this.lico2=im2;
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._init_lock=function()
|
||||
{
|
||||
this._locker=new Array();
|
||||
this._locker_count="0";
|
||||
this._lockOn=true;
|
||||
this._globalIdStorageFindA=this._globalIdStorageFind;
|
||||
this._globalIdStorageFind=this._lockIdFind;
|
||||
|
||||
if (this._serializeItem){
|
||||
this._serializeItemA=this._serializeItem;
|
||||
this._serializeItem=this._serializeLockItem;
|
||||
|
||||
|
||||
this._serializeTreeA=this.serializeTree;
|
||||
this.serializeTree=this._serializeLockTree;
|
||||
|
||||
}
|
||||
|
||||
this.setLockedIcons(this.imageArray[0],this.imageArray[1],this.imageArray[2]);
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._lockIdFind=function(itemId,skipXMLSearch,skipParsing)
|
||||
{
|
||||
if (!this.skipLock)
|
||||
if ((!skipParsing)&&(this._lockOn==true)&&(this._locker[itemId]==true)) { return null; }
|
||||
return this._globalIdStorageFindA(itemId,skipXMLSearch,skipParsing);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._serializeLockItem=function(node)
|
||||
{
|
||||
if (this._locker[node.id]==true) return "";
|
||||
return this._serializeItemA(node);
|
||||
};
|
||||
dhtmlXTreeObject.prototype._serializeLockTree=function()
|
||||
{
|
||||
var out=this._serializeTreeA();
|
||||
return out.replace(/<item[^>]+locked\=\"1\"[^>]+\/>/g,"");
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._moveNodeToA=dhtmlXTreeObject.prototype._moveNodeTo;
|
||||
dhtmlXTreeObject.prototype._moveNodeTo=function(itemObject,targetObject,beforeNode){
|
||||
if ((targetObject.treeNod.isLocked)&&(targetObject.treeNod.isLocked(targetObject.id))) {
|
||||
return false;
|
||||
}
|
||||
return this._moveNodeToA(itemObject,targetObject,beforeNode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @desc: lock tree
|
||||
* @param: isLock - bool value. True - lock, false - unlock
|
||||
* @edition: Professional
|
||||
* @type: public
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.lockTree=function(isLock)
|
||||
{
|
||||
if (dhx4.s2b(isLock))
|
||||
this._initTreeLocker();
|
||||
else
|
||||
if (this._TreeLocker) {
|
||||
this._TreeLocker.parentNode.removeChild(this._TreeLocker);
|
||||
this._TreeLocker=null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._initTreeLocker=function(isLock)
|
||||
{
|
||||
if (this._TreeLocker) return;
|
||||
this.parentObject.style.overflow="hidden";
|
||||
if (this.parentObject.style.position != 'absolute')
|
||||
this.parentObject.style.position = 'relative';
|
||||
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.style.position = 'absolute';
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
div.className = 'dhx_tree_opacity';
|
||||
|
||||
div.style.width = this.allTree.offsetWidth+'px';
|
||||
div.style.backgroundColor = '#FFFFFF';
|
||||
|
||||
div.style.height = this.allTree.offsetHeight+'px';
|
||||
//div.style.display = 'none';
|
||||
this._TreeLocker = div;
|
||||
this.parentObject.appendChild(this._TreeLocker);
|
||||
};
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
116
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_path.js
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
dhtmlXTreeObject.prototype.addPath=function(sid,tid,style,id){
|
||||
//sid on top, tid in deep
|
||||
this.activatePaths();
|
||||
style=style||{};
|
||||
var path=[];
|
||||
var to=null;
|
||||
var from=this._idpull[tid];
|
||||
var end=this._idpull[sid];
|
||||
while (end!=to){
|
||||
path.push({open:this._getOpenState(from),
|
||||
from:from.id,
|
||||
size:(to?this._getIndex(to):0),
|
||||
to:(to?to.id:null),
|
||||
style:"border-left:"+(style.width||1)+"px "+(style.mode||"solid")+" "+(style.color||"red")+"; border-bottom:"+(style.width||1)+"px "+(style.mode||"solid")+" "+(style.color||"red")+";"})
|
||||
to=from;
|
||||
from=from.parentObject;
|
||||
}
|
||||
|
||||
while (!id || this._pathspull[id]) id=(id||0)+1;
|
||||
|
||||
this._pathspull[id]={path:path,id:id};
|
||||
this._paths.push(this._pathspull[id]);
|
||||
this._renderPath(this._pathspull[id])
|
||||
};
|
||||
dhtmlXTreeObject.prototype.activatePaths=function(height){
|
||||
var that=this;
|
||||
this.attachEvent("onOpenEnd",function(){
|
||||
for (var i=0; i<that._paths.length; i++){
|
||||
that._clearPath(that._paths[i])
|
||||
that._renderPath(that._paths[i]);
|
||||
}
|
||||
});
|
||||
this.attachEvent("onXLE",function(xml){
|
||||
var ends=dhx4.ajax.xpath("//pathend", xml);
|
||||
var starts=dhx4.ajax.xpath("//pathstart", xml);
|
||||
var stpull={};
|
||||
for (var i=0; i<starts.length; i++)
|
||||
stpull[starts[i].getAttribute("id")]=starts[i];
|
||||
|
||||
for (var i=0; i<starts.length; i++){
|
||||
var end=ends[i].parentNode;
|
||||
var start=stpull[ends[i].getAttribute("id")];
|
||||
this.addPath(start.parentNode.getAttribute("id"),end.getAttribute("id"),{color:start.getAttribute("color"),mode:start.getAttribute("mode"),width:start.getAttribute("width")},start.getAttribute("id"));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (height) this._halfHeight=height;
|
||||
else if (this._idpull[0].childsCount)
|
||||
this._halfHeight=Math.floor(this._idpull[0].childNodes[0].span.parentNode.offsetHeight/2);
|
||||
|
||||
if (!this._halfHeight)
|
||||
this._halfHeight=9;
|
||||
|
||||
this.activatePaths=function(){}
|
||||
}
|
||||
dhtmlXTreeObject.prototype._clearPath=function(obj){
|
||||
for (var i=obj.path.length-1; i>0; i--){
|
||||
var t=obj.path[i];
|
||||
if (t._html)
|
||||
t._html.parentNode.removeChild(t._html);
|
||||
t._html=null;
|
||||
}
|
||||
}
|
||||
dhtmlXTreeObject.prototype._renderPath=function(obj){
|
||||
var c=this._idpull[obj.path[obj.path.length-1].from].span.parentNode.parentNode;
|
||||
var top=(_isIE?9:8)+this._halfHeight;
|
||||
|
||||
var left=(_isIE?27:27);
|
||||
while(c.offsetParent!=this.allTree){
|
||||
top+=c.offsetTop;
|
||||
left+=c.offsetLeft;
|
||||
c=c.offsetParent;
|
||||
}
|
||||
|
||||
|
||||
for (var i=obj.path.length-1; i>0; i--){
|
||||
var t=obj.path[i];
|
||||
var d=document.createElement("div");
|
||||
if (!this._idpull[t.to].tr.offsetHeight) return;
|
||||
var pos=this._idpull[t.to].tr.offsetTop;
|
||||
d.style.cssText='position:absolute; z-index:1; width:'+(_isIE?10:8)+'px; height:'+(pos-9)+'px; left:'+left+'px; top:'+top+'px;'+t.style;
|
||||
top+=pos;
|
||||
left+=18;
|
||||
this.allTree.appendChild(d);
|
||||
t._html=d;
|
||||
|
||||
}
|
||||
}
|
||||
dhtmlXTreeObject.prototype.deletePath=function(id){
|
||||
var z=this._pathspull[id];
|
||||
if (z){
|
||||
this._clearPath(z);
|
||||
delete this._pathspull[id];
|
||||
for (var i=0; i<this._paths.length; i++)
|
||||
if (this._paths[i]==z)
|
||||
return this._paths.splice(i,1);
|
||||
}
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype.deleteAllPaths=function(id){
|
||||
for (var i=this._paths.length-1; i>=0; i--)
|
||||
this.deletePath(this._paths[i].id);
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._paths=[];
|
||||
dhtmlXTreeObject.prototype._pathspull={};
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
56
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_rl.js
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Purpose: right-to-left extension for dhtmlxTree
|
||||
Last updated: 17.02.2006
|
||||
*/
|
||||
|
||||
/**
|
||||
* @desc: enables Right-to-Left mode in tree
|
||||
* @type: public
|
||||
* @param: mode - true/false
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableRTL=function(mode){
|
||||
var z=dhx4.s2b(mode);
|
||||
if (((z)&&(!this.rtlMode))||((!z)&&(this.rtlMode)))
|
||||
{
|
||||
this.rtlMode=z;
|
||||
this._switchToRTL(this.rtlMode);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._switchToRTL=function(mode) {
|
||||
if (mode){
|
||||
this.allTree.className=
|
||||
this._ltr_line=this.lineArray;
|
||||
this._ltr_min=this.minusArray;
|
||||
this._ltr_plus=this.plusArray;
|
||||
this.lineArray=new Array("line2_rtl.gif","line3_rtl.gif","line4_rtl.gif","blank.gif","blank.gif","line1_rtl.gif");
|
||||
this.minusArray=new Array("minus2_rtl.gif","minus3_rtl.gif","minus4_rtl.gif","minus.gif","minus5_rtl.gif");
|
||||
this.plusArray=new Array("plus2_rtl.gif","plus3_rtl.gif","plus4_rtl.gif","plus.gif","plus5_rtl.gif");
|
||||
this.allTree.className="containerTableStyleRTL";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.allTree.className="containerTableStyle";
|
||||
this.lineArray=this._ltr_line;
|
||||
this.minusArray=this._ltr_min;
|
||||
this.plusArray=this._ltr_plus;
|
||||
}
|
||||
if (this.htmlNode.childsCount)
|
||||
this._redrawFrom(this,this.htmlNode);
|
||||
};
|
||||
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
|
||||
117
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_sb.js
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Purpose: sorting extension for dhtmlxTree
|
||||
Last updated: 03.05.2005
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @desc: reorder items in tree according to their text
|
||||
* @type: public
|
||||
* @param: nodeId - id of node to start sorting from
|
||||
* @param: all_levels - sorting all levels or only current level
|
||||
* @param: order - sorting order - ASC or DES
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
|
||||
dhtmlXTreeObject.prototype.sortTree=function(nodeId,order,all_levels)
|
||||
{
|
||||
var sNode=this._globalIdStorageFind(nodeId);
|
||||
if (!sNode) return false;
|
||||
|
||||
this._reorderBranch(sNode,(order.toString().toLowerCase()=="asc"),dhx4.s2b(all_levels))
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: set custom sort functions, which has two parametrs - id_of_item1,id_of_item2
|
||||
* @type: public
|
||||
* @param: func - sorting function
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.setCustomSortFunction=function(func)
|
||||
{
|
||||
this._csfunca=func;
|
||||
};
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._reorderBranch=function(node,order,all_levels){
|
||||
var m=[];
|
||||
var count=node.childsCount;
|
||||
if (!count) return;
|
||||
|
||||
var parent = node.childNodes[0].tr.parentNode;
|
||||
for (var i=0; i<count; i++){
|
||||
m[i]=node.childNodes[i];
|
||||
parent.removeChild(m[i].tr);
|
||||
}
|
||||
|
||||
var self=this;
|
||||
if (order==1)
|
||||
if(this._csfunca)
|
||||
m.sort( function(a,b){ return self._csfunca(a.id,b.id); } );
|
||||
else
|
||||
m.sort( function(a,b){ return ((a.span.innerHTML.toUpperCase()>b.span.innerHTML.toUpperCase())?1:((a.span.innerHTML.toUpperCase()==b.span.innerHTML.toUpperCase())?0:-1)) } );
|
||||
else
|
||||
if(this._csfunca)
|
||||
m.sort( function(a,b){ return self._csfunca(b.id,a.id); } );
|
||||
else
|
||||
m.sort( function(a,b){ return ((a.span.innerHTML.toUpperCase()<b.span.innerHTML.toUpperCase())?1:((a.span.innerHTML.toUpperCase()==b.span.innerHTML.toUpperCase())?0:-1)) } );
|
||||
|
||||
for (var i=0; i<count; i++){
|
||||
parent.appendChild(m[i].tr);
|
||||
node.childNodes[i]=m[i];
|
||||
|
||||
if ((all_levels)&&(m[i].unParsed))
|
||||
m[i].unParsed.set("order",order?1:-1);
|
||||
else
|
||||
if ((all_levels)&&(m[i].childsCount))
|
||||
this._reorderBranch(m[i],order,all_levels);
|
||||
|
||||
}
|
||||
|
||||
for (var i=0; i<count; i++){
|
||||
this._correctPlus(m[i]);
|
||||
this._correctLine(m[i]);
|
||||
}
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._reorderXMLBranch=function(node){
|
||||
var orderold=node.getAttribute("order");
|
||||
if (orderold=="none") return;
|
||||
var order=(orderold==1);
|
||||
var count=node.childNodes.length;
|
||||
if (!count) return;
|
||||
|
||||
var m=new Array();
|
||||
var j=0;
|
||||
|
||||
for (var i=0; i<count; i++)
|
||||
if (node.childNodes[i].nodeType==1)
|
||||
{ m[j]=node.childNodes[i]; j++ }
|
||||
|
||||
for (var i=count-1; i!=0; i--)
|
||||
node.removeChild(node.childNodes[i]);
|
||||
|
||||
|
||||
if (order)
|
||||
m.sort( function(a,b){ return ((a.getAttribute("text")>b.getAttribute("text"))?1:((a.getAttribute("text")==b.getAttribute("text"))?0:-1)) } );
|
||||
else
|
||||
m.sort( function(a,b){ return ((a.getAttribute("text")<b.getAttribute("text"))?1:((a.getAttribute("text")==b.getAttribute("text"))?0:-1)) } );
|
||||
|
||||
for (var i=0; i<j; i++){
|
||||
m[i].setAttribute("order",orderold);
|
||||
node.appendChild(m[i]);
|
||||
}
|
||||
|
||||
node.setAttribute("order","none");
|
||||
}
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
413
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_srnd.js
Normal file
@ -0,0 +1,413 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/**
|
||||
* @desc: enables smart rendering mode (usefull for big trees with lots f items on each level)
|
||||
* @edition: professional
|
||||
* @type: public
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableSmartRendering=function(){
|
||||
this.enableSmartXMLParsing(true);
|
||||
this._srnd=true;
|
||||
this.itemHeight=18;
|
||||
var that=this;
|
||||
this.allTree.onscroll=function(){
|
||||
if (that._srndT) return;
|
||||
that._srndT=window.setTimeout(function(){
|
||||
that._srndT=null;
|
||||
that._renderState();
|
||||
|
||||
},300);
|
||||
};
|
||||
|
||||
this.attachEvent("onXLE",function(){
|
||||
that._renderState();
|
||||
});
|
||||
this._singleTimeSRND();
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._renderState=function(){
|
||||
//var z=this.allTree.parentNode;
|
||||
//var t=z.removeChild(this.allTree);
|
||||
|
||||
|
||||
if (!this._idpull[this.rootId]._sready)
|
||||
this.prepareSR(this.rootId,true);
|
||||
var top=this.allTree.scrollTop;
|
||||
var pos=Math.floor(top/this.itemHeight);
|
||||
var height=Math.ceil(this.allTree.offsetHeight/this.itemHeight);
|
||||
|
||||
this._group_render=true;
|
||||
this._getItemByPos(top,this.itemHeight,height,null,false,this._renderItemSRND);
|
||||
this._group_render=false;
|
||||
|
||||
//z.appendChild(this.allTree);
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._renderItemSRND=function(a,b){
|
||||
if (!a.span){
|
||||
//render row
|
||||
a.span=-1;
|
||||
var z=a.parentObject.htmlNode.childNodes[0].childNodes;
|
||||
var count=b*this.itemHeight; var x=null;
|
||||
for (var i=1; i<z.length; i++) {
|
||||
|
||||
x=z[i];
|
||||
var y=x.nodem?this.itemHeight:(x.offsetHeight||parseInt(x.childNodes[1].firstChild.style.height));
|
||||
|
||||
count-=y;
|
||||
if (count<0) {
|
||||
if (count==-1) { count++; continue; } //magic
|
||||
var h=x.childNodes[1].firstChild;
|
||||
// console.log("top: "+this.allTree.scrollTop+",original: "+y+",stop at:"+count+", current height:"+(parseInt(h.style.height))+",new height:"+(parseInt(h.style.height)-(y-Math.abs(count)+this.itemHeight))+"px");
|
||||
h.style.height=(parseInt(h.style.height)-(y-Math.abs(count)+this.itemHeight))+"px";
|
||||
if (Math.abs(count)!=y){
|
||||
// console.log("add new as "+(count+y));
|
||||
var fill=this._drawNewHolder(count+y,true);
|
||||
x.parentNode.insertBefore(fill,x)
|
||||
|
||||
}
|
||||
x.tr={nextSibling:x};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (h && h.style.height!="0px" && !x.offsetHeight)
|
||||
{ var rh=this._hAdI; this._hAdI=true; }
|
||||
this._parseItem(a._sxml,a.parentObject,null,x);
|
||||
if (h && h.style.height!="0px" && !x.offsetHeight)
|
||||
{ this._hAdI=rh; }
|
||||
if (a.unParsed) this._correctPlus(a);
|
||||
if (h && h.style.height=="0px") x.parentNode.removeChild(x);
|
||||
}
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._buildSRND=function(z,skipParsing){
|
||||
if (z.parentObject)
|
||||
this._globalIdStorageFind(z.parentObject.id);
|
||||
if (!this._idpull[this.rootId]._sready)
|
||||
this.prepareSR(this.rootId,true);
|
||||
|
||||
this._renderItemSRND(z,this._getIndex(z));
|
||||
if ((z.unParsed)&&(!skipParsing))
|
||||
this.reParse(z,0);
|
||||
|
||||
if (!z.prepareSR)
|
||||
this.prepareSR(z.id);
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._getIndex=function(z){
|
||||
for (var a=0; a<z.parentObject.childsCount; a++)
|
||||
if (z.parentObject.childNodes[a]==z) return a;
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype.prepareSR=function(it,mode){
|
||||
it=this._idpull[it];
|
||||
if (it._sready) return;
|
||||
var tr=this._drawNewHolder(this.itemHeight*it.childsCount,mode);
|
||||
it.htmlNode.childNodes[0].appendChild(tr);
|
||||
it._sready=true;
|
||||
//it.tr=tr; tr.nodem=it;
|
||||
}
|
||||
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._drawNewHolder=function(s,mode){
|
||||
var t=document.createElement("TR");
|
||||
var b=document.createElement("TD");
|
||||
var b2=document.createElement("TD");
|
||||
var z=document.createElement("DIV");
|
||||
z.innerHTML=" ";
|
||||
b.appendChild(z)
|
||||
t.appendChild(b2); t.appendChild(b);
|
||||
if (!mode){
|
||||
t.style.display="none";
|
||||
}
|
||||
|
||||
z.style.height=s+'px';
|
||||
return t;
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._getNextNodeSR=function(item,mode){
|
||||
if ((!mode)&&(item.childsCount)) return item.childNodes[0];
|
||||
if (item==this.htmlNode)
|
||||
return -1;
|
||||
if ((item.tr)&&(item.tr.nextSibling)&&(item.tr.nextSibling.nodem))
|
||||
return item.tr.nextSibling.nodem;
|
||||
|
||||
return this._getNextNode(item.parentObject,true);
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._getItemByPos=function(pos,h,l,i,m,f){
|
||||
/*
|
||||
current implementation can be slow in case of deep hierarchy, in future we can move
|
||||
counter login in HideShow function, so each top level item will know it real position
|
||||
*/
|
||||
if (!i){
|
||||
this._pos_c=pos;
|
||||
i=this._idpull[this.rootId];
|
||||
}
|
||||
|
||||
for (var j=0; j<i.childsCount; j++){
|
||||
this._pos_c-=h;
|
||||
if (this._pos_c<=0) m=true;
|
||||
if (m) {
|
||||
f.apply(this,[i.childNodes[j],j]);
|
||||
l--;}
|
||||
if (l<0) return l;
|
||||
if (i.childNodes[j]._open){
|
||||
l=this._getItemByPos(null,h,l,i.childNodes[j],m,f);
|
||||
if (l<0) return l;
|
||||
}
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._addItemSRND=function(pid,id,p){
|
||||
var parentObject=this._idpull[pid];
|
||||
var Count=parentObject.childsCount;
|
||||
var Nodes=parentObject.childNodes;
|
||||
|
||||
|
||||
|
||||
Nodes[Count]=new dhtmlXTreeItemObject(id,"",parentObject,this,null,1);
|
||||
itemId = Nodes[Count].id;
|
||||
Nodes[Count]._sxml=p.clone();
|
||||
|
||||
parentObject.childsCount++;
|
||||
}
|
||||
|
||||
|
||||
dhtmlXTreeObject.prototype._singleTimeSRND=function(){
|
||||
this._redrawFrom=function(){}
|
||||
var _originalTreeItem=dhtmlXTreeItemObject;
|
||||
this._singleTimeSRND=function(){};
|
||||
window.dhtmlXTreeItemObject=function(itemId,itemText,parentObject,treeObject,actionHandler,mode){
|
||||
if (!treeObject._srnd) {
|
||||
return _originalTreeItem.call(this,itemId,itemText,parentObject,treeObject,actionHandler,mode);
|
||||
}
|
||||
this.htmlNode="";
|
||||
this.acolor="";
|
||||
this.scolor="";
|
||||
this.tr=0;
|
||||
this.childsCount=0;
|
||||
this.tempDOMM=0;
|
||||
this.tempDOMU=0;
|
||||
this.dragSpan=0;
|
||||
this.dragMove=0;
|
||||
this.span=0;
|
||||
this.closeble=1;
|
||||
this.childNodes=new Array();
|
||||
this.userData=new cObject();
|
||||
|
||||
|
||||
this.checkstate=0;
|
||||
this.treeNod=treeObject;
|
||||
this.label=itemText;
|
||||
this.parentObject=parentObject;
|
||||
this.actionHandler=actionHandler;
|
||||
this.images=new Array(treeObject.imageArray[0],treeObject.imageArray[1],treeObject.imageArray[2]);
|
||||
|
||||
|
||||
this.id=treeObject._globalIdStorageAdd(itemId,this);
|
||||
|
||||
if (itemId==treeObject.rootId){
|
||||
if (this.treeNod.checkBoxOff ) this.htmlNode=this.treeNod._createItem(1,this,mode);
|
||||
else this.htmlNode=this.treeNod._createItem(0,this,mode);
|
||||
this.htmlNode.objBelong=this;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Updates to existing code
|
||||
|
||||
|
||||
*/
|
||||
this.setCheckSR=this.setCheck;
|
||||
this.setCheck=function(itemId,state){
|
||||
this._globalIdStorageFind(itemId);
|
||||
return this.setCheckSR(itemId,state);
|
||||
};
|
||||
this._get_srnd_p=function(id){
|
||||
var p=[];
|
||||
while(id!=this.rootId){
|
||||
var pid=this.getParentId(id);
|
||||
for (var i=0; i < this._idpull[pid].childsCount; i++)
|
||||
if (this._idpull[pid].childNodes[i].id==id){
|
||||
p.push([pid,i])
|
||||
break;
|
||||
}
|
||||
id=pid;
|
||||
}
|
||||
p.reverse();
|
||||
return p
|
||||
};
|
||||
this._get_srnd_p_last=function(id,p,mask){
|
||||
p=p||[];
|
||||
|
||||
var pos=0;
|
||||
while (true){
|
||||
var i=this._idpull[id];
|
||||
if (i._sxml && this.findStrInXML(i._sxml.d,"text",mask))
|
||||
this._globalIdStorageFind(i.id);
|
||||
var pos=i.childsCount;
|
||||
if (!pos) break;
|
||||
p.push([id,pos-1])
|
||||
id=i.childNodes[pos-1].id;
|
||||
}
|
||||
|
||||
return p;
|
||||
};
|
||||
this._get_prev_srnd=function(p,mask){
|
||||
var last;
|
||||
if (!p.length){
|
||||
p.push.apply(p,this._get_srnd_p_last(this.rootId,null,mask));
|
||||
last=p[p.length-1];
|
||||
return this._idpull[last[0]].childNodes[last[1]];
|
||||
}
|
||||
last=p[p.length-1];
|
||||
if (last[1]) {
|
||||
last[1]--;
|
||||
var curr=this._idpull[last[0]].childNodes[last[1]];
|
||||
this._get_srnd_p_last(curr.id,p,mask);
|
||||
var last=p[p.length-1];
|
||||
return this._idpull[last[0]].childNodes[last[1]];
|
||||
} else {
|
||||
p.pop();
|
||||
if (!p.length) return this._get_prev_srnd(p,mask)
|
||||
var last=p[p.length-1];
|
||||
return this._idpull[last[0]].childNodes[last[1]];
|
||||
}
|
||||
};
|
||||
|
||||
this._get_next_srnd=function(p,skip){
|
||||
if (!p.length){
|
||||
p.push([this.rootId,0]);
|
||||
return this._idpull[this.rootId].childNodes[0];
|
||||
}
|
||||
|
||||
var last=p[p.length-1];
|
||||
var curr=this._idpull[last[0]].childNodes[last[1]];
|
||||
if (curr.childsCount && !skip){
|
||||
p.push([curr.id,0]);
|
||||
return curr.childNodes[0];
|
||||
}
|
||||
last[1]++;
|
||||
var curr=this._idpull[last[0]].childNodes[last[1]];
|
||||
if (curr)
|
||||
return curr;
|
||||
p.pop();
|
||||
if (!p.length)
|
||||
return this.htmlNode;
|
||||
|
||||
return this._get_next_srnd(p,true);
|
||||
};
|
||||
this._findNodeByLabel=function(searchStr,direction,fromNode){
|
||||
//default next|prev locators is not reliable
|
||||
var searchStr=searchStr.replace(new RegExp("^( )+"),"").replace(new RegExp("( )+$"),"");
|
||||
searchStr = new RegExp(searchStr.replace(/([\*\+\\\[\]\(\)]{1})/gi,"\\$1").replace(/ /gi,".*"),"gi");
|
||||
|
||||
//get start node
|
||||
if (!fromNode)
|
||||
{
|
||||
fromNode=this._selected[0];
|
||||
if (!fromNode) fromNode=this.htmlNode;
|
||||
}
|
||||
var startNode=fromNode;
|
||||
var p=this._get_srnd_p(startNode.id);
|
||||
while (fromNode=(direction?this._get_prev_srnd(p,searchStr):this._get_next_srnd(p))){
|
||||
if (fromNode.label){
|
||||
if (fromNode.label.search(searchStr)!=-1) return fromNode
|
||||
} else {
|
||||
if (fromNode._sxml){
|
||||
if (fromNode._sxml.get("text").search(searchStr)!=-1)
|
||||
return fromNode;
|
||||
if (this.findStrInXML(fromNode._sxml.d,"text",searchStr))
|
||||
this._globalIdStorageFind(fromNode.id);
|
||||
}
|
||||
}
|
||||
|
||||
if ((fromNode.unParsed)&&(this.findStrInXML(fromNode.unParsed.d,"text",searchStr)))
|
||||
this.reParse(fromNode);
|
||||
|
||||
if (startNode.id==fromNode.id) break;
|
||||
if(direction&&p.length==1&&p[0][1]==0)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
this.deleteChildItems=function(id){
|
||||
if (this.rootId==id){
|
||||
this._selected=new Array();
|
||||
this._idpull={};
|
||||
this._p=this._pos_c=this._pullSize=null;
|
||||
this.allTree.removeChild(this.htmlNode.htmlNode);
|
||||
|
||||
this.htmlNode=new dhtmlXTreeItemObject(this.rootId,"",0,this);
|
||||
this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display="none";
|
||||
this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className="hiddenRow";
|
||||
|
||||
this.allTree.insertBefore(this.htmlNode.htmlNode,this.selectionBar);
|
||||
if(_isFF){
|
||||
this.allTree.childNodes[0].width="100%";
|
||||
this.allTree.childNodes[0].style.overflow="hidden";
|
||||
}
|
||||
}
|
||||
}
|
||||
this._HideShow=function(itemObject,mode){
|
||||
if ((this.XMLsource)&&(!itemObject.XMLload)) {
|
||||
if (mode==1) return; //close for not loaded node - ignore it
|
||||
itemObject.XMLload=1;
|
||||
this._loadDynXML(itemObject.id);
|
||||
return; };
|
||||
//#__pro_feature:01112006{
|
||||
//#smart_parsing:01112006{
|
||||
if (!itemObject.span)
|
||||
this._buildSRND(itemObject);
|
||||
|
||||
if (itemObject.unParsed){
|
||||
this.reParse(itemObject);
|
||||
this.prepareSR(itemObject.id);
|
||||
}
|
||||
|
||||
if (itemObject.childsCount==0) return;
|
||||
//#}
|
||||
//#}
|
||||
var Nodes=itemObject.htmlNode.childNodes[0].childNodes; var Count=Nodes.length;
|
||||
if (Count>1){
|
||||
if ( ( (Nodes[1].style.display!="none") || (mode==1) ) && (mode!=2) ) {
|
||||
//nb:solves standard doctype prb in IE
|
||||
this.allTree.childNodes[0].border = "1";
|
||||
this.allTree.childNodes[0].border = "0";
|
||||
var nodestyle="none";
|
||||
itemObject._open=false;
|
||||
}
|
||||
else {
|
||||
var nodestyle="";
|
||||
itemObject._open=true;
|
||||
}
|
||||
|
||||
for (var i=1; i<Count; i++)
|
||||
Nodes[i].style.display=nodestyle;
|
||||
|
||||
this._renderState();
|
||||
}
|
||||
this._correctPlus(itemObject);
|
||||
}
|
||||
}
|
||||
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
|
||||
|
||||
106
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_start.js
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
function dhtmlXTreeFromHTML(obj){
|
||||
if (typeof(obj)!="object")
|
||||
obj=document.getElementById(obj);
|
||||
|
||||
var n=obj;
|
||||
var id=n.id;
|
||||
var cont="";
|
||||
|
||||
for (var j=0; j<obj.childNodes.length; j++)
|
||||
if (obj.childNodes[j].nodeType=="1"){
|
||||
if (obj.childNodes[j].tagName=="XMP"){
|
||||
var cHead=obj.childNodes[j];
|
||||
for (var m=0; m<cHead.childNodes.length; m++)
|
||||
cont+=cHead.childNodes[m].data;
|
||||
|
||||
}
|
||||
else if (obj.childNodes[j].tagName.toLowerCase()=="ul")
|
||||
cont=dhx_li2trees(obj.childNodes[j],new Array(),0);
|
||||
break;
|
||||
}
|
||||
obj.innerHTML="";
|
||||
|
||||
|
||||
var t=new dhtmlXTreeObject(obj,"100%","100%",0);
|
||||
var z_all=new Array();
|
||||
for ( b in t )
|
||||
z_all[b.toLowerCase()]=b;
|
||||
|
||||
var atr=obj.attributes;
|
||||
for (var a=0; a<atr.length; a++)
|
||||
if ((atr[a].name.indexOf("set")==0)||(atr[a].name.indexOf("enable")==0)){
|
||||
var an=atr[a].name;
|
||||
if (!t[an])
|
||||
an=z_all[atr[a].name];
|
||||
t[an].apply(t,atr[a].value.split(","));
|
||||
}
|
||||
|
||||
if (typeof(cont)=="object"){
|
||||
t.XMLloadingWarning=1;
|
||||
for (var i=0; i<cont.length; i++){
|
||||
var n=t.insertNewItem(cont[i][0],cont[i][3],cont[i][1]);
|
||||
if (cont[i][2]) t._setCheck(n,cont[i][2]);
|
||||
}
|
||||
t.XMLloadingWarning=0;
|
||||
t.lastLoadedXMLId=0;
|
||||
t._redrawFrom(t);
|
||||
}
|
||||
else
|
||||
t.parse("<tree id='0'>"+cont+"</tree>");
|
||||
window[id]=t;
|
||||
|
||||
var oninit = obj.getAttribute("oninit");
|
||||
if (oninit) eval(oninit);
|
||||
return t;
|
||||
}
|
||||
|
||||
function dhx_init_trees(){
|
||||
var z=document.getElementsByTagName("div");
|
||||
for (var i=0; i<z.length; i++)
|
||||
if (z[i].className=="dhtmlxTree")
|
||||
dhtmlXTreeFromHTML(z[i])
|
||||
}
|
||||
|
||||
function dhx_li2trees(tag,data,ind){
|
||||
for (var i=0; i<tag.childNodes.length; i++){
|
||||
var z=tag.childNodes[i];
|
||||
if ((z.nodeType==1)&&(z.tagName.toLowerCase()=="li")){
|
||||
var c=""; var ul=null;
|
||||
var check=z.getAttribute("checked");
|
||||
for (var j=0; j<z.childNodes.length; j++){
|
||||
var zc=z.childNodes[j];
|
||||
if (zc.nodeType==3) c+=zc.data;
|
||||
else if (zc.tagName.toLowerCase()!="ul") c+=dhx_outer_html(zc);
|
||||
else ul=zc;
|
||||
}
|
||||
|
||||
data[data.length]=[ind,c,check,(z.id||(data.length+1))];
|
||||
if (ul)
|
||||
data=dhx_li2trees(ul,data,(z.id||data.length));
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function dhx_outer_html(node){
|
||||
if (node.outerHTML) return node.outerHTML;
|
||||
var temp=document.createElement("DIV");
|
||||
temp.appendChild(node.cloneNode(true));
|
||||
temp=temp.innerHTML;
|
||||
return temp;
|
||||
}
|
||||
|
||||
if (window.addEventListener) window.addEventListener("load",dhx_init_trees,false);
|
||||
else if (window.attachEvent) window.attachEvent("onload",dhx_init_trees);
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
|
||||
|
||||
465
themes/sources/dhtmlxTree/codebase/ext/dhtmlxtree_xw.js
Normal file
@ -0,0 +1,465 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 5.2.0
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Purpose: saving state extension for dhtmlxTree
|
||||
Inner Version: 1.3
|
||||
Last updated: 05.07.2005
|
||||
*/
|
||||
|
||||
dhtmlXTreeObject.prototype._serEnts=[["&","&"],["<","<"],[">",">"]];
|
||||
|
||||
/**
|
||||
* @desc: register XML entity for replacement while initialization (default are: ampersand, lessthen and greaterthen symbols)
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @param: rChar - source char
|
||||
* @param: rEntity - target entity
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.registerXMLEntity=function(rChar,rEntity){
|
||||
this._serEnts[this._serEnts.length]=[rChar,rEntity,new RegExp(rChar,"g")];
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: configure XML serialization
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @param: userData - enable/disable user data serialization
|
||||
* @param: fullXML - enable/disable full XML serialization
|
||||
* @param: escapeEntities - convert tag brackets to related html entitites
|
||||
* @param: userDataAsCData - output user data in CDATA sections
|
||||
* @param: DTD - if specified, then set as XML's DTD
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.setSerializationLevel=function(userData,fullXML,escapeEntities,userDataAsCData,DTD){
|
||||
this._xuserData=dhx4.s2b(userData);
|
||||
this._xfullXML=dhx4.s2b(fullXML);
|
||||
this._dtd=DTD;
|
||||
this._xescapeEntities=dhx4.s2b(escapeEntities);
|
||||
if (dhx4.s2b(userDataAsCData)){
|
||||
this._apreUC="<![CDATA[";
|
||||
this._apstUC="]]>";
|
||||
}
|
||||
else{
|
||||
}
|
||||
|
||||
for (var i=0; i< this._serEnts.length; i++)
|
||||
this._serEnts[i][2]=new RegExp(this._serEnts[i][0],"g");
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: get xml representation (as string) of tree
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.serializeTree=function(){
|
||||
if (this.stopEdit) this.stopEdit();
|
||||
this._apreUC=this._apreUC||"";
|
||||
this._apstUC=this._apstUC||"";
|
||||
var out='<?xml version="1.0"?>';
|
||||
if (this._dtd)
|
||||
out+="<!DOCTYPE tree SYSTEM \""+this._dtd+"\">";
|
||||
out+='<tree id="'+this.rootId+'">';
|
||||
|
||||
if ((this._xuserData)&&(this._idpull[this.rootId]._userdatalist))
|
||||
{
|
||||
var names=this._idpull[this.rootId]._userdatalist.split(",");
|
||||
for (var i=0; i<names.length; i++)
|
||||
out+="<userdata name=\""+names[i]+"\">"+this._apreUC+this._idpull[this.rootId].userData["t_"+names[i]]+this._apstUC+"</userdata>";
|
||||
}
|
||||
|
||||
|
||||
for (var i=0; i<this.htmlNode.childsCount; i++)
|
||||
out+=this._serializeItem(this.htmlNode.childNodes[i]);
|
||||
|
||||
out+="</tree>";
|
||||
return out;
|
||||
};
|
||||
/**
|
||||
* @desc: return xml description of tree item
|
||||
* @type: private
|
||||
* @param: itemNode - tree item object
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype._serializeItem=function(itemNode){
|
||||
if (itemNode.unParsed)
|
||||
if (dhx4.isIE){
|
||||
return itemNode.unParsed.d.xml;
|
||||
}
|
||||
else{
|
||||
var xmlSerializer = new XMLSerializer();
|
||||
return xmlSerializer.serializeToString(itemNode.unParsed.d);
|
||||
}
|
||||
|
||||
|
||||
var out="";
|
||||
if (this._selected.length)
|
||||
var lid=this._selected[0].id;
|
||||
else lid="\"";
|
||||
|
||||
|
||||
var text=itemNode.span.innerHTML;
|
||||
|
||||
if (this._xescapeEntities)
|
||||
for (var i=0; i<this._serEnts.length; i++)
|
||||
text=text.replace(this._serEnts[i][2],this._serEnts[i][1]);
|
||||
|
||||
if (!this._xfullXML)
|
||||
out='<item id="'+itemNode.id+'" '+(this._getOpenState(itemNode)==1?' open="1" ':'')+(lid==itemNode.id?' select="1"':'')+' text="'+text+'"'+( ((this.XMLsource)&&(itemNode.XMLload==0))?" child=\"1\" ":"")+'>';
|
||||
else
|
||||
out='<item id="'+itemNode.id+'" '+(this._getOpenState(itemNode)==1?' open="1" ':'')+(lid==itemNode.id?' select="1"':'')+' text="'+text+'" im0="'+itemNode.images[0]+'" im1="'+itemNode.images[1]+'" im2="'+itemNode.images[2]+'" '+(itemNode.acolor?('aCol="'+itemNode.acolor+'" '):'')+(itemNode.scolor?('sCol="'+itemNode.scolor+'" '):'')+(itemNode.checkstate==1?'checked="1" ':(itemNode.checkstate==2?'checked="-1"':''))+(itemNode.closeable?'closeable="1" ':'')+( ((this.XMLsource)&&(itemNode.XMLload==0))?" child=\"1\" ":"")+'>';
|
||||
|
||||
if ((this._xuserData)&&(itemNode._userdatalist))
|
||||
{
|
||||
var names=itemNode._userdatalist.split(",");
|
||||
for (var i=0; i<names.length; i++)
|
||||
out+="<userdata name=\""+names[i]+"\">"+this._apreUC+itemNode.userData["t_"+names[i]]+this._apstUC+"</userdata>";
|
||||
}
|
||||
|
||||
for (var i=0; i<itemNode.childsCount; i++)
|
||||
out+=this._serializeItem(itemNode.childNodes[i]);
|
||||
|
||||
|
||||
|
||||
out+="</item>";
|
||||
return out;
|
||||
}
|
||||
/**
|
||||
* @desc: save selected item to cookie
|
||||
* @type: public
|
||||
* @param: name - optional, cookie name
|
||||
* @param: cookie_param - additional parametrs added to cookie
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.saveSelectedItem=function(name,cookie_param){
|
||||
name=name||"";
|
||||
this.setCookie("treeStateSelected"+name,this.getSelectedItemId(),cookie_param);
|
||||
}
|
||||
/** @desc: restore selected item from cookie
|
||||
* @type: public
|
||||
* @param: name - optional, cookie name
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.restoreSelectedItem=function(name){
|
||||
name=name||"";
|
||||
var z=this.getCookie("treeStateSelected"+name);
|
||||
this.selectItem(z,false);
|
||||
}
|
||||
|
||||
|
||||
/** @desc: enable/disable autosaving selected node in cookie
|
||||
* @type: public
|
||||
* @param: mode - true/false
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.enableAutoSavingSelected=function(mode,cookieName){
|
||||
this.assMode=dhx4.s2b(mode);
|
||||
if ((this.assMode)&&(!this.oldOnSelect)){
|
||||
this.oldOnSelect=this.onRowSelect;
|
||||
this.onRowSelect=function(e,htmlObject,mode){
|
||||
if (!htmlObject) htmlObject=this;
|
||||
htmlObject.parentObject.treeNod.oldOnSelect(e,htmlObject,mode);
|
||||
if (htmlObject.parentObject.treeNod.assMode)
|
||||
htmlObject.parentObject.treeNod.saveSelectedItem(htmlObject.parentObject.treeNod.assCookieName);
|
||||
}
|
||||
}
|
||||
|
||||
this.assCookieName=cookieName;
|
||||
}
|
||||
|
||||
|
||||
/** @desc: save tree to cookie
|
||||
* @type: public
|
||||
* @param: name - optional, cookie name
|
||||
* @param: cookie_param - additional parametrs added to cookie
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.saveState=function(name,cookie_param){
|
||||
var z=this._escape(this.serializeTree());
|
||||
var kusok = 4000;
|
||||
if (z.length>kusok)
|
||||
{
|
||||
if(navigator.appName.indexOf("Microsoft")!=-1)
|
||||
return false;//IE max cookie length is ~4100
|
||||
this.setCookie("treeStatex"+name,Math.ceil(z.length/kusok));
|
||||
for (var i=0; i<Math.ceil(z.length/kusok); i++)
|
||||
{
|
||||
this.setCookie("treeStatex"+name+"x"+i,z.substr(i*kusok,kusok),cookie_param);
|
||||
}
|
||||
}
|
||||
else
|
||||
this.setCookie("treeStatex"+name,z,cookie_param);
|
||||
var z=this.getCookie("treeStatex"+name);
|
||||
if (!z) {
|
||||
this.setCookie("treeStatex"+name,"",cookie_param);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/** @desc: load tree from cookie
|
||||
* @type: public
|
||||
* @param: name - optional,cookie name
|
||||
* @edition: Professional
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadState=function(name){
|
||||
var z=this.getCookie("treeStatex"+name);
|
||||
// alert("treeStatex"+name);
|
||||
if (!z) return false;
|
||||
|
||||
if (z.length)
|
||||
{
|
||||
if (z.toString().length<4)
|
||||
{
|
||||
|
||||
var z2="";
|
||||
for (var i=0; i<z; i++){
|
||||
z2+=this.getCookie("treeStatex"+name+"x"+i);
|
||||
}
|
||||
z=z2;
|
||||
}
|
||||
this.parse((this.utfesc=="utf8")?decodeURI(z):unescape(z));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/** @desc: save cookie
|
||||
* @type: private
|
||||
* @param: name - cookie name
|
||||
* @param: value - cookie value
|
||||
* @param: cookie_param - additional parametrs added to cookie
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
|
||||
dhtmlXTreeObject.prototype.setCookie=function(name,value,cookie_param) {
|
||||
var str = name + "=" + value + (cookie_param?("; "+cookie_param):"");
|
||||
/* ((expires) ? "; expires=" + expires.toGMTString() : "") +
|
||||
((path) ? "; path=" + path : "; path=/") +
|
||||
((domain) ? "; domain=" + domain : "") +
|
||||
((secure) ? "; secure" : "");*/
|
||||
document.cookie = str;
|
||||
}
|
||||
|
||||
/** @desc: get cookie
|
||||
* @type: private
|
||||
* @param: name - cookie name
|
||||
* @edition: Professional
|
||||
* @topic: 0
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.getCookie=function(name) {
|
||||
var search = name + "=";
|
||||
if (document.cookie.length > 0) {
|
||||
var offset = document.cookie.indexOf(search);
|
||||
if (offset != -1) {
|
||||
offset += search.length;
|
||||
var end = document.cookie.indexOf(";", offset);
|
||||
if (end == -1)
|
||||
end = document.cookie.length;
|
||||
return document.cookie.substring(offset, end);
|
||||
} }
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @desc: save open nodes to cookie
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @param: name - optional,cookie name
|
||||
* @param: cookie_param - additional parametrs added to cookie
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.saveOpenStates=function(name,cookie_param){
|
||||
var z=[];
|
||||
for (var i=0; i<this.htmlNode.childsCount; i++)
|
||||
z=z.concat(this._collectOpenStates(this.htmlNode.childNodes[i]));
|
||||
z=z.join(this.dlmtr);
|
||||
|
||||
this.setCookie("treeOpenStatex"+name,z,cookie_param);
|
||||
};
|
||||
|
||||
/** @desc: restore open nodes from cookie
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @param: name - optional,cookie name
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.loadOpenStates=function(name){
|
||||
for (var i=0; i<this.htmlNode.childsCount; i++)
|
||||
this._xcloseAll(this.htmlNode.childNodes[i]);
|
||||
|
||||
this.allTree.childNodes[0].border = "1";
|
||||
this.allTree.childNodes[0].border = "0";
|
||||
|
||||
var z=getCookie("treeOpenStatex"+name);
|
||||
if (z) {
|
||||
var arr=z.split(this.dlmtr);
|
||||
for (var i=0; i<arr.length; i++)
|
||||
{
|
||||
var zNode=this._globalIdStorageFind(arr[i]);
|
||||
if (zNode){
|
||||
if ((this.XMLsource)&&(!zNode.XMLload)&&(zNode.id!=this.rootId)){
|
||||
this._delayedLoad(zNode,"loadOpenStates('"+name+"')");
|
||||
return;
|
||||
}
|
||||
else
|
||||
this.openItem(arr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.callEvent("onAllOpenDynamic",[]);
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._delayedLoad=function(node,name){
|
||||
this.afterLoadMethod=name;
|
||||
this.onLoadReserve = this.onXLE; //save loading end handler
|
||||
this.onXLE=this._delayedLoadStep2; //set on XML data loading end handler
|
||||
this._loadDynXML(node.id);
|
||||
}
|
||||
dhtmlXTreeObject.prototype._delayedLoadStep2=function(tree){
|
||||
tree.onXLE=tree.onLoadReserve; //save loading end handler
|
||||
// if (tree.onXLE) tree.onXLE(tree);
|
||||
window.setTimeout( function() { dhtmlx.temp = tree; eval("dhtmlx.temp."+tree.afterLoadMethod); } ,100);
|
||||
if (tree.onXLE) tree.onXLE(tree);
|
||||
tree.callEvent("onXLE",[tree]);
|
||||
|
||||
}
|
||||
|
||||
/** @desc: build list of opened nodes
|
||||
* @type: private
|
||||
* @edition: Professional
|
||||
* @param: node - start tree item
|
||||
* @param: list - start list value
|
||||
* @topic: 2
|
||||
*/
|
||||
dhtmlXTreeObject.prototype._collectOpenStates=function(node){
|
||||
var list=[];
|
||||
if (this._getOpenState(node)==1)
|
||||
{
|
||||
list.push(node.id);
|
||||
for (var i=0; i<node.childsCount; i++)
|
||||
list=list.concat(this._collectOpenStates(node.childNodes[i]));
|
||||
}
|
||||
return list;
|
||||
};
|
||||
|
||||
/**
|
||||
* @desc: expand target node and all child nodes (same as openAllItems, but works in dynamic trees)
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @param: itemId - node id, optional
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.openAllItemsDynamic = function(itemId)
|
||||
{
|
||||
this.ClosedElem=new Array();
|
||||
this.G_node=null;
|
||||
var itemNode = this._globalIdStorageFind(itemId||this.rootId); //get node object by id of tree sart node
|
||||
if (itemNode.id != this.rootId &&this.getOpenState(itemNode.id) != 0) this.openItem(itemId);
|
||||
this._openAllNodeChilds(itemNode, 0); //open closed nodes that have data, or find nodes that have no data yet
|
||||
|
||||
|
||||
if(this.ClosedElem.length>0){
|
||||
this.onLoadReserve = this.onXLE; //save loading end handler
|
||||
this.onXLE=this._loadAndOpen; //set on XML data loading end handler
|
||||
this._loadAndOpen(this); //if there are not loaded items -> run load&open routine
|
||||
}
|
||||
};
|
||||
|
||||
dhtmlXTreeObject.prototype._openAllNodeChilds = function(itemNode)
|
||||
{
|
||||
//for dynamic loading
|
||||
if ((itemNode.XMLload==0)||(itemNode.unParsed)) this.ClosedElem.push(itemNode); //if not loaded put in array
|
||||
for (var i=0; i<itemNode.childsCount; i++) //for all childnodes
|
||||
{
|
||||
//no dynamic loading
|
||||
if(this._getOpenState(itemNode.childNodes[i])<0) this._HideShow(itemNode.childNodes[i],2); //if closed -> open
|
||||
if(itemNode.childNodes[i].childsCount>0) this._openAllNodeChilds(itemNode.childNodes[i]); //if has childs -> run same routine for that node
|
||||
|
||||
//for dynamic loading
|
||||
if ((itemNode.childNodes[i].XMLload==0)||(itemNode.childNodes[i].unParsed)) this.ClosedElem.push(itemNode.childNodes[i]); //if not loaded put in array
|
||||
}
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._loadAndOpen = function(that)
|
||||
{
|
||||
if(that.G_node) //if there was loaded one node
|
||||
{
|
||||
that._openItem(that.G_node); //open it
|
||||
that._openAllNodeChilds(that.G_node); //run open/find closed nodes for childs of this node
|
||||
that.G_node = null; //erase "just loaded node" pointer
|
||||
}
|
||||
|
||||
if(that.ClosedElem.length>0) that.G_node = that.ClosedElem.shift(); //get not loaded node if any left in array
|
||||
|
||||
if(that.G_node)
|
||||
if (that.G_node.unParsed)
|
||||
that.reParse(that.G_node);
|
||||
else
|
||||
window.setTimeout( function(){ that._loadDynXML(that.G_node.id); },100);
|
||||
else
|
||||
{
|
||||
that.onXLE = that.onLoadReserve; //restore loading end handler if finished opening
|
||||
if (that.onXLE) that.onXLE(that);
|
||||
that.callEvent("onAllOpenDynamic",[that]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc: expand list of nodes in dynamic tree (wait of loading of node before expanding next)
|
||||
* @type: public
|
||||
* @edition: Professional
|
||||
* @param: list - list of nodes which will be expanded
|
||||
* @param: flag - true/false - select last node in the list
|
||||
* @topic: 4
|
||||
*/
|
||||
dhtmlXTreeObject.prototype.openItemsDynamic=function(list,flag){
|
||||
if (this.onXLE==this._stepOpen) return;
|
||||
this._opnItmsDnmcFlg=dhx4.s2b(flag);
|
||||
this.onLoadReserve = this.onXLE;
|
||||
this.onXLE=this._stepOpen;
|
||||
this.ClosedElem=list.split(",").reverse();
|
||||
this._stepOpen(this);
|
||||
}
|
||||
|
||||
dhtmlXTreeObject.prototype._stepOpen=function(that){
|
||||
if(!that.ClosedElem.length){
|
||||
that.onXLE = that.onLoadReserve;
|
||||
if (that._opnItmsDnmcFlg)
|
||||
that.selectItem(that.G_node,true);
|
||||
if ((that.onXLE)&&(arguments[1]))
|
||||
that.onXLE.apply(that,arguments);
|
||||
that.callEvent("onOpenDynamicEnd",[]);
|
||||
return;
|
||||
}
|
||||
that.G_node=that.ClosedElem.pop();
|
||||
that.skipLock = true;
|
||||
var temp=that._globalIdStorageFind(that.G_node);
|
||||
|
||||
if(temp){
|
||||
if (temp.XMLload===0)
|
||||
that.openItem(that.G_node);
|
||||
else{
|
||||
that.openItem(that.G_node);
|
||||
that._stepOpen(that);
|
||||
}
|
||||
}
|
||||
that.skipLock = false;
|
||||
}
|
||||
|
||||
//(c)dhtmlx ltd. www.dhtmlx.com
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 56 B |
|
After Width: | Height: | Size: 87 B |
|
After Width: | Height: | Size: 156 B |
|
After Width: | Height: | Size: 568 B |
|
After Width: | Height: | Size: 882 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 863 B |
|
After Width: | Height: | Size: 870 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 116 B |
|
After Width: | Height: | Size: 897 B |
|
After Width: | Height: | Size: 881 B |
|
After Width: | Height: | Size: 159 B |
|
After Width: | Height: | Size: 227 B |
|
After Width: | Height: | Size: 56 B |
|
After Width: | Height: | Size: 87 B |
|
After Width: | Height: | Size: 579 B |
|
After Width: | Height: | Size: 571 B |
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 155 B |
|
After Width: | Height: | Size: 92 B |
|
After Width: | Height: | Size: 878 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_skyblue/leaf.gif
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_skyblue/line.gif
Normal file
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 74 B |
|
After Width: | Height: | Size: 76 B |
|
After Width: | Height: | Size: 81 B |
|
After Width: | Height: | Size: 81 B |
|
After Width: | Height: | Size: 67 B |
|
After Width: | Height: | Size: 69 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_skyblue/lock.gif
Normal file
|
After Width: | Height: | Size: 208 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 107 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 121 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 125 B |
|
After Width: | Height: | Size: 117 B |
|
After Width: | Height: | Size: 117 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 111 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_skyblue/plus.gif
Normal file
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 123 B |
|
After Width: | Height: | Size: 124 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 120 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 114 B |
|
After Width: | Height: | Size: 113 B |
|
After Width: | Height: | Size: 213 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 56 B |
|
After Width: | Height: | Size: 87 B |
|
After Width: | Height: | Size: 95 B |
|
After Width: | Height: | Size: 98 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 130 B |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 92 B |
|
After Width: | Height: | Size: 92 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_terrace/leaf.gif
Normal file
|
After Width: | Height: | Size: 98 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_terrace/line.gif
Normal file
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 78 B |
|
After Width: | Height: | Size: 79 B |
|
After Width: | Height: | Size: 74 B |
|
After Width: | Height: | Size: 76 B |
|
After Width: | Height: | Size: 81 B |
|
After Width: | Height: | Size: 81 B |
|
After Width: | Height: | Size: 67 B |
|
After Width: | Height: | Size: 69 B |
BIN
themes/sources/dhtmlxTree/codebase/imgs/dhxtree_terrace/lock.gif
Normal file
|
After Width: | Height: | Size: 117 B |
|
After Width: | Height: | Size: 75 B |
|
After Width: | Height: | Size: 76 B |
|
After Width: | Height: | Size: 85 B |
|
After Width: | Height: | Size: 88 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 78 B |