| 12345678910 |
- /*
- ===================================================================
- Copyright DHTMLX LTD. http://www.dhtmlx.com
- This code is obfuscated and not allowed for any purposes except
- using on sites which belongs to DHTMLX LTD.
- Please contact sales@dhtmlx.com to obtain necessary
- license for usage of dhtmlx components.
- ===================================================================
- */dhtmlXGridObject.prototype._updateTGRState=function(c){if(c.update&&c.id!=0){if(this.rowsAr[c.id].imgTag)this.rowsAr[c.id].imgTag.src=this.imgURL+c.state+".gif";c.update= !1}};dhtmlXGridObject.prototype.doExpand=function(c){this.editStop();var a=c.parentNode.parentNode.parentNode,b=this._h2.get[a.idd];if(this.callEvent("onOpen",[a.idd,b.state=="plus"? -1:1]))b.state=="plus"?this.expandKids(a):b.state=="minus"&& !b._closeable&&this.collapseKids(a)};function dhtmlxHierarchy(){var c={id:0,childs:[],level: -1,parent:null,index:0,state:dhtmlXGridObject._emptyLineImg};this.order=[c];this.get={0:c};this.swap=function(a,b){var c=a.parent,e=a.index;c.childs[e]=b;c.childs[b.index]=a;a.index=b.index;b.index=e};this.forEachChildF=function(a,b,c,e){for(var f=this.get[a],g=0;g<f.childs.length;g++)if(b.apply(c||this,[f.childs[g]]))f.childs[g].childs.length&&this.forEachChildF(f.childs[g].id,b,c,e),e&&e.call(c||this,f.childs[g])};this.forEachChild=function(a,b,c){for(var e=this.get[a],f=0;f<e.childs.length;f++)b.apply(c||this,[e.childs[f]]),e.childs[f].childs.length&&this.forEachChild(e.childs[f].id,b,c)};this.change=function(a,b,c){var e=this.get[a];if(e[b]!=c)e[b]=c,e.update= !0};this.add=function(a,b){return this.addAfter(a,b)};this.addAfter=function(a,b,c,e){var f=this.get[b||0],g=c?this.get[c].index+(e?0:1):f.childs.length,h={id:a,childs:[],level:f.level+1,parent:f,index:g,state:dhtmlXGridObject._emptyLineImg};f.state==dhtmlXGridObject._emptyLineImg&&this.change(b,"state",b==0?"minus":"plus");if(c){for(var i=g;i<f.childs.length;i++)f.childs[i].index++;f.childs=f.childs.slice(0,g).concat([h]).concat(f.childs.slice(g,f.childs.length))}else f.childs.push(h);return this.get[a]=h};this.addBefore=function(a,b,c){return this.addAfter(a,b,c,!0)};this.remove=function(a){for(var b=this.get[a||0],c=0;c<b.childs.length;c++)this.deleteAll(b.childs[c].id);b.childs=[];b.parent.childs=b.parent.childs.slice(0,b.index).concat(b.parent.childs.slice(b.index+1));for(c=b.index;c<b.parent.childs.length;c++)b.parent.childs[c].index--;delete this.get[a]};this.deleteAll=function(a){for(var b=this.get[a||0],c=0;c<b.childs.length;c++)this.deleteAll(b.childs[c].id);b.childs=[];delete this.get[a]};return this}dhtmlXGridObject.prototype._getOpenLenght=function(c,a){var b=this._h2.get[c].childs;a+=b.length;for(var d=0;d<b.length;d++)b[d].childs.length&&b[d].state=="minus"&&(a+=this._getOpenLenght(b[d].id,0));return a};dhtmlXGridObject.prototype.collapseKids=function(c){var a=this._h2.get[c.idd];if(a.state=="minus"&&this.callEvent("onOpenStart",[c.idd,1])){var b=c.rowIndex;b<0&&(b=this.rowsCol._dhx_find(c)+1);this._h2.change(a.id,"state","plus");this._updateTGRState(a);if(this._srnd||this.pagingOn)this._h2_to_buff(),this._renderSort();else{for(var d=this._getOpenLenght(this.rowsCol[b-1].idd,0),e=0;e<d;e++)this.rowsCol[b+e].parentNode.removeChild(this.rowsCol[b+e]);this.rowsCol.splice(b,d)}this.callEvent("onGridReconstructed",[]);this.setSizes();this._h2_to_buff();this.callEvent("onOpenEnd",[c.idd,-1])}};dhtmlXGridObject.prototype._massInsert=function(c,a,b){var d=[],e=_isKHTML?this.obj:this.obj.rows[0].parentNode;this._h2_to_buff();if(this._srnd||this.pagingOn)return this._renderSort();for(var f=this._getOpenLenght(c.id,0),g=0;g<f;g++){var h=this.render_row(b+g);a?a.parentNode.insertBefore(h,a):e.appendChild(h);d.push(h)}this.rowsCol=dhtmlxArray(this.rowsCol.slice(0,b).concat(d).concat(this.rowsCol.slice(b)));return c.childs.length+d.length};dhtmlXGridObject.prototype.expandKids=function(c,a){var b=this._h2.get[c.idd];if(b.childs.length||b._xml_await)if(b.state=="plus"&&(b._loading||a||this.callEvent("onOpenStart",[b.id,-1]))){var d=this.getRowIndex(b.id)+1;if(b.childs.length){b._loading= !1;this._h2.change(b.id,"state","minus");this._updateTGRState(b);var e=this._massInsert(b,this.rowsCol[d],d);this.callEvent("onGridReconstructed",[])}else if(b._xml_await)b._loading= !0,this.callEvent("onDynXLS",[b.id])&&this.loadXML(this.kidsXmlFile+""+(this.kidsXmlFile.indexOf("?")!= -1?"&":"?")+"id="+b.id);this.setSizes();b._loading||this.callEvent("onOpenEnd",[b.id,1]);this._fixAlterCss()}};dhtmlXGridObject.prototype.kidsXmlFile="";dhtmlXGridObject.prototype.sortTreeRows=function(c,a,b){var d="getValue";this.cells5({parentNode:{grid:this}},this.getColType(c)).getDate&&(d="getDate",a="str");this.forEachRow(function(b){var e=this._h2.get[b];if(e){var f=this._get_cell_value(e.buff,c,d);a=="int"?(e._sort=parseFloat(f),e._sort=isNaN(e._sort)? -99999999999999:e._sort):e._sort=f}});var e=this,f=1,g= -1;b=="des"&&(f= -1,g=1);var h=null;a=="cus"&&(h=function(a,d){return e._customSorts[c](a._sort,d._sort,b,a.id,d.id)});a=="str"&&(h=function(a,b){return a._sort<b._sort?g:a._sort==b._sort?0:f});a=="int"&&(h=function(a,b){return a._sort<b._sort?g:a._sort==b._sort?0:f});a=="date"&&(h=function(a,b){return(Date.parse(new Date(a._sort||"01/01/1900"))-Date.parse(new Date(b._sort||"01/01/1900")))*f});this._sortTreeRows(h,0);this._renderSort(0,!0);this.callEvent("onGridReconstructed",[])};dhtmlXGridObject.prototype._sortTreeRows=function(c,a){var b=this._h2.get[a].childs;this.rowsCol.stablesort?this.rowsCol.stablesort.call(b,c):b.sort(c);for(var d=0;d<b.length;d++)b[d].childs.length&&this._sortTreeRows(c,b[d].id),b[d].index=d};dhtmlXGridObject.prototype._renderSort=function(){this._h2_to_buff();var c=this.objBox.scrollTop;this._reset_view();this.objBox.scrollTop=c};dhtmlXGridObject.prototype._fixAlterCssTGR=function(){this._realfake||this._h2.forEachChild(0,function(c){if(c.buff.tagName=="TR"){var a=(this._cssSP?c.level%2:c.index%2)?this._cssUnEven:this._cssEven;this.rowsAr[c.id].className=a+(this._cssSU?" "+a+"_"+c.level:"")+" "+(this.rowsAr[c.id]._css||"")+(this.rowsAr[c.id].className.indexOf("rowselected")!= -1?" rowselected":"")}},this)};dhtmlXGridObject.prototype.moveRowUDTG=function(c,a){var b=this._h2.get[c],d=b.parent.childs[b.index+a];if(d&&d.parent==b.parent){var e=[b.state,d.state];this.collapseKids(this.rowsAr[b.id]);this.collapseKids(this.rowsAr[d.id]);var f=this.rowsCol._dhx_find(this.rowsAr[c]),g=this.rowsBuffer._dhx_find(this.rowsAr[c]),h=this.obj.rows[0].parentNode.removeChild(this.rowsCol[f]),i=this.rowsCol[f+(a==1?2:a)];i?i.parentNode.insertBefore(h,i):this.obj.rows[0].parentNode.appendChild(h);this.rowsCol._dhx_swapItems(f,f+a);this.rowsBuffer._dhx_swapItems(g,g+a);this._h2.swap(d,b);e[0]=="minus"&&this.expandKids(this.rowsAr[b.id]);e[1]=="minus"&&this.expandKids(this.rowsAr[d.id]);this._fixAlterCss(Math.min(f,f+a))}};function eXcell_tree(c){if(c)this.cell=c,this.grid=this.cell.parentNode.grid;this.isDisabled=function(){return this.cell._disabled||this.grid._edtc};this.edit=function(){if(!this.er&& !this.grid._edtc){this.er=this.cell.parentNode.valTag;this.val=this.getLabel();this.cell.atag= !this.grid.multiLine&&(_isKHTML||_isMacOS||_isFF)?"INPUT":"TEXTAREA";this.er.innerHTML="<"+this.cell.atag+" class='dhx_combo_edit' type='text' style='height:"+(this.cell.offsetHeight-6)+"px; width:100%; border:0px; margin:0px; padding:0px; padding-top:"+(_isFF?1:2)+"px; overflow:hidden;'></"+this.cell.atag+">";this.er.childNodes[0].onmousedown=function(a){(a||event).cancelBubble= !0};this.er.childNodes[0].onselectstart=function(a){a||(a=event);return a.cancelBubble= !0};if(_isFF)this.er.style.top="1px";this.er.className+=" editable";this.er.firstChild.onclick=function(a){(a||event).cancelBubble= !0};this.er.firstChild.value=this.val;this.obj=this.er.firstChild;this.er.firstChild.style.width=Math.max(0,this.cell.offsetWidth-this.er.offsetLeft)+"px";this.er.firstChild.focus();_isIE&&this.er.firstChild.focus()}};this.detach=function(){if(this.er){this.setLabel(this.er.firstChild.value);this.er.className=this.er.className.replace("editable","");var a=this.val!=this.er.innerHTML;if(_isFF)this.er.style.top="2px";this.obj=this.er=null;return a}};this.getValue=function(){return this.getLabel()};this.setImage=function(a){this.cell.parentNode.imgTag.nextSibling.src=this.grid.iconURL+a;this.grid._h2.get[this.cell.parentNode.idd].image=a};this.getImage=function(){};this.setLabel=function(a){this.setValueA(a)};this.getLabel=function(){return this.cell.parentNode.valTag.innerHTML}}eXcell_tree.prototype=new eXcell;eXcell_tree.prototype.setValueA=function(c){this.cell.parentNode.valTag.innerHTML=c;this.grid.callEvent("onCellChanged",[this.cell.parentNode.idd,this.cell._cellIndex,c])};eXcell_tree.prototype.setValue=function(c){if(this.cell.parentNode.imgTag)return this.setLabel(c);if(this.grid._tgc.imgURL==null||this.grid._tgc.imgURL!=this.grid.imgURL){var a={};a.spacer="<img src='"+this.grid.imgURL+"blank.gif' align='absmiddle' class='space'>";a.imst="<img src='"+this.grid.imgURL;a.imsti="<img src='"+(this.grid.iconURL||this.grid.imgURL);a.imact="' align='absmiddle' onclick='this."+(_isKHTML?"":"parentNode.")+"parentNode.parentNode.parentNode.parentNode.grid.doExpand(this);event.cancelBubble=true;'>";a.plus=a.imst+"plus.gif"+a.imact;a.minus=a.imst+"minus.gif"+a.imact;a.blank=a.imst+"blank.gif"+a.imact;a.start="<div class='treegrid_cell' style='overflow:hidden; white-space : nowrap; height:"+(_isIE?20:18)+"px;'>";a.itemim="' align='absmiddle' "+(this.grid._img_height?' height="'+this.grid._img_height+'"':"")+(this.grid._img_width?' width="'+this.grid._img_width+'"':"")+" ><span "+(_isFF||_isOpera?"style='position:relative; top:2px;'":"")+"id='nodeval'>";a.close="</span></div>";this.grid._tgc=a}var a=this.grid._tgc,b=this.cell.parentNode.idd,d=this.grid._h2.get[b];if(this.grid.kidsXmlFile||this.grid._slowParse)d.has_kids=d.has_kids||this.cell.parentNode._attrs.xmlkids&&d.state!="minus",d._xml_await= ! !d.has_kids;d.image=d.image||this.cell._attrs.image||"leaf.gif";d.label=c;for(var e=[a.start],f=0;f<d.level;f++)e.push(a.spacer);d.has_kids?(e.push(a.plus),d.state="plus"):e.push(a.imst+d.state+".gif"+a.imact);e.push(a.imsti);e.push(d.image);e.push(a.itemim);e.push(d.label);e.push(a.close);this.cell.innerHTML=e.join("");this.cell._treeCell= !0;this.cell.parentNode.imgTag=this.cell.childNodes[0].childNodes[d.level];this.cell.parentNode.valTag=this.cell.childNodes[0].childNodes[d.level+2];if(_isKHTML)this.cell.vAlign="top";if(d.parent.id!=0&&d.parent.state=="plus")this.grid._updateTGRState(d.parent,!1),this.cell.parentNode._skipInsert= !0;this.grid.callEvent("onCellChanged",[b,this.cell._cellIndex,c])};dhtmlXGridObject.prototype._process_tree_xml=function(c,a,b){this._parsing= !0;var d= !1;if(!a){this.render_row=this.render_row_tree;d= !0;a=c.getXMLTopNode(this.xml.top);b=a.getAttribute("parent")||0;b=="0"&&(b=0);if(!this._h2)this._h2=new dhtmlxHierarchy;if(this._fake)this._fake._h2=this._h2}var e=c.doXPath(this.xml.row,a);this._open=this._open||[];for(var f=0;f<e.length;f++){var g=e[f].getAttribute("id");g||(g=this.uid(),e[f].setAttribute("id",g));var h=this._h2.add(g,b);h.buff={idd:g,data:e[f],_parser:this._process_xml_row,_locator:this._get_xml_data};if(e[f].getAttribute("open"))h.state="minus",this._open.push(g);this.rowsAr[g]=h.buff;this._process_tree_xml(c,e[f],g)}if(d){e.length?b!=0&& !this._srnd&&this._h2.change(b,"state","minus"):this._h2.change(b,"state",dhtmlXGridObject._emptyLineImg);for(f=0;f<this._open.length;f++){var i=this._h2.get[this._open[f]];if(!i.childs.length)i.state=dhtmlXGridObject._emptyLineImg}this._updateTGRState(this._h2.get[b]);this._h2_to_buff();b!=0&&this._srnd?this.openItem(b):this.pagingOn?this._renderSort():this.render_dataset();if(this.kidsXmlFile)for(f=0;f<this._open.length;f++)i=this._h2.get[this._open[f]],i._xml_await&&this.expandKids({idd:i.id});this._open=[];this._slowParse=== !1&&this.forEachRow(function(a){this.render_row_tree(0,a)});this._parsing= !1;b!=0&& !this._srnd&&this.callEvent("onOpenEnd",[b,1])}return c.xmlDoc.responseXML?c.xmlDoc.responseXML:c.xmlDoc};dhtmlXGridObject.prototype._h2_to_buff=function(c){if(!c&&(c=this._h2.get[0],this.rowsBuffer=new dhtmlxArray,this._fake&& !this._realfake))this._fake.rowsBuffer=this.rowsBuffer;for(var a=0;a<c.childs.length;a++)this.rowsBuffer.push(c.childs[a].buff),c.childs[a].state=="minus"&&this._h2_to_buff(c.childs[a])};dhtmlXGridObject.prototype.render_row_tree=function(c,a){if(a)var b=this._h2.get[a],b=b?b.buff:b;else b=this.rowsBuffer[c];if(!b)return-1;if(b._parser){if(this.rowsAr[b.idd]&&this.rowsAr[b.idd].tagName=="TR")return this._h2.get[b.idd].buff=this.rowsBuffer[c]=this.rowsAr[b.idd];var d=this._prepareRow(b.idd);this.rowsAr[b.idd]=d;a||(this.rowsBuffer[c]=d);this._h2.get[b.idd].buff=d;b._parser.call(this,d,b.data);this._postRowProcessing(d);return d}return b};dhtmlXGridObject.prototype._removeTrGrRow=function(c,a){if(a)this._h2.forEachChild(a.id,function(a){this._removeTrGrRow(null,a);delete this.rowsAr[a.id]},this);else{var b=this.getRowIndex(c.idd),a=this._h2.get[c.idd];if(b!= -1&&b!==this.undefined){var d=1;a&&a.state=="minus"&&(d+=this._getOpenLenght(a.id,0));for(var e=0;e<d;e++)this.rowsCol[e+b]&&this.rowsCol[e+b].parentNode.removeChild(this.rowsCol[e+b]);if(this._fake){for(e=0;e<d;e++)this._fake.rowsCol[e+b]&&this._fake.rowsCol[e+b].parentNode.removeChild(this._fake.rowsCol[e+b]);d>1&&this._fake.rowsCol.splice(b+1,d-1)}this.rowsCol.splice(b,d);this.rowsBuffer.splice(b,d)}a&&(this._removeTrGrRow(null,a),delete this.rowsAr[a.id],a.parent.childs.length==1&&(this._h2.change(a.parent.id,"state",dhtmlXGridObject._emptyLineImg),this._updateTGRState(a.parent)),this._h2.remove(a.id))}};dhtmlXGridObject.prototype.openItem=function(c){var a=this._h2.get[c||0],b=this.getRowById(c||0);b&&(a.parent&&a.parent.id!=0&&this.openItem(a.parent.id),this.expandKids(b))};dhtmlXGridObject.prototype._addRowClassic=dhtmlXGridObject.prototype.addRow;dhtmlXGridObject.prototype.addRow=function(c,a,b,d,e,f){if(!this._h2)return this._addRowClassic(c,a,b);var d=d||0,g=this.cellType._dhx_find("tree");typeof a=="string"&&(a=a.split(this.delim));var h=this._h2.get[c];if(!h)d==0?b=this.rowsBuffer.length:(b=this.getRowIndex(d)+1,this._h2.get[d].state=="minus"?b+=this._getOpenLenght(d,0):this._skipInsert= !0);h=h||this._h2.add(c,d);h.image=e;h.has_kids=f;return h.buff=this._addRowClassic(c,a,b)};dhtmlXGridObject.prototype.addRowBefore=function(c,a,b,d,e){var f=this.rowsAr[b];if(f){if(!this._h2)return this.addRow(c,a,this.getRowIndex(b));var g=this._h2.get[b].parent.id,h=this.getRowIndex(b);if(h== -1)this._skipInsert= !0;this._h2.addBefore(c,g,b);return this.addRow(c,a,h,this._h2.get[b].parent.id,d,e)}};dhtmlXGridObject.prototype.addRowAfter=function(c,a,b,d,e){var f=this.rowsAr[b];if(f){if(!this._h2)return this.addRow(c,a,this.getRowIndex(b)+1);var g=this._h2.get[b].parent.id,h=this.getRowIndex(b);if(h== -1)this._skipInsert= !0;this._h2.get[b].state=="minus"?h+=this._getOpenLenght(b,0)+1:h++;this._h2.addAfter(c,g,b);return this.addRow(c,a,h,g,d,e)}};dhtmlXGridObject.prototype.af=function(c){this._slowParse=convertStringToBoolean(c)};dhtmlXGridObject.prototype._copyTreeGridRowContent=function(c,a,b){var d=this.cellType._dhx_find("tree");for(i=0;i<c.cells.length;i++)i!=d?this.cells(b,i).setValue(this.cells(a,i).getValue()):this.cells(b,i).setValueA(this.cells(a,i).getValue())};dhtmlXGridObject.prototype.closeItem=function(c){var a=this.getRowById(c);a&&this.collapseKids(a)};dhtmlXGridObject.prototype.deleteChildItems=function(c){var a=this._h2.get[c];if(a)for(;a.childs.length;)this.deleteRow(a.childs[0].id)};dhtmlXGridObject.prototype.getAllSubItems=function(c){var a=[],b=this._h2.get[c||0];if(b)for(var d=0;d<b.childs.length;d++)a.push(b.childs[d].id),b.childs[d].childs.length&&(a=a.concat(this.getAllSubItems(b.childs[d].id).split(this.delim)));return a.join(this.delim)};dhtmlXGridObject.prototype.getChildItemIdByIndex=function(c,a){var b=this._h2.get[c||0];return!b?null:b.childs[a]?b.childs[a].id:null};dhtmlXGridObject.prototype.getItemText=function(c){return this.cells(c,this.cellType._dhx_find("tree")).getLabel()};dhtmlXGridObject.prototype.getOpenState=function(c){var a=this._h2.get[c||0];if(a)return a.state=="minus"? !0: !1};dhtmlXGridObject.prototype.getParentId=function(c){var a=this._h2.get[c||0];return!a|| !a.parent?null:a.parent.id};dhtmlXGridObject.prototype.getSubItems=function(c){var a=[],b=this._h2.get[c||0];if(b)for(var d=0;d<b.childs.length;d++)a.push(b.childs[d].id);return a.join(this.delim)};dhtmlXGridObject.prototype.expandAll=function(c){this._renderAllExpand(c||0);this._h2_to_buff();this._reset_view();this.setSizes();this.callEvent("onGridReconstructed",[]);this._redrawLines&&this._redrawLines()};dhtmlXGridObject.prototype._renderAllExpand=function(c){for(var a=this._h2.get[c].childs,b=0;b<a.length;b++)a[b].childs.length&&(this._h2.change(a[b].id,"state","minus"),this._updateTGRState(a[b]),this._renderAllExpand(a[b].id))};dhtmlXGridObject.prototype.collapseAll=function(c){this._h2.forEachChild(c||0,function(a){if(a&&a.state=="minus")a.state="plus",a.update= !0,this._updateTGRState(a)},this);this._h2_to_buff();this._reset_view();this.setSizes();this.callEvent("onGridReconstructed",[]);this._redrawLines&&this._redrawLines()};dhtmlXGridObject.prototype.hasChildren=function(c){var a=this._h2.get[c];return a&&a.childs.length?a.childs.length:a._xml_await? -1:0};dhtmlXGridObject.prototype.setItemCloseable=function(c,a){var b=this._h2.get[c];if(b)b._closeable= !convertStringToBoolean(a)};dhtmlXGridObject.prototype.setItemText=function(c,a){return this.cells(c,this.cellType._dhx_find("tree")).setLabel(a)};dhtmlXGridObject.prototype.setItemImage=function(c,a){this._h2.get[c].image=a;this.rowsAr[c].imgTag.nextSibling.src=(this.iconURL||"")+a};dhtmlXGridObject.prototype.getItemImage=function(c){this.getRowById(c);return this._h2.get[c].image};dhtmlXGridObject.prototype.setImageSize=function(c,a){this._img_width=c;this._img_height=a};dhtmlXGridObject.prototype._getRowImage=function(c){return this._h2.get[c.idd].image};dhtmlXGridObject.prototype.setOnOpenStartHandler=function(c){this.attachEvent("onOpenStart",c)};dhtmlXGridObject.prototype.setOnOpenEndHandler=function(c){this.attachEvent("onOpenEnd",c)};dhtmlXGridObject.prototype.cn=function(c){this._edtc= !convertStringToBoolean(c)};dhtmlXGridObject.prototype.getLevel=function(c){var a=this._h2.get[c||0];return!a? -1:a.level};dhtmlXGridObject.prototype._fixHiddenRowsAllTG=function(c,a){for(i in this.rowsAr)if(this.rowsAr[i]&&this.rowsAr[i].childNodes)this.rowsAr[i].childNodes[c].style.display=a};dhtmlXGridObject._emptyLineImg="blank";
|