llTree.appendChild(this.htmlNode.htmlNode); this.allTree.onselectstart=new Function("return false;"); this.XMLLoader=new dtmlXMLLoaderObject(this._parseXMLTree,this); this.dragger.addDragLanding(this.allTree,this); return this; };
function dhtmlXTreeItemObject(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.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(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; }; dhtmlXTreeObject.prototype._globalIdStorageAdd=function(itemId,itemObject){ if(this._globalIdStorageFind(itemId)){d=new Date();itemId=d.valueOf()+"_"+itemId;return this._globalI dStorageAdd(itemId,itemObject);} this._globalIdStorage[this._globalIdStorageSize]=itemId; this.globalNodeStorage[this._globalIdStorageSize]=itemObject; this._globalIdStorageSize++; return itemId; }; dhtmlXTreeObject.prototype._globalIdStorageSub=function(itemId){ for(var i=0;i<this._globalIdStorageSize;i++) if(this._globalIdStorage[i]==itemId) { this._globalIdStorage[i]=this._globalIdStorage[this._globalIdStorageSize-1]; this.globalNodeStorage[i]=this.globalNodeStorage[this._globalIdStorageSize-1]; this._globalIdStorageSize--; this._globalIdStorage[this._globalIdStorageSize]=0; this.globalNodeStorage[this._globalIdStorageSize]=0; } }; dhtmlXTreeObject.prototype._globalIdStorageFind=function(itemId){ for(var i=0;i<this._globalIdStorageSize;i++) if(this._globalIdStorage[i]==itemId) return this.globalNodeStorage[i]; return 0; };
dhtmlXTreeObject.prototype._drawNewTr=function(htmlObject) { var tr =document.createElement('tr'); var td1=document.createElement('td'); var td2=document.createElement('td'); td1.appendChild(document.createTextNode("")); td2.colSpan=3;td2.appendChild(htmlObject);tr.appendChild(td1);tr.appendChild(td2); return tr; }; dhtmlXTreeObject.prototype.loadXMLString=function(xmlString){this.XMLLoader.loadXMLString(xmlString);}; dhtmlXTreeObject.prototype.loadXML=function(file){this.XMLLoader.loadXML(file);}; dhtmlXTreeObject.prototype._attachChildNode=function(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs,url,beforeNode){ if(beforeNode)parentObject=beforeNode.parentObject; if(((parentObject.XMLload==0)&&(this.XMLsource))&&(!this.XMLloadingWarning)) { parentObject.XMLload=1;this.loadXML(this.XMLsource+getUrlSymbol(this.XMLsource)+"itemId="+escape(parentObject.itemId)); } var Count=parentObject.childsCount; var Nodes=parentObject.childNodes; if((!itemActionHandler)&&(this.aFunc))itemActionHandler=this.aFunc; Nodes[Count]=new dhtmlXTreeItemObject(itemId,itemText,parentObject,this,itemActionHandler,1); if(image1)Nodes[Count].images[0]=image1; if(image2)Nodes[Count].images[1]=image2; if(image3)Nodes[Count].images[2]=image3; parentObject.childsCount++; var tr=this._drawNewTr(Nodes[Count].htmlNode); if(this.XMLloadingWarning) Nodes[Count].htmlNode.parentNode.parentNode.style.display="none"; if(optionStr){ var tempStr=optionStr.split(","); for(var i=0;i<tempStr.length;i++) { switch(tempStr[i]) { case "TOP": if(parentObject.childsCount>1)beforeNode=parentObject.htmlNode.childNodes[0].childNodes[1].nodem.previousSibling;break; } }; }; if((beforeNode)&&(beforeNode.tr.nextSibling)) parentObject.htmlNode.childNodes[0].insertBefore(tr,beforeNode.tr.nextSibling); else parentObject.htmlNode.childNodes[0].appendChild(tr); if(this.XMLsource)if((childs)&&(childs!=0))Nodes[Count].XMLload=0;else Nodes[Count].XMLload=1; Nodes[Count].tr=tr; tr.nodem=Nodes[Count]; if(parentObject.itemId==0) tr.childNodes[0].className="hitemIddenRow"; if(optionStr){ var tempStr=optionStr.split(","); for(var i=0;i<tempStr.length;i++) { switch(tempStr[i]) { case "SELECT": this.selectItem(itemId,false);break; case "CALL": this.selectItem(itemId,true);break; case "CHILD": Nodes[Count].XMLload=0;break; case "CHECKED": if(this.XMLloadingWarning) this.setCheckList+=itemId; else this.setCheck(itemId,1); break; case "OPEN": Nodes[Count].openMe=1;break; } }; }; if(!this.XMLloadingWarning) { if(this._getOpenState(parentObject)<0) this.openItem(parentObject.id); if(beforeNode) { this._correctPlus(beforeNode); this._correctLine(beforeNode); } this._correctPlus(parentObject); this._correctLine(parentObject); this._correctPlus(Nodes[Count]); if(parentObject.childsCount>=2) { this._correctPlus(Nodes[parentObject.childsCount-2]); this._correctLine(Nodes[parentObject.childsCount-2]); } if(parentObject.childsCount!=2)this._correctPlus(Nodes[0]); if(this.tscheck)this._correctCheckStates(parentObject); } return Nodes[Count]; };
dhtmlXTreeObject.prototype.insertNewItem=function(parentId,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs,url){ var parentObject=this._globalIdStorageFind(parentId); if(!parentObject)return(-1); return this._attachChildNode(parentObject,itemId,itemText,itemActionHandler,image1,image2,image3,optionStr,childs,url); }; dhtmlXTreeObject.prototype._parseXMLTree=function(dhtmlObject,node,parentId,level){ dhtmlObject.XMLloadingWarning=1; var nodeAskingCall=""; if(!node){ node=dhtmlObject.XMLLoader.getXMLTopNode("tree"); parentId=node.getAttribute("id"); dhtmlObject.setCheckList=""; } for(var i=0;i<node.childNodes.length;i++) { if((node.childNodes[i].nodeType==1)&&(node.childNodes[i].tagName == "item")) { var name=node.childNodes[i].getAttribute("text"); var cId=node.childNodes[i].getAttribute("id"); var im0=node.childNodes[i].getAttribute("im0"); var im1=node.childNodes[i].getAttribute("im1"); var im2=node.childNodes[i].getAttribute("im2"); var aColor=node.childNodes[i].getAttribute("aCol"); var sColor=node.childNodes[i].getAttribute("sCol"); var chd=node.childNodes[i].getAttribute("child"); var atop=node.childNodes[i].getAttribute("top"); var aopen=node.childNodes[i].getAttribute("open"); var aselect=node.childNodes[i].getAttribute("select"); var acall=node.childNodes[i].getAttribute("call"); var achecked=node.childNodes[i].getAttribute("checked"); var closeable=node.childNodes[i].getAttribute("closeable"); var url=node.childNodes[i].getAttribute("url"); var zST=""; if(aselect)zST+=",SELECT"; if(atop)zST+=",TOP"; if(acall)nodeAskingCall=cId; if(achecked)zST+=",CHECKED"; if((aopen)&&(aopen!="0"))zST+=",OPEN"; var temp=dhtmlObject._globalIdStorageFind(parentId); temp.XMLload=1; dhtmlObject.insertNewItem(parentId,cId,name,0,im0,im1,im2,zST,chd,url); if(dhtmlObject.parserExtension)dhtmlObject.parserExtension._parseExtension(node.childNodes[i],dhtmlObject.parserExtension,cId,parentId); dhtmlObject.setItemColor(cId,aColor,sColor); if((closeable=="0")||(closeable=="1"))dhtmlObject.setItemCloseable(cId,closeable); var zcall=dhtmlObject._parseXMLTree(dhtmlObject,node.childNodes[i],cId,1); if(zcall!="")nodeAskingCall=zcall; } else if((node.childNodes[i].nodeType==1)&&(node.childNodes[i].tagName == "userdata")) { var name=node.childNodes[i].getAttribute("name"); if((name)&&(node.childNodes[i].childNodes[0])){ dhtmlObject.setUserData(parentId,name,node.childNodes[i].childNodes[0].dat上一页 [1] [2] [3] [4] 下一页 |