//v.3.6 build 131023 /* Copyright DHTMLX LTD. http://www.dhtmlx.com You allowed to use this component or parts of it under GPL terms To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com */ function xmlPointer(a){this.d=a} xmlPointer.prototype={text:function(){if(!_isFF)return this.d.xml;var a=new XMLSerializer;return a.serializeToString(this.d)},get:function(a){return this.d.getAttribute(a)},exists:function(){return!!this.d},content:function(){return this.d.firstChild?this.d.firstChild.data:""},each:function(a,b,c,d){var e=this.d.childNodes,f=new xmlPointer;if(e.length)for(d=d||0;d 0)i={},i.tr=a.childNodes[0].tr.previousSibling;a._has_top=!0;for(o=l;o>0;o--)k[o]=k[o-1];l=0}var n;if(!(n=this._idpull[b])||n.span!=-1)n=k[l]=new dhtmlXTreeItemObject(b,c,a,this,d,1),b=k[l].id,a.childsCount++;if(!n.htmlNode)n.label=c,n.htmlNode=this._createItem(this.checkBoxOff?1:0,n),n.htmlNode.objBelong=n;e&&(n.images[0]=e);f&&(n.images[1]=f);g&&(n.images[2]=g);var q=this._drawNewTr(n.htmlNode);if(this.XMLloadingWarning||this._hAdI)n.htmlNode.parentNode.parentNode.style.display="none";i&&i.tr&& i.tr.nextSibling?a.htmlNode.childNodes[0].insertBefore(q,i.tr.nextSibling):this.parsingOn==a.id?this.parsedArray[this.parsedArray.length]=q:a.htmlNode.childNodes[0].appendChild(q);i&&!i.span&&(i=null);if(this.XMLsource)n.XMLload=j&&j!=0?0:1;n.tr=q;q.nodem=n;if(a.itemId==0)q.childNodes[0].className="hiddenRow";(a._r_logic||this._frbtr)&&this._setSrc(n.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0],this.imPath+this.radioArray[0]);if(h){s=h.split(",");for(p=0;p=2&&(this._correctPlus(k[a.childsCount-2]), this._correctLine(k[a.childsCount-2])),a.childsCount!=2&&this._correctPlus(k[0]),this.tscheck&&this._correctCheckStates(a),this._onradh))if(this.xmlstate==1){var t=this.onXLE;this.onXLE=function(a){this._onradh(b);t&&t(a)}}else this._onradh(b);return n};dhtmlXTreeObject.prototype.insertNewItem=function(a,b,c,d,e,f,g,h,j){var i=this._globalIdStorageFind(a);if(!i)return-1;var m=this._attachChildNode(i,b,c,d,e,f,g,h,j);if(!this._idpull[this.rootId].XMLload)this._idpull[this.rootId].XMLload=1;return m}; dhtmlXTreeObject.prototype.insertNewChild=function(a,b,c,d,e,f,g,h,j){return this.insertNewItem(a,b,c,d,e,f,g,h,j)};dhtmlXTreeObject.prototype._parseXMLTree=function(a,b,c,d,e){var f=new xmlPointer(e.getXMLTopNode("tree"));a._parse(f);a._p=f}; dhtmlXTreeObject.prototype._parseItem=function(a,b,c,d){var e;if(this._srnd&&(!this._idpull[e=a.get("id")]||!this._idpull[e].span))this._addItemSRND(b.id,e,a);else{var f=a.get_all();if(typeof this.waitUpdateXML=="object"&&!this.waitUpdateXML[f.id])this._parse(a,f.id,1);else{var g=[];f.select&&g.push("SELECT");f.top&&g.push("TOP");if(f.call)this.nodeAskingCall=f.id;f.checked==-1?g.push("HCHECKED"):f.checked&&g.push("CHECKED");f.open&&g.push("OPEN");if(this.waitUpdateXML)if(this._globalIdStorageFind(f.id))var h= this.updateItem(f.id,f.text,f.im0,f.im1,f.im2,f.checked,f.child);else this.npl==0?g.push("TOP"):c=b.childNodes[this.npl],h=this._attachChildNode(b,f.id,f.text,0,f.im0,f.im1,f.im2,g.join(","),f.child,0,c),f.id=h.id,c=null;else h=this._attachChildNode(b,f.id,f.text,0,f.im0,f.im1,f.im2,g.join(","),f.child,d||0,c);if(f.tooltip)h.span.parentNode.parentNode.title=f.tooltip;f.style&&(h.span.style.cssText?h.span.style.cssText+=";"+f.style:h.span.setAttribute("style",h.span.getAttribute("style")+"; "+f.style)); if(f.radio)h._r_logic=!0;if(f.nocheckbox){var j=h.span.parentNode.previousSibling.previousSibling;j.style.display="none";h.nocheckbox=!0}f.disabled&&(f.checked!=null&&this._setCheck(h,f.checked),this.disableCheckbox(h,1));h._acc=f.child||0;this.parserExtension&&this.parserExtension._parseExtension.call(this,a,f,b?b.id:0);this.setItemColor(h,f.aCol,f.sCol);f.locked=="1"&&this.lockItem(h.id,!0,!0);(f.imwidth||f.imheight)&&this.setIconSize(f.imwidth,f.imheight,h);(f.closeable=="0"||f.closeable=="1")&& this.setItemCloseable(h,f.closeable);var i="";f.topoffset&&this.setItemTopOffset(h,f.topoffset);if(!this.slowParse||typeof this.waitUpdateXML=="object")a.sub_exists("item")&&(i=this._parse(a,f.id,1));if(i!="")this.nodeAskingCall=i;a.each("userdata",function(b){this.setUserData(a.get("id"),b.get("name"),b.content())},this)}}}; dhtmlXTreeObject.prototype._parse=function(a,b,c,d){if(this._srnd&&!this.parentObject.offsetHeight){var e=this;return window.setTimeout(function(){e._parse(a,b,c,d)},100)}if(a.exists()){this.skipLock=!0;if(!b){var b=a.get("id"),f=a.get("dhx_security");if(f)dhtmlx.security_key=f;if(a.get("radio"))this.htmlNode._r_logic=!0;this.parsingOn=b;this.parsedArray=[];this.nodeAskingCall=this.setCheckList=""}var g=this._globalIdStorageFind(b);if(!g)return dhtmlxError.throwError("DataStructure","XML refers to not existing parent"); this.parsCount=this.parsCount?this.parsCount+1:1;this.XMLloadingWarning=1;var h=g.childsCount&&!d&&!this._edsbps&&!g._has_top?0:0;this.npl=0;a.each("item",function(a){g.XMLload=1;this._parseItem(a,g,0,h);this.npl++},this,d);if(!c){a.each("userdata",function(b){this.setUserData(a.get("id"),b.get("name"),b.content())},this);g.XMLload=1;if(this.waitUpdateXML){this.waitUpdateXML=!1;for(var j=g.childsCount-1;j>=0;j--)g.childNodes[j]._dmark&&this.deleteItem(g.childNodes[j].id)}for(var i=this._globalIdStorageFind(this.parsingOn), j=0;j1){(c[1].style.display!="none"||b==1)&&b!=2?(this.allTree.childNodes[0].border="1",this.allTree.childNodes[0].border="0",nodestyle="none"):nodestyle="";for(var e=1;e7)k.style.width="999999px";else if(!window._KHTMLrv)k.style.width="100%";b.span.innerHTML=b.label;k.appendChild(b.span);k.parentObject=b;g.parentObject=b;k.onclick= this.onRowSelect;g.onclick=this.onRowClick;k.ondblclick=this.onRowClick2;if(this.ettip)f.title=b.label;if(this.dragAndDropOff){if(this._aimgs)this.dragger.addDraggableItem(m,this),m.parentObject=b;this.dragger.addDraggableItem(k,this)}b.span.style.paddingLeft="5px";b.span.style.paddingRight="5px";k.style.verticalAlign="";k.style.fontSize="10pt";k.style.cursor=this.style_pointer;f.appendChild(g);f.appendChild(j);f.appendChild(m);f.appendChild(k);e.appendChild(f);d.appendChild(e);if(this.ehlt||this.checkEvent("onMouseIn")|| this.checkEvent("onMouseOut"))f.onmousemove=this._itemMouseIn,f[_isIE?"onmouseleave":"onmouseout"]=this._itemMouseOut;return d};dhtmlXTreeObject.prototype.setImagePath=function(a){this.iconURL=this.imPath=a};dhtmlXTreeObject.prototype.setIconPath=function(a){this.iconURL=a};dhtmlXTreeObject.prototype.setOnRightClickHandler=function(a){this.attachEvent("onRightClick",a)};dhtmlXTreeObject.prototype.setOnClickHandler=function(a){this.attachEvent("onClick",a)}; dhtmlXTreeObject.prototype.setOnSelectStateChange=function(a){this.attachEvent("onSelect",a)};dhtmlXTreeObject.prototype.setXMLAutoLoading=function(a){this.XMLsource=a};dhtmlXTreeObject.prototype.setOnCheckHandler=function(a){this.attachEvent("onCheck",a)};dhtmlXTreeObject.prototype.setOnOpenHandler=function(a){this.attachEvent("onOpenStart",a)};dhtmlXTreeObject.prototype.setOnOpenStartHandler=function(a){this.attachEvent("onOpenStart",a)}; dhtmlXTreeObject.prototype.setOnOpenEndHandler=function(a){this.attachEvent("onOpenEnd",a)};dhtmlXTreeObject.prototype.setOnDblClickHandler=function(a){this.attachEvent("onDblClick",a)};dhtmlXTreeObject.prototype.openAllItems=function(a){var b=this._globalIdStorageFind(a);if(!b)return 0;this._xopenAll(b)};dhtmlXTreeObject.prototype.getOpenState=function(a){var b=this._globalIdStorageFind(a);return!b?"":this._getOpenState(b)}; dhtmlXTreeObject.prototype.closeAllItems=function(a){if(a===window.undefined)a=this.rootId;var b=this._globalIdStorageFind(a);if(!b)return 0;this._xcloseAll(b);this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0"}; dhtmlXTreeObject.prototype.setUserData=function(a,b,c){var d=this._globalIdStorageFind(a,0,!0);if(d){if(b=="hint")d.htmlNode.childNodes[0].childNodes[0].title=c;if(typeof d.userData["t_"+b]=="undefined")d._userdatalist?d._userdatalist+=","+b:d._userdatalist=b;d.userData["t_"+b]=c}};dhtmlXTreeObject.prototype.getUserData=function(a,b){var c=this._globalIdStorageFind(a,0,!0);return!c?void 0:c.userData["t_"+b]}; dhtmlXTreeObject.prototype.getItemColor=function(a){var b=this._globalIdStorageFind(a);if(!b)return 0;var c={};if(b.acolor)c.acolor=b.acolor;if(b.scolor)c.scolor=b.scolor;return c};dhtmlXTreeObject.prototype.setItemColor=function(a,b,c){var d=a&&a.span?a:this._globalIdStorageFind(a);if(d){if(d.i_sel){if(c)d.span.style.color=c}else if(b)d.span.style.color=b;if(c)d.scolor=c;if(b)d.acolor=b}else return 0}; dhtmlXTreeObject.prototype.getItemText=function(a){var b=this._globalIdStorageFind(a);return!b?0:b.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML};dhtmlXTreeObject.prototype.getParentId=function(a){var b=this._globalIdStorageFind(a);return!b||!b.parentObject?"":b.parentObject.id};dhtmlXTreeObject.prototype.changeItemId=function(a,b){if(a!=b){var c=this._globalIdStorageFind(a);if(!c)return 0;c.id=b;c.span.contextMenuId=b;this._idpull[b]=this._idpull[a];delete this._idpull[a]}}; dhtmlXTreeObject.prototype.doCut=function(){this.nodeCut&&this.clearCut();this.nodeCut=[].concat(this._selected);for(var a=0;a=2&&(this._correctPlus(i[b.childsCount-2]),this._correctLine(i[b.childsCount-2]));this._correctPlus(i[b.childsCount-1]);this.tscheck&&this._correctCheckStates(b);e.tscheck&&e._correctCheckStates(g)}f>1&&(e._correctPlus(g.childNodes[f-2]),e._correctLine(g.childNodes[f-2]));e._correctPlus(g);e._correctLine(g);this.callEvent("onDrop",[a.id,b.id,c?c.id:null,e,b.treeNod]);return a.id}; dhtmlXTreeObject.prototype._clearStyles=function(a){if(a.htmlNode){var b=a.htmlNode.childNodes[0].childNodes[0].childNodes[1],c=b.nextSibling.nextSibling;a.span.innerHTML=a.label;a.i_sel=!1;a._aimgs&&this.dragger.removeDraggableItem(b.nextSibling);this.checkBoxOff?(b.childNodes[0].style.display="",b.childNodes[0].onclick=this.onCheckBoxClick,this._setSrc(b.childNodes[0],this.imPath+this.checkArray[a.checkstate])):b.childNodes[0].style.display="none";b.childNodes[0].treeNod=this;this.dragger.removeDraggableItem(c); this.dragAndDropOff&&this.dragger.addDraggableItem(c,this);this._aimgs&&this.dragger.addDraggableItem(b.nextSibling,this);c.childNodes[0].className="standartTreeRow";c.onclick=this.onRowSelect;c.ondblclick=this.onRowClick2;b.previousSibling.onclick=this.onRowClick;this._correctLine(a);this._correctPlus(a);for(var d=0;d0){var d=a.childNodes[c].unParsed?this._getAllScraggyItemsXML(a.childNodes[c].unParsed,1):this._getAllScraggyItems(a.childNodes[c]);d&&(b?b+=this.dlmtr+d:b=d)}else b?b+=this.dlmtr+a.childNodes[c].id:b=""+a.childNodes[c].id;return b}; dhtmlXTreeObject.prototype._getAllFatItems=function(a){for(var b="",c=0;c0){b?b+=this.dlmtr+a.childNodes[c].id:b=""+a.childNodes[c].id;var d=a.childNodes[c].unParsed?this._getAllFatItemsXML(a.childNodes[c].unParsed,1):this._getAllFatItems(a.childNodes[c]);d&&(b+=this.dlmtr+d)}return b}; dhtmlXTreeObject.prototype._getAllSubItems=function(a,b,c){var d=c?c:this._globalIdStorageFind(a);if(!d)return 0;for(var b="",e=0;e=c.childsCount?null:c.childNodes[b].id};dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(a,b){var c=this._globalIdStorageFind(a);return!c||b>=c.childsCount?null:c.childNodes[b].id};dhtmlXTreeObject.prototype.setDragHandler=function(a){this.attachEvent("onDrag",a)}; dhtmlXTreeObject.prototype._clearMove=function(){if(this._lastMark)this._lastMark.className=this._lastMark.className.replace(/dragAndDropRow/g,""),this._lastMark=null;this.allTree.className=this.allTree.className.replace(" selectionBox","")}; dhtmlXTreeObject.prototype.enableDragAndDrop=function(a,b){a=="temporary_disabled"?(this.dADTempOff=!1,a=!0):this.dADTempOff=!0;(this.dragAndDropOff=convertStringToBoolean(a))&&this.dragger.addDragLanding(this.allTree,this);if(arguments.length>1)this._ddronr=!convertStringToBoolean(b)}; dhtmlXTreeObject.prototype._setMove=function(a){if(a.parentObject.span){var b=getAbsoluteTop(a),c=getAbsoluteTop(this.allTree)-this.allTree.scrollTop;this.dadmodec=this.dadmode;this.dadmodefix=0;var d=a.parentObject.span;d.className+=" dragAndDropRow";this._lastMark=d;this._autoScroll(null,b,c)}}; dhtmlXTreeObject.prototype._autoScroll=function(a,b,c){if(this.autoScroll){a&&(b=getAbsoluteTop(a),c=getAbsoluteTop(this.allTree)-this.allTree.scrollTop);if(b-c-parseInt(this.allTree.scrollTop)>parseInt(this.allTree.offsetHeight)-50)this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20;if(b-c"+this._selected[f].span.innerHTML+ "";else e=this.getSelectedItemText().split(this.dlmtr);d.innerHTML=e.join("");d.style.position="absolute";d.className="dragSpanDiv";this._dragged=[].concat(this._selected);return d};dhtmlXTreeObject.prototype._focusNode=function(a){var b=getAbsoluteTop(a.htmlNode)-getAbsoluteTop(this.allTree);if(b>this.allTree.offsetHeight-30||b<0)this.allTree.scrollTop=b+this.allTree.scrollTop};dhtmlXTreeObject.prototype._preventNsDrag=function(a){a&&a.preventDefault&&a.preventDefault();return!1}; dhtmlXTreeObject.prototype._drag=function(a,b,c){this._autoOpenTimer&&clearTimeout(this._autoOpenTimer);if(!c.parentObject)c=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0],this.dadmodec=0;this._clearMove();var d=a.parentObject.treeNod;d&&d._clearMove&&d._clearMove("");if(!this.dragMove||this.dragMove())for(var e=!d||!d._clearMove||!d._dragged?Array(a.parentObject):d._dragged,f=c.parentObject,g=0;g2?c.checkstate-3:c.checkstate,this._setCheck(c),c.dscheck<3))c.dscheck=!1}; dhtmlXTreeObject.prototype.setEscapingMode=function(a){this.utfesc=a};dhtmlXTreeObject.prototype.enableHighlighting=function(a){this.ehlt=!0;this.ehlta=convertStringToBoolean(a)};dhtmlXTreeObject.prototype._itemMouseOut=function(){var a=this.childNodes[3].parentObject,b=a.treeNod;b.callEvent("onMouseOut",[a.id]);if(a.id==b._l_onMSI)b._l_onMSI=null;if(b.ehlta)a.span.className=a.span.className.replace("_lor","")}; dhtmlXTreeObject.prototype._itemMouseIn=function(){var a=this.childNodes[3].parentObject,b=a.treeNod;b._l_onMSI!=a.id&&b.callEvent("onMouseIn",[a.id]);b._l_onMSI=a.id;if(b.ehlta)a.span.className=a.span.className.replace("_lor",""),a.span.className=a.span.className.replace(/((standart|selected)TreeRow)/,"$1_lor")};dhtmlXTreeObject.prototype.enableActiveImages=function(a){this._aimgs=convertStringToBoolean(a)}; dhtmlXTreeObject.prototype.focusItem=function(a){var b=this._globalIdStorageFind(a);if(!b)return 0;this._focusNode(b)};dhtmlXTreeObject.prototype.getAllSubItems=function(a){return this._getAllSubItems(a)};dhtmlXTreeObject.prototype.getAllChildless=function(){return this._getAllScraggyItems(this.htmlNode)};dhtmlXTreeObject.prototype.getAllLeafs=dhtmlXTreeObject.prototype.getAllChildless; dhtmlXTreeObject.prototype._getAllScraggyItems=function(a){for(var b="",c=0;c0){var d=a.childNodes[c].unParsed?this._getAllScraggyItemsXML(a.childNodes[c].unParsed,1):this._getAllScraggyItems(a.childNodes[c]);d&&(b?b+=this.dlmtr+d:b=d)}else b?b+=this.dlmtr+a.childNodes[c].id:b=""+a.childNodes[c].id;return b}; dhtmlXTreeObject.prototype._getAllFatItems=function(a){for(var b="",c=0;c0){b?b+=this.dlmtr+a.childNodes[c].id:b=""+a.childNodes[c].id;var d=a.childNodes[c].unParsed?this._getAllFatItemsXML(a.childNodes[c].unParsed,1):this._getAllFatItems(a.childNodes[c]);d&&(b+=this.dlmtr+d)}return b};dhtmlXTreeObject.prototype.getAllItemsWithKids=function(){return this._getAllFatItems(this.htmlNode)}; dhtmlXTreeObject.prototype.getAllFatItems=dhtmlXTreeObject.prototype.getAllItemsWithKids;dhtmlXTreeObject.prototype.getAllChecked=function(){return this._getAllChecked("","",1)};dhtmlXTreeObject.prototype.getAllUnchecked=function(a){a&&(a=this._globalIdStorageFind(a));return this._getAllChecked(a,"",0)};dhtmlXTreeObject.prototype.getAllPartiallyChecked=function(){return this._getAllChecked("","",2)}; dhtmlXTreeObject.prototype.getAllCheckedBranches=function(){var a=[this._getAllChecked("","",1)],b=this._getAllChecked("","",2);b&&a.push(b);return a.join(this.dlmtr)};dhtmlXTreeObject.prototype._getAllChecked=function(a,b,c){if(!a)a=this.htmlNode;a.checkstate==c&&(a.nocheckbox||(b?b+=this.dlmtr+a.id:b=""+a.id));for(var d=a.childsCount,e=0;e